mirror of
https://github.com/whowechina/chu_pico.git
synced 2025-02-17 10:48:41 +01:00
Cmake optimization with built time display
This commit is contained in:
parent
23864c2cd5
commit
ccb6376e7f
Binary file not shown.
@ -1,27 +1,29 @@
|
||||
function(make_firmware board board_def)
|
||||
pico_sdk_init()
|
||||
add_executable(${board}
|
||||
main.c slider.c air.c rgb.c save.c config.c commands.c
|
||||
cli.c lzfx.c vl53l0x.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 -Wall -Werror -Wfatal-errors -O3)
|
||||
target_include_directories(${board} PRIVATE ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
target_link_libraries(${board} PRIVATE
|
||||
aic
|
||||
pico_multicore pico_stdlib hardware_pio hardware_pwm hardware_flash
|
||||
hardware_adc hardware_i2c hardware_watchdog
|
||||
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(chu_pico BOARD_CHU_PICO)
|
||||
pico_sdk_init()
|
||||
|
||||
include_directories(${CMAKE_CURRENT_LIST_DIR})
|
||||
add_compile_options(-Wall -Werror -Wfatal-errors -O3)
|
||||
link_libraries(pico_multicore pico_stdlib hardware_i2c hardware_spi
|
||||
hardware_pio hardware_flash hardware_watchdog
|
||||
tinyusb_device tinyusb_board)
|
||||
|
||||
function(make_firmware board board_def)
|
||||
add_executable(${board}
|
||||
main.c slider.c air.c rgb.c save.c config.c commands.c
|
||||
cli.c lzfx.c vl53l0x.c mpr121.c usb_descriptors.c)
|
||||
target_compile_definitions(${board} PUBLIC ${board_def})
|
||||
pico_enable_stdio_usb(${board} 1)
|
||||
|
||||
pico_generate_pio_header(${board} ${CMAKE_CURRENT_LIST_DIR}/ws2812.pio)
|
||||
|
||||
target_link_libraries(${board} PRIVATE aic)
|
||||
|
||||
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(chu_pico BOARD_CHU_PICO)
|
||||
|
@ -59,7 +59,8 @@ int cli_match_prefix(const char *str[], int num, const char *prefix)
|
||||
static void handle_help(int argc, char *argv[])
|
||||
{
|
||||
printf("%s", cli_logo);
|
||||
printf("\tSN: %016llx\n\n", board_id_64());
|
||||
printf("\tSN: %016llx\n", board_id_64());
|
||||
printf("\tBuilt: %s %s\n\n", __DATE__, __TIME__);
|
||||
printf("Available commands:\n");
|
||||
for (int i = 0; i < num_commands; i++) {
|
||||
printf("%*s: %s\n", max_cmd_len + 2, commands[i], helps[i]);
|
||||
@ -150,6 +151,9 @@ void cli_run()
|
||||
if (c == EOF) {
|
||||
return;
|
||||
}
|
||||
if (c == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (c == '\b' || c == 127) { // both backspace and delete
|
||||
if (cmd_len > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user