2020-02-12 12:40 AM
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
2020-02-12 06:23 AM
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?
2020-02-18 05:00 AM
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
2020-02-18 01:57 PM
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
2020-02-18 02:08 PM
STM32L031 CM0+ device, so yes