STM32 ~ BootLoad 总结与分析

 boot地址为:0x8000000 ~ 0x800c000

主程序地址为:0x800c000之后

主函数之前添加一下中断向量偏移,以及程序起始地址。

注意:相关外设时钟,比如定时器时钟、UART时钟等。必须在中断向量偏移程序之前初始化,否则相关外设会开启失败。(RCC_Configuration();)

	RCC_Configuration();
	GPIO_Configuration();
	NVIC_Configuration();
	
	IWDG_Init(5,1562);       //¿´ÃŹ·5  6.248Ãë 
	
	__set_MSP(*(vu32*)(0x800c000));										//APP1 µØÖ·0x800A000		APP2 µØÖ·0x8023000
	NVIC_SetVectorTable(0x8000000,0xc000);
	delay_ms(50);
	
	TIM3_Init();
	TIM1_Init();//TIM1 PWM³õʼ»¯
	TIM4_Init();

启动程序添加跳转指令:

#define APP_START_ADDR       0X0800C800	    
iap_load_app(APP_START_ADDR);

猜你喜欢

转载自blog.csdn.net/qq_27747359/article/details/106532946