Browse Source

🚑️ Init FastIO before anything else (#22508)

Tanguy Pruvot 2 years ago
parent
commit
ae846c2cb2
No account linked to committer's email address

+ 0
- 2
Marlin/src/HAL/STM32/HAL.cpp View File

@@ -63,8 +63,6 @@ TERN_(POSTMORTEM_DEBUGGING, extern void install_min_serial());
63 63
 
64 64
 // HAL initialization task
65 65
 void HAL_init() {
66
-  FastIO_init();
67
-
68 66
   // Ensure F_CPU is a constant expression.
69 67
   // If the compiler breaks here, it means that delay code that should compute at compile time will not work.
70 68
   // So better safe than sorry here.

+ 1
- 1
Marlin/src/HAL/STM32/fastio.cpp View File

@@ -26,7 +26,7 @@
26 26
 
27 27
 #include "../../inc/MarlinConfig.h"
28 28
 
29
-GPIO_TypeDef* FastIOPortMap[LastPort + 1];
29
+GPIO_TypeDef* FastIOPortMap[LastPort + 1] = { 0 };
30 30
 
31 31
 void FastIO_init() {
32 32
   LOOP_L_N(i, NUM_DIGITAL_PINS)

+ 1
- 0
Marlin/src/HAL/STM32/fastio.h View File

@@ -38,6 +38,7 @@ extern GPIO_TypeDef * FastIOPortMap[];
38 38
 // ------------------------
39 39
 
40 40
 void FastIO_init(); // Must be called before using fast io macros
41
+#define FASTIO_INIT() FastIO_init()
41 42
 
42 43
 // ------------------------
43 44
 // Defines

+ 3
- 3
Marlin/src/HAL/STM32F1/pinsDebug.h View File

@@ -19,15 +19,15 @@
19 19
 #pragma once
20 20
 
21 21
 /**
22
- * Support routines for STM32GENERIC (Maple)
22
+ * Support routines for MAPLE_STM32F1
23 23
  */
24 24
 
25 25
 /**
26 26
  * Translation of routines & variables used by pinsDebug.h
27 27
  */
28 28
 
29
-#ifndef BOARD_NR_GPIO_PINS  // Only in STM32GENERIC (Maple)
30
-   #error "Expected BOARD_NR_GPIO_PINS not found"
29
+#ifndef BOARD_NR_GPIO_PINS // Only in MAPLE_STM32F1
30
+  #error "Expected BOARD_NR_GPIO_PINS not found"
31 31
 #endif
32 32
 
33 33
 #include "fastio.h"

+ 4
- 0
Marlin/src/MarlinCore.cpp View File

@@ -1131,6 +1131,10 @@ inline void tmc_standby_setup() {
1131 1131
  *  - Set Marlin to RUNNING State
1132 1132
  */
1133 1133
 void setup() {
1134
+  #ifdef FASTIO_INIT
1135
+    FASTIO_INIT();
1136
+  #endif
1137
+
1134 1138
   #ifdef BOARD_PREINIT
1135 1139
     BOARD_PREINIT(); // Low-level init (before serial init)
1136 1140
   #endif

+ 1
- 8
Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h View File

@@ -99,19 +99,12 @@
99 99
 // Avoid nozzle heat and fan start before serial init
100 100
 #define BOARD_OPENDRAIN_MOSFETS
101 101
 
102
-#define BOARD_INIT_OD_PINS() { \
102
+#define BOARD_PREINIT() { \
103 103
   OUT_WRITE_OD(HEATER_0_PIN, 0); \
104 104
   OUT_WRITE_OD(HEATER_BED_PIN, 0); \
105 105
   OUT_WRITE_OD(FAN_PIN, 0); \
106 106
 }
107 107
 
108
-#ifdef MAPLE_STM32F1
109
-  // Only Maple Framework allow that early
110
-  #define BOARD_PREINIT BOARD_INIT_OD_PINS
111
-#else
112
-  #define BOARD_INIT BOARD_INIT_OD_PINS
113
-#endif
114
-
115 108
 //
116 109
 // PWM for a servo probe
117 110
 // Other servo devices are not supported on this board!

Loading…
Cancel
Save