Live data from Hacker News

Booting the Raspberry Pi

leiradel.github.io

1–5 of 5 posts

Re: Booting the Raspberry Pi

#3
post #2

Is it just me, or did the author forget to copy the initialized data into the .data section? He did remember to zero the .bss

The .data section contents are already in place when the kernel.bin file is loaded by the GPU. This is made by the linker script.

Re: Booting the Raspberry Pi

#4
post #3
post #2

Is it just me, or did the author forget to copy the initialized data into the .data section? He did remember to zero the .bss

The .data section contents are already in place when the kernel.bin file is loaded by the GPU. This is made by the linker script.

Generally linker script places the data initialization values somewhere after the code. You then usually have to copy them into actual location and RAM where they need to be. This is usually done right before or right after zeroing the .bss

the only way for this would not be required, is the code expects to run from RAM, and the linker script specifically placed the .data after the code

Re: Booting the Raspberry Pi

#5
post #4
post #3

Earlier quoted context omitted.

The .data section contents are already in place when the kernel.bin file is loaded by the GPU. This is made by the linker script.

Generally linker script places the data initialization values somewhere after the code. You then usually have to copy them into actual location and RAM where they need to be. This is usually done right before or right after zeroing the .bss the only way for this would not be required, is the code expects to run from RAM, and the linker script specifically placed the .data after the code

This is exactly what the linker script does: https://github.com/LdB-ECM/Raspberry-Pi/blob/master/Multicor...

The resulting binary is loaded as a whole to RAM, there are no intermediary representation of the executable like a PE or ELF, and there are no relocations; everything is already resolved during link time.