cancel
Showing results for 
Search instead for 
Did you mean: 

In stm32-cortexM0, do we have any process where we can define the location for the Main stack and program stack?

Priyadarshini Solanki
Associate II

In #[STM32 MCUs]​ - #Cortex-m0​ . In *.icf we can define the size and location of stack in the RAM area.

Is there any process to define the size and start location of Main stack and program stack separate in the stack section?

5 REPLIES 5

startup.s you can presumably program it with any mode/settings you like.

Assume IAR just gives you very basic pedestrian settings, if you want to do advanced stuff, you can create your own variables and sections in the .ICF (linker script, or equivalent), and put the implementation details in your own source.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..

I am curious, how controller will know that CSTACK is the place where Stack data should be stored.

Is it, due to loading  DCD   sfe(CSTACK) in vector table?

S.Ma
Principal

First, unless I'm wrong, the core has a PC Program counter.

This one is fetched from the interrupt vector table once the reset is released.

Then the statup() function which typically is toolchain's compiler business (IAR) will initialize the registers and any global C variable prior to starting the user code.

The linker config file makes you define segments of memories and properties.

If create my own sections for main stack and Process Stack in the .ICF.

How compiler will know , that the place to store main stack data and process stack data?

The linker config file makes you define segments of memories and properties.

Yes, i can define the separate section to place my various data and give the location where it should be in RAM.

How to define at what location process stack to be initialized ?