xdai
Posts: 2
Joined: Sun Mar 01, 2015 10:06 am

Does RPi2 honor "kernel_address"?

Sun Mar 01, 2015 10:17 am

I am asking because I put following in config.txt:

Code: Select all

...
kernel=loader.bin
kernel_address=0x00000000
...
So I was trying to ask start.elf to load "loader.bin"(my bare metal program) to 0x00000000. I spend one day to debug some weird behavior of loader.bin, and it turned out it was loaded to 0x8000 instead of 0x0000.

Can someone confirm that "kernel_address" should actually work? I am wondering maybe I just missed some obvious point...

mimi123
Posts: 583
Joined: Thu Aug 22, 2013 3:32 pm

Re: Does RPi2 honor "kernel_address"?

Sun Mar 01, 2015 11:19 am

xdai wrote:I am asking because I put following in config.txt:

Code: Select all

...
kernel=loader.bin
kernel_address=0x00000000
...
So I was trying to ask start.elf to load "loader.bin"(my bare metal program) to 0x00000000. I spend one day to debug some weird behavior of loader.bin, and it turned out it was loaded to 0x8000 instead of 0x0000.

Can someone confirm that "kernel_address" should actually work? I am wondering maybe I just missed some obvious point...
you should not use kernel_address but kernel_old=1 to load @absolute zero

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5343
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Does RPi2 honor "kernel_address"?

Sun Mar 01, 2015 11:21 am

By default the firmware inserts some startup code at 0x0 and inserts the kernel ATAGs at 0x100. Actual kernel is loaded at 0x8000.

Add kernel_old=1 to avoids prepending the boot code.
Add disable_commandline_tags=1 to avoid populating the ATAGs.

Set both of those and your kernel will be loaded at 0 (or kernel_address if specified).

xdai
Posts: 2
Joined: Sun Mar 01, 2015 10:06 am

Re: Does RPi2 honor "kernel_address"?

Mon Mar 02, 2015 8:12 am

Thanks, that's good to know. Does that mean "kernel_address" will honor any other addres settings other than zero? I assume so.

(Yes I understand we still need to handle ATAG).

mrvn
Posts: 58
Joined: Wed Jan 09, 2013 6:50 pm

Re: Does RPi2 honor "kernel_address"?

Wed Mar 04, 2015 4:29 pm

dom wrote:Set both of those and your kernel will be loaded at 0 (or kernel_address if specified).
Does that also apply to the extra cores on the RPi2? I assume normaly the bootcode at 0 would halt the extra cores till something is written to their mailboxes. So will they all power up and start executing the code at 0 without waiting?

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5343
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Does RPi2 honor "kernel_address"?

Wed Mar 04, 2015 6:46 pm

mrvn wrote:
dom wrote:Set both of those and your kernel will be loaded at 0 (or kernel_address if specified).
Does that also apply to the extra cores on the RPi2? I assume normaly the bootcode at 0 would halt the extra cores till something is written to their mailboxes. So will they all power up and start executing the code at 0 without waiting?
All cores start running from zero after reset. The default boot code makes 3 cores wait for a signal from first core.
If you provide your own boot code, you will probably need to do something similar (or you will end up running the same code 4 times in parallel...)

rln
Posts: 175
Joined: Wed Apr 09, 2014 1:43 pm
Location: Sweden
Contact: Website

Re: Does RPi2 honor "kernel_address"?

Wed Jan 20, 2016 2:11 pm

dom wrote:By default the firmware inserts some startup code at 0x0 and inserts the kernel ATAGs at 0x100. Actual kernel is loaded at 0x8000. Add kernel_old=1 to avoids prepending the boot code. Add disable_commandline_tags=1 to avoid populating the ATAGs. Set both of those and your kernel will be loaded at 0 (or kernel_address if specified).
I would like to set "kernel_address" to a very high address but seems it doesn't work nowadays. Very old firmwares accept arbitrary addresses but recent versions only work with either 0x0 or 0x8000. Would it be possible to get the old behaviour back?
Author of the robust Nard distro http://www.nard.se

Return to “Bare metal, Assembly language”