diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000..6e290bc --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,34 @@ +# SPDX-License-Identifier: Apache-2.0 + +zephyr_include_directories(.) + +target_sources(app PRIVATE + bat_charger.cpp + data_nodes.cpp + daq.cpp + daq_driver.c + device_status.cpp + dcdc.cpp + eeprom.cpp + half_bridge.cpp + hardware.cpp + helper.cpp + leds.cpp + load.cpp + load_driver.c + main.cpp + power_port.cpp + pwm_switch_driver.c + pwm_switch.cpp + setup.cpp +) + +add_subdirectory(ext) + +target_sources_if_kconfig(CONFIG_CUSTOM_DATA_NODES_FILE, app PRIVATE data_nodes_custom.cpp) + +# Using this option enables user-specific customization of the firmware. The +# custom subfolder should have its own CMakeLists.txt file. +if(${CONFIG_CUSTOMIZATION}) + add_subdirectory(custom build/custom) +endif() diff --git a/src/ext/CMakeLists.txt b/src/ext/CMakeLists.txt new file mode 100644 index 0000000..60ab8d5 --- /dev/null +++ b/src/ext/CMakeLists.txt @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: Apache-2.0 + +target_sources(app PRIVATE + ext.cpp + oled.cpp + serial.cpp + can.cpp + can_msg_queue.cpp +) diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index d97ec5d..cc2d053 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -4,48 +4,13 @@ set(BOARD_ROOT ${CMAKE_SOURCE_DIR}/..) set(DTS_ROOT ${CMAKE_SOURCE_DIR}) cmake_minimum_required(VERSION 3.13.1) -include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) project(libre_solar_charge_controller) -add_definitions(-D__ZEPHYR__ -DDEBUG_PRINT_FLAGS=7) +add_definitions(-DDEBUG_PRINT_FLAGS=7) -include_directories(../src) - -target_sources_if_kconfig(CONFIG_CUSTOM_DATA_NODES_FILE, app PRIVATE ../src/data_nodes_custom.cpp) - -target_sources(app PRIVATE - ../src/bat_charger.cpp - ../src/data_nodes.cpp - ../src/daq.cpp - ../src/daq_driver.c - ../src/device_status.cpp - ../src/dcdc.cpp - ../src/eeprom.cpp - ../src/half_bridge.cpp - ../src/hardware.cpp - ../src/helper.cpp - ../src/leds.cpp - ../src/load.cpp - ../src/load_driver.c - ../src/main.cpp - ../src/power_port.cpp - ../src/pwm_switch_driver.c - ../src/pwm_switch.cpp - ../src/setup.cpp - ../src/ext/ext.cpp - ../src/ext/oled.cpp - ../src/ext/serial.cpp - ../src/ext/can.cpp - ../src/ext/can_msg_queue.cpp -) - -# Using this option enables user-specific customization of the firmware. The -# src/custom subfolder should have its own CMakeLists.txt file. -if(${CONFIG_CUSTOMIZATION}) - add_subdirectory(../src/custom build/custom) -endif() +add_subdirectory(../src build/src) add_subdirectory(../lib/thingset build/thingset) add_subdirectory(../lib/oled-display build/oled-display) -#add_subdirectory_ifdef(CONFIG_EXT_OLED_DISPLAY ../lib/oled-display)