rp2: Use core-provided cmake fragments instead of custom ones.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2021-03-14 15:52:33 +11:00
parent eccd73a403
commit a9140ab09b
4 changed files with 119 additions and 335 deletions

View File

@ -6,8 +6,8 @@ if(NOT CMAKE_BUILD_TYPE)
endif() endif()
# Set main target and component locations # Set main target and component locations
set(MICROPYTHON_TARGET firmware) set(MICROPY_TARGET firmware)
get_filename_component(MPY_DIR "../.." ABSOLUTE) get_filename_component(MICROPY_DIR "../.." ABSOLUTE)
if (PICO_SDK_PATH_OVERRIDE) if (PICO_SDK_PATH_OVERRIDE)
set(PICO_SDK_PATH ${PICO_SDK_PATH_OVERRIDE}) set(PICO_SDK_PATH ${PICO_SDK_PATH_OVERRIDE})
else() else()
@ -15,42 +15,46 @@ else()
endif() endif()
# Use the local tinyusb instead of the one in pico-sdk # Use the local tinyusb instead of the one in pico-sdk
set(PICO_TINYUSB_PATH ${MPY_DIR}/lib/tinyusb) set(PICO_TINYUSB_PATH ${MICROPY_DIR}/lib/tinyusb)
# Include component cmake fragments # Include component cmake fragments
include(micropy_py.cmake) include(${MICROPY_DIR}/py/py.cmake)
include(micropy_extmod.cmake) include(${MICROPY_DIR}/extmod/extmod.cmake)
include(${PICO_SDK_PATH}/pico_sdk_init.cmake) include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
# Define the top-level project # Define the top-level project
project(${MICROPYTHON_TARGET}) project(${MICROPY_TARGET})
pico_sdk_init() pico_sdk_init()
add_executable(${MICROPYTHON_TARGET}) add_executable(${MICROPY_TARGET})
set(SOURCE_LIB set(MICROPY_QSTRDEFS_PORT
${MPY_DIR}/lib/littlefs/lfs1.c ${PROJECT_SOURCE_DIR}/qstrdefsport.h
${MPY_DIR}/lib/littlefs/lfs1_util.c
${MPY_DIR}/lib/littlefs/lfs2.c
${MPY_DIR}/lib/littlefs/lfs2_util.c
${MPY_DIR}/lib/mp-readline/readline.c
${MPY_DIR}/lib/oofatfs/ff.c
${MPY_DIR}/lib/oofatfs/ffunicode.c
${MPY_DIR}/lib/timeutils/timeutils.c
${MPY_DIR}/lib/utils/gchelper_m0.s
${MPY_DIR}/lib/utils/gchelper_native.c
${MPY_DIR}/lib/utils/mpirq.c
${MPY_DIR}/lib/utils/stdout_helpers.c
${MPY_DIR}/lib/utils/sys_stdio_mphal.c
${MPY_DIR}/lib/utils/pyexec.c
) )
set(SOURCE_DRIVERS set(MICROPY_SOURCE_LIB
${MPY_DIR}/drivers/bus/softspi.c ${MICROPY_DIR}/lib/littlefs/lfs1.c
${MICROPY_DIR}/lib/littlefs/lfs1_util.c
${MICROPY_DIR}/lib/littlefs/lfs2.c
${MICROPY_DIR}/lib/littlefs/lfs2_util.c
${MICROPY_DIR}/lib/mp-readline/readline.c
${MICROPY_DIR}/lib/oofatfs/ff.c
${MICROPY_DIR}/lib/oofatfs/ffunicode.c
${MICROPY_DIR}/lib/timeutils/timeutils.c
${MICROPY_DIR}/lib/utils/gchelper_m0.s
${MICROPY_DIR}/lib/utils/gchelper_native.c
${MICROPY_DIR}/lib/utils/mpirq.c
${MICROPY_DIR}/lib/utils/pyexec.c
${MICROPY_DIR}/lib/utils/stdout_helpers.c
${MICROPY_DIR}/lib/utils/sys_stdio_mphal.c
) )
set(SOURCE_PORT set(MICROPY_SOURCE_DRIVERS
${MICROPY_DIR}/drivers/bus/softspi.c
)
set(MICROPY_SOURCE_PORT
fatfs_port.c fatfs_port.c
machine_adc.c machine_adc.c
machine_i2c.c machine_i2c.c
@ -73,11 +77,11 @@ set(SOURCE_PORT
uart.c uart.c
) )
set(SOURCE_QSTR set(MICROPY_SOURCE_QSTR
${SOURCE_PY} ${MICROPY_SOURCE_PY}
${SOURCE_EXTMOD} ${MICROPY_SOURCE_EXTMOD}
${MPY_DIR}/lib/utils/mpirq.c ${MICROPY_DIR}/lib/utils/mpirq.c
${MPY_DIR}/lib/utils/sys_stdio_mphal.c ${MICROPY_DIR}/lib/utils/sys_stdio_mphal.c
${PROJECT_SOURCE_DIR}/machine_adc.c ${PROJECT_SOURCE_DIR}/machine_adc.c
${PROJECT_SOURCE_DIR}/machine_i2c.c ${PROJECT_SOURCE_DIR}/machine_i2c.c
${PROJECT_SOURCE_DIR}/machine_pin.c ${PROJECT_SOURCE_DIR}/machine_pin.c
@ -94,37 +98,65 @@ set(SOURCE_QSTR
${PROJECT_SOURCE_DIR}/rp2_pio.c ${PROJECT_SOURCE_DIR}/rp2_pio.c
) )
set(MPY_QSTR_DEFS ${PROJECT_SOURCE_DIR}/qstrdefsport.h) set(PICO_SDK_COMPONENTS
hardware_adc
hardware_base
hardware_clocks
hardware_dma
hardware_flash
hardware_gpio
hardware_i2c
hardware_irq
hardware_pio
hardware_pwm
hardware_regs
hardware_rtc
hardware_spi
hardware_structs
hardware_sync
hardware_timer
hardware_uart
hardware_watchdog
pico_base_headers
pico_binary_info
pico_bootrom
pico_multicore
pico_platform
pico_stdio
pico_stdlib
pico_sync
pico_time
pico_unique_id
tinyusb_device
)
# Define mpy-cross flags and frozen manifest # Define mpy-cross flags and frozen manifest
set(MPY_CROSS_FLAGS -march=armv7m) set(MICROPY_CROSS_FLAGS -march=armv7m)
set(FROZEN_MANIFEST ${PROJECT_SOURCE_DIR}/manifest.py) set(MICROPY_FROZEN_MANIFEST ${PROJECT_SOURCE_DIR}/manifest.py)
include(micropy_rules.cmake) target_sources(${MICROPY_TARGET} PRIVATE
${MICROPY_SOURCE_PY}
target_sources(${MICROPYTHON_TARGET} PRIVATE ${MICROPY_SOURCE_EXTMOD}
${SOURCE_PY} ${MICROPY_SOURCE_LIB}
${SOURCE_EXTMOD} ${MICROPY_SOURCE_DRIVERS}
${SOURCE_LIB} ${MICROPY_SOURCE_PORT}
${SOURCE_DRIVERS}
${SOURCE_PORT}
) )
target_include_directories(${MICROPYTHON_TARGET} PRIVATE target_include_directories(${MICROPY_TARGET} PRIVATE
"${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}"
"${MPY_DIR}" "${MICROPY_DIR}"
"${CMAKE_BINARY_DIR}" "${CMAKE_BINARY_DIR}"
) )
target_compile_options(${MICROPYTHON_TARGET} PRIVATE target_compile_options(${MICROPY_TARGET} PRIVATE
-Wall -Wall
#-Werror -Werror
-DFFCONF_H=\"${MPY_DIR}/lib/oofatfs/ffconf.h\"
-DLFS1_NO_MALLOC -DLFS1_NO_DEBUG -DLFS1_NO_WARN -DLFS1_NO_ERROR -DLFS1_NO_ASSERT
-DLFS2_NO_MALLOC -DLFS2_NO_DEBUG -DLFS2_NO_WARN -DLFS2_NO_ERROR -DLFS2_NO_ASSERT
) )
target_compile_definitions(${MICROPYTHON_TARGET} PRIVATE target_compile_definitions(${MICROPY_TARGET} PRIVATE
FFCONF_H=\"${MICROPY_OOFATFS_DIR}/ffconf.h\"
LFS1_NO_MALLOC LFS1_NO_DEBUG LFS1_NO_WARN LFS1_NO_ERROR LFS1_NO_ASSERT
LFS2_NO_MALLOC LFS2_NO_DEBUG LFS2_NO_WARN LFS2_NO_ERROR LFS2_NO_ASSERT
PICO_FLOAT_PROPAGATE_NANS=1 PICO_FLOAT_PROPAGATE_NANS=1
PICO_STACK_SIZE=0x2000 PICO_STACK_SIZE=0x2000
PICO_CORE1_STACK_SIZE=0 PICO_CORE1_STACK_SIZE=0
@ -134,34 +166,50 @@ target_compile_definitions(${MICROPYTHON_TARGET} PRIVATE
PICO_NO_BI_STDIO_UART=1 # we call it UART REPL PICO_NO_BI_STDIO_UART=1 # we call it UART REPL
) )
target_link_libraries(${MICROPYTHON_TARGET} target_link_libraries(${MICROPY_TARGET}
hardware_adc ${PICO_SDK_COMPONENTS}
hardware_dma
hardware_flash
hardware_i2c
hardware_pio
hardware_pwm
hardware_rtc
hardware_spi
hardware_sync
pico_multicore
pico_stdlib_headers
pico_stdlib
pico_unique_id
tinyusb_device
) )
# todo this is a bit brittle, but we want to move a few source files into RAM (which requires # todo this is a bit brittle, but we want to move a few source files into RAM (which requires
# a linker script modification) until we explicitly add macro calls around the function # a linker script modification) until we explicitly add macro calls around the function
# defs to move them into RAM. # defs to move them into RAM.
if (PICO_ON_DEVICE AND NOT PICO_NO_FLASH AND NOT PICO_COPY_TO_RAM) if (PICO_ON_DEVICE AND NOT PICO_NO_FLASH AND NOT PICO_COPY_TO_RAM)
pico_set_linker_script(${MICROPYTHON_TARGET} ${CMAKE_CURRENT_LIST_DIR}/memmap_mp.ld) pico_set_linker_script(${MICROPY_TARGET} ${CMAKE_CURRENT_LIST_DIR}/memmap_mp.ld)
endif() endif()
pico_add_extra_outputs(${MICROPYTHON_TARGET}) pico_add_extra_outputs(${MICROPY_TARGET})
add_custom_command(TARGET ${MICROPYTHON_TARGET} add_custom_command(TARGET ${MICROPY_TARGET}
POST_BUILD POST_BUILD
COMMAND arm-none-eabi-size --format=berkeley ${PROJECT_BINARY_DIR}/${MICROPYTHON_TARGET}.elf COMMAND arm-none-eabi-size --format=berkeley ${PROJECT_BINARY_DIR}/${MICROPY_TARGET}.elf
VERBATIM VERBATIM
) )
# Collect all the include directories and compile definitions for the pico-sdk components.
macro(_process_target targ)
if(TARGET ${targ})
get_target_property(type ${targ} TYPE)
set(_inc OFF)
set(_def OFF)
if(${type} STREQUAL STATIC_LIBRARY)
get_target_property(_inc ${targ} INCLUDE_DIRECTORIES)
get_target_property(_def ${targ} COMPILE_DEFINITIONS)
elseif(${type} STREQUAL INTERFACE_LIBRARY)
get_target_property(_inc ${targ} INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(_def ${targ} INTERFACE_COMPILE_DEFINITIONS)
endif()
if(_inc)
list(APPEND MICROPY_CPP_INC_EXTRA ${_inc})
endif()
if(_def)
list(APPEND MICROPY_CPP_DEF_EXTRA ${_def})
endif()
endif()
endmacro()
foreach(comp ${PICO_SDK_COMPONENTS})
_process_target(${comp})
_process_target(${comp}_headers)
endforeach()
# Include the main MicroPython cmake rules.
include(${MICROPY_DIR}/py/mkrules.cmake)

View File

@ -1,40 +0,0 @@
# CMake fragment for MicroPython extmod component
set(SOURCE_EXTMOD
${MPY_DIR}/extmod/machine_i2c.c
${MPY_DIR}/extmod/machine_mem.c
${MPY_DIR}/extmod/machine_pulse.c
${MPY_DIR}/extmod/machine_signal.c
${MPY_DIR}/extmod/machine_spi.c
${MPY_DIR}/extmod/modbtree.c
${MPY_DIR}/extmod/modframebuf.c
${MPY_DIR}/extmod/modonewire.c
${MPY_DIR}/extmod/moduasyncio.c
${MPY_DIR}/extmod/modubinascii.c
${MPY_DIR}/extmod/moducryptolib.c
${MPY_DIR}/extmod/moductypes.c
${MPY_DIR}/extmod/moduhashlib.c
${MPY_DIR}/extmod/moduheapq.c
${MPY_DIR}/extmod/modujson.c
${MPY_DIR}/extmod/modurandom.c
${MPY_DIR}/extmod/modure.c
${MPY_DIR}/extmod/moduselect.c
${MPY_DIR}/extmod/modussl_axtls.c
${MPY_DIR}/extmod/modussl_mbedtls.c
${MPY_DIR}/extmod/modutimeq.c
${MPY_DIR}/extmod/moduwebsocket.c
${MPY_DIR}/extmod/moduzlib.c
${MPY_DIR}/extmod/modwebrepl.c
${MPY_DIR}/extmod/uos_dupterm.c
${MPY_DIR}/extmod/utime_mphal.c
${MPY_DIR}/extmod/vfs.c
${MPY_DIR}/extmod/vfs_blockdev.c
${MPY_DIR}/extmod/vfs_fat.c
${MPY_DIR}/extmod/vfs_fat_diskio.c
${MPY_DIR}/extmod/vfs_fat_file.c
${MPY_DIR}/extmod/vfs_lfs.c
${MPY_DIR}/extmod/vfs_posix.c
${MPY_DIR}/extmod/vfs_posix_file.c
${MPY_DIR}/extmod/vfs_reader.c
${MPY_DIR}/extmod/virtpin.c
)

View File

@ -1,134 +0,0 @@
# CMake fragment for MicroPython core py component
set(MPY_PY_DIR "${MPY_DIR}/py")
set(MPY_PY_QSTRDEFS "${MPY_PY_DIR}/qstrdefs.h")
set(MPY_GENHDR_DIR "${CMAKE_BINARY_DIR}/genhdr")
set(MPY_MPVERSION "${MPY_GENHDR_DIR}/mpversion.h")
set(MPY_MODULEDEFS "${MPY_GENHDR_DIR}/moduledefs.h")
set(MPY_QSTR_DEFS_LAST "${MPY_GENHDR_DIR}/qstr.i.last")
set(MPY_QSTR_DEFS_SPLIT "${MPY_GENHDR_DIR}/qstr.split")
set(MPY_QSTR_DEFS_COLLECTED "${MPY_GENHDR_DIR}/qstrdefs.collected.h")
set(MPY_QSTR_DEFS_PREPROCESSED "${MPY_GENHDR_DIR}/qstrdefs.preprocessed.h")
set(MPY_QSTR_DEFS_GENERATED "${MPY_GENHDR_DIR}/qstrdefs.generated.h")
set(MPY_FROZEN_CONTENT "${CMAKE_BINARY_DIR}/frozen_content.c")
# All py/ source files
set(SOURCE_PY
${MPY_PY_DIR}/argcheck.c
${MPY_PY_DIR}/asmarm.c
${MPY_PY_DIR}/asmbase.c
${MPY_PY_DIR}/asmthumb.c
${MPY_PY_DIR}/asmx64.c
${MPY_PY_DIR}/asmx86.c
${MPY_PY_DIR}/asmxtensa.c
${MPY_PY_DIR}/bc.c
${MPY_PY_DIR}/binary.c
${MPY_PY_DIR}/builtinevex.c
${MPY_PY_DIR}/builtinhelp.c
${MPY_PY_DIR}/builtinimport.c
${MPY_PY_DIR}/compile.c
${MPY_PY_DIR}/emitbc.c
${MPY_PY_DIR}/emitcommon.c
${MPY_PY_DIR}/emitglue.c
${MPY_PY_DIR}/emitinlinethumb.c
${MPY_PY_DIR}/emitinlinextensa.c
${MPY_PY_DIR}/emitnarm.c
${MPY_PY_DIR}/emitnthumb.c
${MPY_PY_DIR}/emitnx64.c
${MPY_PY_DIR}/emitnx86.c
${MPY_PY_DIR}/emitnxtensa.c
${MPY_PY_DIR}/emitnxtensawin.c
${MPY_PY_DIR}/formatfloat.c
${MPY_PY_DIR}/frozenmod.c
${MPY_PY_DIR}/gc.c
${MPY_PY_DIR}/lexer.c
${MPY_PY_DIR}/malloc.c
${MPY_PY_DIR}/map.c
${MPY_PY_DIR}/modarray.c
${MPY_PY_DIR}/modbuiltins.c
${MPY_PY_DIR}/modcmath.c
${MPY_PY_DIR}/modcollections.c
${MPY_PY_DIR}/modgc.c
${MPY_PY_DIR}/modio.c
${MPY_PY_DIR}/modmath.c
${MPY_PY_DIR}/modmicropython.c
${MPY_PY_DIR}/modstruct.c
${MPY_PY_DIR}/modsys.c
${MPY_PY_DIR}/modthread.c
${MPY_PY_DIR}/moduerrno.c
${MPY_PY_DIR}/mpprint.c
${MPY_PY_DIR}/mpstate.c
${MPY_PY_DIR}/mpz.c
${MPY_PY_DIR}/nativeglue.c
${MPY_PY_DIR}/nlr.c
${MPY_PY_DIR}/nlrpowerpc.c
${MPY_PY_DIR}/nlrsetjmp.c
${MPY_PY_DIR}/nlrthumb.c
${MPY_PY_DIR}/nlrx64.c
${MPY_PY_DIR}/nlrx86.c
${MPY_PY_DIR}/nlrxtensa.c
${MPY_PY_DIR}/obj.c
${MPY_PY_DIR}/objarray.c
${MPY_PY_DIR}/objattrtuple.c
${MPY_PY_DIR}/objbool.c
${MPY_PY_DIR}/objboundmeth.c
${MPY_PY_DIR}/objcell.c
${MPY_PY_DIR}/objclosure.c
${MPY_PY_DIR}/objcomplex.c
${MPY_PY_DIR}/objdeque.c
${MPY_PY_DIR}/objdict.c
${MPY_PY_DIR}/objenumerate.c
${MPY_PY_DIR}/objexcept.c
${MPY_PY_DIR}/objfilter.c
${MPY_PY_DIR}/objfloat.c
${MPY_PY_DIR}/objfun.c
${MPY_PY_DIR}/objgenerator.c
${MPY_PY_DIR}/objgetitemiter.c
${MPY_PY_DIR}/objint.c
${MPY_PY_DIR}/objint_longlong.c
${MPY_PY_DIR}/objint_mpz.c
${MPY_PY_DIR}/objlist.c
${MPY_PY_DIR}/objmap.c
${MPY_PY_DIR}/objmodule.c
${MPY_PY_DIR}/objnamedtuple.c
${MPY_PY_DIR}/objnone.c
${MPY_PY_DIR}/objobject.c
${MPY_PY_DIR}/objpolyiter.c
${MPY_PY_DIR}/objproperty.c
${MPY_PY_DIR}/objrange.c
${MPY_PY_DIR}/objreversed.c
${MPY_PY_DIR}/objset.c
${MPY_PY_DIR}/objsingleton.c
${MPY_PY_DIR}/objslice.c
${MPY_PY_DIR}/objstr.c
${MPY_PY_DIR}/objstringio.c
${MPY_PY_DIR}/objstrunicode.c
${MPY_PY_DIR}/objtuple.c
${MPY_PY_DIR}/objtype.c
${MPY_PY_DIR}/objzip.c
${MPY_PY_DIR}/opmethods.c
${MPY_PY_DIR}/pairheap.c
${MPY_PY_DIR}/parse.c
${MPY_PY_DIR}/parsenum.c
${MPY_PY_DIR}/parsenumbase.c
${MPY_PY_DIR}/persistentcode.c
${MPY_PY_DIR}/profile.c
${MPY_PY_DIR}/pystack.c
${MPY_PY_DIR}/qstr.c
${MPY_PY_DIR}/reader.c
${MPY_PY_DIR}/repl.c
${MPY_PY_DIR}/ringbuf.c
${MPY_PY_DIR}/runtime.c
${MPY_PY_DIR}/runtime_utils.c
${MPY_PY_DIR}/scheduler.c
${MPY_PY_DIR}/scope.c
${MPY_PY_DIR}/sequence.c
${MPY_PY_DIR}/showbc.c
${MPY_PY_DIR}/smallint.c
${MPY_PY_DIR}/stackctrl.c
${MPY_PY_DIR}/stream.c
${MPY_PY_DIR}/unicode.c
${MPY_PY_DIR}/vm.c
${MPY_PY_DIR}/vstr.c
${MPY_PY_DIR}/warning.c
)

View File

@ -1,90 +0,0 @@
# CMake fragment for MicroPython rules
target_sources(${MICROPYTHON_TARGET} PRIVATE
${MPY_MPVERSION}
${MPY_QSTR_DEFS_GENERATED}
${MPY_FROZEN_CONTENT}
)
# Command to force the build of another command
add_custom_command(
OUTPUT FORCE_BUILD
COMMENT ""
COMMAND echo -n
)
# Generate mpversion.h
add_custom_command(
OUTPUT ${MPY_MPVERSION}
COMMAND ${CMAKE_COMMAND} -E make_directory ${MPY_GENHDR_DIR}
COMMAND python3 ${MPY_DIR}/py/makeversionhdr.py ${MPY_MPVERSION}
DEPENDS FORCE_BUILD
)
# Generate moduledefs.h
add_custom_command(
OUTPUT ${MPY_MODULEDEFS}
COMMAND python3 ${MPY_PY_DIR}/makemoduledefs.py --vpath="/" ${SOURCE_QSTR} > ${MPY_MODULEDEFS}
DEPENDS ${MPY_MPVERSION}
${SOURCE_QSTR}
)
# Generate qstrs
# If any of the dependencies in this rule change then the C-preprocessor step must be run.
# It only needs to be passed the list of SOURCE_QSTR files that have changed since it was
# last run, but it looks like it's not possible to specify that with cmake.
add_custom_command(
OUTPUT ${MPY_QSTR_DEFS_LAST}
COMMAND ${CMAKE_C_COMPILER} -E \$\(C_INCLUDES\) \$\(C_FLAGS\) -DNO_QSTR ${SOURCE_QSTR} > ${MPY_GENHDR_DIR}/qstr.i.last
DEPENDS ${MPY_MODULEDEFS}
${SOURCE_QSTR}
VERBATIM
)
add_custom_command(
OUTPUT ${MPY_QSTR_DEFS_SPLIT}
COMMAND python3 ${MPY_DIR}/py/makeqstrdefs.py split qstr ${MPY_GENHDR_DIR}/qstr.i.last ${MPY_GENHDR_DIR}/qstr _
COMMAND touch ${MPY_QSTR_DEFS_SPLIT}
DEPENDS ${MPY_QSTR_DEFS_LAST}
VERBATIM
)
add_custom_command(
OUTPUT ${MPY_QSTR_DEFS_COLLECTED}
COMMAND python3 ${MPY_DIR}/py/makeqstrdefs.py cat qstr _ ${MPY_GENHDR_DIR}/qstr ${MPY_QSTR_DEFS_COLLECTED}
DEPENDS ${MPY_QSTR_DEFS_SPLIT}
VERBATIM
)
add_custom_command(
OUTPUT ${MPY_QSTR_DEFS_PREPROCESSED}
COMMAND cat ${MPY_PY_QSTRDEFS} ${MPY_QSTR_DEFS} ${MPY_QSTR_DEFS_COLLECTED} | sed "s/^Q(.*)/\"&\"/" | ${CMAKE_C_COMPILER} -E \$\(C_INCLUDES\) \$\(C_FLAGS\) - | sed "s/^\\\"\\(Q(.*)\\)\\\"/\\1/" > ${MPY_QSTR_DEFS_PREPROCESSED}
DEPENDS ${MPY_PY_QSTRDEFS} ${MPY_QSTR_DEFS} ${MPY_QSTR_DEFS_COLLECTED}
VERBATIM
)
add_custom_command(
OUTPUT ${MPY_QSTR_DEFS_GENERATED}
COMMAND python3 ${MPY_PY_DIR}/makeqstrdata.py ${MPY_QSTR_DEFS_PREPROCESSED} > ${MPY_QSTR_DEFS_GENERATED}
DEPENDS ${MPY_QSTR_DEFS_PREPROCESSED}
VERBATIM
)
# Build frozen code
target_compile_options(${MICROPYTHON_TARGET} PUBLIC
-DMICROPY_QSTR_EXTRA_POOL=mp_qstr_frozen_const_pool
-DMICROPY_MODULE_FROZEN_MPY=\(1\)
)
add_custom_command(
OUTPUT ${MPY_FROZEN_CONTENT}
COMMAND python3 ${MPY_DIR}/tools/makemanifest.py -o ${MPY_FROZEN_CONTENT} -v "MPY_DIR=${MPY_DIR}" -v "PORT_DIR=${PROJECT_SOURCE_DIR}" -b "${CMAKE_BINARY_DIR}" -f${MPY_CROSS_FLAGS} ${FROZEN_MANIFEST}
DEPENDS FORCE_BUILD
${MPY_QSTR_DEFS_GENERATED}
VERBATIM
)