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.
This commit is contained in:
hogthrob
2019-07-01 14:30:11 +02:00
committed by Martin Jäger
parent 26ae254ec4
commit 7ee248cf81
3 changed files with 38 additions and 0 deletions
+1
View File
@@ -40,4 +40,5 @@ deploy:
local_dir: html
github_token: $GH_REPO_TOKEN
on:
repo: LibreSolar/charge-controller-firmware
branch: master
+17
View File
@@ -0,0 +1,17 @@
# Custom settings, as referred to as "extra_script" in platformio.ini
#
# See http://docs.platformio.org/en/latest/projectconf.html#extra-script
# and https://docs.platformio.org/en/latest/projectconf/advanced_scripting.html#extra-linker-flags-without-wl-prefix
#
# We are setting the required linker flags for use of newlib-nano
Import("env")
env.Append(
LINKFLAGS=[
"-Wl,-u,_printf_float",
"--specs=nano.specs",
"--specs=nosys.specs"
]
)
+20
View File
@@ -32,11 +32,16 @@ monitor_speed = 115200
# Compiler settings
build_flags =
-std=gnu++11
-fsingle-precision-constant
-Wl,-Map,memory.map
-D TURN_OFF_MBED_DEPRECATED_WARNING
-D MBED_BUILD_PROFILE_RELEASE
# -D MBED_BUILD_PROFILE_DEBUG
build_unflags = -std=gnu++98
extra_scripts = linker_flags_newlib-nano.py
lib_deps =
https://github.com/ThingSet/thingset-cpp
SX1276GenericLib
@@ -54,8 +59,11 @@ upload_protocol = ${common.upload_protocol}
monitor_speed = ${common.monitor_speed}
build_flags = ${common.build_flags}
-D MPPT_2420_LC_0V10
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_unflags= ${common.build_unflags}
extra_scripts = ${common.extra_scripts}
# https://github.com/LibreSolar/MPPT-1210-HUS/tree/586626f3d8
[env:mppt-1210-hus-v0.2]
@@ -68,6 +76,8 @@ build_flags = ${common.build_flags}
-D MPPT_1210_HUS_0V2
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_unflags= ${common.build_unflags}
extra_scripts = ${common.extra_scripts}
# https://github.com/LibreSolar/MPPT-1210-HUS/tree/63e5842671
[env:mppt-1210-hus-v0.4]
@@ -80,6 +90,8 @@ build_flags = ${common.build_flags}
-D MPPT_1210_HUS_0V4
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_unflags= ${common.build_unflags}
extra_scripts = ${common.extra_scripts}
[env:mppt-1210-hus-v0.6]
platform = ${common.platform}
@@ -91,6 +103,8 @@ build_flags = ${common.build_flags}
-D MPPT_1210_HUS_0V6
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_unflags= ${common.build_unflags}
extra_scripts = ${common.extra_scripts}
# initial test version (obsolete)
[env:pwm-2420-lus-v0.1]
@@ -103,6 +117,8 @@ build_flags = ${common.build_flags}
-D PWM_2420_LUS_0V1
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_unflags= ${common.build_unflags}
extra_scripts = ${common.extra_scripts}
# https://github.com/LibreSolar/PWM-2420-LUS
[env:pwm-2420-lus-v0.2]
@@ -115,12 +131,16 @@ build_flags = ${common.build_flags}
-D PWM_2420_LUS_0V2
lib_deps = ${common.lib_deps}
lib_ignore = ${common.lib_ignore}
build_unflags= ${common.build_unflags}
extra_scripts = ${common.extra_scripts}
[env:unit-test-native]
platform = native
build_flags =
-std=gnu++11
-D LITTLE_ENDIAN
-D UNIT_TEST
# include src directory (otherwise unit-tests will only include lib directory)
test_build_project_src = true
lib_ignore = USB, mbed-USBDevice, mbed-mbedtls, USBSerial, ESP32, Adafruit_GFX
build_unflags= ${common.build_unflags}