Skip to content

RPi Pico port compilation #174

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

Merged
merged 7 commits into from
Sep 6, 2021
Merged
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
19 changes: 19 additions & 0 deletions bindings.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This file is to be given as "make USER_C_MODULES=..." when building Micropython port

include(${CMAKE_CURRENT_LIST_DIR}/mkrules.cmake)

# create targets for generated files
all_lv_bindings()

# lvgl bindings target (the mpy module)
add_library(usermod_lv_bindings INTERFACE)
target_sources(usermod_lv_bindings INTERFACE ${LV_SRC})
target_include_directories(usermod_lv_bindings INTERFACE ${LV_INCLUDE})

# lvgl bindings depend on lvgl itself, pull it in
include(${LVGL_DIR}/CMakeLists.txt)
target_link_libraries(usermod_lv_bindings INTERFACE lvgl_interface)

# make usermod (target declared by Micropython for all user compiled modules) link to bindings
# this way the bindings (and transitively lvgl_interface) get proper compilation flags
target_link_libraries(usermod INTERFACE usermod_lv_bindings)
77 changes: 42 additions & 35 deletions mkrules.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
find_package(Python3 REQUIRED COMPONENTS Interpreter)
find_program(AWK awk mawk gawk)

set(LV_BINDINGS_DIR ${MICROPY_DIR}/lib/lv_bindings)
set(LV_BINDINGS_DIR ${CMAKE_CURRENT_LIST_DIR})

# Common function for creating LV bindings

Expand Down Expand Up @@ -81,7 +81,9 @@ set(LV_PNG_DIR ${LV_BINDINGS_DIR}/driver/png/lodepng)
set(LV_MP ${CMAKE_BINARY_DIR}/lv_mp.c)
set(LV_PNG ${CMAKE_BINARY_DIR}/lv_png.c)
set(LV_PNG_C ${CMAKE_BINARY_DIR}/lv_png_c.c)
set(LV_ESPIDF ${CMAKE_BINARY_DIR}/lv_espidf.c)
if(ESP_PLATFORM)
set(LV_ESPIDF ${CMAKE_BINARY_DIR}/lv_espidf.c)
endif()

# Function for creating all specific bindings

Expand All @@ -105,7 +107,11 @@ function(all_lv_bindings)

file(GLOB_RECURSE LV_PNG_HEADERS ${LV_PNG_DIR}/*.h)
configure_file(${LV_PNG_DIR}/lodepng.cpp ${LV_PNG_C} COPYONLY)
idf_build_set_property(COMPILE_DEFINITIONS "${LV_PNG_PP_OPTIONS}" APPEND)
if(ESP_PLATFORM)
idf_build_set_property(COMPILE_DEFINITIONS "${LV_PNG_PP_OPTIONS}" APPEND)
else()
add_definitions(${LV_PNG_PP_OPTIONS})
endif()
lv_bindings(
OUTPUT
${LV_PNG}
Expand All @@ -120,30 +126,31 @@ function(all_lv_bindings)
)

# ESPIDF bindings

file(GLOB_RECURSE LV_ESPIDF_HEADERS ${IDF_PATH}/components/*.h ${LV_BINDINGS_DIR}/driver/esp32/*.h)
lv_bindings(
OUTPUT
${LV_ESPIDF}
INPUT
${LV_BINDINGS_DIR}/driver/esp32/espidf.h
DEPENDS
${LV_ESPIDF_HEADERS}
PP_OPTIONS
-DPYCPARSER
GEN_OPTIONS
-M espidf
FILTER
i2s_ll.h
i2s_hal.h
esp_intr_alloc.h
soc/spi_periph.h
rom/ets_sys.h
soc/sens_struct.h
soc/rtc.h
driver/periph_ctrl.h
include/esp_private
)
if(ESP_PLATFORM)
file(GLOB_RECURSE LV_ESPIDF_HEADERS ${IDF_PATH}/components/*.h ${LV_BINDINGS_DIR}/driver/esp32/*.h)
lv_bindings(
OUTPUT
${LV_ESPIDF}
INPUT
${LV_BINDINGS_DIR}/driver/esp32/espidf.h
DEPENDS
${LV_ESPIDF_HEADERS}
PP_OPTIONS
-DPYCPARSER
GEN_OPTIONS
-M espidf
FILTER
i2s_ll.h
i2s_hal.h
esp_intr_alloc.h
soc/spi_periph.h
rom/ets_sys.h
soc/sens_struct.h
soc/rtc.h
driver/periph_ctrl.h
include/esp_private
)
endif(ESP_PLATFORM)

endfunction()

Expand All @@ -158,16 +165,16 @@ set(LV_INCLUDE

set(LV_SRC
${LV_MP}

${LV_BINDINGS_DIR}/driver/esp32/espidf.c
${LV_BINDINGS_DIR}/driver/esp32/modrtch.c
${LV_BINDINGS_DIR}/driver/esp32/sh2lib.c

${LV_PNG}
${LV_PNG_C}
${LV_BINDINGS_DIR}/driver/png/mp_lodepng.c

${LV_ESPIDF}
)


if(ESP_PLATFORM)
LIST(APPEND LV_SRC
${LV_BINDINGS_DIR}/driver/esp32/espidf.c
${LV_BINDINGS_DIR}/driver/esp32/modrtch.c
${LV_BINDINGS_DIR}/driver/esp32/sh2lib.c
${LV_ESPIDF}
)
endif(ESP_PLATFORM)