Page 1 of 1

GCC Startup Assembly file?

Posted: Tue Oct 15, 2013 8:13 pm
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.

Re: GCC Startup Assembly file?

Posted: Tue Oct 15, 2013 8:18 pm
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

Re: GCC Startup Assembly file?

Posted: Tue Oct 15, 2013 9:00 pm
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.

Re: GCC Startup Assembly file?

Posted: Tue Oct 15, 2013 9:20 pm
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