Malugu
Newbie level 3
When I use STM32L072RBT6, according to the interrupt vector mapping of CM0, use the following code; for example, my APP address: 0x08006000;
I copy the interrupt vector table of this address to the actual address of RAM, such as 0x2000000, the total size of 0xc0 is limited;
Then perform remapping, so that the system can find the interrupt list in the APP, but the APP cannot actually cause an interrupt;
My code is as follows:
#define APPLICATION_ADDRESS ((uint32_t) 0x08003000)
The VectorTable variable is limited to 0x2000000, and the size is reserved for 512bytes;
static uint8_t i = 0;
static uint32_t tmpCfgr;
__HAL_RCC_SYSCFG_CLK_ENABLE ();
bootmode = SYSCFG-> CFGR1;
for (i = 0; i <48; i ++)
{
VectorTable = (* (uint32_t *) (APPLICATION_ADDRESS + (i << 2)));
}
// memcpy ((void *) 0x20000000, (void *) VectorTable, 0xC0);
// __ HAL_SYSCFG_REMAPMEMORY_SRAM ();
tmpCfgr = SYSCFG-> CFGR1;
tmpCfgr & = (uint32_t) (~ SYSCFG_CFGR1_MEM_MODE_Msk);
tmpCfgr | = (uint32_t) 0x03;
SYSCFG-> CFGR1 = tmpCfgr;
bootmode = SYSCFG-> CFGR1; Cannot set the mapping mode, it is always 0x00, I want to set it to 0x03
I copy the interrupt vector table of this address to the actual address of RAM, such as 0x2000000, the total size of 0xc0 is limited;
Then perform remapping, so that the system can find the interrupt list in the APP, but the APP cannot actually cause an interrupt;
My code is as follows:
#define APPLICATION_ADDRESS ((uint32_t) 0x08003000)
The VectorTable variable is limited to 0x2000000, and the size is reserved for 512bytes;
static uint8_t i = 0;
static uint32_t tmpCfgr;
__HAL_RCC_SYSCFG_CLK_ENABLE ();
bootmode = SYSCFG-> CFGR1;
for (i = 0; i <48; i ++)
{
VectorTable = (* (uint32_t *) (APPLICATION_ADDRESS + (i << 2)));
}
// memcpy ((void *) 0x20000000, (void *) VectorTable, 0xC0);
// __ HAL_SYSCFG_REMAPMEMORY_SRAM ();
tmpCfgr = SYSCFG-> CFGR1;
tmpCfgr & = (uint32_t) (~ SYSCFG_CFGR1_MEM_MODE_Msk);
tmpCfgr | = (uint32_t) 0x03;
SYSCFG-> CFGR1 = tmpCfgr;
bootmode = SYSCFG-> CFGR1; Cannot set the mapping mode, it is always 0x00, I want to set it to 0x03