cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F429 GCC stack size error with personal DFU

echonoh
Associate
Posted on October 03, 2016 at 13:52

Hi everyone!

I'm GUI programing with STM32F429GI.

I've two application which one is myself DFU app and other is Main Application.

DFU is located flash at 0x8000000 to 0x800BFFF

And Main application start 0X800C000.

STM32F429IG has a 192K SRAM  :  0x20000000 to 0x2002FFFF 

But I'm compile with GCC + Eclipse, it has a problem in link script.

If I set _estack = 0x2002FFFF, my main application is not run.

But I set _estack = 0x2001FFFF, may main application is work well except stack is insufficient.

Why end of RAM is decrease on the _estack value?

Anyone is help me?

p.s : If I'm compile with IAR, it's not problem.  

  

  
2 REPLIES 2
Posted on October 03, 2016 at 14:45

The stack pointer should be 4-byte aligned, not odd. ie 0x20020000 not 0x2001FFFF

It could be possible there are some checks that the SP is in RAM, the test often used by ST isn't exactly robust. Look at any code that transfers control from loader to application.

What Initial SP does IAR use?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
echonoh
Associate
Posted on October 04, 2016 at 04:05

Hi clive1

I know that the stack pointer should be 4-byte aligned, but it can be done with odd length as like as IAR flash.icf.

My main application has IAR's flash.icf content is below

/////////////////////// start ////////////////////

/*###ICF### Section handled by ICF editor, don't touch! ****/

/*-Editor annotation file-*/

/* IcfEditorFile=''$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml'' */

/*-Specials-*/

define symbol __ICFEDIT_intvec_start__ = 0x0800C000;

/*-Memory Regions-*/

define symbol __ICFEDIT_region_ROM_start__    = 0x0800c000;

define symbol __ICFEDIT_region_ROM_end__      = 0x081FFFFF;

define symbol __ICFEDIT_region_RAM_start__    = 0x20000000;

define symbol __ICFEDIT_region_RAM_end__      = 0x2002FFFF;

define symbol __ICFEDIT_region_CCMRAM_start__ = 0x10000000;

define symbol __ICFEDIT_region_CCMRAM_end__   = 0x1000FFFF;

/*-Sizes-*/

define symbol __ICFEDIT_size_cstack__ = 0x2000;

define symbol __ICFEDIT_size_heap__   = 0x2000;

/**** End of ICF editor section. ###ICF###*/

define memory mem with size = 4G;

define region ROM_region      = mem:[from __ICFEDIT_region_ROM_start__   to __ICFEDIT_region_ROM_end__];

define region RAM_region      = mem:[from __ICFEDIT_region_RAM_start__   to __ICFEDIT_region_RAM_end__];

define region CCMRAM_region   = mem:[from __ICFEDIT_region_CCMRAM_start__   to __ICFEDIT_region_CCMRAM_end__];

define block CSTACK    with alignment = 8, size = __ICFEDIT_size_cstack__   { };

define block HEAP      with alignment = 8, size = __ICFEDIT_size_heap__     { };

initialize by copy { readwrite };

do not initialize  { section .noinit };

place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };

place in ROM_region   { readonly };

place in RAM_region   { readwrite,  block CSTACK, block HEAP }; 

////////////////////////////////// end //////////////////////

 

And My DFU app has a same icf's content except of 

define symbol __ICFEDIT_intvec_start__ = 0x08000000;

/*-Memory Regions-*/

define symbol __ICFEDIT_region_ROM_start__    = 0x08000000;

My main application is OK on the IAR but GCC is not OK except only set estack = 0x2001FFFF.

But it occurs stack insufficient!