Mbed support removed

Rationale: The support for both Zephyr and Mbed made the code confusing,
especially because of many ifdefs.

Zephyr RTOS is the future!
This commit is contained in:
Martin Jäger
2020-04-04 08:21:43 +02:00
parent 2c2e59c072
commit 2d74a3a554
22 changed files with 81 additions and 1076 deletions
+26 -14
View File
@@ -2,7 +2,7 @@
![build badge](https://travis-ci.com/LibreSolar/charge-controller-firmware.svg?branch=master)
This repository contains the firmware for the different Libre Solar Charge Controllers. Originally, the firmware was based on [ARM Mbed OS](https://www.mbed.com). The current version also supports using [Zephyr RTOS](https://www.zephyrproject.org/) for some boards.
This repository contains the firmware for the different Libre Solar Charge Controllers based on [Zephyr RTOS](https://www.zephyrproject.org/).
Coding style is described [here](https://github.com/LibreSolar/coding-style).
@@ -10,7 +10,7 @@ Coding style is described [here](https://github.com/LibreSolar/coding-style).
## Supported devices
The software is configurable to support different charge controller PCBs with either STM32F072 (including CAN support) or low-power STM32L072/3 MCUs.
The software is configurable to support different charge controller PCBs with STM32F072, low-power STM32L072/3 or most recent STM32G431 MCUs:
- [Libre Solar MPPT 12/24V 20A with CAN](https://github.com/LibreSolar/MPPT-2420-LC)
- [Libre Solar MPPT 12V 10A with USB](https://github.com/LibreSolar/MPPT-1210-HUS)
@@ -26,7 +26,7 @@ git clone --recursive https://github.com/LibreSolar/charge-controller-firmware
Unfortunately, the green GitHub "Clone or download" button does not include submodules. If you cloned the repository already and want to pull the submodules, run `git submodule update --init --recursive`.
### ARM Mbed OS
### PlatfrormIO
It is suggested to use Visual Studio Code and PlatformIO for firmware development, as it simplifies compiling and uploading the code a lot:
@@ -40,15 +40,28 @@ It is suggested to use Visual Studio Code and PlatformIO for firmware developmen
5. Press the upload button at the bottom left corner in VS Code.
### Zephyr
### Native Zephyr environment
Support for Zephyr was recently added to PlatformIO. You may need to run `pio upgrade` and `pio update` to get the most recent version.
You can also use the Zephyr build system directly for advanced configuration using `menuconfig` or if you need more recently added features.
After that, you should be able to compile and flash Zephyr for supported boards (-zephyr suffix in platformio.ini) in the same way as explained above for Mbed.
The CMake entry point is in the `zephyr` subfolder, so you need to run `west` command in that directory.
As the build system in PlatformIO is not the same as the native Zephyr build system, there might still be some issues. Generally, also `west build` and `west flash` should work if called from within the zephyr subdirectory.
Initial board selection (see `boards subfolder for correct names):
**Important:** For the STM32G4 we require several bug fixes that were introduced in Zephyr v2.2. The PlatformIO package is currently based on v2.1, so it is required to use native Zephyr build system until PlatformIO package is updated.
west build -b <board-name>
Flash with specific debug probe (runner), e.g. J-Link:
west flash -r jlink
User configuration using menuconfig:
west build -t menuconfig
Report of used memory (RAM and flash):
west build -t rom_report
west build -t ram_report
### Troubleshooting
@@ -58,11 +71,9 @@ The standard OpenOCD settings sometimes fail to flash firmware to this MCU, whic
Try one of these workarounds:
1. Change OpenOCD settings to `set WORKAREASIZE 0x1000` in the file `~/.platformio/packages/tool-openocd/scripts/board/st_nucleo_l073rz.cfg`.
1. Change OpenOCD settings to `adapter_khz 500` in line 70 in `~/.platformio/packages/tool-openocd/scripts/target/stm32l0.cfg`.
2. Use ST-Link tools. For Windows there is a GUI tool. Under Linux, uncomment the `upload_command` line in `platformio.ini`.
3. Use other debuggers and tools, e.g. Segger J-Link.
2. Use other tools or debug probes such as [STM32CubeProgrammer](https://www.st.com/en/development-tools/stm32cubeprog.html) or [Segger J-Link](https://www.segger.com/products/debug-probes/j-link/).
#### Connection failures
@@ -97,9 +108,10 @@ The documentation auto-generated by Doxygen can be found [here](https://libre.so
## Conformance testing
We are using Travis CI to perform several checks for each commit or pull-request. In order to run
the same tests locally (recommended before each pull-request) use the script `check.sh`:
the same tests locally (recommended before each pull-request) use the script `check.sh` or ` check.bat`:
bash check.sh
bash check.sh # Linux
cmd check.bat # Windows
### Unit-tests