Hi
I recently moved from an STM8 to an ARM Cortex M-23 (GD32E230).
The nice thing about the STM8 is the simplicity, in particular the startup code, which only consists of one assembly file that I could easily read and change.
So to save space on my 32kB ROM I ended up removing pretty much all the startup code apart from setting up the stack pointer. For the variable initialization I just initialized the whole RAM to zero, then initialized in my main the (very few) variables that needed a different value. It worked very well, and I saved loads of ROM space.
I am trying to do the same for the ARM Cortex-M, but I just want to make sure I do not miss anything "important". Like I did for the STM8, I am checking the final ASM code in the project AXF file.
Reading on the net, it seems the __scatterloadXXX ASM functions do the following:
* initialize to zero all global variables which are uninitialized in C code (I guess as a safety?)
* initialize the other global variables (this part just gets removed if I have no initialized variables in my C code)
So far so good. But then comes the stuff I do not get:
* __user_setup_stackheap sets up the stack and the heap... The stack is already set up by the MSP register... What is there left to do?
And for the heap I guess it is only a "software" thing since it is not mentioned anywhere in the ARM Cortex Device Generic User Guide?
* After the call to my main() there is the whole exit and __rt_exit, which should just be a dumb forever loop? (or not needed at all since the main() does not ever end)
Unless any of these is used for debugging?
Many questions I know - sorry about that
Thank you!
Simon
PS: not 100% related, but the STM8 compiler used to create very readable Assembly listings with the associated C code in comments above each small group of Assembly commands.
When it comes to ARM, the only ASM listing I can get from the compiled code is the output of the "fromelf.exe", which shows a lot but not the original C code - is that possible?