cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F030RC shift starting address causes SysTick_Handler() not executed

David163888
Associate II

Using the STM32F030RC, the program that originally ran at 0x800000 was moved to 0x8020000. After the move, SysTick_Handler() is no longer executed, causing HAL_Delay() to fail. Has anyone encountered this issue before?

1 ACCEPTED SOLUTION

Accepted Solutions
gbm
Principal

Quick-and dirty solution:

change RAM base in linker script from 0x20000000 to 0x200000c0, change size to the original size -192.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice

View solution in original post

4 REPLIES 4
gbm
Principal

It's not an issue - it's normal behavior. There are many threads on this topic under the "F0 bootloader" keywords. You need to relocate vector table to RAM, which requires some modifications to linker script and adding 3 lines of code to your program or to the bootloader. Just find and read these threads.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
David163888
Associate II

I added that copy ISR table to SRAM and solve HAL_Delay() issue。 
But new issue comes that some varible content is corrupted, below is my code

main(){

HAL_Init();

/* USER CODE BEGIN Init */

 

/* USER CODE END Init */

 

/* Configure the system clock */

SystemClock_Config();

 

/* USER CODE BEGIN SysInit */

 

/* USER CODE END SysInit */

 

/* Initialize all configured peripherals */

MX_GPIO_Init();

MX_USART2_UART_Init();

MX_I2C2_Init();

MX_TIM3_Init();

MX_TIM6_Init();

MX_TIM14_Init();

MX_TIM16_Init();

MX_USART1_UART_Init();

MX_TIM17_Init();

/* USER CODE BEGIN 2 */

 

/* Relocate by software the vector table to the internal SRAM at 0x20000000 ***/

 

/* Copy the vector table from the Flash (mapped at the base of the application

load address 0x08004000) to the base address of the SRAM at 0x20000000. */

uint32_t *ISR_address;

 

 

ISR_address = ISR_DATA_AREA;

 

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

{

*(ISR_address+(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();

 

// NVIC_EnableIRQ(SysTick_IRQn);

// __enable_irq();

O_USART2_DIR = 0; //when USART2 initial, prepare for Rx

printf("Application Target %d:%d Started!!!\r\n", APP_Version[0],APP_Version[1]);

...

}

the APP_Version[]'s value is corrupted.

gbm
Principal

Quick-and dirty solution:

change RAM base in linker script from 0x20000000 to 0x200000c0, change size to the original size -192.

My STM32 stuff on github - compact USB device stack and more: https://github.com/gbm-ii/gbmUSBdevice
David163888
Associate II

Thanks a lot!!!