2017-01-12 11:43 PM
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
2017-01-13 01:34 AM
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.
2017-01-13 01:41 AM
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.o0x20000e40 VectorTable2017-01-13 02:06 AM
I modified the linkerscript.ld as following.
From:
MEMORY
{RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 8KROM (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
2017-01-13 07:50 AM
It is more portable than specifying absolute addresses with AT attributes.