cancel
Showing results for 
Search instead for 
Did you mean: 

Cortex M0 Vector relocation issue

stenasc
Senior
Posted on February 07, 2014 at 00:42

Hi,

I'm trying to implement IAP on an stm32f051 device, but get a linker error when specifing VectorTable address is 0x20000000.

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

STM32F0-Discovery_Demo.axf: Error: L6985E: Unable to automatically place AT section main.o(.ARM.__AT_0x20000000) with required base address 0x20000000. Please manually place in the scatter file using the --no_autoat option. 

The program compiles and links when I don't mention a particular address

__IO uint32_t VectorTable[48];

 

Program Size: Code=46848 RO-data=2976 RW-data=1312 ZI-data=6712 

and I can see it in the map file..

VectorTable          0x200011e4   Data

I know I don't have a lot of RAM so is this the issue? If I could get a workaround without using the scatter file (never used it before), that would be good as well. Hopefully someone can give me a few pointers.

Regards

Bob
10 REPLIES 10
Posted on July 16, 2015 at 17:57

I can't edit my older posts. The cut-n-paste came from the ST ISP example, shouldn't be Resetting the SYSCFG, rather enabling the Clock

uint32_t *VectorTable = (uint32_t *)0x20000000; // Carve space here via linker script, or attributes
// Copy the vector table from the Flash (mapped at the base of the application
// load address 0x08003000) to the base address of the SRAM at 0x20000000.
for(i = 0; i < 48; i++) // Check Vector count on your part
VectorTable[i] = *(__IO uint32_t*)(0x08003000 + (i<<2)); 
// Enable the SYSCFG peripheral clock
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
// Remap SRAM at 0x00000000
SYSCFG_MemoryRemapConfig(SYSCFG_MemoryRemap_SRAM);

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