bootloader设置:
staTIc void check_boot_mode(void)
{
uint32_t JumpAddress;
void(*Jump_To_ApplicaTIon)(void);
if (((*((__IO uint32_t*)(APP_SEGA_START_ADDRESS+8))) & 0x2FFE0000 ) == 0x20000000)
{
JumpAddress = *(__IO uint32_t*) (APP_SEGA_START_ADDRESS + 12);
Jump_To_ApplicaTIon = (void *)JumpAddress;
__set_MSP(*((__IO uint32_t*) (APP_SEGA_START_ADDRESS+8)));
Jump_To_ApplicaTIon();
}
}
application设置:
const uint8_t eh[8] __attribute__((at(0x08004000)));这个是使使用代码加载首地址向后推移8字节;
下图是使用代码加载地址和内存设置:
下面是中断向量表映射装备:
#define APPLICATION_ADDRESS (uint32_t)0x08004008
__IO uint32_t VectorTable[48] __attribute__((at(0x20000000)));
for(i = 0; i 《 48; i++)
{
VectorTable[i] = *(__IO uint32_t*)(APPLICATION_ADDRESS + (i《《2));
}