ProjectConfig_Boot.c 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "CommandsDefine.h"
  2. #include "delay.h"
  3. //#include "AnalogChannelCtrl.h"
  4. #include "usart.h"
  5. #include "timer.h"
  6. #include "iwdg.h"
  7. #include "iap.h"
  8. #include "stmflash.h"
  9. #define RUNNING_WHERE_AT_BOOT 1
  10. //#include "Probe.h"
  11. const VersionInfo OurVersionInfo /*__attribute__((at(BOOT_VERSION_FLASH_ADDR_BASE)))*/=
  12. {
  13. 0,//Version_MainNo
  14. 10,//Version_SubNo
  15. 8,//Version_ModifyNo
  16. 0,//Version_Revision_Number
  17. "20230913084451",//Version_Date
  18. "zhaoyong",//Version_ModifierName 16byte
  19. "Boot",//Version_ModelName 32byte
  20. "AtBoot.new UpdateSend.can read ver from app"//Version_Comment 64byte
  21. };
  22. VersionInfo* GetVersion()
  23. {
  24. return (VersionInfo*)(&OurVersionInfo);
  25. }
  26. void MainInit()
  27. {
  28. NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置系统中断优先级分组2
  29. delay_init(168); //初始化延时函数
  30. uart_init(115200); //初始化串口6波特率为115200
  31. sysIsReady =1;
  32. //u32 tt = USART_REC_LEN;
  33. //tt = tt + 1;
  34. //启动检测
  35. if(iap_check_appstate()==1)
  36. {
  37. //跳转APP1
  38. if(((*(vu32*)(FLASH_ADDR_APP+4))&0xFF000000)==0x08000000)// 0X08XXXXXX.
  39. //if(((*(vu32*)(FLASH_APP1_ADDR))&0x2FFE0000)==0x200A0000)//判断
  40. {
  41. //USART_Cmd(USART6, DISABLE);
  42. //iap_set_run_count();
  43. iap_load_app(FLASH_ADDR_APP);//执行FLASH APP代码
  44. }
  45. else
  46. {
  47. }
  48. }
  49. }