rgbstar
Posts: 5
Joined: Fri Jul 19, 2019 3:22 pm

RPI2 ATAGS returns strange value

Fri Jul 19, 2019 3:40 pm

The boot SD card is created by installing raspbian 2018-11-13 on raspberry pi 2 (v1.1), then I replaced kernel7.img with my own simple os from (https://github.com/jsandler18/raspi-kernel).

The modify the simple OS a little bit, the OS can blink LED, UART, and request frame buffer and print strings on the screen. But when I try to access ATAG at 0x100, I got "0x55555555", I tried to print the contents between 0x100 and 0x128, all of them are "0x55555555".

Then I thought maybe ATAG may not be at 0x100, then I use r2 that passed to kernel_main, the r2 is actually pointed to 0x2eff9d00, looks like some random place. by the way, I saved r0,r1,r2 in the boot.S (code are below)

I also tried to set disable_commandline_tags=0, nothing helps. Then tried to set disable_commandline_tags=1, then the kernel won't even start.

I wonder if it is because newer Raspian doesn't setup ATAG anymore or I am missing something?

_start:
mov sp,#0x8000
push {r0,r1,r2}
....
....
pop {r0,r1,r2}
bl kernel_main
....

dp11
Posts: 12
Joined: Thu Dec 29, 2011 5:46 pm

Re: RPI2 ATAGS returns strange value

Fri Jul 19, 2019 6:04 pm

Try removing the device tree files from the sdcard.

rgbstar
Posts: 5
Joined: Fri Jul 19, 2019 3:22 pm

Re: RPI2 ATAGS returns strange value

Fri Jul 19, 2019 6:41 pm

brilliant! it worked! Strangely, I can't disable the device tree from config.txt.
you saved my day, thanks very very much!

Return to “Bare metal, Assembly language”