CSTACK issue with IAP
Hi, i'm trying to make an app for my card to introduce IAP (update by ethernet, http in my case)
To do this, i'm starting from the example give by stm32 cube STM324x9I_EVAL\Applications\LwIP\LwIP_IAP\EWARM (I test with STM32439I-EVAL2). The example work fine (i can load the binaries give in example). But
now, I want to compile another project (STM324x9I_EVAL\Applications\STemWin\STemWin_HelloWorld\EWARM) to load it with IAP.On the IAP example, they redefine the start address like this :
#define USER_FLASH_FIRST_PAGE_ADDRESS 0x08020000
On the second example (that I want to load with IAP) I need to modify the project to start at 0x08020000, to do this I change this on IAR :


In file system_stm32f4xx.c I do this :
#define VECT_TAB_OFFSET 0x20000
And after in the code they have this instruction :
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */
FLASH_BASE is equal to
#define FLASH_BASE ((uint32_t)0x08000000)
The map generated with the linker :*******************************************************************************
*** PLACEMENT SUMMARY
***
''A1'': place at 0x08020000 { ro section .intvec };
''P1'': place in [from 0x08020000 to 0x081fffff] { ro };
''P2'': place in [from 0x20000000 to 0x2002ffff] { rw, block CSTACK, block HEAP };
Section Kind Address Size Object
------- ---- ------- ---- ------
''A1'': 0x1ac
.intvec ro code 0x08020000 0x1ac startup_stm32f429xx.o [1]
- 0x080201ac 0x1ac
''P1'': 0xddc3
.text ro code 0x080201ac 0x11fc LCDConf_stm324x9i_eval_MB1063.o [1]
If i launch the card and load the file with IAP, it's ok, but at reboot the system doesn't start the app. To debug it i do this (in the IAP) :
main :
uint32_t test,calcul;
.
.
.
test=(*(__IO uint32_t*)USER_FLASH_FIRST_PAGE_ADDRESS);
calcul = test & 0x2FFE0000;
/* Check if valid stack address (RAM address) then jump to user application */
if (calcul == 0x20000000)
{
/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (USER_FLASH_FIRST_PAGE_ADDRESS + 4);
They check the stack address, in my case if I use the bin that I make, calcul is equal to 0x20020000
à
the same offset that I add for the flash. If i remove the test the app start correctly. In the map file (downloaded app) : CSTACK 0x2002bd60 0x2000 <Block> CSTACK uninit 0x2002bd60 0x2000 <Block tail> - 0x2002dd60 0x2dd60Here we can see the stack address start at 0x2002xxxx, do you know how i can resolve this please ?
