Prozess of startup-file generation
How is the startup-file generated? As far as I understand, the symbols from the linker-script (_sdata, _edata, _sbss, _ebss and _sidata) are used to copy the ".data" section from the LMA (Flash) to the VMA (RAM), to initialize the ".bss" section with zeroes and to locate the stack. This is done by the "Reset_Handler" function whose start-adress is placed in the ".isr" section. According to the map-file, the code of the "Reset_Handler" function is placed in the ".text" section.
According to my understanding, the labels (adresses) of the linker-file are required to generate the "Reset_Handler" function. After that, the code of the function is placed in the ".text" section of the linker file. But this will change the follwing labels (adresses). So the adresses used for the generation of the startup-file might have changed and the startup-file might be incorrect.
Is ".text" space required for the "Reset-Handler" calculated in advance and reserved when the linker-file is generated? Or is it a kind of iteration process? Which instance of the gcc toolchain generates the startup-file?
Thanks
Andreas
