本帖最后由 kfawj 于 2021-6-15 16:03 编辑
最近上手STM32F070RB芯片,通过bootload可以加载程序。奇怪是设备上电有时可以进入中断,有时不能进入中断。下面还是上代码吧:
#define BOOTLOAD
#ifdef BOOTLOAD
#define APPLICATION_ADDRESS (uint32_t)0x08004000
#if (defined ( __CC_ARM ))
__IO uint32_t VectorTable[48] __attribute__((at(0x20000000)));
#elif (defined (__ICCARM__))
#pragma location = 0x20000000
__no_init __IO uint32_t VectorTable[48];
#elif defined ( __GNUC__ )
__IO uint32_t VectorTable[48] __attribute__((section(".RAMVectorTable")));
#elif defined ( __TASKING__ )
__IO uint32_t VectorTable[48] __at(0x20000000);
#endif
int main(void)
{
/* USER CODE BEGIN 1 */
uint32_t channel;
RTC_TimeTypeDef sTime_tmp = {0};
RTC_DateTypeDef sDate_tmp = {0};
#ifdef BOOTLOAD
uint32_t i = 0;
for(i = 0; i < 48; i++)
{
VectorTable = *(__IO uint32_t*)(APPLICATION_ADDRESS + (i<<2));
}
__HAL_SYSCFG_REMAPMEMORY_SRAM(); //±ØÐëµÄ
SystemInit();
#endif
............
HAL_Delay(2000);
while (1)
{
}
} |