cancel
Showing results for 
Search instead for 
Did you mean: 

In STM32F030CCT6TR Cortex-M0 series microcontroller,when the pointer jumps from bootloader project to Application project ,no interrupts are being raised in application project even after the initialization and interrupt functions are enabled.

TShet.2
Associate III

The Interrupt vector table for both the Bootloader and the Application Project are shared at 0x800000 register location,but when code pointer jumps to Application project the interrupt vector still remains at 0x800000 and the application project has no access to it. Can you please explain how to move interrupt vector location at the start of Application Project Location.

13 REPLIES 13

Cortex-M0 does not have the SCB_VTOR register which other Cortex-Mx cores have, so the only way is to place (copy) the vector table into RAM and remap RAM on 0x0000'0000 by setting SYSCFG_CFGR1.MEM_MODE to 0b11.

JW

TShet.2
Associate III

#define SYSCFG_CFGR1_MEM_MODE_Pos      (0U)                

#define SYSCFG_CFGR1_MEM_MODE_Msk      (0x3UL << SYSCFG_CFGR1_MEM_MODE_Pos) /*!< 0x00000003 */

#define SYSCFG_CFGR1_MEM_MODE        SYSCFG_CFGR1_MEM_MODE_Msk      /*!< SYSCFG_Memory Remap Config */

#define SYSCFG_CFGR1_MEM_MODE_0       (0x1UL << SYSCFG_CFGR1_MEM_MODE_Pos) /*!< 0x00000001 */

#define SYSCFG_CFGR1_MEM_MODE_1       (0x2UL << SYSCFG_CFGR1_MEM_MODE_Pos) /*!< 0x00000002 */

The SYSCFG_CFGR1.MEM_MODE has already been set to 0x3 in the code.

Make sure that the Linker builds for the ​correct address deeper into Flash, and that you're copying the table into the front of RAM, and you're not reusing that space for variables, etc.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Rim LANDOLSI
ST Employee

Hello @TShet.2​ ,

the flash should be programmed with an Interrupt Vector Table which starts at 0x08000000 for the bootloader, as it is the case, and another one for the application.

Will be waiting for your feedback.

TShet.2
Associate III

How can I create another Interrupt Vector Table for Application project?

Can you provide me with some example code?

There should be examples within CubeF0 board level project trees.

T​he base address for the image is usually expressed in the Linker Script, .LD file. This also describes the RAM available, and where you can hide or carve out spaces.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Rim LANDOLSI
ST Employee

Example code for Bootloader application project:

  • For the Boot’s code
    • Add these instructions to the main.c
typedef void (*pFunction)(void);
#define APPLICATION_ADDRESS 0x08003800 (this is an example address)
pFunction JumpToApplication;
JumpToApplication = (pFunction) (*(volatile uint32_t*) (APPLICATION_ADDRESS + 4));
__set_MSP(*(uint32_t*) APPLICATION_ADDRESS);
JumpToApplication();
  •  Change the FLASH memory size in the linker file according to the application start address.
FLASH    (rx)    : ORIGIN = 0x08000000,   LENGTH = 28K (this is an example)

  • For the application’s code:
    • Change the FLASH memory size in the linker file according to the application start address.
FLASH   (rx)   : ORIGIN = 0x08003800,  LENGTH = 100K

When your question is answered, please close this topic by choosing Select as Best. This will help other users find that answer faster.

Thank you,

Rim.

I have done the similar thing suggested by you as shown below,

calling the below function in bootloader project and setting ETX_APP_FLASH_ADDR and origin location of Application as 0X0800C800.

static void goto_application(void)

{

 void (*app_reset_handler)(void) = (void*)(*((volatile uint32_t*) (ETX_APP_FLASH_ADDR + 4U)));

 deinitEverything();

 app_reset_handler();  //call the app reset handler

}

Program pointer jumps to Application project but interrupts are not getting generated even after initializing the timers and ADC.

Rim LANDOLSI
ST Employee

Make sure that SystemInit() isn't changing SCB->VTOR to some other address. Otherwise, try to activate interrupts by adding this line to main.c of the application's code :

 /* USER CODE BEGIN 1 */
  SCB->VTOR = 0X0800C800;
 /* USER CODE END 1 */

It could be, also, helpful to provide the whole project you are working on to further analyze the issue with interrupts.