summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYAMAMOTO Takashi <yamamoto@midokura.com>2024-02-13 14:53:58 +0900
committerDamien George <damien@micropython.org>2024-02-15 16:35:10 +1100
commite3be70b5e8a4b6f80426f967c467f9f765f92c26 (patch)
tree444328e73af310297110a51d2b6b7c8e2352ccda
parentc27d304bed737ef0315ca695323f7adc42e61ba9 (diff)
minimal: Allow compiling on macOS.
Signed-off-by: YAMAMOTO Takashi <yamamoto@midokura.com>
-rw-r--r--ports/minimal/Makefile5
-rw-r--r--ports/minimal/mpconfigport.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/ports/minimal/Makefile b/ports/minimal/Makefile
index 050c4ddf5..824e54205 100644
--- a/ports/minimal/Makefile
+++ b/ports/minimal/Makefile
@@ -26,9 +26,14 @@ CFLAGS_CORTEX_M4 = -mthumb -mtune=cortex-m4 -mcpu=cortex-m4 -msoft-float -fsingl
CFLAGS += $(INC) -Wall -Werror -std=c99 -nostdlib $(CFLAGS_CORTEX_M4) $(COPT)
LDFLAGS += -nostdlib -T stm32f405.ld -Map=$@.map --cref --gc-sections
else
+UNAME_S := $(shell uname -s)
LD = $(CC)
CFLAGS += $(INC) -Wall -Werror -Wdouble-promotion -Wfloat-conversion -std=c99 $(COPT)
+ifeq ($(UNAME_S),Linux)
LDFLAGS += -Wl,-Map=$@.map,--cref -Wl,--gc-sections
+else ifeq ($(UNAME_S),Darwin)
+LDFLAGS += -Wl,-map,$@.map -Wl,-dead_strip
+endif
endif
CSUPEROPT = -Os # save some code space
diff --git a/ports/minimal/mpconfigport.h b/ports/minimal/mpconfigport.h
index 56bef165f..87287cbc6 100644
--- a/ports/minimal/mpconfigport.h
+++ b/ports/minimal/mpconfigport.h
@@ -33,7 +33,7 @@ typedef long mp_off_t;
#define MICROPY_HW_BOARD_NAME "minimal"
#define MICROPY_HW_MCU_NAME "unknown-cpu"
-#ifdef __linux__
+#if defined(__linux__) || defined(__APPLE__)
#define MICROPY_MIN_USE_STDOUT (1)
#define MICROPY_HEAP_SIZE (25600) // heap size 25 kilobytes
#endif