zephyr: Create options to enable frozen modules.
Enables the ability to use frozen modules in the zephyr port. Enabled by adding `CONFIG_MICROPY_FROZEN_MODULES` to the board configuration file. Manually set manifest path with `CONFIG_MICROPY_FROZEN_MANIFEST`. Signed-off-by: Vdragon <mail@massdriver.space>
This commit is contained in:
@@ -34,6 +34,11 @@ set(MICROPY_TARGET micropython)
|
|||||||
include(${MICROPY_DIR}/py/py.cmake)
|
include(${MICROPY_DIR}/py/py.cmake)
|
||||||
include(${MICROPY_DIR}/extmod/extmod.cmake)
|
include(${MICROPY_DIR}/extmod/extmod.cmake)
|
||||||
|
|
||||||
|
if (CONFIG_MICROPY_FROZEN_MODULES)
|
||||||
|
cmake_path(ABSOLUTE_PATH CONFIG_MICROPY_FROZEN_MANIFEST BASE_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
|
||||||
|
set(MICROPY_FROZEN_MANIFEST ${CONFIG_MICROPY_FROZEN_MANIFEST})
|
||||||
|
endif()
|
||||||
|
|
||||||
set(MICROPY_SOURCE_PORT
|
set(MICROPY_SOURCE_PORT
|
||||||
main.c
|
main.c
|
||||||
help.c
|
help.c
|
||||||
@@ -115,10 +120,11 @@ zephyr_library_compile_definitions(
|
|||||||
zephyr_library_sources(${MICROPY_SOURCE_QSTR})
|
zephyr_library_sources(${MICROPY_SOURCE_QSTR})
|
||||||
zephyr_library_link_libraries(kernel)
|
zephyr_library_link_libraries(kernel)
|
||||||
|
|
||||||
add_dependencies(${MICROPY_TARGET} zephyr_generated_headers)
|
|
||||||
|
|
||||||
include(${MICROPY_DIR}/py/mkrules.cmake)
|
include(${MICROPY_DIR}/py/mkrules.cmake)
|
||||||
|
|
||||||
|
add_dependencies(BUILD_VERSION_HEADER zephyr_generated_headers)
|
||||||
|
add_dependencies(${MICROPY_TARGET} zephyr_generated_headers)
|
||||||
|
|
||||||
target_sources(app PRIVATE
|
target_sources(app PRIVATE
|
||||||
src/zephyr_start.c
|
src/zephyr_start.c
|
||||||
src/zephyr_getchar.c
|
src/zephyr_getchar.c
|
||||||
|
|||||||
@@ -41,6 +41,14 @@ config MICROPY_VFS_LFS1
|
|||||||
config MICROPY_VFS_LFS2
|
config MICROPY_VFS_LFS2
|
||||||
bool "LittleFs version 2 file system"
|
bool "LittleFs version 2 file system"
|
||||||
|
|
||||||
|
config MICROPY_FROZEN_MODULES
|
||||||
|
bool "Enable Frozen Modules"
|
||||||
|
|
||||||
|
config MICROPY_FROZEN_MANIFEST
|
||||||
|
string "Path to Frozen Modules manifest.py"
|
||||||
|
depends on MICROPY_FROZEN_MODULES
|
||||||
|
default "boards/manifest.py"
|
||||||
|
|
||||||
endmenu # MicroPython Options
|
endmenu # MicroPython Options
|
||||||
|
|
||||||
source "Kconfig.zephyr"
|
source "Kconfig.zephyr"
|
||||||
|
|||||||
7
ports/zephyr/boards/manifest.py
Normal file
7
ports/zephyr/boards/manifest.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
# This is an example frozen module manifest. Enable this by configuring
|
||||||
|
# the Zephyr project and enabling the frozen modules config feature.
|
||||||
|
|
||||||
|
freeze("$(PORT_DIR)/modules")
|
||||||
|
|
||||||
|
# Require a micropython-lib module.
|
||||||
|
require("upysh")
|
||||||
Reference in New Issue
Block a user