This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Source files order in output image

Hello to all:

How does Linker or Compiler determine that which source file should be located first in base address of device memory? For example we have a project with a startup file.s (stm32f10x_startup.s) and a main.c. We expect that, the object of startup file.s be located in initial address of execute memory (typically ROM) and main.c object, be located after; because, typically, the microcontrollers read address 0x0 after rest to receive MSP base address and then 0x4 to receive Reset handler address, which these information are in startup file corresponding to that microcontroller. So if main.c contents, be located from address 0x0, then the execution encounters with error. Also there maybe another (another.s) file, in this case, how does linker decide which (startup file.s) or (another.s) shouldbe located first?