Hello,
In another post, I mentioned that I am working on very basic code in CW10.4 for the FRDM-KL25 board, to be used on a software lab course for engineering students. Now I am analyszing the startup code, and I have noticed that the first function that is called is "__thumb_startup()", located at __arm_start.c file. This function calls some other functions, named __init_registers(), __init_hardware(), __load_static_base(), __init_pid(), __init_pic(), zero_fill_bss(), __copy_rom_sections_to_ram(), __call_static_initializers(), and __init_user().
I have tried to find the sources for these functions, but so far I could not locate them. Can anyone give me a hint?
One more thing, is there any good reference for position-independent data and relocatable code, related to Kinetis L series, and/or CodeWarrior 10?
Thanks in advance.
These funcions are supplied in runtime lib 'librt.a',
Below is extracted in MAP file, from it, we can see that the source code of '__copy_rom_sections_to_ram' is in file 'ROMCopy.c', source code of '__init_registers' is in file '__arm_eabi_init.c'.... The other functions are similar.
These source files which are used to generate 'librt.a' locate at: C:\Freescale\CW MCU v10.4\MCU\ARM_GCC_Support\ewl\EWL_Runtime\src\arm\
------------------------------------------------------------------------------------------------
.text.__copy_rom_section 0x00001984 0x48 C:/Freescale/CW MCU v10.4/MCU/ARM_GCC_Support/ewl/lib/armv6-m\librt.a(ROMCopy.o) 0x00001984 __copy_rom_section
.text.__copy_rom_sections_to_ram 0x000019cc 0x34 C:/Freescale/CW MCU v10.4/MCU/ARM_GCC_Support/ewl/lib/armv6-m\librt.a(ROMCopy.o) 0x000019cc __copy_rom_sections_to_ram
.text.__destroy_global_chain 0x00001a00 0x1c C:/Freescale/CW MCU v10.4/MCU/ARM_GCC_Support/ewl/lib/armv6-m\librt.a(__arm_eabi_init.o) 0x00001a00 __destroy_global_chain
.text.__init_registers 0x00001a1c 0x1c C:/Freescale/CW MCU v10.4/MCU/ARM_GCC_Support/ewl/lib/armv6-m\librt.a(__arm_eabi_init.o) 0x00001a1c __init_registers
.text.__init_user 0x00001a38 0x4 C:/Freescale/CW MCU v10.4/MCU/ARM_GCC_Support/ewl/lib/armv6-m\librt.a(__arm_eabi_init.o) 0x00001a38 __init_user]
------------------------------------------------------------------------------------------------
Thanks for the answer. Now I just need to locate the source files that generate the runtime library. I want my students to srudy the source codes, so they can see the startup source code. Where would the files like ROMCopu.c and __arm_eabi_init.c be located?
Both 'ROMCopu.c' and '__arm_eabi_init.c' are located in:
C:\Freescale\CW MCU v10.4\MCU\ARM_GCC_Support\ewl\EWL_Runtime\src\arm
C:\Freescale\CW MCU v10.4\MCU\ARM_EABI_Support\ewl\EWL_Runtime\Runtime_ARM\Source
Thanks! That helped a lot!