I try to read link scripts of coreboot.
In addition to the x86 platform, code segments and data segments are contiguous during the bootblock/romstage phase. However, only CAR/SRAM can be used as memory in the bootblock/romstage stage, this should be separate from the flash where the program is located. Why this is not reflected in the link script？
Does the machine have a special mechanism ?
Looking forward to your reply !!!
I try to read link scripts of coreboot. In addition to the x86 platform, code segments and data segments are contiguous during the bootblock/romstage phase.
There is no data segment for bootblock/romstage on x86. You are not allowed to use global (or static local) variables. The build system will enforce this. You can see that https://review.coreboot.org/cgit/coreboot.git/tree/src/arch/x86/include/arch... defines ARCH_STAGE_HAS_DATA_SECTION and ARCH_STAGE_HAS_BSS_SECTION to 0, so the .data and .bss sections in https://review.coreboot.org/cgit/coreboot.git/tree/src/lib/program.ld get removed by the preprocessor.
There is the special mechanism of a CAR_GLOBAL variable which needs to be marked as such in the code and only accessed through the car_get_var()/car_set_var() macros (from https://review.coreboot.org/cgit/coreboot.git/tree/src/arch/x86/include/arch...). They are placed in a special section that gets linked to the CAR address space by the https://review.coreboot.org/cgit/coreboot.git/tree/src/arch/x86/car.ld script.
On other architectures (like Arm), we don't have any systems that execute directly from flash (yet). We always load code and data into SRAM before executing so they can be contiguous in there.