cancel
Showing results for 
Search instead for 
Did you mean: 

Bootloader + Two applications

Santhosh KM
Associate II
Posted on September 07, 2017 at 08:19

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-application
13 REPLIES 13
Nesrine M_O
Lead II
Posted on September 11, 2017 at 15:39

Hi

kmtaranath

,

Please refer to the

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-expansion-software/x-cube-extboot.html

application note and the associated software it may help you.

-Nesrine-

Posted on September 11, 2017 at 15:56

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Gregory Holcomb
Associate II
Posted on September 11, 2017 at 16:44

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);

Posted on September 11, 2017 at 16:54

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Santhosh KM
Associate II
Posted on September 12, 2017 at 12:01

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

Posted on September 12, 2017 at 10:42

All these files linker addressed matching as per .ICF file.

Posted on September 12, 2017 at 11:08

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on September 12, 2017 at 12:00

__vector_table is pointing to 

__ICFEDIT_intvec_start__     in each build .. Bootloader, application1 and application2

Posted on September 12, 2017 at 16:46

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..