Skip to main content
Explorer
January 23, 2025
Solved

STM32F030RC shift starting address causes SysTick_Handler() not executed

  • January 23, 2025
  • 4 replies
  • 654 views

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?

    This topic has been closed for replies.
    Best answer by gbm

    Quick-and dirty solution:

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

    4 replies

    Graduate
    January 23, 2025

    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.

    Explorer
    January 24, 2025

    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.

    gbmAnswer
    Graduate
    January 24, 2025

    Quick-and dirty solution:

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

    Explorer
    January 27, 2025

    Thanks a lot!!!