Trying to jump in stm32l496 bootloader from application


Philippe O'Reilly <poreilly@...>
 

Hi,

 

I wrote a small application for the STM32L496 processor. The application simply jumps in the ROM bootloader of the CPU.

When I compile my application within STM32Cube IDE (version 1.6.0), it works properly.

When I compile it with zephyr, using west metatool, it does not work.

 

Here is the code of my application:

 

    void (*SysMemBootJump)(void);

    volatile uint32_t addr = 0x1FFF0000;

    HAL_RCC_DeInit();

    SysTick->CTRL = 0;

    SysTick->LOAD = 0;

    SysTick->VAL = 0;

    __HAL_RCC_SYSCFG_CLK_ENABLE();

 

    __disable_irq();

    SCB->VTOR=0;

 

    __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();

 

    SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));

    __set_MSP(*(uint32_t *)addr);

 

    SysMemBootJump();

       while(1);

 

 

I can not find out what makes it fail on Zephyr. If I could get some help on that problem, I would really appreciate.

 

Thanks

Philippe O’Reilly

______


Erwan Gouriou
 

Hi Philippe,

There could be multiple reasons, but we'd need reported errors to be able to help.
Also, maybe you can open a github discussion and provide details (errors, build  environment, ...)
for following up.

BR
Erwan



On Thu, 10 Jun 2021 at 22:24, Philippe O'Reilly <poreilly@...> wrote:

Hi,

 

I wrote a small application for the STM32L496 processor. The application simply jumps in the ROM bootloader of the CPU.

When I compile my application within STM32Cube IDE (version 1.6.0), it works properly.

When I compile it with zephyr, using west metatool, it does not work.

 

Here is the code of my application:

 

    void (*SysMemBootJump)(void);

    volatile uint32_t addr = 0x1FFF0000;

    HAL_RCC_DeInit();

    SysTick->CTRL = 0;

    SysTick->LOAD = 0;

    SysTick->VAL = 0;

    __HAL_RCC_SYSCFG_CLK_ENABLE();

 

    __disable_irq();

    SCB->VTOR=0;

 

    __HAL_SYSCFG_REMAPMEMORY_SYSTEMFLASH();

 

    SysMemBootJump = (void (*)(void)) (*((uint32_t *)(addr + 4)));

    __set_MSP(*(uint32_t *)addr);

 

    SysMemBootJump();

       while(1);

 

 

I can not find out what makes it fail on Zephyr. If I could get some help on that problem, I would really appreciate.

 

Thanks

Philippe O’Reilly

______