carlosftm/RPi-Pico-Baremetal

[Discussions] Why the length in boot_stage2.ld is equal 254?

Closed this issue · 1 comments

boot_stage2.ld
MEMORY {
/* We are loaded to the top 256 bytes of SRAM, which is above the bootrom
stack. Note 4 bytes occupied by checksum. */
SRAM(rx) : ORIGIN = 0x20040000, LENGTH = 254
}

ReadMe.md
"""
The bootrom copies 256 bytes from SPI to internal SRAM (SRAM5) and check for valid CRC32 checksum. If the checksum is correct (252 bytes of code + 4 bytes of the checksum), the code (flash second stage) is executed.
"""
combine them together, why not the length = 252, and retain 4 bytes for checksum. This is the straight forward thinking.

Hi,

Yes, you are right. Length = 256 - 4. The comment is right on the .ld file is correct. Just the assignment needs to be corrected.
Thank you for your observation!