Skip to content

Commit 6e22ece

Browse files
committed
Incomplete attempt to enable frozen modules. Fails to build.
1 parent 594670e commit 6e22ece

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

ports/zephyr/CMakeLists.txt

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ set(MICROPY_PORT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
3131
set(MICROPY_DIR ${MICROPY_PORT_DIR}/../..)
3232
set(MICROPY_TARGET micropython)
3333

34+
message(MICROPY_PORT_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
35+
message(MICROPY_DIR="${MICROPY_DIR}")
36+
message(ZEPHYR_BASE="$ENV{ZEPHYR_BASE}")
37+
message(CMAKE_CURRENT_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}")
38+
3439
include(${MICROPY_DIR}/py/py.cmake)
3540
include(${MICROPY_DIR}/extmod/extmod.cmake)
3641

@@ -87,16 +92,23 @@ zephyr_get_system_include_directories_for_lang(C system_includes)
8792
zephyr_get_compile_definitions_for_lang(C definitions)
8893
zephyr_get_compile_options_for_lang(C options)
8994

90-
set(MICROPY_CPP_FLAGS_EXTRA ${includes} ${system_includes} ${definitions} ${options})
91-
9295
zephyr_library_named(${MICROPY_TARGET})
9396

9497
zephyr_library_include_directories(
9598
${MICROPY_INC_CORE}
9699
${MICROPY_PORT_DIR}
97100
${CMAKE_CURRENT_BINARY_DIR}
101+
${CMAKE_CURRENT_BINARY_DIR}/zephyr/include/generated
102+
../../generated
98103
)
99104

105+
zephyr_include_directories(
106+
${CMAKE_CURRENT_BINARY_DIR}/zephyr/include/generated
107+
../../generated
108+
)
109+
110+
set(MICROPY_CPP_FLAGS_EXTRA ${includes} ${system_includes} ${definitions} ${options} ${zephyr_include_directories})
111+
100112
zephyr_library_compile_options(
101113
-std=gnu99 -fomit-frame-pointer
102114
)
@@ -114,10 +126,26 @@ zephyr_library_compile_definitions(
114126
zephyr_library_sources(${MICROPY_SOURCE_QSTR})
115127
zephyr_library_link_libraries(kernel)
116128

117-
add_dependencies(${MICROPY_TARGET} zephyr_generated_headers)
129+
add_dependencies(${MICROPY_TARGET}
130+
zephyr_interface
131+
zephyr_generated_headers
132+
)
133+
134+
# Save the manifest file set from the cmake command line.
135+
set(MICROPY_USER_FROZEN_MANIFEST ${MICROPY_FROZEN_MANIFEST})
136+
137+
# Set the frozen manifest file. Note if MICROPY_FROZEN_MANIFEST is set from the cmake
138+
# command line, then it will override the default and any manifest set by the board.
139+
if (MICROPY_USER_FROZEN_MANIFEST)
140+
set(MICROPY_FROZEN_MANIFEST ${MICROPY_USER_FROZEN_MANIFEST})
141+
elseif (NOT MICROPY_FROZEN_MANIFEST)
142+
set(MICROPY_FROZEN_MANIFEST ${CMAKE_CURRENT_LIST_DIR}/boards/manifest.py)
143+
endif()
118144

119145
include(${MICROPY_DIR}/py/mkrules.cmake)
120146

147+
add_dependencies(${BUILD_FROZEN_CONTENT} zephyr_generated_headers)
148+
121149
target_sources(app PRIVATE
122150
src/zephyr_start.c
123151
src/zephyr_getchar.c

ports/zephyr/boards/manifest.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include("$(MPY_DIR)/extmod/asyncio")
2+
3+
# Require some micropython-lib modules.
4+
require("neopixel")
5+
require("onewire")

0 commit comments

Comments
 (0)