2020-11-09 04:41 AM
I'm starting to program STM32 cortex M0 uC, and I want to do it totally from scratch, without any code automatically generated for me, using STM32CubeIDE 1.4.0.
In my code, I've erased everything and letf only this:
int main(void)
{
while (1)
{
}
}
But when I open the file "***.LIST" I can see a lot of code generated, including the interrupt handlers and other stuff.
How can I stop it from writting background code for me and let everything manually made for me?
Thanks
2020-11-09 05:30 AM
Don't use STM32CubeMX to create project.
You will have to in your own code init everything, but that seems to be what you want (I don't have time to go that route anymore).
Slightly simpler is to use MX to create project, but don't enable any pins or features (No GPIO, No UART, No Clocks, etc.)
If I was in your boots I would:
Paul
2020-11-09 06:31 AM
Thanks for replying.
I took a look at [startup_stm32xxxxxxxx.s] but I must be missing something cuz I didn't get what I should delete or change to stop de initial code from compiling. I've tried do delete it all but some erros occurs when compilling.
2020-11-09 06:59 AM
I recommend not messing with the .s file, but instead studying it so you know what it does, most of it is critical required code I never touch.
Have you done a minimal project either:
Don't be surprised if it takes hours/days of referring to Datasheet and Reference Manual for your IC to understand what's in the init code.
Much easier to leave it and just insert in generated main() a call to main2() which you write in a separate file (main2 should replace everything done main()).
Paul
2020-11-09 11:07 AM
If you're going to mess with the startup_xxxx.s code (you're asking for a heap of hurt, but your choice), I'd suggest putting away the C compiler and going to raw assembly.
You're giving up the interrupt structure, memory testing, memory initialization, copying from flash to ram, setting up the stacks, setting up the heap, arranging the environment so that you can even branch to main and so that main can call subroutines and get back.
You've got a F1 car and you're wondering why it has brake pads and a crash structure since you're not planning on going slow or crashing. Okay. I suggest you start at the beginning, but if you insist you should look up the ARM programming reference and architecture manual for your processor. Learn about the memory layout, boot sequence, stacks, heap, ABI, registers, and fault handlers. But be cautious, the ARM family was designed to support compilers, you can code by hand in assembly, but it's working against the design.
2020-11-09 11:53 AM
I will definitely not program ARM32 in assembly language. But since I want to know every register I'm working with, to understand every internal step my uC is taking, I have to understand everything it takes to start working, so that's why I want to do it from scratch now that I'm just beggining with 32 bits uC (I already have good experience with 8 bit uC).
I have already read the datasheet and the reference manual, my "problem" now is just with STM32cubeIDE.
2020-11-09 12:42 PM
OK, I understand wanting to know the details (and actually started that way, but found with 32bit you just have to think&work at a higher level as so much code and such complex ICs).
Look at the .s file under startup, but just to see the minimal functionality that is happening.
Then look at main.c
There's not much to it, unless you've enabled a bunch modules.
Paul