Browse Source

Fix compilation error for MKS Robin (#13506)

pull/1/head
Alexander Gavrilenko 6 years ago
committed by Scott Lahteine
parent
commit
6d9aaca082
  1. 4
      Marlin/src/HAL/HAL_STM32F1/HAL.h
  2. 18
      Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp
  3. 4
      Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp
  4. 2
      Marlin/src/lcd/dogm/HAL_LCD_com_defines.h
  5. 4
      buildroot/share/PlatformIO/scripts/mks_robin.py
  6. 1
      platformio.ini

4
Marlin/src/HAL/HAL_STM32F1/HAL.h

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

18
Marlin/src/HAL/HAL_STM32F1/HAL_sdio_STM32F1.cpp

@ -21,7 +21,7 @@
* *
*/ */
#if defined(__STM32F1__) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY)) #if defined(ARDUINO_ARCH_STM32F1) && (defined(STM32_HIGH_DENSITY) || defined(STM32_XL_DENSITY))
#include "HAL_sdio_STM32F1.h" #include "HAL_sdio_STM32F1.h"
@ -76,7 +76,7 @@ bool SDIO_Init(void) {
return true; return true;
} }
bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) { bool SDIO_ReadBlock_DMA(uint32_t blockAddress, uint8_t *data) {
if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false; if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
if (blockAddress >= SdCard.LogBlockNbr) return false; if (blockAddress >= SdCard.LogBlockNbr) return false;
if ((0x03 & (uint32_t)data)) return false; // misaligned data if ((0x03 & (uint32_t)data)) return false; // misaligned data
@ -100,6 +100,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL); dma_disable(SDIO_DMA_DEV, SDIO_DMA_CHANNEL);
if (SDIO->STA & SDIO_STA_RXDAVL) {
while (SDIO->STA & SDIO_STA_RXDAVL) (void) SDIO->FIFO;
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false;
}
if (SDIO_GET_FLAG(SDIO_STA_TRX_ERROR_FLAGS)) { if (SDIO_GET_FLAG(SDIO_STA_TRX_ERROR_FLAGS)) {
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS); SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false; return false;
@ -108,6 +114,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
return true; return true;
} }
bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
uint32_t retries = 3;
while (retries--) if (SDIO_ReadBlock_DMA(blockAddress, data)) return true;
return false;
}
bool SDIO_WriteBlock(uint32_t blockAddress, const uint8_t *data) { bool SDIO_WriteBlock(uint32_t blockAddress, const uint8_t *data) {
if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false; if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
if (blockAddress >= SdCard.LogBlockNbr) return false; if (blockAddress >= SdCard.LogBlockNbr) return false;
@ -264,4 +276,4 @@ bool SDIO_GetCmdResp7(void) {
return true; return true;
} }
#endif // __STM32F1__ && (STM32_HIGH_DENSITY || STM32_XL_DENSITY) #endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)

4
Marlin/src/HAL/HAL_STM32F1/u8g_com_stm32duino_fsmc.cpp

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

2
Marlin/src/lcd/dogm/HAL_LCD_com_defines.h

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

4
buildroot/share/PlatformIO/scripts/mks_robin.py

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

1
platformio.ini

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

Loading…
Cancel
Save