From bbd1312fe543341a40b71a58f56ceacbe4206cd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20J=C3=A4ger?= Date: Fri, 24 Jul 2020 08:34:45 +0200 Subject: [PATCH] Relocate and clean up application Kconfig structure --- boards/arm/mppt_1210_hus/Kconfig | 5 --- boards/arm/mppt_2420_hpx/Kconfig | 5 --- boards/arm/mppt_2420_lc/Kconfig | 5 --- .../arm/mppt_2420_lc/mppt_2420_lc_defconfig | 3 +- boards/arm/mppt_2420_rc/Kconfig | 5 --- .../arm/mppt_2420_rc/mppt_2420_rc_defconfig | 2 +- boards/arm/pwm_2420_lus/Kconfig | 5 --- src/data_nodes.cpp | 6 +-- src/ext/can.cpp | 4 +- src/ext/serial.cpp | 8 ++-- {boards => zephyr}/Kconfig | 38 +++++++++++------ zephyr/prj.conf | 42 +++++++++---------- 12 files changed, 57 insertions(+), 71 deletions(-) delete mode 100644 boards/arm/mppt_1210_hus/Kconfig delete mode 100644 boards/arm/mppt_2420_hpx/Kconfig delete mode 100644 boards/arm/mppt_2420_lc/Kconfig delete mode 100644 boards/arm/mppt_2420_rc/Kconfig delete mode 100644 boards/arm/pwm_2420_lus/Kconfig rename {boards => zephyr}/Kconfig (90%) diff --git a/boards/arm/mppt_1210_hus/Kconfig b/boards/arm/mppt_1210_hus/Kconfig deleted file mode 100644 index abfb339..0000000 --- a/boards/arm/mppt_1210_hus/Kconfig +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2019 Martin Jäger / Libre Solar - -# include generic charge controller Kconfig -rsource "../../Kconfig" diff --git a/boards/arm/mppt_2420_hpx/Kconfig b/boards/arm/mppt_2420_hpx/Kconfig deleted file mode 100644 index abfb339..0000000 --- a/boards/arm/mppt_2420_hpx/Kconfig +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2019 Martin Jäger / Libre Solar - -# include generic charge controller Kconfig -rsource "../../Kconfig" diff --git a/boards/arm/mppt_2420_lc/Kconfig b/boards/arm/mppt_2420_lc/Kconfig deleted file mode 100644 index 2aa1ba7..0000000 --- a/boards/arm/mppt_2420_lc/Kconfig +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2020 Martin Jäger / Libre Solar - -# include generic charge controller Kconfig -rsource "../../Kconfig" diff --git a/boards/arm/mppt_2420_lc/mppt_2420_lc_defconfig b/boards/arm/mppt_2420_lc/mppt_2420_lc_defconfig index ee6e4f6..2cd8fd9 100755 --- a/boards/arm/mppt_2420_lc/mppt_2420_lc_defconfig +++ b/boards/arm/mppt_2420_lc/mppt_2420_lc_defconfig @@ -35,8 +35,7 @@ CONFIG_I2C_1=y CONFIG_I2C_2=y CONFIG_CAN=y -#CONFIG_CAN_1=y -CONFIG_EXT_THINGSET_CAN=y +CONFIG_THINGSET_CAN=y CONFIG_EEPROM=y CONFIG_EEPROM_AT24=y diff --git a/boards/arm/mppt_2420_rc/Kconfig b/boards/arm/mppt_2420_rc/Kconfig deleted file mode 100644 index 2aa1ba7..0000000 --- a/boards/arm/mppt_2420_rc/Kconfig +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2020 Martin Jäger / Libre Solar - -# include generic charge controller Kconfig -rsource "../../Kconfig" diff --git a/boards/arm/mppt_2420_rc/mppt_2420_rc_defconfig b/boards/arm/mppt_2420_rc/mppt_2420_rc_defconfig index d9fa3d2..1a24f32 100644 --- a/boards/arm/mppt_2420_rc/mppt_2420_rc_defconfig +++ b/boards/arm/mppt_2420_rc/mppt_2420_rc_defconfig @@ -63,7 +63,7 @@ CONFIG_EEPROM_AT24=y # don't enable CAN by default until PR #22832 is merged to upstream Zephyr #CONFIG_CAN=y -#CONFIG_EXT_THINGSET_CAN=y +#CONFIG_THINGSET_CAN=y CONFIG_ISOTP=y CONFIG_ISOTP_RX_BUF_COUNT=1 diff --git a/boards/arm/pwm_2420_lus/Kconfig b/boards/arm/pwm_2420_lus/Kconfig deleted file mode 100644 index abfb339..0000000 --- a/boards/arm/pwm_2420_lus/Kconfig +++ /dev/null @@ -1,5 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# Copyright (c) 2019 Martin Jäger / Libre Solar - -# include generic charge controller Kconfig -rsource "../../Kconfig" diff --git a/src/data_nodes.cpp b/src/data_nodes.cpp index 846513d..29d1e18 100644 --- a/src/data_nodes.cpp +++ b/src/data_nodes.cpp @@ -51,7 +51,7 @@ static char auth_password[11]; bool pub_serial_enable = false; -#if CONFIG_EXT_THINGSET_CAN +#if CONFIG_THINGSET_CAN bool pub_can_enable = false; uint16_t ts_can_node_id = CONFIG_THINGSET_CAN_DEFAULT_NODE_ID; #endif @@ -200,7 +200,7 @@ static DataNode data_nodes[] = { ID_CONF, TS_ANY_R | TS_ANY_W, PUB_NVM), #endif -#if CONFIG_EXT_THINGSET_CAN +#if CONFIG_THINGSET_CAN TS_NODE_UINT16(0x59, "CanNodeId", &ts_can_node_id, ID_CONF, TS_ANY_R | TS_ANY_W, PUB_NVM), #endif @@ -460,7 +460,7 @@ static DataNode data_nodes[] = { TS_NODE_BOOL(0xF2, "Enable", &pub_serial_enable, 0xF1, TS_ANY_RW, 0), TS_NODE_PUBSUB(0xF3, "IDs", PUB_SER, 0xF1, TS_ANY_RW, 0), -#if CONFIG_EXT_THINGSET_CAN +#if CONFIG_THINGSET_CAN TS_NODE_PATH(0xF5, "can", ID_PUB, NULL), TS_NODE_BOOL(0xF6, "Enable", &pub_can_enable, 0xF5, TS_ANY_RW, 0), TS_NODE_PUBSUB(0xF7, "IDs", PUB_CAN, 0xF5, TS_ANY_RW, 0), diff --git a/src/ext/can.cpp b/src/ext/can.cpp index ef6da71..a9014dc 100644 --- a/src/ext/can.cpp +++ b/src/ext/can.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#if CONFIG_EXT_THINGSET_CAN +#if CONFIG_THINGSET_CAN #include #include @@ -164,4 +164,4 @@ void can_pub_thread() K_THREAD_DEFINE(can_pub, 1024, can_pub_thread, NULL, NULL, NULL, 6, 0, 1000); -#endif /* CONFIG_EXT_THINGSET_CAN */ +#endif /* CONFIG_THINGSET_CAN */ diff --git a/src/ext/serial.cpp b/src/ext/serial.cpp index bbb1ee3..5e87988 100644 --- a/src/ext/serial.cpp +++ b/src/ext/serial.cpp @@ -4,7 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -#if CONFIG_EXT_THINGSET_SERIAL +#if CONFIG_THINGSET_SERIAL #include #include @@ -21,8 +21,8 @@ struct device *uart_dev = device_get_binding(UART_DEVICE_NAME); -static char buf_resp[CONFIG_EXT_THINGSET_SERIAL_TX_BUF_SIZE]; -static char buf_req[CONFIG_EXT_THINGSET_SERIAL_RX_BUF_SIZE]; +static char buf_resp[CONFIG_THINGSET_SERIAL_TX_BUF_SIZE]; +static char buf_req[CONFIG_THINGSET_SERIAL_RX_BUF_SIZE]; static volatile size_t req_pos = 0; static volatile bool command_flag = false; @@ -126,4 +126,4 @@ void serial_thread() K_THREAD_DEFINE(serial_thread_id, 1024, serial_thread, NULL, NULL, NULL, 6, 0, 1000); -#endif /* CONFIG_EXT_THINGSET_SERIAL */ +#endif /* CONFIG_THINGSET_SERIAL */ diff --git a/boards/Kconfig b/zephyr/Kconfig similarity index 90% rename from boards/Kconfig rename to zephyr/Kconfig index 1f88608..8031141 100644 --- a/boards/Kconfig +++ b/zephyr/Kconfig @@ -1,6 +1,8 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2019 Martin Jäger (Libre Solar) +mainmenu "Libre Solar Charge Controller Firmware" + # # Invisible (board-specific) Kconfig symbols # @@ -31,6 +33,8 @@ config HS_MOSFET_FAIL_SAFE_PROTECTION # Visible (user-configurable) Kconfig symbols # +menu "Charge Controller Setup" + choice prompt "High-voltage terminal" depends on $(dt_compat_enabled,dcdc) @@ -81,7 +85,7 @@ choice endchoice -menu "Battery configuration" +menu "Battery" choice prompt "Default battery cell type" @@ -143,11 +147,13 @@ config BAT_DEFAULT_CAPACITY_AH endmenu +endmenu # Terminal configuration -menu "Extensions and interfaces" + +menu "UEXT port" config EXT_OLED_DISPLAY - bool "OLED display at UEXT" + bool "OLED display" config EXT_OLED_BRIGHTNESS depends on EXT_OLED_DISPLAY @@ -155,42 +161,45 @@ config EXT_OLED_BRIGHTNESS range 1 255 default 1 -config EXT_THINGSET_SERIAL +endmenu # UEXT port + + +menu "ThingSet interfaces" + +config THINGSET_SERIAL bool "ThingSet serial interface" -config EXT_THINGSET_SERIAL_RX_BUF_SIZE - depends on EXT_THINGSET_SERIAL +config THINGSET_SERIAL_RX_BUF_SIZE + depends on THINGSET_SERIAL int "ThingSet serial RX buffer size" range 64 2048 default 512 -config EXT_THINGSET_SERIAL_TX_BUF_SIZE - depends on EXT_THINGSET_SERIAL +config THINGSET_SERIAL_TX_BUF_SIZE + depends on THINGSET_SERIAL int "ThingSet serial TX buffer size" range 256 2048 default 1024 -config EXT_THINGSET_CAN +config THINGSET_CAN depends on CAN bool "ThingSet CAN interface" config THINGSET_CAN_DEFAULT_NODE_ID - depends on EXT_THINGSET_CAN + depends on THINGSET_CAN int "ThingSet CAN default node ID" range 0 255 default 20 config THINGSET_EXPERT_PASSWORD - depends on EXT_THINGSET_SERIAL || EXT_THINGSET_CAN string "ThingSet expert user password" default "expert123" config THINGSET_MAKER_PASSWORD - depends on EXT_THINGSET_SERIAL || EXT_THINGSET_CAN string "ThingSet maker password" default "maker456" -endmenu +endmenu # ThingSet interfaces menuconfig CUSTOMIZATION @@ -219,3 +228,6 @@ config CUSTOM_DCDC_CONTROLLER MPPT control. endif + +# include main Zephyr menu entries from Zephyr root directory +source "Kconfig.zephyr" diff --git a/zephyr/prj.conf b/zephyr/prj.conf index 4925934..3e1e69b 100644 --- a/zephyr/prj.conf +++ b/zephyr/prj.conf @@ -1,38 +1,38 @@ -# direct printf calls to console -CONFIG_STDOUT_CONSOLE=y +# Main application configuration (overrides board-specific settings) # default is 1024 CONFIG_HEAP_MEM_POOL_SIZE=1024 +CONFIG_CPLUSPLUS=y + +CONFIG_NEWLIB_LIBC=y +CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y + +CONFIG_BUILD_OUTPUT_BIN=y + +CONFIG_WATCHDOG=y +CONFIG_WDT_DISABLE_AT_BOOT=y + +CONFIG_REBOOT=y + +CONFIG_HWINFO=y + CONFIG_GPIO=y CONFIG_SERIAL=y CONFIG_I2C=y -CONFIG_WDT_DISABLE_AT_BOOT=y - -# disable log by default to save memory for STM32F0 with little RAM -CONFIG_LOG=y -CONFIG_LOG_MINIMAL=y - -#CONFIG_NEWLIB_LIBC_NANO=y -CONFIG_NEWLIB_LIBC=y -CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y - CONFIG_CONSOLE_SUBSYS=y CONFIG_CONSOLE_GETCHAR=y -CONFIG_CPLUSPLUS=y +# direct printf calls to console +CONFIG_STDOUT_CONSOLE=y -CONFIG_HWINFO=y - -CONFIG_BUILD_OUTPUT_BIN=y +# use minimal log by default to save memory for STM32F0 with little RAM +CONFIG_LOG=y +CONFIG_LOG_MINIMAL=y # ThingSet protocol interface at UART serial -CONFIG_EXT_THINGSET_SERIAL=y +CONFIG_THINGSET_SERIAL=y # I2C OLED display in UEXT connector #CONFIG_EXT_OLED_DISPLAY=y - -CONFIG_REBOOT=y - -CONFIG_WATCHDOG=y