cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F103 RAM crashed

Nick Belazor
Associate II
Posted on May 06, 2018 at 22:51

I need lock my firmware on the FLASH. But i need access to firmware from my bootloader. Also i need get any more function from own bootloader.

QUESTION:

When i set RDP level == 1 on stm32f103 all ok. FLASH in lock state and all cool.

But, when i try jumping to my application in RAM from own bootloader i get unknown bugs.. data on the RAM is damaged! =(

why?

ps. when RDP level is 0 - then all ok and work fine! Jump is correctly work and sub-programm in RAM work fine

my JUMP (

jump_addr is RAM offset - 0x2000....

:(

void Jump_Execute(uint32_t jump_addr = 0x20005800){

// prepare JUMP

uint32_t appJumpAddress = *((volatile uint32_t *)(jump_addr + 4));

void (*GoToApp)(void) = NULL;

__disable_irq();

// reset ALL and deInit

HAL_GPIO_DeInit(GPIOA, GPIO_PIN_All);

HAL_GPIO_DeInit(GPIOB, GPIO_PIN_All);

HAL_GPIO_DeInit(GPIOC, GPIO_PIN_All);

HAL_GPIO_DeInit(GPIOD, GPIO_PIN_All);

HAL_RCC_DeInit();

__HAL_RCC_PWR_CLK_DISABLE();

__HAL_RCC_GPIOA_CLK_DISABLE();

__HAL_RCC_GPIOB_CLK_DISABLE();

__HAL_RCC_GPIOC_CLK_DISABLE();

__HAL_RCC_GPIOD_CLK_DISABLE();

RCC->CIR = 0x00000000;

HAL_DeInit();

NVIC_DeInit();

NVIC_SCBDeInit();

// reset systicktimer

SysTick->CTRL = 0;

SysTick->LOAD = 0;

SysTick->VAL = 0;

GoToApp = (void (*)(void)) appJumpAddress;

__DMB();

__set_MSP(*((volatile uint32_t *) jump_addr)); //stack pointer (to RAM) for USER app in this address

SCB->VTOR = jump_addr;

__DSB();

//** GO MAIN!

GoToApp();

//** does not jump =(

while (1){

}

}

#bootloader #crash-data #stm32f103
0 REPLIES 0