diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile index d1ba9663c3..577cc9c1ee 100644 --- a/ports/mimxrt/Makefile +++ b/ports/mimxrt/Makefile @@ -331,7 +331,6 @@ endif # Set default values for optional variables MICROPY_HW_SDRAM_AVAIL ?= 0 MICROPY_HW_SDRAM_SIZE ?= 0 -MICROPY_PY_MACHINE_SDCARD ?= 0 # Configure default compiler flags CFLAGS += \ @@ -351,7 +350,6 @@ CFLAGS += \ -DMICROPY_HW_FLASH_SIZE=$(MICROPY_HW_FLASH_SIZE) \ -DMICROPY_HW_SDRAM_AVAIL=$(MICROPY_HW_SDRAM_AVAIL) \ -DMICROPY_HW_SDRAM_SIZE=$(MICROPY_HW_SDRAM_SIZE) \ - -DMICROPY_PY_MACHINE_SDCARD=$(MICROPY_PY_MACHINE_SDCARD) \ -DSPI_RETRY_TIMES=1000000 \ -DUART_RETRY_TIMES=1000000 \ -DXIP_BOOT_HEADER_ENABLE=1 \ diff --git a/ports/mimxrt/boards/ADAFRUIT_METRO_M7/mpconfigboard.h b/ports/mimxrt/boards/ADAFRUIT_METRO_M7/mpconfigboard.h index 7d759df5e6..241567ab73 100644 --- a/ports/mimxrt/boards/ADAFRUIT_METRO_M7/mpconfigboard.h +++ b/ports/mimxrt/boards/ADAFRUIT_METRO_M7/mpconfigboard.h @@ -7,6 +7,7 @@ #define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin)) #define MICROPY_HW_NUM_PIN_IRQS (2 * 32) +#define MICROPY_HW_ENABLE_SDCARD (0) // Define mapping logical UART # to hardware UART # // LPUART1 on USB_DBG -> 0 diff --git a/ports/mimxrt/boards/ADAFRUIT_METRO_M7/mpconfigboard.mk b/ports/mimxrt/boards/ADAFRUIT_METRO_M7/mpconfigboard.mk index 236db27c87..a8f7add6d2 100644 --- a/ports/mimxrt/boards/ADAFRUIT_METRO_M7/mpconfigboard.mk +++ b/ports/mimxrt/boards/ADAFRUIT_METRO_M7/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1011 MCU_VARIANT = MIMXRT1011DAE5A MICROPY_FLOAT_IMPL = single -MICROPY_PY_MACHINE_SDCARD = 0 MICROPY_HW_FLASH_TYPE ?= qspi_nor_flash MICROPY_HW_FLASH_SIZE ?= 0x800000 # 8MB diff --git a/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h index 26811fdab8..fc135c5e1b 100644 --- a/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.h @@ -7,6 +7,7 @@ #define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin)) #define MICROPY_HW_NUM_PIN_IRQS (2 * 32) +#define MICROPY_HW_ENABLE_SDCARD (0) // Define mapping logical UART # to hardware UART # // LPUART1 on USB_DBG -> 0 diff --git a/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.mk b/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.mk index 19db53c3f8..dd52585906 100644 --- a/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.mk +++ b/ports/mimxrt/boards/MIMXRT1010_EVK/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1011 MCU_VARIANT = MIMXRT1011DAE5A MICROPY_FLOAT_IMPL = single -MICROPY_PY_MACHINE_SDCARD = 0 MICROPY_HW_FLASH_TYPE = qspi_nor_flash MICROPY_HW_FLASH_SIZE = 0x1000000 # 16MB diff --git a/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.h b/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.h index 655bb62c27..f47bbf4fa1 100644 --- a/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.h +++ b/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.h @@ -10,6 +10,7 @@ #define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_high(pin)) #define MICROPY_HW_NUM_PIN_IRQS (3 * 32) +#define MICROPY_PY_MACHINE_SDCARD (0) // Define mapping logical UART # to hardware UART # // RX/TX HW-UART Logical UART diff --git a/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.mk b/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.mk index ba7d61f6d4..34e5cdee51 100644 --- a/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.mk +++ b/ports/mimxrt/boards/MIMXRT1015_EVK/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1015 MCU_VARIANT = MIMXRT1015DAF5A MICROPY_FLOAT_IMPL = single -MICROPY_PY_MACHINE_SDCARD = 0 MICROPY_HW_FLASH_TYPE = qspi_nor_flash MICROPY_HW_FLASH_SIZE = 0x1000000 # 16MB diff --git a/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.mk b/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.mk index 547b88d57d..c98843a1a3 100644 --- a/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.mk +++ b/ports/mimxrt/boards/MIMXRT1020_EVK/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1021 MCU_VARIANT = MIMXRT1021DAG5A MICROPY_FLOAT_IMPL = double -MICROPY_PY_MACHINE_SDCARD = 1 MICROPY_HW_FLASH_TYPE = qspi_nor_flash MICROPY_HW_FLASH_SIZE = 0x800000 # 8MB diff --git a/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.mk b/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.mk index 0cf2a34804..ef7bbc8f56 100644 --- a/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.mk +++ b/ports/mimxrt/boards/MIMXRT1050_EVK/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1052 MCU_VARIANT = MIMXRT1052DVL6B MICROPY_FLOAT_IMPL = double -MICROPY_PY_MACHINE_SDCARD = 1 MICROPY_HW_FLASH_TYPE = qspi_hyper_flash MICROPY_HW_FLASH_SIZE = 0x4000000 # 64MB diff --git a/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.mk b/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.mk index c2556a2724..3af7cd231a 100644 --- a/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.mk +++ b/ports/mimxrt/boards/MIMXRT1060_EVK/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1062 MCU_VARIANT = MIMXRT1062DVJ6A MICROPY_FLOAT_IMPL = double -MICROPY_PY_MACHINE_SDCARD = 1 MICROPY_HW_FLASH_TYPE = qspi_nor_flash MICROPY_HW_FLASH_SIZE = 0x800000 # 8MB diff --git a/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.mk b/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.mk index d3ba752419..95cfb4585a 100644 --- a/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.mk +++ b/ports/mimxrt/boards/MIMXRT1064_EVK/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1064 MCU_VARIANT = MIMXRT1064DVL6A MICROPY_FLOAT_IMPL = double -MICROPY_PY_MACHINE_SDCARD = 1 MICROPY_HW_FLASH_TYPE = internal MICROPY_HW_FLASH_SIZE = 0x400000 # 4MB diff --git a/ports/mimxrt/boards/MIMXRT1170_EVK/mpconfigboard.mk b/ports/mimxrt/boards/MIMXRT1170_EVK/mpconfigboard.mk index 25747a52c6..1488730f7c 100644 --- a/ports/mimxrt/boards/MIMXRT1170_EVK/mpconfigboard.mk +++ b/ports/mimxrt/boards/MIMXRT1170_EVK/mpconfigboard.mk @@ -3,7 +3,6 @@ MCU_VARIANT = MIMXRT1176DVMAA MCU_CORE = _cm7 MICROPY_FLOAT_IMPL = double -MICROPY_PY_MACHINE_SDCARD = 1 MICROPY_HW_FLASH_TYPE ?= qspi_nor_flash MICROPY_HW_FLASH_SIZE ?= 0x1000000 # 16MB MICROPY_HW_FLASH_RESERVED ?= 0x100000 # 1MB CM4 Code address space diff --git a/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h b/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h index 9443bb3732..324cee9b14 100644 --- a/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h +++ b/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.h @@ -11,6 +11,7 @@ #define MICROPY_HW_LED_OFF(pin) (mp_hal_pin_low(pin)) #define MICROPY_HW_NUM_PIN_IRQS (2 * 32) +#define MICROPY_PY_MACHINE_SDCARD (0) // Define mapping logical UART # to hardware UART # // LPUART1 on RX/TX -> 1 diff --git a/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.mk b/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.mk index 135c43257c..58429d2981 100644 --- a/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.mk +++ b/ports/mimxrt/boards/OLIMEX_RT1010/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1011 MCU_VARIANT = MIMXRT1011DAE5A MICROPY_FLOAT_IMPL = single -MICROPY_PY_MACHINE_SDCARD ?= 0 MICROPY_HW_FLASH_TYPE = qspi_nor_flash MICROPY_HW_FLASH_SIZE = 0x200000 # 2MB MICROPY_HW_FLASH_RESERVED ?= 0x1000 # 4KB diff --git a/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.mk b/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.mk index ca27dff55f..2cf7d33c63 100644 --- a/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.mk +++ b/ports/mimxrt/boards/SEEED_ARCH_MIX/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1052 MCU_VARIANT = MIMXRT1052DVL6B MICROPY_FLOAT_IMPL = double -MICROPY_PY_MACHINE_SDCARD = 1 MICROPY_HW_FLASH_TYPE = qspi_nor_flash MICROPY_HW_FLASH_SIZE = 0x800000 # 8MB diff --git a/ports/mimxrt/boards/TEENSY40/mpconfigboard.mk b/ports/mimxrt/boards/TEENSY40/mpconfigboard.mk index 4482c629f7..07f174944b 100644 --- a/ports/mimxrt/boards/TEENSY40/mpconfigboard.mk +++ b/ports/mimxrt/boards/TEENSY40/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1062 MCU_VARIANT = MIMXRT1062DVJ6A MICROPY_FLOAT_IMPL = double -MICROPY_PY_MACHINE_SDCARD = 1 MICROPY_HW_FLASH_TYPE = qspi_nor_flash MICROPY_HW_FLASH_SIZE = 0x200000 # 2MB MICROPY_HW_FLASH_RESERVED ?= 0x1000 # 4KB diff --git a/ports/mimxrt/boards/TEENSY41/mpconfigboard.mk b/ports/mimxrt/boards/TEENSY41/mpconfigboard.mk index cf07144668..b297448a30 100755 --- a/ports/mimxrt/boards/TEENSY41/mpconfigboard.mk +++ b/ports/mimxrt/boards/TEENSY41/mpconfigboard.mk @@ -2,7 +2,6 @@ MCU_SERIES = MIMXRT1062 MCU_VARIANT = MIMXRT1062DVJ6A MICROPY_FLOAT_IMPL = double -MICROPY_PY_MACHINE_SDCARD = 1 MICROPY_HW_FLASH_TYPE = qspi_nor_flash MICROPY_HW_FLASH_SIZE = 0x800000 # 8MB MICROPY_HW_FLASH_RESERVED ?= 0x1000 # 4KB diff --git a/ports/mimxrt/machine_sdcard.c b/ports/mimxrt/machine_sdcard.c index 496eb93533..b0bf8613c2 100644 --- a/ports/mimxrt/machine_sdcard.c +++ b/ports/mimxrt/machine_sdcard.c @@ -24,11 +24,12 @@ * THE SOFTWARE. */ -#if MICROPY_PY_MACHINE_SDCARD - #include "py/runtime.h" #include "py/mperrno.h" #include "extmod/vfs.h" + +#if MICROPY_PY_MACHINE_SDCARD + #include "ticks.h" #if defined(MIMXRT1170x_SERIES) diff --git a/ports/mimxrt/mpconfigport.h b/ports/mimxrt/mpconfigport.h index d1fe17ee10..feb6cb2660 100644 --- a/ports/mimxrt/mpconfigport.h +++ b/ports/mimxrt/mpconfigport.h @@ -87,6 +87,9 @@ uint32_t trng_random_u32(void); #ifndef MICROPY_PY_MACHINE_I2S #define MICROPY_PY_MACHINE_I2S (0) #endif +#ifndef MICROPY_PY_MACHINE_SDCARD +#define MICROPY_PY_MACHINE_SDCARD (1) +#endif #define MICROPY_PY_MACHINE_SOFTI2C (1) #define MICROPY_PY_MACHINE_SPI (1) #define MICROPY_PY_MACHINE_SOFTSPI (1) diff --git a/ports/mimxrt/sdcard.c b/ports/mimxrt/sdcard.c index 6dbd45303b..ae52ed5d2c 100644 --- a/ports/mimxrt/sdcard.c +++ b/ports/mimxrt/sdcard.c @@ -24,6 +24,8 @@ * THE SOFTWARE. */ +#include "py/mphal.h" + #if MICROPY_PY_MACHINE_SDCARD #include "sdcard.h"