cancel
Showing results for 
Search instead for 
Did you mean: 

How to change starting address of my project

BAlex.3
Associate

I'm currently using a STM32F030CC and i need a Bootloader and Main App structure. The problem is that i can't find in system_stm32f0xx.c constant VECT_TAB_OFFSET to change. Also SCB->VTOR is missing. I'm currently using SMT32CUBEIDE v1.4.1. Any ideeas ?

1 ACCEPTED SOLUTION

Accepted Solutions
3 REPLIES 3
TDK
Guru
Piranha
Chief II

And for the most robust and simple architecture combine the vector table relocation with this design:

https://community.st.com/s/question/0D50X0000AFpTmUSQV/using-nvicsystemreset-in-bootloaderapplication-jumps

Seems that i'm missing something since it doesn't work...

My bootloader is working ok (tested with a led on at start of main app, which is off in bootloader)

In my main app i added :

#if  (defined ( __CC_ARM ))

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

#elif (defined (__ICCARM__))

#pragma location = 0x20000000

__no_init __IO uint32_t VectorTable[48];

#elif defined  ( __GNUC__ )

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

#endif

and in my main function between SystemClock_Config(); and MX_GPIO_Init(); i added:

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

 {

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

 }

 /* Enable the SYSCFG peripheral clock*/

 __HAL_RCC_SYSCFG_CLK_ENABLE();

 /* Remap SRAM at 0x00000000 */

 __HAL_SYSCFG_REMAPMEMORY_SRAM();

Then in STM32F030CCTX_FLASH.ld i changed this lines:

/* Memories definition */

MEMORY

{

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

 FLASH  (rx)  : ORIGIN = 0x8008000,  LENGTH = 110K

}

But my project isn't running, it stopped when i called HAL_UART_Receive_DMA(&huart1, dma_buff[0].data, sizeof(dma_buff[0].data));