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-13 01:42 AM
Single step is not possible to debug, it will not show anything after few steps to see how it enters main(). I can see VTOR is changing and reset is happening after jump to second application
2017-09-13 06:00 AM
Ok, and your supervisor is satisfied with that answer?
With the data you're seeing why would it reset? Do you have a watchdog timer? Does the code look like the Reset Handler for App2?
2017-09-14 01:15 AM
Hello,
I was also unable to jump to an application, I fixed it by disabling everything before doing the jump, like this:
void fn_jump_to_application(void){ SCB_DisableICache(); SCB_DisableDCache(); HAL_MspDeInit(); HAL_DeInit(); HAL_RCC_DeInit(); __HAL_RCC_PWR_CLK_DISABLE(); __HAL_RCC_GPIOE_CLK_DISABLE(); __HAL_RCC_GPIOB_CLK_DISABLE(); __HAL_RCC_GPIOG_CLK_DISABLE(); __HAL_RCC_GPIOD_CLK_DISABLE(); __HAL_RCC_GPIOA_CLK_DISABLE(); __HAL_RCC_GPIOC_CLK_DISABLE(); __HAL_RCC_GPIOI_CLK_DISABLE(); __HAL_RCC_GPIOH_CLK_DISABLE(); __HAL_RCC_GPIOF_CLK_DISABLE();/* Jump to user application */
JumpAddress = *(__IO uint32_t*) (FLASH_APPLICATION_START_ADDRESS + 4); Jump_To_Application = (pFunction) JumpAddress; /* Initialize user application's Stack Pointer */ __set_MSP(*(__IO uint32_t*) FLASH_APPLICATION_START_ADDRESS); Jump_To_Application();}+ don't forget to update the VECT_TAB_OFFSET, like this:#ifdef BOOTLOADER_MODE
#define VECT_TAB_OFFSET 0x00000000 //start address = 0x08000000 #elif APPLICATION_MODE #define VECT_TAB_OFFSET 0x00080000 //start address = 0x08080000#endif...
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET; /* Vector Table Relocation in Internal FLASH */)
Francois
2017-09-17 08:13 PM
Turvey.Clive.002
Yes I was having watch dog timer it jumps to application ( disabled watchdog for time being) now. Thanks