Fix compilation error for MKS Robin (#13506)

This commit is contained in:
Alexander Gavrilenko 2019-03-29 20:40:24 +03:00 committed by Scott Lahteine
parent c6dbe6e9d6
commit 6d9aaca082
6 changed files with 26 additions and 7 deletions

View file

@ -130,6 +130,10 @@ void HAL_init();
#define analogInputToDigitalPin(p) (p)
#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_END if (!primask) (void)__iSeiRetVal()
#define ISRS_ENABLED() (!__get_primask())

View file

@ -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"
@ -76,7 +76,7 @@ bool SDIO_Init(void) {
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 (blockAddress >= SdCard.LogBlockNbr) return false;
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);
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)) {
SDIO_CLEAR_FLAG(SDIO_ICR_CMD_FLAGS | SDIO_ICR_DATA_FLAGS);
return false;
@ -108,6 +114,12 @@ bool SDIO_ReadBlock(uint32_t blockAddress, uint8_t *data) {
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) {
if (SDIO_GetCardState() != SDIO_CARD_TRANSFER) return false;
if (blockAddress >= SdCard.LogBlockNbr) return false;
@ -264,4 +276,4 @@ bool SDIO_GetCmdResp7(void) {
return true;
}
#endif // __STM32F1__ && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)

View file

@ -26,7 +26,7 @@
* 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"
@ -267,4 +267,4 @@ uint32_t LCD_IO_ReadData(uint16_t RegValue, uint8_t ReadSize) {
#endif // HAS_GRAPHICAL_LCD
#endif // (STM32F1 || STM32F1xx) && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)
#endif // ARDUINO_ARCH_STM32F1 && (STM32_HIGH_DENSITY || STM32_XL_DENSITY)

View file

@ -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);
#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);
#define U8G_COM_HAL_FSMC_FN u8g_com_stm32duino_fsmc_fn
#else

View file

@ -1,7 +1,9 @@
Import("env")
# 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.Replace(LDSCRIPT_PATH="buildroot/share/PlatformIO/ldscripts/mks_robin.ld")

View file

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