main.c 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /* USER CODE BEGIN Header */
  2. /**
  3. ******************************************************************************
  4. * @file : main.c
  5. * @brief : Main program body
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under BSD 3-Clause license,
  13. * the "License"; You may not use this file except in compliance with the
  14. * License. You may obtain a copy of the License at:
  15. * opensource.org/licenses/BSD-3-Clause
  16. *
  17. ******************************************************************************
  18. */
  19. /* USER CODE END Header */
  20. /* Includes ------------------------------------------------------------------*/
  21. #include "main.h"
  22. /* Private includes ----------------------------------------------------------*/
  23. /* USER CODE BEGIN Includes */
  24. /* USER CODE END Includes */
  25. /* Private typedef -----------------------------------------------------------*/
  26. /* USER CODE BEGIN PTD */
  27. /* USER CODE END PTD */
  28. /* Private define ------------------------------------------------------------*/
  29. /* USER CODE BEGIN PD */
  30. #define HSEM_ID_0 (0U) /* HW semaphore 0*/
  31. /* USER CODE END PD */
  32. /* Private macro -------------------------------------------------------------*/
  33. /* USER CODE BEGIN PM */
  34. /* USER CODE END PM */
  35. /* Private variables ---------------------------------------------------------*/
  36. /* USER CODE BEGIN PV */
  37. /* USER CODE END PV */
  38. /* Private function prototypes -----------------------------------------------*/
  39. /* USER CODE BEGIN PFP */
  40. /* USER CODE END PFP */
  41. /* Private user code ---------------------------------------------------------*/
  42. /* USER CODE BEGIN 0 */
  43. /* USER CODE END 0 */
  44. /**
  45. * @brief The application entry point.
  46. * @retval int
  47. */
  48. int main(void)
  49. {
  50. /* USER CODE BEGIN 1 */
  51. /* USER CODE END 1 */
  52. /* USER CODE BEGIN Boot_Mode_Sequence_1 */
  53. /*HW semaphore Clock enable*/
  54. __HAL_RCC_HSEM_CLK_ENABLE();
  55. /* Activate HSEM notification for Cortex-M4*/
  56. HAL_HSEM_ActivateNotification(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
  57. /*
  58. Domain D2 goes to STOP mode (Cortex-M4 in deep-sleep) waiting for Cortex-M7 to
  59. perform system initialization (system clock config, external memory configuration.. )
  60. */
  61. HAL_PWREx_ClearPendingEvent();
  62. HAL_PWREx_EnterSTOPMode(PWR_MAINREGULATOR_ON, PWR_STOPENTRY_WFE, PWR_D2_DOMAIN);
  63. /* Clear HSEM flag */
  64. __HAL_HSEM_CLEAR_FLAG(__HAL_HSEM_SEMID_TO_MASK(HSEM_ID_0));
  65. /* USER CODE END Boot_Mode_Sequence_1 */
  66. /* MCU Configuration--------------------------------------------------------*/
  67. /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
  68. HAL_Init();
  69. /* USER CODE BEGIN Init */
  70. /* USER CODE END Init */
  71. /* USER CODE BEGIN SysInit */
  72. /* USER CODE END SysInit */
  73. /* Initialize all configured peripherals */
  74. /* USER CODE BEGIN 2 */
  75. /* USER CODE END 2 */
  76. /* Infinite loop */
  77. /* USER CODE BEGIN WHILE */
  78. while (1)
  79. {
  80. /* USER CODE END WHILE */
  81. /* USER CODE BEGIN 3 */
  82. }
  83. /* USER CODE END 3 */
  84. }
  85. /* USER CODE BEGIN 4 */
  86. /* USER CODE END 4 */
  87. /**
  88. * @brief This function is executed in case of error occurrence.
  89. * @retval None
  90. */
  91. void Error_Handler(void)
  92. {
  93. /* USER CODE BEGIN Error_Handler_Debug */
  94. /* User can add his own implementation to report the HAL error return state */
  95. /* USER CODE END Error_Handler_Debug */
  96. }
  97. #ifdef USE_FULL_ASSERT
  98. /**
  99. * @brief Reports the name of the source file and the source line number
  100. * where the assert_param error has occurred.
  101. * @param file: pointer to the source file name
  102. * @param line: assert_param error line source number
  103. * @retval None
  104. */
  105. void assert_failed(uint8_t *file, uint32_t line)
  106. {
  107. /* USER CODE BEGIN 6 */
  108. /* User can add his own implementation to report the file name and line number,
  109. tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
  110. /* USER CODE END 6 */
  111. }
  112. #endif /* USE_FULL_ASSERT */
  113. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/