hogthrob 7ee248cf81 Reduced codesize: Switch to newlib-nano; Travis deploy on LibreSolar only (#37)
* Reduced codesize: Switch to newlib-nano

Figured out how to switch to newlib-nano in a simple way.
Reduced build size by about 29k. Applied this to all STM32 builds.
Please test with the STM32L072 hardware, I don't have one of those,
only STM32F072

Also "upgraded" the compiler accepted language standard to gnu c++11 (from gnu++98).

And finally defined that all floating point constants are to be treated
as "floats" and not as double (which is the default). Reduces the number
of implicit double promotions almost to the required minimum.

In some places the double functions are applied to floats which also
causes some unwanted time and code growth. But this is not fixed yet.

* Change travis to try to deploy only on "master" repo

* Fixed typo

gnu++11 was not really enabled, due to copy'n'paste typo.
2019-07-01 14:30:11 +02:00
2019-03-05 15:32:41 +01:00
2016-08-02 14:02:09 +02:00
2017-04-14 18:04:13 +02:00

Libre Solar Charge Controller Firmware

build badge

Firmware based on ARM mbed framework for the Libre Solar MPPT/PWM solar charge controllers

Supported devices

The software is configurable to support different charge controller PCBs with either STM32F072 (including CAN support) or low-power STM32L072/3 MCUs.

Initial software setup (IMPORTANT!)

  1. Select the correct board in platformio.ini by removing the comment before the board name under [platformio]

  2. Copy src/config.h_template to src/config.h, and adjust basic settings

    (config.h is ignored by git, so your changes are kept after software updates using git pull)

    cp src/config.h_template src/config.h
    $EDITOR src/config.h
    

Toolchain and flashing instructions

See the Libre Solar website for project-agnostic instructions on how to develop software and flash new firmware.

Troubleshooting

If flashing the STM32L072 MCU using OpenOCD fails

... as seems to happen with the standard settings from PlatformIO, then ...

NOTE This MCU is used in the MPPT 1210 HUS and the PWM charge controller, for example.

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.

  2. Use ST-Link tools. For Windows there is a GUI tool. Under Linux, use the following command:

    st-flash write .pioenvs/mppt-2420-lc-v0.10/firmware.bin 0x08000000
    
  3. Use other debuggers and tools, e.g. Segger J-Link.

If flashing fails like this ...

In PlatformIO:

Error: init mode failed (unable to connect to the target)
in procedure 'program'
** OpenOCD init failed **
shutdown command invoked

or with ST-Link:

$ st-flash write .pioenvs/mppt-1210-hus-v0.4/firmware.bin  0x08000000
st-flash 1.5.1
2019-06-21T18:13:03 INFO common.c: Loading device parameters....
2019-06-21T18:13:03 WARN common.c: unknown chip id! 0x5fa0004

check the connection between the board used for flashing (for example the Nucleo), and the MPPT.

API documentation

The documentation auto-generated by Doxygen can be found here.

Unit tests

In order to run the unit tests, you need a PlatformIO Plus account. Run tests with the following command:

platformio test -e unit-test-native

Additional firmware documentation (docs folder)

S
Description
Firmware for Libre Solar MPPT/PWM charge controllers
https://libre.solar/charge-controller-firmware/
Readme
5.7 MiB
Languages
C++ 77.6%
C 18.1%
CMake 1.6%
Python 1.4%
Shell 0.7%
Other 0.6%