summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Ebensberger <philipp.ebensberger@3bricks-software.de>2022-06-22 20:39:23 +0200
committerDamien George <damien@micropython.org>2022-06-24 17:58:27 +1000
commitb1aec393b132b69bab94ec88ea1fdc4ace081313 (patch)
tree2230cf62fbf88aeb225bbe6327f0a7076f03ecf8
parentfbc50196ad60fa548e79f8d1e5d87c3fa93c7848 (diff)
mimxrt/Makefile: Modify handling of SDRAM option.
Replaces preprocessor macro for SDRAM option from #ifdef to #if in order to allow always setting the define `MICROPY_HW_SDRAM_AVAIL` just with the appropriate value 0/1. This eliminates one `if` in the Makefile.
-rw-r--r--ports/mimxrt/Makefile12
-rw-r--r--ports/mimxrt/board_init.c2
-rw-r--r--ports/mimxrt/boards/MIMXRT1021.ld4
-rw-r--r--ports/mimxrt/boards/MIMXRT1052.ld4
-rw-r--r--ports/mimxrt/boards/MIMXRT1062.ld4
-rw-r--r--ports/mimxrt/boards/MIMXRT1064.ld4
-rw-r--r--ports/mimxrt/boards/common.ld4
7 files changed, 17 insertions, 17 deletions
diff --git a/ports/mimxrt/Makefile b/ports/mimxrt/Makefile
index 7f93a6826..ed7cc0630 100644
--- a/ports/mimxrt/Makefile
+++ b/ports/mimxrt/Makefile
@@ -373,6 +373,10 @@ else
CFLAGS += -Os -DNDEBUG
endif
+# Set default values for optional variables
+MICROPY_HW_SDRAM_AVAIL ?= 0
+MICROPY_HW_SDRAM_SIZE ?= 0
+
# Configure default compiler flags
CFLAGS += \
$(INC) \
@@ -389,6 +393,8 @@ CFLAGS += \
-DFSL_SDK_ENABLE_DRIVER_CACHE_CONTROL=1 \
-DI2C_RETRY_TIMES=1000000 \
-DMICROPY_HW_FLASH_SIZE=$(MICROPY_HW_FLASH_SIZE) \
+ -DMICROPY_HW_SDRAM_AVAIL=$(MICROPY_HW_SDRAM_AVAIL) \
+ -DMICROPY_HW_SDRAM_SIZE=$(MICROPY_HW_SDRAM_SIZE) \
-DSPI_RETRY_TIMES=1000000 \
-DUART_RETRY_TIMES=1000000 \
-DXIP_BOOT_HEADER_ENABLE=1 \
@@ -458,12 +464,6 @@ CFLAGS += \
-DMBEDTLS_CONFIG_FILE='"mbedtls/mbedtls_config.h"'
endif
-ifdef MICROPY_HW_SDRAM_AVAIL
-CFLAGS += \
- -DMICROPY_HW_SDRAM_AVAIL=$(MICROPY_HW_SDRAM_AVAIL) \
- -DMICROPY_HW_SDRAM_SIZE=$(MICROPY_HW_SDRAM_SIZE)
-endif
-
CFLAGS += $(CFLAGS_MOD) $(CFLAGS_EXTRA)
# =============================================================================
diff --git a/ports/mimxrt/board_init.c b/ports/mimxrt/board_init.c
index c3dbb652b..12496890a 100644
--- a/ports/mimxrt/board_init.c
+++ b/ports/mimxrt/board_init.c
@@ -52,7 +52,7 @@ void board_init(void) {
CLOCK_EnableClock(kCLOCK_Iomuxc);
// ------------- SDRAM ------------ //
- #ifdef MICROPY_HW_SDRAM_AVAIL
+ #if MICROPY_HW_SDRAM_AVAIL
mimxrt_sdram_init();
#endif
diff --git a/ports/mimxrt/boards/MIMXRT1021.ld b/ports/mimxrt/boards/MIMXRT1021.ld
index 1263cd336..60557f1bb 100644
--- a/ports/mimxrt/boards/MIMXRT1021.ld
+++ b/ports/mimxrt/boards/MIMXRT1021.ld
@@ -27,7 +27,7 @@ dtcm_size = 0x00018000;
ocrm_start = 0x20200000;
ocrm_size = 0x00018000;
-#ifdef MICROPY_HW_SDRAM_AVAIL
+#if MICROPY_HW_SDRAM_AVAIL
sdram_start = 0x80000000;
sdram_size = MICROPY_HW_SDRAM_SIZE;
#endif
@@ -37,7 +37,7 @@ __stack_size__ = 0x6000;
_estack = __StackTop;
_sstack = __StackLimit;
-#ifdef MICROPY_HW_SDRAM_AVAIL
+#if MICROPY_HW_SDRAM_AVAIL
_gc_heap_start = ORIGIN(m_sdram);
_gc_heap_end = ORIGIN(m_sdram) + LENGTH(m_sdram);
#else
diff --git a/ports/mimxrt/boards/MIMXRT1052.ld b/ports/mimxrt/boards/MIMXRT1052.ld
index f7c60d24f..3e5739acf 100644
--- a/ports/mimxrt/boards/MIMXRT1052.ld
+++ b/ports/mimxrt/boards/MIMXRT1052.ld
@@ -29,7 +29,7 @@ dtcm_size = 0x00020000;
ocrm_start = 0x20200000;
ocrm_size = 0x00040000;
-#ifdef MICROPY_HW_SDRAM_AVAIL
+#if MICROPY_HW_SDRAM_AVAIL
sdram_start = 0x80000000;
sdram_size = MICROPY_HW_SDRAM_SIZE;
#endif
@@ -39,7 +39,7 @@ __stack_size__ = 0x6000;
_estack = __StackTop;
_sstack = __StackLimit;
-#ifdef MICROPY_HW_SDRAM_AVAIL
+#if MICROPY_HW_SDRAM_AVAIL
_gc_heap_start = ORIGIN(m_sdram);
_gc_heap_end = ORIGIN(m_sdram) + LENGTH(m_sdram);
#else
diff --git a/ports/mimxrt/boards/MIMXRT1062.ld b/ports/mimxrt/boards/MIMXRT1062.ld
index f588e5bd9..fc4eb20c0 100644
--- a/ports/mimxrt/boards/MIMXRT1062.ld
+++ b/ports/mimxrt/boards/MIMXRT1062.ld
@@ -29,7 +29,7 @@ dtcm_size = 0x00020000;
ocrm_start = 0x20200000;
ocrm_size = 0x000C0000;
-#ifdef MICROPY_HW_SDRAM_AVAIL
+#if MICROPY_HW_SDRAM_AVAIL
sdram_start = 0x80000000;
sdram_size = MICROPY_HW_SDRAM_SIZE;
#endif
@@ -39,7 +39,7 @@ __stack_size__ = 0x8000;
_estack = __StackTop;
_sstack = __StackLimit;
-#ifdef MICROPY_HW_SDRAM_AVAIL
+#if MICROPY_HW_SDRAM_AVAIL
_gc_heap_start = ORIGIN(m_sdram);
_gc_heap_end = ORIGIN(m_sdram) + LENGTH(m_sdram);
#else
diff --git a/ports/mimxrt/boards/MIMXRT1064.ld b/ports/mimxrt/boards/MIMXRT1064.ld
index b36c52845..148f1f23e 100644
--- a/ports/mimxrt/boards/MIMXRT1064.ld
+++ b/ports/mimxrt/boards/MIMXRT1064.ld
@@ -31,7 +31,7 @@ dtcm_size = 0x00020000;
ocrm_start = 0x20200000;
ocrm_size = 0x000C0000;
-#ifdef MICROPY_HW_SDRAM_AVAIL
+#if MICROPY_HW_SDRAM_AVAIL
sdram_start = 0x80000000;
sdram_size = MICROPY_HW_SDRAM_SIZE;
#endif
@@ -41,7 +41,7 @@ __stack_size__ = 0x6000;
_estack = __StackTop;
_sstack = __StackLimit;
-#ifdef MICROPY_HW_SDRAM_AVAIL
+#if MICROPY_HW_SDRAM_AVAIL
_gc_heap_start = ORIGIN(m_sdram);
_gc_heap_end = ORIGIN(m_sdram) + LENGTH(m_sdram);
#else
diff --git a/ports/mimxrt/boards/common.ld b/ports/mimxrt/boards/common.ld
index 7aee66e2e..fbc99da3d 100644
--- a/ports/mimxrt/boards/common.ld
+++ b/ports/mimxrt/boards/common.ld
@@ -46,7 +46,7 @@ MEMORY
m_dtcm (RW) : ORIGIN = dtcm_start, LENGTH = dtcm_size
m_ocrm (RW) : ORIGIN = ocrm_start, LENGTH = ocrm_size
- #ifdef MICROPY_HW_SDRAM_AVAIL
+ #if MICROPY_HW_SDRAM_AVAIL
m_sdram (RX) : ORIGIN = sdram_start, LENGTH = sdram_size
#endif
}
@@ -55,7 +55,7 @@ MEMORY
SECTIONS
{
__flash_start = flash_start;
- #ifdef MICROPY_HW_SDRAM_AVAIL
+ #if MICROPY_HW_SDRAM_AVAIL
__sdram_start = sdram_start;
#endif
__vfs_start = ORIGIN(m_vfs);