cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F2xx IAP question

Barbie
Associate II
Posted on April 05, 2013 at 23:33

I have base my IAP on AN2557 application.

I change the offset for my APP to 0x08010000 because need same extra sectors for fix varibles.

I change the icf file according :

define symbol __ICFEDIT_intvec_start__ = 0x08010000;// start main APP on sector 4

define symbol __ICFEDIT_region_ROM_start__ = 0x08010000; // start main APP on sector 4

define symbol __ICFEDIT_region_ROM_end__   = 0x080FFFFF;

and in the main put this:

 

NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x10000); 

In the Boot App I set this code for jumping (copy from AN2557)

 

        /* Test if user code is programmed starting from address ''ApplicationAddress'' */

         if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)

          {

            SysTick_IRQControl(DISABLE); // Stop SysTick IRQ befor jump to the new application

            /* Jump to user application */

            JumpAddress = *(__IO uint32_t*) (ApplicationAddress + 4);

            Jump_To_Application = (pFunction) JumpAddress;

            /* Initialize user application's Stack Pointer */

           __set_MSP(*(__IO uint32_t*) ApplicationAddress);

           Jump_To_Application();

          }         

But when I made a bin code for the APP I get this hex on the first lines:

01 02 00 00 which not lead to get 0x2000---- on 

 if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)

When I look on the AN2557 APP code (SYSTICK) I found it start with 28 04 00 20 which I think get the 0x2000---- (Little indian format).

1. Am I right?

2. What is the porpuse of 

this if:

if (((*(__IO uint32_t*)ApplicationAddress) & 0x2FFE0000 ) == 0x20000000)

3. What could be the reason I don't get the right address?

Regards

Bar.

#iap-jump-issue
1 REPLY 1
Posted on April 06, 2013 at 00:31

You clearly have something wrong. The purpose of the test is to confirm the value you're loading for the stack pointer (SP), points to RAM. If it doesn't things will go pear shaped quickly.

Consider if ApplicationAddress reflects the base you have chosen.

Check also the first dozen bytes of your hex/bin file as produced by the linker.
Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..