Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom compiled in code.py contents #10073

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions py/circuitpy_mpconfig.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion supervisor/shared/filesystem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Loading