|
@@ -78,14 +78,20 @@ uint16_t HAL_adc_result;
|
78
|
78
|
// Public functions
|
79
|
79
|
// --------------------------------------------------------------------------
|
80
|
80
|
|
81
|
|
-// HAL initialization task
|
82
|
|
-void HAL_init(void) {
|
83
|
81
|
|
84
|
|
- // Needed for DELAY_NS() / DELAY_US() on CORTEX-M7
|
85
|
|
- #if (defined(__arm__) || defined(__thumb__)) && __CORTEX_M == 7
|
|
82
|
+// Needed for DELAY_NS() / DELAY_US() on CORTEX-M7
|
|
83
|
+#if (defined(__arm__) || defined(__thumb__)) && __CORTEX_M == 7
|
|
84
|
+ // HAL pre-initialization task
|
|
85
|
+ // Force the preinit function to run between the premain() and main() function
|
|
86
|
+ // of the STM32 arduino core
|
|
87
|
+ __attribute__((constructor (102)))
|
|
88
|
+ void HAL_preinit() {
|
86
|
89
|
enableCycleCounter();
|
87
|
|
- #endif
|
|
90
|
+ }
|
|
91
|
+#endif
|
88
|
92
|
|
|
93
|
+// HAL initialization task
|
|
94
|
+void HAL_init(void) {
|
89
|
95
|
FastIO_init();
|
90
|
96
|
|
91
|
97
|
#if ENABLED(SDSUPPORT)
|