From f59fecdbb34732921be03fd2247ebb5042ea3d9d Mon Sep 17 00:00:00 2001 From: whowechina Date: Sun, 19 May 2024 11:31:01 +0800 Subject: [PATCH] Cmake knows to update built time --- Production/firmware/mai_pico.uf2 | Bin 148480 -> 148480 bytes firmware/src/CMakeLists.txt | 71 ++++++++++++++++--------------- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/Production/firmware/mai_pico.uf2 b/Production/firmware/mai_pico.uf2 index 037319011479c5b476b0df93af011be3f2432d80..be790848b35a560a59287abf30ad493bdc3a3395 100644 GIT binary patch delta 35 ncmZqZ;A{Y*EsUwR1P!f>4XjMe8Gyhyu~Na%a(me=#;!~N!uSfu delta 35 ncmZqZ;A{Y*EsUwR1Wl|AO{`3e8Gyhyu~Na%Vtd&w#;!~N!x#$3 diff --git a/firmware/src/CMakeLists.txt b/firmware/src/CMakeLists.txt index 5ed911e..342586f 100644 --- a/firmware/src/CMakeLists.txt +++ b/firmware/src/CMakeLists.txt @@ -1,34 +1,37 @@ -set(BTSTACK_ROOT ${PICO_SDK_PATH}/lib/btstack) -set(LWIP_ROOT ${PICO_SDK_PATH}/lib/lwip) - -function(make_firmware board board_def) - pico_sdk_init() - add_executable(${board} - main.c touch.c button.c rgb.c save.c config.c cli.c commands.c io.c hid.c - mpr121.c usb_descriptors.c) - target_compile_definitions(${board} PUBLIC ${board_def}) - pico_enable_stdio_usb(${board} 1) - pico_enable_stdio_uart(${board} 0) - - pico_generate_pio_header(${board} ${CMAKE_CURRENT_LIST_DIR}/ws2812.pio) - - target_compile_options(${board} PRIVATE -Wfatal-errors -O3) - target_include_directories(${board} PRIVATE ${CMAKE_CURRENT_LIST_DIR}) - target_include_directories(${board} PRIVATE - ${BTSTACK_ROOT}/src - ${LWIP_ROOT}/src/include) - - target_link_libraries(${board} PRIVATE - aic - pico_multicore pico_stdlib hardware_pio hardware_pwm hardware_flash - hardware_adc hardware_i2c hardware_watchdog pico_unique_id - tinyusb_device tinyusb_board) - - pico_add_extra_outputs(${board}) - - add_custom_command(TARGET ${board} POST_BUILD - COMMAND cp ${board}.uf2 ${CMAKE_CURRENT_LIST_DIR}/..) -endfunction() - -make_firmware(mai_pico BOARD_MAI_PICO) - +set(BTSTACK_ROOT ${PICO_SDK_PATH}/lib/btstack) +set(LWIP_ROOT ${PICO_SDK_PATH}/lib/lwip) + +function(make_firmware board board_def) + pico_sdk_init() + add_executable(${board} + main.c touch.c button.c rgb.c save.c config.c cli.c commands.c io.c hid.c + mpr121.c usb_descriptors.c) + target_compile_definitions(${board} PUBLIC ${board_def}) + pico_enable_stdio_usb(${board} 1) + pico_enable_stdio_uart(${board} 0) + + pico_generate_pio_header(${board} ${CMAKE_CURRENT_LIST_DIR}/ws2812.pio) + + target_compile_options(${board} PRIVATE -Wfatal-errors -O3) + target_include_directories(${board} PRIVATE ${CMAKE_CURRENT_LIST_DIR}) + target_include_directories(${board} PRIVATE + ${BTSTACK_ROOT}/src + ${LWIP_ROOT}/src/include) + + target_link_libraries(${board} PRIVATE + aic + pico_multicore pico_stdlib hardware_pio hardware_pwm hardware_flash + hardware_adc hardware_i2c hardware_watchdog pico_unique_id + tinyusb_device tinyusb_board) + + pico_add_extra_outputs(${board}) + + add_custom_command(TARGET ${board} PRE_BUILD + COMMAND touch ${CMAKE_CURRENT_SOURCE_DIR}/cli.c) + + add_custom_command(TARGET ${board} POST_BUILD + COMMAND cp ${board}.uf2 ${CMAKE_CURRENT_LIST_DIR}/..) +endfunction() + +make_firmware(mai_pico BOARD_MAI_PICO) +