GCC Startup Assembly file?

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
alexlesuper
Posts: 10
Joined: Tue Oct 15, 2013 3:52 pm

GCC Startup Assembly file?

Post by alexlesuper »

Hello,

I am porting ChibiOS to Rowley Crossworks manually (which means I am not using any of their startup files whatsoever) which uses GCC. However, I am looking through the ChibiOS repository and I cannot find the startup file for GCC. When I was in Keil using RVCT, I had the cstartup.s file that came in the repo, but with GCC I can't seem to find the assembly startup file. Am I missing something here?

Thanks in advance.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: GCC Startup Assembly file?

Post by Giovanni »

Hi,

It is not an assembler file, it is named crt0.c, look under ./os/ports/GCC/ARMCMx, probably there is no need to change anything. I recommend you use the very same files and settings found in the provided Makefiles before attempting changes.

The startup files are VERY important because the Cortex-M must be initialized in a very specific way (dual stacks, privileged mode). It is also recommended to use the provided .ld files.

Giovanni
alexlesuper
Posts: 10
Joined: Tue Oct 15, 2013 3:52 pm

Re: GCC Startup Assembly file?

Post by alexlesuper »

Ok I understand now. I made it so that it used only the ctr0.c file.

Just one heads up: The linker program from crossworks expected a reset handler called "reset_handler", however the one in ChibiOS is called "ResetHandler". I manually renamed it in the crt0.c file and it built the .elf correctly. I haven't done much research as to why this is.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: GCC Startup Assembly file?

Post by Giovanni »

Hi,

You should use the vectors file (vectors.c) and scatter files (.ld) provided with ChibiOS. There is no need to rename anything.

Giovanni
Post Reply