From 04f0d429705bb155ae3994bb52e78955f7bd43dd Mon Sep 17 00:00:00 2001 From: Martin Jaeger <17674105+martinjaeger@users.noreply.github.com> Date: Tue, 7 Jan 2020 09:38:10 +0100 Subject: [PATCH] Zephyr board names unified with mbed code --- boards/Kconfig | 4 ++-- .../CMakeLists.txt | 0 .../Kconfig | 2 +- .../Kconfig.board | 2 +- .../Kconfig.defconfig | 6 +++--- .../board.cmake | 0 .../mppt_1210_hus_0v4.dts} | 0 .../mppt_1210_hus_0v4.yaml} | 2 +- .../mppt_1210_hus_0v4_defconfig} | 1 - .../pinmux.c | 0 .../support/openocd.cfg | 0 ...1210hus_0v4.json => mppt_1210_hus_0v4.json} | 0 platformio.ini | 18 +++++++++--------- src/pcb.h | 10 +++++----- src/pcbs/pwm_2420_lus.h | 8 ++++---- zephyr/CMakeLists.txt | 3 +-- 16 files changed, 27 insertions(+), 29 deletions(-) rename boards/arm/{mppt1210hus_0v4 => mppt_1210_hus_0v4}/CMakeLists.txt (100%) rename boards/arm/{mppt1210hus_0v4 => mppt_1210_hus_0v4}/Kconfig (78%) rename boards/arm/{mppt1210hus_0v4 => mppt_1210_hus_0v4}/Kconfig.board (83%) rename boards/arm/{mppt1210hus_0v4 => mppt_1210_hus_0v4}/Kconfig.defconfig (84%) rename boards/arm/{mppt1210hus_0v4 => mppt_1210_hus_0v4}/board.cmake (100%) rename boards/arm/{mppt1210hus_0v4/mppt1210hus_0v4.dts => mppt_1210_hus_0v4/mppt_1210_hus_0v4.dts} (100%) rename boards/arm/{mppt1210hus_0v4/mppt1210hus_0v4.yaml => mppt_1210_hus_0v4/mppt_1210_hus_0v4.yaml} (85%) rename boards/arm/{mppt1210hus_0v4/mppt1210hus_0v4_defconfig => mppt_1210_hus_0v4/mppt_1210_hus_0v4_defconfig} (95%) rename boards/arm/{mppt1210hus_0v4 => mppt_1210_hus_0v4}/pinmux.c (100%) rename boards/arm/{mppt1210hus_0v4 => mppt_1210_hus_0v4}/support/openocd.cfg (100%) rename boards/{mppt1210hus_0v4.json => mppt_1210_hus_0v4.json} (100%) diff --git a/boards/Kconfig b/boards/Kconfig index 3b80da0..15e4eeb 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -4,6 +4,6 @@ # Generic Libre Solar Charge Controller configuration # -source "$(BOARD_DIR)/../../Kconfig.hidden" +rsource "Kconfig.hidden" -source "$(BOARD_DIR)/../../Kconfig.user" +rsource "Kconfig.user" diff --git a/boards/arm/mppt1210hus_0v4/CMakeLists.txt b/boards/arm/mppt_1210_hus_0v4/CMakeLists.txt similarity index 100% rename from boards/arm/mppt1210hus_0v4/CMakeLists.txt rename to boards/arm/mppt_1210_hus_0v4/CMakeLists.txt diff --git a/boards/arm/mppt1210hus_0v4/Kconfig b/boards/arm/mppt_1210_hus_0v4/Kconfig similarity index 78% rename from boards/arm/mppt1210hus_0v4/Kconfig rename to boards/arm/mppt_1210_hus_0v4/Kconfig index 9cddfe1..abfb339 100644 --- a/boards/arm/mppt1210hus_0v4/Kconfig +++ b/boards/arm/mppt_1210_hus_0v4/Kconfig @@ -2,4 +2,4 @@ # Copyright (c) 2019 Martin Jäger / Libre Solar # include generic charge controller Kconfig -source "$(BOARD_DIR)/../../Kconfig" +rsource "../../Kconfig" diff --git a/boards/arm/mppt1210hus_0v4/Kconfig.board b/boards/arm/mppt_1210_hus_0v4/Kconfig.board similarity index 83% rename from boards/arm/mppt1210hus_0v4/Kconfig.board rename to boards/arm/mppt_1210_hus_0v4/Kconfig.board index f3f1cf0..cde21e2 100755 --- a/boards/arm/mppt1210hus_0v4/Kconfig.board +++ b/boards/arm/mppt_1210_hus_0v4/Kconfig.board @@ -1,6 +1,6 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2019 Martin Jäger / Libre Solar -config BOARD_MPPT1210HUS_0V4 +config BOARD_MPPT_1210_HUS_0V4 bool "Libre Solar MPPT 1210 HUS v0.4" depends on SOC_STM32L073XX diff --git a/boards/arm/mppt1210hus_0v4/Kconfig.defconfig b/boards/arm/mppt_1210_hus_0v4/Kconfig.defconfig similarity index 84% rename from boards/arm/mppt1210hus_0v4/Kconfig.defconfig rename to boards/arm/mppt_1210_hus_0v4/Kconfig.defconfig index f40bfb9..b3b9a48 100755 --- a/boards/arm/mppt1210hus_0v4/Kconfig.defconfig +++ b/boards/arm/mppt_1210_hus_0v4/Kconfig.defconfig @@ -1,10 +1,10 @@ # SPDX-License-Identifier: Apache-2.0 # Copyright (c) 2019 Martin Jäger / Libre Solar -if BOARD_MPPT1210HUS_0V4 +if BOARD_MPPT_1210_HUS_0V4 config BOARD - default "mppt1210hus_0v4" + default "mppt_1210_hus_0v4" config HAS_DCDC_CONVERTER default y @@ -45,4 +45,4 @@ config SPI_STM32_INTERRUPT endif # SPI -endif # BOARD_MPPT1210HUS_0V4 +endif # BOARD_MPPT_1210_HUS_0V4 diff --git a/boards/arm/mppt1210hus_0v4/board.cmake b/boards/arm/mppt_1210_hus_0v4/board.cmake similarity index 100% rename from boards/arm/mppt1210hus_0v4/board.cmake rename to boards/arm/mppt_1210_hus_0v4/board.cmake diff --git a/boards/arm/mppt1210hus_0v4/mppt1210hus_0v4.dts b/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.dts similarity index 100% rename from boards/arm/mppt1210hus_0v4/mppt1210hus_0v4.dts rename to boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.dts diff --git a/boards/arm/mppt1210hus_0v4/mppt1210hus_0v4.yaml b/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.yaml similarity index 85% rename from boards/arm/mppt1210hus_0v4/mppt1210hus_0v4.yaml rename to boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.yaml index a94e903..17e4d3f 100755 --- a/boards/arm/mppt1210hus_0v4/mppt1210hus_0v4.yaml +++ b/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4.yaml @@ -1,4 +1,4 @@ -identifier: mppt1210hus_0v4 +identifier: mppt_1210_hus_0v4 name: MPPT-1210-HUS-0V4 type: mcu arch: arm diff --git a/boards/arm/mppt1210hus_0v4/mppt1210hus_0v4_defconfig b/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4_defconfig similarity index 95% rename from boards/arm/mppt1210hus_0v4/mppt1210hus_0v4_defconfig rename to boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4_defconfig index 2210e5a..b210279 100755 --- a/boards/arm/mppt1210hus_0v4/mppt1210hus_0v4_defconfig +++ b/boards/arm/mppt_1210_hus_0v4/mppt_1210_hus_0v4_defconfig @@ -6,7 +6,6 @@ CONFIG_SOC_SERIES_STM32L0X=y # Platform Configuration CONFIG_SOC_STM32L073XX=y -CONFIG_BOARD_MPPT1210HUS_0V4=y # General Kernel Options CONFIG_CORTEX_M_SYSTICK=y diff --git a/boards/arm/mppt1210hus_0v4/pinmux.c b/boards/arm/mppt_1210_hus_0v4/pinmux.c similarity index 100% rename from boards/arm/mppt1210hus_0v4/pinmux.c rename to boards/arm/mppt_1210_hus_0v4/pinmux.c diff --git a/boards/arm/mppt1210hus_0v4/support/openocd.cfg b/boards/arm/mppt_1210_hus_0v4/support/openocd.cfg similarity index 100% rename from boards/arm/mppt1210hus_0v4/support/openocd.cfg rename to boards/arm/mppt_1210_hus_0v4/support/openocd.cfg diff --git a/boards/mppt1210hus_0v4.json b/boards/mppt_1210_hus_0v4.json similarity index 100% rename from boards/mppt1210hus_0v4.json rename to boards/mppt_1210_hus_0v4.json diff --git a/platformio.ini b/platformio.ini index 95529f7..56d474a 100644 --- a/platformio.ini +++ b/platformio.ini @@ -72,34 +72,34 @@ check_flags = [env:mppt-2420-lc-v0.10] board = nucleo_f072rb build_flags = ${env.build_flags} - -D MPPT_2420_LC_0V10 + -D CONFIG_BOARD_MPPT_2420_LC_0V10 # https://github.com/LibreSolar/MPPT-1210-HUS/tree/586626f3d8 [env:mppt-1210-hus-v0.2] board = nucleo_f072rb build_flags = ${env.build_flags} - -D MPPT_1210_HUS_0V2 + -D CONFIG_BOARD_MPPT_1210_HUS_0V2 # https://github.com/LibreSolar/MPPT-1210-HUS/tree/63e5842671 [env:mppt-1210-hus-v0.4] board = nucleo_l073rz build_flags = ${env.build_flags} - -D MPPT_1210_HUS_0V4 + -D CONFIG_BOARD_MPPT_1210_HUS_0V4 # https://github.com/LibreSolar/mppt-1210-hus/releases/tag/v0.6 [env:mppt-1210-hus-v0.6] board = nucleo_l073rz build_flags = ${env.build_flags} - -D MPPT_1210_HUS_0V7 + -D CONFIG_BOARD_MPPT_1210_HUS_0V7 # https://github.com/LibreSolar/MPPT-1210-HUS [env:mppt-1210-hus-v0.7] board = nucleo_l073rz build_flags = ${env.build_flags} - -D MPPT_1210_HUS_0V7 + -D CONFIG_BOARD_MPPT_1210_HUS_0V7 [env:mppt-1210-hus-v0.4-zephyr] -board = mppt1210hus_0v4 +board = mppt_1210_hus_0v4 framework = zephyr build_flags = -std=gnu++17 @@ -113,17 +113,17 @@ extra_scripts = generate_version_file.py [env:pwm-2420-lus-v0.2] board = nucleo_l073rz build_flags = ${env.build_flags} - -D PWM_2420_LUS_0V2 + -D CONFIG_BOARD_PWM_2420_LUS_0V2 [env:pwm-2420-lus-v0.3] board = nucleo_l073rz build_flags = ${env.build_flags} - -D PWM_2420_LUS_0V3 + -D CONFIG_BOARD_PWM_2420_LUS_0V3 [env:pwm-2420-lus-v0.3-bl] board = nucleo_l073rz build_flags = ${env.build_flags} - -D PWM_2420_LUS_0V3 + -D CONFIG_BOARD_PWM_2420_LUS_0V3 -D BOOTLOADER_ENABLED -Wl,-T'"$PROJECT_DIR\STM32L073XZ.ld.link_script.ld"',-v diff --git a/src/pcb.h b/src/pcb.h index a2ed315..112dac5 100644 --- a/src/pcb.h +++ b/src/pcb.h @@ -16,15 +16,15 @@ // specific board settings /////////////////////////////////////////////////////////////////////////////// -#if defined(MPPT_2420_LC_0V10) +#if defined(CONFIG_BOARD_MPPT_2420_LC_0V10) #include "pcbs/mppt_2420_lc_0v10.h" -#elif defined(MPPT_1210_HUS_0V2) +#elif defined(CONFIG_BOARD_MPPT_1210_HUS_0V2) #include "pcbs/mppt_1210_hus_0v2.h" -#elif defined(MPPT_1210_HUS_0V4) +#elif defined(CONFIG_BOARD_MPPT_1210_HUS_0V4) #include "pcbs/mppt_1210_hus_0v4.h" -#elif defined(MPPT_1210_HUS_0V7) +#elif defined(CONFIG_BOARD_MPPT_1210_HUS_0V7) #include "pcbs/mppt_1210_hus_0v7.h" -#elif defined(PWM_2420_LUS_0V2) || defined(PWM_2420_LUS_0V3) +#elif defined(CONFIG_BOARD_PWM_2420_LUS_0V2) || defined(CONFIG_BOARD_PWM_2420_LUS_0V3) #include "pcbs/pwm_2420_lus.h" #elif defined(UNIT_TEST) #include "pcbs/pcb_stub.h" diff --git a/src/pcbs/pwm_2420_lus.h b/src/pcbs/pwm_2420_lus.h index 865e094..97f0fdd 100644 --- a/src/pcbs/pwm_2420_lus.h +++ b/src/pcbs/pwm_2420_lus.h @@ -9,9 +9,9 @@ #define DEVICE_TYPE "PWM-2420-LUS" -#ifdef PWM_2420_LUS_0V2 +#ifdef CONFIG_BOARD_PWM_2420_LUS_0V2 #define HARDWARE_VERSION "v0.2" -#elif defined(PWM_2420_LUS_0V3) +#elif defined(CONFIG_BOARD_PWM_2420_LUS_0V3) #define HARDWARE_VERSION "v0.3" #endif @@ -110,10 +110,10 @@ static const pin_state_t led_pin_setup[NUM_LEDS][NUM_LED_PINS] = { #define ADC_GAIN_V_BAT (132 / 12) #define ADC_GAIN_V_SOLAR (1 + 120/12 + 120/8.2) -#ifdef PWM_2420_LUS_0V2 +#ifdef CONFIG_BOARD_PWM_2420_LUS_0V2 // op amp gain: 68/2.2, resistor: 2 mOhm #define ADC_GAIN_I_LOAD (1000 / 2 / (68/2.2)) -#elif defined(PWM_2420_LUS_0V3) +#elif defined(CONFIG_BOARD_PWM_2420_LUS_0V3) // fix for hardware bug in overcurrent comparator voltage divider wiring #define ADC_GAIN_I_LOAD (1000 / 2 / (68/2.2) * (39+12+8.2) / (12+8.2)) #endif diff --git a/zephyr/CMakeLists.txt b/zephyr/CMakeLists.txt index f3ba7c2..d00eaa8 100644 --- a/zephyr/CMakeLists.txt +++ b/zephyr/CMakeLists.txt @@ -1,6 +1,5 @@ # SPDX-License-Identifier: Apache-2.0 -set(BOARD mppt1210hus_0v4) set(BOARD_ROOT ${CMAKE_SOURCE_DIR}/..) cmake_minimum_required(VERSION 3.13.1) @@ -8,7 +7,7 @@ include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE) project(libre_solar_charge_controller) -add_definitions(-DMPPT_1210_HUS_0V4 -D__ZEPHYR__ -DDEBUG_PRINT_FLAGS=7) +add_definitions(-D__ZEPHYR__ -DDEBUG_PRINT_FLAGS=7) include_directories(../src)