Hi,
this probably a dumb question but how can I increase the stack size using ARM gcc? The target mcu linker file has no such section and neither has the startup_gcc.c.
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi,
this probably a dumb question but how can I increase the stack size using ARM gcc? The target mcu linker file has no such section and neither has the startup_gcc.c.
Hi,
There are two possible scenarios, depending how do you use the gcc toolchain:
a) if used from CCS, then the same place of Project Properties specify the stack size, to be taken into account.
b) if used stand alone, without CCS, then a good place to specify it is the linker file (this also manages the heap area). Since you do not find out such thing, I presume you use the CCS, so the previous case would be better. If b) is really your case, then a linker file (a good one) you may find out inside CMSIS package.
Take into account - if you just have problem(s) with stack, then, in CCS, there is a hidden variable _stack generated by the compiler and you may add it to the watch window in debugger to tell you where the stack is. The only problem is I do not know if this is also generated if gcc is used.
Petrei
It depends upon how the run-time start up code initialises the stack pointer.JustGreg said:Anyway, I'm wondering what is the default stack size then?
When a Tiva example project is created in CCS 6.1 using the GNU v4.8.4 compiler the <device>_startup_ccs_gcc.c source file added to the project has the following which allocates space for the stack, and sets the initial stack pointer:
//***************************************************************************** // // Reserve space for the system stack. // //***************************************************************************** static uint32_t pui32Stack[128]; //***************************************************************************** // // The vector table. Note that the proper constructs must be placed on this to // ensure that it ends up at physical address 0x0000.0000 or at the start of // the program if located at a start address other than 0. // //***************************************************************************** __attribute__ ((section(".intvecs"))) void (* const g_pfnVectors[])(void) = { (void (*)(void))((uint32_t)pui32Stack + sizeof(pui32Stack)), // The initial stack pointer
This means the size of the pui32Stack array, which is 128 32-bit words or 512 bytes, is the size of the stack. The vector table entry sets the initial stack pointer to the end of the pui32Stack array. The ResetISR function which is in the same <device>_startup_ccs_gcc.c source file doesn't adjust the stack pointer before calling main.