stm32fxx_STLclassBvar.h 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /**
  2. ******************************************************************************
  3. * @file stm32fxx_STLclassBvar.h
  4. * @author MCD Application Team
  5. * @version V2.2.0
  6. * @date 19-June-2017
  7. * @brief Contains all safety critical variables; they must have
  8. * predefined addresses and inverse redundant storage
  9. ******************************************************************************
  10. * @attention
  11. *
  12. * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
  13. *
  14. * Redistribution and use in source and binary forms, with or without modification,
  15. * are permitted provided that the following conditions are met:
  16. * 1. Redistributions of source code must retain the above copyright notice,
  17. * this list of conditions and the following disclaimer.
  18. * 2. Redistributions in binary form must reproduce the above copyright notice,
  19. * this list of conditions and the following disclaimer in the documentation
  20. * and/or other materials provided with the distribution.
  21. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  22. * may be used to endorse or promote products derived from this software
  23. * without specific prior written permission.
  24. *
  25. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  26. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  27. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  28. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  29. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  30. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  31. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  32. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  33. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  34. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. ******************************************************************************
  37. */
  38. /* Define to prevent recursive inclusion -------------------------------------*/
  39. #ifndef __STL_CLASS_B_VAR_H
  40. #define __STL_CLASS_B_VAR_H
  41. /* This avoids having multiply defined global variables */
  42. #ifdef ALLOC_GLOBALS
  43. #define EXTERN
  44. #else
  45. #define EXTERN extern
  46. #endif
  47. /* Includes ------------------------------------------------------------------*/
  48. /* Exported types ------------------------------------------------------------*/
  49. /* Exported constants --------------------------------------------------------*/
  50. /* Exported macro ------------------------------------------------------------*/
  51. /* Exported functions ------------------------------------------------------- */
  52. #ifdef __IAR_SYSTEMS_ICC__ /* IAR Compiler */
  53. /* RAM location for temporary storage of original values at run time RAM transparent test */
  54. EXTERN __no_init uint32_t aRunTimeRamBuf[RT_RAM_BLOCKSIZE + 2U] @ "RUN_TIME_RAM_BUF";
  55. /* pointers for run time RAM transparent test */
  56. EXTERN __no_init uint32_t *pRunTimeRamChk @ "RUN_TIME_RAM_PNT";
  57. EXTERN __no_init uint32_t *pRunTimeRamChkInv @ "RUN_TIME_RAM_PNT";
  58. EXTERN __no_init uint32_t aGAP_FOR_RAM_TEST_OVERLAY[2] @ "RUN_TIME_RAM_PNT";
  59. /* Class B non inverted variables area */
  60. EXTERN __no_init uint32_t CtrlFlowCnt @ "CLASS_B_RAM"; /* Counter for verifying correct program execution at start */
  61. EXTERN __no_init uint32_t ISRCtrlFlowCnt @ "CLASS_B_RAM"; /* Counter for verifying correct program execution in interrupt */
  62. EXTERN __no_init uint32_t PeriodValue @ "CLASS_B_RAM"; /* LSI period measurement at TIM5 IRQHandler */
  63. EXTERN __no_init uint32_t TickCounter @ "CLASS_B_RAM"; /* Software time base used in main program (incremented in SysTick timer ISR */
  64. EXTERN __no_init __IO uint32_t TimeBaseFlag @ "CLASS_B_RAM";/* Indicates to the main routine a 100ms tick */
  65. EXTERN __no_init __IO uint32_t LSIPeriodFlag @ "CLASS_B_RAM";/* Indicates to the main routine a 100ms tick */
  66. EXTERN __no_init uint32_t LastCtrlFlowCnt @ "CLASS_B_RAM"; /* Stores the Control flow counter from one main loop to the other */
  67. EXTERN __no_init uint32_t *pRunCrc32Chk @ "CLASS_B_RAM"; /* Pointer to FLASH for crc32 run-time tests */
  68. EXTERN __no_init uint32_t RefCrc32 @ "CLASS_B_RAM"; /* Reference 32-bit CRC for run-time tests */
  69. /* Class B inverted variables area */
  70. EXTERN __no_init uint32_t CtrlFlowCntInv @ "CLASS_B_RAM_REV";
  71. EXTERN __no_init uint32_t ISRCtrlFlowCntInv @ "CLASS_B_RAM_REV";
  72. EXTERN __no_init uint32_t PeriodValueInv @ "CLASS_B_RAM_REV";
  73. EXTERN __no_init uint32_t TickCounterInv @ "CLASS_B_RAM_REV";
  74. EXTERN __no_init __IO uint32_t TimeBaseFlagInv @ "CLASS_B_RAM_REV";
  75. EXTERN __no_init __IO uint32_t LSIPeriodFlagInv @ "CLASS_B_RAM_REV";
  76. EXTERN __no_init uint32_t LastCtrlFlowCntInv @ "CLASS_B_RAM_REV";
  77. EXTERN __no_init uint32_t *pRunCrc32ChkInv @ "CLASS_B_RAM_REV";
  78. EXTERN __no_init uint32_t RefCrc32Inv @ "CLASS_B_RAM_REV";
  79. /* Magic pattern for Stack overflow in this array */
  80. EXTERN __no_init __IO uint32_t aStackOverFlowPtrn[4] @ "STACK_BOTTOM";
  81. #endif /* __IAR_SYSTEMS_ICC__ */
  82. #ifdef __CC_ARM /* KEIL Compiler */
  83. /* RAM location for temporary storage of original values at run time RAM transparent test */
  84. EXTERN uint32_t aRunTimeRamBuf[RT_RAM_BLOCKSIZE + 2] __attribute__((section("RUN_TIME_RAM_BUF")));
  85. /* RAM pointer for run-time tests */
  86. EXTERN uint32_t *pRunTimeRamChk __attribute__((section("RUN_TIME_RAM_PNT")));
  87. EXTERN uint32_t *pRunTimeRamChkInv __attribute__((section("RUN_TIME_RAM_PNT")));
  88. EXTERN uint32_t aGAP_FOR_RAM_TEST_OVERLAY[2] __attribute__((section("RUN_TIME_RAM_PNT")));
  89. /* Note: the zero_init forces the linker to place variables in the bss section */
  90. /* This allows the UNINIT directive (in scatter file) to work. On the contrary */
  91. /* all Class B variables pairs should be initialized properly by user before using them */
  92. /* Counter for verifying correct program execution at start */
  93. EXTERN uint32_t CtrlFlowCnt __attribute__((section("CLASS_B_RAM"), zero_init));
  94. EXTERN uint32_t CtrlFlowCntInv __attribute__((section("CLASS_B_RAM_REV"), zero_init));
  95. /* Counter for verifying correct program execution in interrupt */
  96. EXTERN uint32_t ISRCtrlFlowCnt __attribute__((section("CLASS_B_RAM"), zero_init));
  97. EXTERN uint32_t ISRCtrlFlowCntInv __attribute__((section("CLASS_B_RAM_REV"), zero_init));
  98. /* LSI period measurement at TIM5 IRQHandler */
  99. EXTERN uint32_t PeriodValue __attribute__((section("CLASS_B_RAM"), zero_init));
  100. EXTERN uint32_t PeriodValueInv __attribute__((section("CLASS_B_RAM_REV"), zero_init));
  101. /* Sofware time base used in main program (incremented in SysTick timer ISR */
  102. EXTERN uint32_t TickCounter __attribute__((section("CLASS_B_RAM"), zero_init));
  103. EXTERN uint32_t TickCounterInv __attribute__((section("CLASS_B_RAM_REV"), zero_init));
  104. /* Indicates to the main routine a 100ms tick */
  105. EXTERN __IO uint32_t TimeBaseFlag __attribute__((section("CLASS_B_RAM"), zero_init));
  106. EXTERN __IO uint32_t TimeBaseFlagInv __attribute__((section("CLASS_B_RAM_REV"), zero_init));
  107. /* Indicates to the main routine a 100ms tick */
  108. EXTERN __IO uint32_t LSIPeriodFlag __attribute__((section("CLASS_B_RAM"), zero_init));
  109. EXTERN __IO uint32_t LSIPeriodFlagInv __attribute__((section("CLASS_B_RAM_REV"), zero_init));
  110. /* Stores the Control flow counter from one main loop to the other */
  111. EXTERN uint32_t LastCtrlFlowCnt __attribute__((section("CLASS_B_RAM"), zero_init));
  112. EXTERN uint32_t LastCtrlFlowCntInv __attribute__((section("CLASS_B_RAM_REV"), zero_init));
  113. /* Pointer to FLASH for crc32 run-time tests */
  114. EXTERN uint32_t *pRunCrc32Chk __attribute__((section("CLASS_B_RAM"), zero_init));
  115. EXTERN uint32_t *pRunCrc32ChkInv __attribute__((section("CLASS_B_RAM_REV"), zero_init));
  116. /* Reference 32-bit CRC for run-time tests */
  117. EXTERN uint32_t RefCrc32 __attribute__((section("CLASS_B_RAM"), zero_init));
  118. EXTERN uint32_t RefCrc32Inv __attribute__((section("CLASS_B_RAM_REV"), zero_init));
  119. /* Magic pattern for Stack overflow in this array */
  120. EXTERN __IO uint32_t aStackOverFlowPtrn[4] __attribute__((section("STACK_BOTTOM"), zero_init));
  121. #endif /* __CC_ARM */
  122. #ifdef __GNUC__ /* GCC Compiler */
  123. #ifndef ALLOC_GLOBALS
  124. /* RAM location for temporary storage of original values at run time RAM transparent test */
  125. extern uint32_t aRunTimeRamBuf[RT_RAM_BLOCKSIZE + 2] __attribute__((section(".run_time_ram_buf")));
  126. /* RAM pointer for run-time tests */
  127. extern uint32_t *pRunTimeRamChk __attribute__((section(".run_time_ram_pnt")));
  128. extern uint32_t *pRunTimeRamChkInv __attribute__((section(".run_time_ram_pnt")));
  129. extern uint32_t aGAP_FOR_RAM_TEST_OVERLAY[2] __attribute__((section(".run_time_ram_pnt")));
  130. /* Note: the zero_init forces the linker to place variables in the bss section */
  131. /* This allows the UNINIT directive (in scatter file) to work. On the contrary */
  132. /* all Class B variables pairs should be initialized properly by user before using them */
  133. /* Counter for verifying correct program execution at start */
  134. extern uint32_t CtrlFlowCnt __attribute__((section (".class_b_ram")));
  135. extern uint32_t CtrlFlowCntInv __attribute__((section (".class_b_ram_rev")));
  136. /* Counter for verifying correct program execution in interrupt */
  137. extern uint32_t ISRCtrlFlowCnt __attribute__((section(".class_b_ram")));
  138. extern uint32_t ISRCtrlFlowCntInv __attribute__((section(".class_b_ram_rev")));
  139. /* LSI period measurement at TIM5 IRQHandler */
  140. extern uint32_t PeriodValue __attribute__((section(".class_b_ram")));
  141. extern uint32_t PeriodValueInv __attribute__((section(".class_b_ram_rev")));
  142. /* Sofware time base used in main program (incremented in SysTick timer ISR */
  143. extern uint32_t TickCounter __attribute__((section(".class_b_ram")));
  144. extern uint32_t TickCounterInv __attribute__((section(".class_b_ram_rev")));
  145. /* Indicates to the main routine a 100ms tick */
  146. extern __IO uint32_t TimeBaseFlag __attribute__((section(".class_b_ram")));
  147. extern __IO uint32_t TimeBaseFlagInv __attribute__((section(".class_b_ram_rev")));
  148. /* Indicates to the main routine a 100ms tick */
  149. extern __IO uint32_t LSIPeriodFlag __attribute__((section(".class_b_ram")));
  150. extern __IO uint32_t LSIPeriodFlagInv __attribute__((section(".class_b_ram_rev")));
  151. /* Stores the Control flow counter from one main loop to the other */
  152. extern uint32_t LastCtrlFlowCnt __attribute__((section(".class_b_ram")));
  153. extern uint32_t LastCtrlFlowCntInv __attribute__((section(".class_b_ram_rev")));
  154. /* Pointer to FLASH for crc32 run-time tests */
  155. extern uint32_t *pRunCrc32Chk __attribute__((section(".class_b_ram")));
  156. extern uint32_t *pRunCrc32ChkInv __attribute__((section(".class_b_ram_rev")));
  157. /* Reference 32-bit CRC for run-time tests */
  158. extern uint32_t RefCrc32 __attribute__((section(".class_b_ram")));
  159. extern uint32_t RefCrc32Inv __attribute__((section(".class_b_ram_rev")));
  160. /* Magic pattern for Stack overflow in this array */
  161. extern __IO uint32_t aStackOverFlowPtrn[4] __attribute__((section(".stack_bottom")));
  162. #else
  163. /* RAM location for temporary storage of original values at run time RAM transparent test */
  164. uint32_t aRunTimeRamBuf[RT_RAM_BLOCKSIZE + 2] __attribute__((section(".run_time_ram_buf")));
  165. /* RAM pointer for run-time tests */
  166. uint32_t *pRunTimeRamChk __attribute__((section(".run_time_ram_pnt")));
  167. uint32_t *pRunTimeRamChkInv __attribute__((section(".run_time_ram_pnt")));
  168. uint32_t aGAP_FOR_RAM_TEST_OVERLAY[2] __attribute__((section(".run_time_ram_pnt")));
  169. /* Note: the zero_init forces the linker to place variables in the bss section */
  170. /* This allows the UNINIT directive (in scatter file) to work. On the contrary */
  171. /* all Class B variables pairs should be initialized properly by user before using them */
  172. /* Counter for verifying correct program execution at start */
  173. uint32_t CtrlFlowCnt __attribute__((section (".class_b_ram"))) = { 0 };
  174. uint32_t CtrlFlowCntInv __attribute__((section (".class_b_ram_rev"))) = { 0 };
  175. /* Counter for verifying correct program execution in interrupt */
  176. uint32_t ISRCtrlFlowCnt __attribute__((section(".class_b_ram"))) = { 0 };
  177. uint32_t ISRCtrlFlowCntInv __attribute__((section(".class_b_ram_rev"))) = { 0 };
  178. /* LSI period measurement at TIM5 IRQHandler */
  179. uint32_t PeriodValue __attribute__((section(".class_b_ram"))) = { 0 };
  180. uint32_t PeriodValueInv __attribute__((section(".class_b_ram_rev"))) = { 0 };
  181. /* Sofware time base used in main program (incremented in SysTick timer ISR */
  182. uint32_t TickCounter __attribute__((section(".class_b_ram"))) = { 0 };
  183. uint32_t TickCounterInv __attribute__((section(".class_b_ram_rev"))) = { 0 };
  184. /* Indicates to the main routine a 100ms tick */
  185. __IO uint32_t TimeBaseFlag __attribute__((section(".class_b_ram"))) = { 0 };
  186. __IO uint32_t TimeBaseFlagInv __attribute__((section(".class_b_ram_rev"))) = { 0 };
  187. /* Indicates to the main routine a 100ms tick */
  188. __IO uint32_t LSIPeriodFlag __attribute__((section(".class_b_ram"))) = { 0 };
  189. __IO uint32_t LSIPeriodFlagInv __attribute__((section(".class_b_ram_rev"))) = { 0 };
  190. /* Stores the Control flow counter from one main loop to the other */
  191. uint32_t LastCtrlFlowCnt __attribute__((section(".class_b_ram"))) = { 0 };
  192. uint32_t LastCtrlFlowCntInv __attribute__((section(".class_b_ram_rev"))) = { 0 };
  193. /* Pointer to FLASH for crc32 run-time tests */
  194. uint32_t *pRunCrc32Chk __attribute__((section(".class_b_ram"))) = { 0 };
  195. uint32_t *pRunCrc32ChkInv __attribute__((section(".class_b_ram_rev"))) = { 0 };
  196. /* Reference 32-bit CRC for run-time tests */
  197. uint32_t RefCrc32 __attribute__((section(".class_b_ram"))) = { 0 };
  198. uint32_t RefCrc32Inv __attribute__((section(".class_b_ram_rev"))) = { 0 };
  199. /* Magic pattern for Stack overflow in this array */
  200. __IO uint32_t aStackOverFlowPtrn[4] __attribute__((section(".stack_bottom"))) = { 0 };
  201. #endif /* ALLOC_GLOBALS */
  202. #endif /* __GNUC__ */
  203. #endif /* __STL_CLASS_B_VAR_H */
  204. /******************* (C) COPYRIGHT STMicroelectronics *****END OF FILE****/