main.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file : main.h
  5. * @brief : Header for main.c file.
  6. * This file contains the common defines of the application.
  7. ******************************************************************************
  8. * @attention
  9. *
  10. * Copyright (c) 2024 STMicroelectronics.
  11. * All rights reserved.
  12. *
  13. * This software is licensed under terms that can be found in the LICENSE file
  14. * in the root directory of this software component.
  15. * If no LICENSE file comes with this software, it is provided AS-IS.
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Define to prevent recursive inclusion -------------------------------------*/
  21. #ifndef __MAIN_H
  22. #define __MAIN_H
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. /* Includes ------------------------------------------------------------------*/
  27. #include "stm32f1xx_hal.h"
  28. /* Private includes ----------------------------------------------------------*/
  29. /* USER CODE BEGIN Includes */
  30. #include <stdio.h>
  31. #define BootLoader_Size 0x7800U
  32. #define Application_Size 0xC800U
  33. #define BIT_Task01_EVENT (EventBits_t)(0x0001 << 0)
  34. #define BIT_Task02_EVENT (EventBits_t)(0x0001 << 1)
  35. #define BIT_Task03_EVENT (EventBits_t)(0x0001 << 2)
  36. #define BIT_Task04_EVENT (EventBits_t)(0x0001 << 3)
  37. #define BIT_TaskAll_EVENT BIT_Task01_EVENT | BIT_Task02_EVENT | BIT_Task03_EVENT | BIT_Task04_EVENT
  38. #define Application_1_Addr 0x08000000U
  39. #define Application_2_Addr (Application_1_Addr + Application_Size) // 0x80118000U 0x801E000
  40. /* 启动的步�? */
  41. #define Startup_Normal 0xFFFFFFFF // 正常启动
  42. #define Startup_Update 0xAAAAAAAA // 升级再启�?
  43. #define Startup_Reset 0x5555AAAA // ***恢复出厂 目前没使�?***
  44. #define ENABLE_DEBUG 1
  45. #if ENABLE_DEBUG > 0
  46. #define DEBUG_PRINTF(...) printf("DEBUG: " __VA_ARGS__)
  47. #else
  48. #define DEBUG_PRINTF(...) do {} while (0)
  49. #endif
  50. /* USER CODE END Includes */
  51. /* Exported types ------------------------------------------------------------*/
  52. /* USER CODE BEGIN ET */
  53. /* USER CODE END ET */
  54. /* Exported constants --------------------------------------------------------*/
  55. /* USER CODE BEGIN EC */
  56. /* USER CODE END EC */
  57. /* Exported macro ------------------------------------------------------------*/
  58. /* USER CODE BEGIN EM */
  59. /* USER CODE END EM */
  60. /* Exported functions prototypes ---------------------------------------------*/
  61. void Error_Handler(void);
  62. /* USER CODE BEGIN EFP */
  63. /* USER CODE END EFP */
  64. /* Private defines -----------------------------------------------------------*/
  65. /* USER CODE BEGIN Private defines */
  66. /* USER CODE END Private defines */
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70. #endif /* __MAIN_H */