From e3be70b5e8a4b6f80426f967c467f9f765f92c26 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Tue, 13 Feb 2024 14:53:58 +0900 Subject: [PATCH] minimal: Allow compiling on macOS. Signed-off-by: YAMAMOTO Takashi --- ports/minimal/Makefile | 5 +++++ ports/minimal/mpconfigport.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) 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