Move to standard Zephyr T2 workspace structure (star topology)
https://docs.zephyrproject.org/latest/guides/west/workspaces.html Previously, west manifest and CMake entry point were in zephyr subfolder as required for PlatformIO. As PlatformIO support was dropped, we can follow the default Zephyr folder structure more closely. The application is built and flashed from app subfolder, where as unit tests are run from tests subfolder.
This commit is contained in:
@@ -5,11 +5,9 @@ on: [push, pull_request]
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: zephyrprojectrtos/ci:v0.18.4
|
||||
# Zephyr v2.7 requires newest SDK, which is not auto-selected by v0.18.4 docker image. Below
|
||||
# env setting can be removed again after upgrade of the docker image.
|
||||
container: zephyrprojectrtos/ci:v0.21.0
|
||||
env:
|
||||
ZEPHYR_SDK_INSTALL_DIR: "/opt/toolchains/zephyr-sdk-0.13.1"
|
||||
CMAKE_PREFIX_PATH: /opt/toolchains
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v2
|
||||
@@ -24,10 +22,9 @@ jobs:
|
||||
working-directory: charge-controller-firmware
|
||||
run: |
|
||||
pip3 install -U west
|
||||
cd zephyr
|
||||
west init -l .
|
||||
west init -l app
|
||||
west update
|
||||
pip3 install -r rtos/scripts/requirements-base.txt
|
||||
pip3 install -r zephyr/scripts/requirements-base.txt
|
||||
|
||||
- name: Trailing whitespace check
|
||||
working-directory: charge-controller-firmware
|
||||
@@ -37,7 +34,7 @@ jobs:
|
||||
- name: Build firmware
|
||||
working-directory: charge-controller-firmware
|
||||
run: |
|
||||
cd zephyr
|
||||
cd app
|
||||
west build -b mppt_2420_hc@0.2 -p
|
||||
west build -b mppt_2420_lc -p
|
||||
west build -b mppt_1210_hus@0.7 -p
|
||||
|
||||
+23
-10
@@ -1,12 +1,25 @@
|
||||
.pio
|
||||
.clang_complete
|
||||
.gcc-flags.json
|
||||
.vscode/*
|
||||
!.vscode/c_cpp_properties.json
|
||||
.west
|
||||
html
|
||||
memory.map
|
||||
custom.ini
|
||||
tools
|
||||
# backup files
|
||||
*.bak
|
||||
*_bak
|
||||
|
||||
# folders generated by west
|
||||
.west
|
||||
bootloader
|
||||
build
|
||||
modules
|
||||
tools
|
||||
zephyr
|
||||
|
||||
# editors
|
||||
.vscode/*
|
||||
!.vscode/c_cpp_properties.json
|
||||
*.swp
|
||||
*~
|
||||
|
||||
# others
|
||||
.clang_complete
|
||||
.gcc-flags.json
|
||||
.pio
|
||||
bin
|
||||
html
|
||||
scripts
|
||||
|
||||
Vendored
+20
-3
@@ -2,17 +2,34 @@
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Zephyr",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/app/src",
|
||||
"${workspaceFolder}/app/build/zephyr/include/generated",
|
||||
"${workspaceFolder}/lib/oled-display/src",
|
||||
"${workspaceFolder}/modules/hal/cmsis/CMSIS/Core/Include",
|
||||
"${workspaceFolder}/modules/hal/stm32/stm32cube/stm32g0xx/soc",
|
||||
"${workspaceFolder}/modules/thingset/src",
|
||||
"${workspaceFolder}/modules/unity/src",
|
||||
"${workspaceFolder}/zephyr/include",
|
||||
"${workspaceFolder}/zephyr/soc/arm/st_stm32/common",
|
||||
"${workspaceFolder}/zephyr/soc/arm/st_stm32/stm32g0",
|
||||
""
|
||||
],
|
||||
"browse": {
|
||||
"path": [
|
||||
"${workspaceFolder}/src"
|
||||
"${workspaceFolder}/app/src",
|
||||
"${workspaceFolder}/modules/thingset/src",
|
||||
"${workspaceFolder}/modules/unity/src"
|
||||
],
|
||||
"limitSymbolsToIncludedHeaders": true
|
||||
},
|
||||
"compileCommands": "${workspaceFolder}/zephyr/build/compile_commands.json",
|
||||
"defines": [
|
||||
"FIRMWARE_VERSION_ID=\"v21.0-21-ga535fa8\""
|
||||
],
|
||||
"cStandard": "c99",
|
||||
"cppStandard": "c++14",
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/zephyr/build/zephyr/include/generated/autoconf.h"
|
||||
"${workspaceFolder}/app/build/zephyr/include/generated/autoconf.h"
|
||||
]
|
||||
}
|
||||
],
|
||||
|
||||
@@ -37,20 +37,20 @@ Unfortunately, the green GitHub "Clone or download" button does not include subm
|
||||
|
||||
Building the firmware requires the native Zephyr build system.
|
||||
|
||||
This guide assumes you have already installed the Zephyr SDK and the west tool according to the [Zephyr documentation](https://docs.zephyrproject.org/latest/getting_started/).
|
||||
This guide assumes you have already installed the Zephyr SDK and the `west` tool according to the [Zephyr documentation](https://docs.zephyrproject.org/latest/getting_started/).
|
||||
|
||||
Now after you cloned the repository (see above), go into the root firmware directory and initialize a west workspace:
|
||||
The repository root directory is the `west` workspace. The `app` subfolder contains all application source files, the CMake entry point and the `west` manifest, so we have to move into this folder:
|
||||
|
||||
west init -l zephyr
|
||||
cd app
|
||||
|
||||
This command will create a `.west/config` file and set up the repository as specified in `zephyr/west.yml` file. Afterwards the following command pulls the Zephyr source and all necessary modules, which might take a while:
|
||||
The following command initializes the west workspace:
|
||||
|
||||
west init -l .
|
||||
|
||||
This command will create a `.west/config` file in the workspace root and set up the repository as specified in the `west.yml` file. Afterwards the following command pulls the Zephyr source and all necessary modules, which might take a while:
|
||||
|
||||
west update
|
||||
|
||||
The CMake entry point is in the `zephyr` subfolder, so you need to run `west build` and `west flash` command in that directory.
|
||||
|
||||
cd zephyr
|
||||
|
||||
Initial board selection (see `boards` subfolder for correct names):
|
||||
|
||||
west build -b <board-name>@<revision>
|
||||
|
||||
@@ -10,5 +10,3 @@ boards*
|
||||
|
||||
# folders generated by west
|
||||
build
|
||||
modules
|
||||
rtos
|
||||
@@ -2,14 +2,14 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(BOARD_ROOT ${CMAKE_SOURCE_DIR}/..)
|
||||
set(DTS_ROOT ${CMAKE_SOURCE_DIR})
|
||||
set(DTS_ROOT ${CMAKE_SOURCE_DIR}/..)
|
||||
|
||||
cmake_minimum_required(VERSION 3.13.1)
|
||||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
||||
|
||||
project(libre_solar_charge_controller)
|
||||
|
||||
add_subdirectory(../src build/src)
|
||||
add_subdirectory(src)
|
||||
|
||||
add_subdirectory(../lib/oled-display build/oled-display)
|
||||
|
||||
@@ -12,12 +12,7 @@ manifest:
|
||||
- name: zephyr
|
||||
remote: zephyrproject
|
||||
revision: v2.7-branch
|
||||
# path must be something else than zephyr as we get a Kconfig include recursion otherwise
|
||||
path: rtos
|
||||
import:
|
||||
# main zephyr modules should be placed in here into zephyr subdirectory
|
||||
path-prefix: zephyr
|
||||
# only get modules we actually need
|
||||
name-allowlist:
|
||||
- cmsis
|
||||
- edtt
|
||||
@@ -25,8 +20,8 @@ manifest:
|
||||
- name: thingset-device-library
|
||||
remote: thingset
|
||||
revision: 1eaa305a9f1873f676b77b8dd0f9d34f1944ecd1
|
||||
path: zephyr/modules/thingset
|
||||
path: modules/thingset
|
||||
- name: unity
|
||||
path: zephyr/modules/unity
|
||||
path: modules/unity
|
||||
revision: 74cde089e65c3435ce9aa87d5c69f4f16b7f6ade
|
||||
remote: throwtheswitch
|
||||
@@ -2,8 +2,7 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
set(BOARD_ROOT ${CMAKE_SOURCE_DIR}/..)
|
||||
set(DTS_ROOT ${CMAKE_SOURCE_DIR}/../zephyr)
|
||||
#set(DTS_ROOT ${CMAKE_CURRENT_LIST_DIR}/..)
|
||||
set(DTS_ROOT ${CMAKE_SOURCE_DIR}/..)
|
||||
|
||||
#set(BOARD "native_posix")
|
||||
#set(ZEPHYR_TOOLCHAIN_VARIANT "host")
|
||||
@@ -16,15 +15,15 @@ add_definitions(-DUNIT_TEST=1)
|
||||
add_definitions(-DUNITY_OUTPUT_COLOR)
|
||||
add_definitions(-DUNITY_EXCLUDE_SETJMP)
|
||||
|
||||
add_subdirectory(../src build/src)
|
||||
add_subdirectory(../app/src build/app)
|
||||
|
||||
zephyr_include_directories(./src)
|
||||
zephyr_include_directories(../src)
|
||||
zephyr_include_directories(../zephyr/modules/thingset/src)
|
||||
zephyr_include_directories(../zephyr/modules/unity/src)
|
||||
zephyr_include_directories(../app/src)
|
||||
zephyr_include_directories(../modules/thingset/src)
|
||||
zephyr_include_directories(../modules/unity/src)
|
||||
|
||||
target_sources(app PRIVATE
|
||||
../zephyr/modules/unity/src/unity.c
|
||||
../modules/unity/src/unity.c
|
||||
src/main.cpp
|
||||
src/tests_bat_charger.cpp
|
||||
src/tests_daq.cpp
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
|
||||
rsource "../zephyr/Kconfig"
|
||||
rsource "../app/Kconfig"
|
||||
|
||||
Reference in New Issue
Block a user