iap.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. * Copyright (c) 2006-2021, RT-Thread Development Team
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. *
  6. * Change Logs:
  7. * Date Author Notes
  8. * 2022-01-17 19813 the first version
  9. */
  10. #ifndef APPLICATIONS_IAP_H_
  11. #define APPLICATIONS_IAP_H_
  12. ///
  13. ///
  14. ///
  15. ///
  16. ///
  17. /// 使用跳转功能前需要设置的几项
  18. ///
  19. /// 1. 设置boot loader工程的rom 起始地址不变 大小缩减为给bl预留的大小
  20. /// 设置位置在linkscripts stm32xxxx - > link.lds
  21. ///
  22. /// 2. 设置bl工程中的烧录方式由auto改为块擦除 选择烧录bin文件 起始位置不变
  23. ///
  24. /// 3. 设置app工程中 rom的起始位置为0x08000000 + bl预留空间的大小 设置rom大小为flash大小-bl大小
  25. ///
  26. /// 4. 设置app工程中的烧录方式由auto改为块擦除 选择烧录bin文件 起始位置改为0x08000000 + bl预留空间的大小
  27. ///
  28. /// 5. 在app工程中libraries\CMSIS\Device\ST\STM32G0xx\Source\Templates\System_stm32xxxx.h中
  29. /// 修改中断向量表的宏定义 VECT_TAB_OFFSET 的值 由默认值0x0U 改为app Rom起始地址
  30. /// 如预留32K给bootloader 则 VECT_TAB_OFFSET 的值设置为0x8000U 即可
  31. ///
  32. /// 6. 再BL工程中 #define app_start_addr 修改为 0x08000000 + VECT_TAB_OFFSET ( boot.c ) 同时修改iap.c中的定义
  33. ///
  34. /// 7. BL工程中 iap.c 和 at_client.c 中 #define 的 App_size 的大小改为app区 的空间大小
  35. ///
  36. ///
  37. ///
  38. ///
  39. ///
  40. ///
  41. uint8_t Sever_CMD_Response(uint8_t CMD_Type);
  42. uint8_t get_slave_num(void);
  43. uint8_t record_wait_sent(void);
  44. void MQTT_Send_Pub(uint8_t type);
  45. void Valve_CTL_Execute(uint8_t Cmd);
  46. int Get_cfg_value(uint16_t start_addr);
  47. uint8_t printf_sensor_list(uint8_t Type);
  48. u_int16_t printf_e_code(uint8_t times);
  49. uint8_t get_slave_addr(void);
  50. uint8_t Get_fw_crc(void);
  51. typedef struct Bak_info ///*/存放bak相关的所有参数 一次性读取 减少bl占用时间
  52. {
  53. uint8_t Bak_sta[3]; ///bak空间的状态,0 - > iap 空间 1 - > bak1空间 2 - > bak2空间
  54. uint16_t FW_Version[3]; ///bak空间中的固件版本号 存放固件版本的1000倍的整数
  55. uint16_t FW_Ver_tim[3]; ///存放bak空间中固件的记录日期
  56. ///具体算法为 高8位存放月的个数与年数*12的和 低八位存放日
  57. } Bak_info;
  58. typedef struct Unsend_buf
  59. {
  60. uint8_t fill_flag; //是否有数据等待发送标记位
  61. uint8_t buf[100]; //等待中的数据
  62. } Unsend_buf;
  63. #endif /* APPLICATIONS_IAP_H_ */