diff --git a/py/circuitpy_mpconfig.mk b/py/circuitpy_mpconfig.mk index 3a240ba1e1db7..fbb5bd8f284fe 100644 --- a/py/circuitpy_mpconfig.mk +++ b/py/circuitpy_mpconfig.mk @@ -67,6 +67,11 @@ CIRCUITPY_MESSAGE_COMPRESSION_LEVEL ?= 9 CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE ?= 0 CFLAGS += -DCIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE=$(CIRCUITPY_OPTIMIZE_PROPERTY_FLASH_SIZE) +# The contents of compiled-in code.py file. +# Ports can override to import frozen modules to compile-in running code +CIRCUITPY_CODEPY_CONTENTS ?= "print(\"Hello World!\")\n" +CFLAGS += -DCIRCUITPY_CODEPY_CONTENTS='$(CIRCUITPY_CODEPY_CONTENTS)' + # async/await language keyword support MICROPY_PY_ASYNC_AWAIT ?= $(CIRCUITPY_FULL_BUILD) CFLAGS += -DMICROPY_PY_ASYNC_AWAIT=$(MICROPY_PY_ASYNC_AWAIT) diff --git a/supervisor/shared/filesystem.c b/supervisor/shared/filesystem.c index e5edb148e4145..d4c26f9adc5f3 100644 --- a/supervisor/shared/filesystem.c +++ b/supervisor/shared/filesystem.c @@ -134,7 +134,7 @@ bool filesystem_init(bool create_allowed, bool force_create) { make_empty_file(&vfs_fat->fatfs, "/settings.toml"); #endif // make a sample code.py file - MAKE_FILE_WITH_OPTIONAL_CONTENTS(&vfs_fat->fatfs, "/code.py", "print(\"Hello World!\")\n"); + MAKE_FILE_WITH_OPTIONAL_CONTENTS(&vfs_fat->fatfs, "/code.py", CIRCUITPY_CODEPY_CONTENTS); // create empty lib directory res = f_mkdir(&vfs_fat->fatfs, "/lib");