cancel
Showing results for 
Search instead for 
Did you mean: 

stm32f051 IAP problem

paul0208
Associate III
Posted on January 13, 2017 at 08:43

Hi, Everyone.

I am testing IAP on stm32f051.

I made IAP code downloading from someone's IAP and did little modify.

IAP code is located on 0x0800 0000 ~ 0x0800 2fff and application is located on 0x0800 3000 ~

I wrote the IAP on 0x0800 0000 and application on 0x0800 3000 by ST-link.

And, I did execute the jumping code to application, jumping to application seemed to be good.

But, interrupt service routine are not operated at all.

I put the code on my application to remap vector table to SRAM as following:

#define APPLICATION_ADDRESS 0x08003000

__IO uint32_t VectorTable[48] __attribute__((section('.RAMVectorTable')));

for(i = 0; i < 48; i++)

  {

  VectorTable[i] = *(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2));

  }

/* Enable the SYSCFG peripheral clock*/

RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);

/* Remap SRAM at 0x00000000 */

SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM);

If I disable all the interrupt, application is working well.

I checked the 0x2000 0000 address's contents and 0x0800 3000 address contents by using ST-link

After executing the application code, 0x2000 0000 address is not same with 0x0800 3000.

What are the points I missed?

Application has tested loading on 0x0800 0000 without IAP, it is working well including interrupt service.

BR

Paul

4 REPLIES 4
Posted on January 13, 2017 at 10:34

Hard to say, perhaps it is how you are transferring control. Ie from an interrupt, or with them disabled.

Attach a project I can review.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
paul0208
Associate III
Posted on January 13, 2017 at 10:41

Hi, Clive,

I set like __IO uint32_t VectorTable[48] __attribute__((at(0x20000000)));

But, in the map file, VectorTable is located at 0x20000e40.

It is the problem I think.

How can I fix this problem?

I am using ARM gcc

(COMMON)

COMMON 0x20000a2c 0x414 src/dbg.o

0x20000e40 VectorTable
paul0208
Associate III
Posted on January 13, 2017 at 11:06

I modified the linkerscript.ld as following.

From:

MEMORY

{

RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8K

ROM (rx) : ORIGIN = 0x8003000, LENGTH = 64K

}

To:

MEMORY

{

RAM (xrw) : ORIGIN = 0x200000d0, LENGTH = 8K

ROM (rx) : ORIGIN = 0x8003000, LENGTH = 64K

}

And, remap function as following:

volatile uint32_t *ptr = (volatile uint32_t *) 0x20000000;

for(i = 0; i < 48; i++)

{

*ptr ++ = *(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2));

}

Then working well.

But, not right solution I think

BR

Paul

Posted on January 13, 2017 at 15:50

It is more portable than specifying absolute addresses with AT attributes.

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