Skip to main content
Visitor II
February 12, 2020
Question

STM32L031 cutom bootloader and interrupts in main application

  • February 12, 2020
  • 3 replies
  • 1235 views

Hello,

currently I work at a project where a customized boot-loader for STM32L31 is required.

External access for the BL is only possible via I2C interface, where the micro-controller acts as a slave.

So far, I've programmed the BL which is placed at the begin of the flash and jumps into main application on request which seems to work.

Unfortunately the main application is not able to handle any interrupt requests (acting also as a I2C slave) when I compile the application with an offset VECT_TAB_OFFSET.

What I did in the main app:

Changed vector offset in system_stm32l0xx.c file of the main application to:

#define VECT_TAB_OFFSET 0x1400U

Changed address in linker file for the FLASH of the main application to:

FLASH (rx)   : ORIGIN = 0x08001400, LENGTH = 28K

Made sure BL app is smaller than 4k.

There is the part of code I use to jump into main application from BL:

#define USER_APP_FLASH_ADDRESS 			0x08001400
 
 
JumpAddress = *(__IO uint32_t*) (USER_APP_FLASH_ADDRESS + 4);
Jump_To_Application = (pFunction)JumpAddress;
 
/* Disable interrupts */
__disable_irq();
 
/* Initialize user application's Stack Pointer */
__set_MSP((*(volatile uint32_t*) USER_APP_FLASH_ADDRESS));
 
Jump_To_Application();

The jump seems to work, but the main app is not calling any ISR's.

Even after erasing the whole flash and debugging the main application at some different flash address. There the uC seems to hang in a delay function which use the SystickCounter.

How can I get interrupts running when I use some other flash location than 0x08000000?

Any suggestions?

Best Ragards

    This topic has been closed for replies.

    3 replies

    Artur1Author
    Visitor II
    February 12, 2020

    Now the main application seems to work while debugging when I stop debugging and start the main app from boot loader, the main app starts but interrupts are still not working.

    Any Ideas why interrupts are working only in debug mode?

    Graduate II
    February 18, 2020

    Line 8 disables interrupts on a CPU. Does the application do the reverse?

    Anyway there is a much better approach described in my post there: https://community.st.com/s/question/0D50X0000AFpTmUSQV/using-nvicsystemreset-in-bootloaderapplication-jumps

    Super User
    February 18, 2020

    Does the L0 have SCB->VTOR? (see ST's Programming Manual and

    http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0662b/Ciheijba.html ) If yes, you need to set it to main application's vector table address.

    And, as Piranha said above, you need to reenable the interrupts globally.

    JW

    Graduate II
    February 18, 2020

    STM32L031 CM0+ device, so yes