2023-03-15 12:21 AM
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.
2023-03-15 12:46 AM
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
2023-03-15 12:53 AM
#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.
2023-03-15 01:15 AM
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.
2023-03-15 02:51 AM
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.
2023-03-15 02:53 AM
How can I create another Interrupt Vector Table for Application project?
Can you provide me with some example code?
2023-03-15 04:36 AM
There should be examples within CubeF0 board level project trees.
The 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.
2023-03-16 02:20 AM
Example code for Bootloader application project:
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();
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 28K (this is an example)
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.
2023-03-16 04:21 AM
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.
2023-03-16 09:12 AM
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.