cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 freeze at osKernelStart() after jump from bootloader

Micls
Visitor

Hi, my stm32f103 freeze after osKernelStart() after jump from bootloader but if I flash at that address it run normally.

I try with blinking LED simple one but it still freeze too (this one not use RTOS).

while (1)
{
HAL_GPIO_TogglePin(LED_SIGNAL_2_GPIO_Port, LED_SIGNAL_2_Pin);
HAL_Delay(500);
HAL_GPIO_TogglePin(LED_SIGNAL_3_GPIO_Port, LED_SIGNAL_3_Pin);
HAL_Delay(500);
/* USER CODE END WHILE */

/* USER CODE BEGIN 3 */
}

 

I using cmsis-rtos v1 (cmsis-rtos v2 in STM32CubeIDE is got error after update to 1.16.1 so I roll back to v1)

Why I know it freeze at there:

I put print at before of each task and one before osKernelStart(), only the one before osKernelStart print it, other is no, all task create successfully.

I already try:
- __disable_irq() but it didn't work
- All bootloader clock and application clock is same.

My setting:

STM32F103RCTX_FLASH.ld:

MEMORY
{
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 48K
FLASH (rx) : ORIGIN = 0x0800C800, LENGTH = 204K
}

system_stm32f1xx.c:

#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.
This value must be a multiple of 0x200. */
#define VECT_TAB_OFFSET 0x0000C800U /*!< Vector Table base offset field.
This value must be a multiple of 0x200. */

my jump function:

void OTATask::_otaGotoApplication()
{
void (*app_reset_handler)(void)=(void (*)(void))(*((volatile uint32_t*) (FLASH_APPLICATION_LOCATION + 4U)));

/* Reset the Clock */
HAL_RCC_DeInit();
HAL_DeInit();
__set_MSP(*(volatile uint32_t*) FLASH_APPLICATION_LOCATION);
SysTick->CTRL = 0;
SysTick->LOAD = 0;
SysTick->VAL = 0;

/* Jump to application */
app_reset_handler();
}
0 REPLIES 0