2017-09-06 11:19 PM
Hi,
I have to download second application and enter second application from the first application.
Bootloader to First application jump is happening and working fine.
I have problem to jump to second application from the first application ( downloaded second application from the bootloader same as first application) using the same approach as jump is made from bootloader to first application.
Bootloader -> jump to first application -> Jump to Second application. I am getting this error
The stack pointer for stack 'CSTACK' (currently 0xF000FB64) is outside the stack range (0x2000DFC0 to 0x2000FFC0) and followed by first application restarts and enters booloader
I have this changes in the linker file ( .icf file)
Bootloader:
define symbol __ICFEDIT_intvec_start__ = 0x08000000; f
define symbol __ICFEDIT_size_cstack__ = 0x4000;
define symbol __ICFEDIT_size_heap__ = 0x200;First application:
define symbol __ICFEDIT_intvec_start__ = 0x08010000; for first application
define symbol __ICFEDIT_size_cstack__ = 0x4000;
define symbol __ICFEDIT_size_heap__ = 0x200;Second application:
define symbol __ICFEDIT_intvec_start__ = 0x08020000; for second application
define symbol __ICFEDIT_size_cstack__ = 0x6000;
define symbol __ICFEDIT_size_heap__ = 0x200;Using this code to jump to second application, used same from bootloader to first application:
JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);
SCB->VTOR = ApplicationAddress; Jump_To_Application = (pFunction) JumpAddress; __set_MSP(*(__IO uint32_t*) ApplicationAddress); Jump_To_Application();Any help is welcome, I think I have problem with the linker settings
Thanks
Santosh
#cstack-error-while-jumping-to-application2017-09-11 06:39 AM
Hi
kmtaranath
,Please refer to the
application note and the associated software it may help you.-Nesrine-
2017-09-11 06:56 AM
Look at the .MAP file and the .BIN or .HEX an see what the Linker actually built and where it placed things.
The .ICF should describe different ROM/FLASH regions which clearly define the constraints of those specific regions.
ie
0x08020000..0x0802FFFF
Read/review the documentation for your chosen tools.
2017-09-11 07:44 AM
Also look to see at run time that your telling the processor where the interrupt vector table is. In my Keil solution with your program location of 0x8020000, I think you'd need NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x20000);
2017-09-11 09:54 AM
In many CMSIS implementations they use SCB->VTOR = 0x08020000; or an equivalent in SystemInit(). I pull in the __Vectors symbol which save the necessity of changing/tracking this in multiple places.
2017-09-12 03:01 AM
I can see PC and SCB_VTOR is changing before trying to jump from one application to other, I expect same behaviour from application1 -> application2. Becuase its working from bootloader -> appliction1
2017-09-12 03:42 AM
All these files linker addressed matching as per .ICF file.
2017-09-12 04:08 AM
Step the code, and transition, at a disassembly level,and understand where the SP gets loaded with a bogus value. When you understand where it comes from you'll be in a better place to fix it.
2017-09-12 05:00 AM
__vector_table is pointing to
__ICFEDIT_intvec_start__ in each build .. Bootloader, application1 and application2
2017-09-12 09:46 AM
We get out the debugger, and we step the code, we follow it through until it gets to main(), or it veers off the tracks..
https://community.st.com/0D50X00009XkXZTSA3