Browse Source

Fix compilation error for MKS Robin (#13506)

Alexander Gavrilenko 5 years ago
parent
commit
6d9aaca082

+ 4
- 0
Marlin/src/HAL/HAL_STM32F1/HAL.h View File

@@ -130,6 +130,10 @@ void HAL_init();
130 130
   #define analogInputToDigitalPin(p) (p)
131 131
 #endif
132 132
 
133
+#ifndef digitalPinHasPWM
134
+  #define digitalPinHasPWM(P) (PIN_MAP[P].timer_device != NULL)
135
+#endif
136
+
133 137
 #define CRITICAL_SECTION_START  uint32_t primask = __get_primask(); (void)__iCliRetVal()
134 138
 #define CRITICAL_SECTION_END    if (!primask) (void)__iSeiRetVal()
135 139
 #define ISRS_ENABLED() (!__get_primask())

+ 15
- 3
Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp View File

@@ -21,7 +21,7 @@
21 21
  *
22 22
  */
23 23
 
24
-#if defined(__STM32F1__) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
24
+#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
25 25
 
26 26
 #include "HAL_sdio_STM32F1.h"
27 27
 
@@ -76,7 +76,7 @@ bool SDIO_Init(void) {
76 76
   return true;
77 77
 }
78 78
 
79
-bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
79
+bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) {
80 80
   if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
81 81
   if (blockAddress >= SdCard.LogBlockNbr) return false;
82 82
   if ((0x03 & (uint32_t)data)) return false; // misaligned data
@@ -100,6 +100,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
100 100
 
101 101
   dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
102 102
 
103
+  if (SDIO->STA & SDIO_STA_RXDAVL) {
104
+    while (SDIO->STA & SDIO_STA_RXDAVL) (void) SDIO->FIFO;
105
+    SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
106
+    return false;
107
+  }
108
+
103 109
   if (SDIO_GET_FLAG(SDIO_STA_TRX_ERROR_FLAGS)) {
104 110
     SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
105 111
     return false;
@@ -108,6 +114,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
108 114
   return true;
109 115
 }
110 116
 
117
+bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
118
+  uint32_t retries = 3;
119
+  while (retries--) if (SDIO_ReadBlock_DMA(blockAddress, data)) return true;
120
+  return false;
121
+}
122
+
111 123
 bool SDIO_WriteBlock(uint32_t blockAddress, const uint8_t *data) {
112 124
   if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
113 125
   if (blockAddress >= SdCard.LogBlockNbr) return false;
@@ -264,4 +276,4 @@ bool SDIO_GetCmdResp7(void) {
264 276
   return true;
265 277
 }
266 278
 
267
-#endif // __STM32F1__ && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
279
+#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)

+ 2
- 2
Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp View File

@@ -26,7 +26,7 @@
26 26
  * Communication interface for FSMC
27 27
  */
28 28
 
29
-#if (defined(STM32F1) || defined(STM32F1xx)) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
29
+#if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
30 30
 
31 31
 #include "../../inc/MarlinConfig.h"
32 32
 
@@ -267,4 +267,4 @@ uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
267 267
 
268 268
 #endif // HAS_GRAPHICAL_LCD
269 269
 
270
-#endif // (STM32F1 || STM32F1xx) && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
270
+#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)

+ 1
- 1
Marlin/src/lcd/dogm/HAL_LCD_com_defines.h View File

@@ -47,7 +47,7 @@
47 47
   uint8_t u8g_com_HAL_LPC1768_ssd_hw_i2c_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
48 48
   #define U8G_COM_SSD_I2C_HAL u8g_com_arduino_ssd_i2c_fn
49 49
 
50
-  #if defined(STM32F1) || defined(STM32F1xx)
50
+  #if defined(ARDUINO_ARCH_STM32F1)
51 51
     uint8_t u8g_com_stm32duino_fsmc_fn(u8g_t *u8g, uint8_t msg, uint8_t arg_val, void *arg_ptr);
52 52
     #define U8G_COM_HAL_FSMC_FN u8g_com_stm32duino_fsmc_fn
53 53
   #else

+ 3
- 1
buildroot/share/PlatformIO/scripts/mks_robin.py View File

@@ -1,7 +1,9 @@
1 1
 Import("env")
2 2
 
3 3
 # Relocate firmware from 0x08000000 to 0x08007000
4
-env['CPPDEFINES'].remove(("VECT_TAB_ADDR", 134217728))
4
+for define in env['CPPDEFINES']:
5
+    if define[0] == "VECT_TAB_ADDR":
6
+        env['CPPDEFINES'].remove(define)
5 7
 env['CPPDEFINES'].append(("VECT_TAB_ADDR", "0x08007000"))
6 8
 env.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin.ld")
7 9
 

+ 1
- 0
platformio.ini View File

@@ -308,6 +308,7 @@ board         = genericSTM32F103ZE
308 308
 extra_scripts = buildroot/share/PlatformIO/scripts/mks_robin.py
309 309
 build_flags   = !python Marlin/src/HAL/HAL_STM32F1/STM32F1_flag_script.py
310 310
   ${common.build_flags}
311
+  -DSTM32_XL_DENSITY
311 312
 src_filter    = ${common.default_src_filter} +<src/HAL/HAL_STM32F1>
312 313
 lib_deps      = ${common.lib_deps}
313 314
 lib_ignore    = c1921b4

Loading…
Cancel
Save