45 Commits

Author SHA1 Message Date
Maxim Prokhorov
ed32ab20ba build(scripts): sync & generate config/arduino.h 2025-06-26 03:11:41 +03:00
Maxim Prokhorov
c5a0b5f23f build(scripts): allow to generate compile_commands.json with everything enabled 2025-06-24 23:55:41 +03:00
Maxim Prokhorov
812ff5a800 pio: pin script replacement to framework version instead of platform
don't replace w/ git version
2024-08-24 01:06:01 +03:00
Maxim Prokhorov
b3bc053e52 pio: workaround py3.12+ syntax warnings
core 2.7.4 elf2bin patches w/ subprocess.run
temporary workaround for -latest, pending 3.2.0 release
2024-08-24 00:50:06 +03:00
Maxim Prokhorov
d292f32a99 pio: dep and preprocess helper target
drop sideeffect dependency in favour of a direct one
build both .d and .E, for .o and preprocessor deps respectively
2024-07-25 21:31:59 +03:00
Maxim Prokhorov
e529e38ec6 pio: update for re2c 3.0 and fix exit handling 2024-05-16 00:04:00 +03:00
Maxim Prokhorov
cfab435275 pio: experiment with cachedir 2023-03-27 19:12:27 +03:00
Maxim Prokhorov
e2c8dd7be1 pio: fix dependencies generator
`-mD` is not an option...

`-M -MF $file` can be used together with `-E` to generate a small
makefile-like generator (does not include any compiler flags!) for the
target file so we know which files it would use during compilation
2023-01-17 06:25:53 +03:00
Maxim Prokhorov
579a5b239b pio: helper to build single-source .E 2023-01-13 02:42:34 +03:00
Maxim Prokhorov
ac14cbca4f pio: .gz and two-step hint on upload target 2022-09-23 05:04:26 +03:00
Maxim Prokhorov
d2e0bd9ac5 pio: update formatting 2022-08-31 03:08:30 +03:00
Maxim Prokhorov
5527441d36 pio: cppcheck works with pio-check
https://docs.platformio.org/en/latest/core/userguide/cmd_check.html
2022-08-31 03:08:30 +03:00
Maxim Prokhorov
246364470c ci: compress debug symbols a bit more 2022-08-31 03:08:30 +03:00
Maxim Prokhorov
038f1ffec3 pio: firmware.bin.gz builder 2022-08-31 03:08:30 +03:00
Maxim Prokhorov
d17316f78c pio: fix .bin size check script dependency
cannot depend on checkprogsize, since it depends on .elf and not .bin

also, compare with the block-aligned size
add notes about reserved space

warning might become annoying, though :)
2022-08-31 03:08:06 +03:00
Maxim Prokhorov
e8e9c152e7 pio: missing scripts 2022-08-30 03:22:47 +03:00
Maxim Prokhorov
74ce4d974d pio: update formatting 2022-08-30 03:18:11 +03:00
Maxim Prokhorov
c0e74e431d pio: prettier file size output 2022-08-30 03:18:07 +03:00
Maxim Prokhorov
fd249c8055 pio: also hide raw putc function in postmortem
updates scripts to be a post action
rename redefined symbols to stubs
2022-08-30 02:06:30 +03:00
Maxim Prokhorov
6f122f5ecb pio: debug info in distributed builds and build-and-copy fixes
store objcopy of these extra symbols and .map from the linker
distribution will have an extra debug .zip file that could be used with
the exception decoder

also fixes relative paths in the build-and-copy
(although, yet again loses the pio target in the gui)
2022-08-30 01:33:55 +03:00
Maxim Prokhorov
8312f27e4b pio: even shorter suffix for .ipp files
remove .cpp from the resulting suffix, since .ipp already implies it is c++
update comments once again
2021-12-07 01:06:18 +03:00
Maxim Prokhorov
d094283df2 pio: formatting 2021-11-30 01:28:09 +03:00
Maxim Prokhorov
a7a9c5045f pio: generate .cpp.ipp instead of .cpp.inc
fixes #2479
2021-11-30 00:15:52 +03:00
Maxim Prokhorov
c738b91b6a pio: simplify single-source builder
Generate resulting .cpp in the $BUILD_DIR, no need for atexit
Register middleware only once, there's no need to manually walk the
project directory since fnmatch.fnmatch(...) supports globs

Provide a SCons Action instead of simple function, so there's a way to
generate things on demand via command line
```
$ pio run -e $env -t .pio/build/$env/espurna_single_source/src/main.cpp
```
2021-11-30 00:06:24 +03:00
Maxim Prokhorov
ebc479f145 pio: fix indirect dependency on the build-and-copy .bin 2021-11-29 23:06:25 +03:00
Maxim Prokhorov
79321b6707 ci: directly use the test build headers
- just pass `-include ${cfg}` to the compiler instead of a
  temporary custom.h. also do `-DDEVICE=...` and `-DMANUFACTURER=...`
- rework test_build to print using `logging` module
- report leftover configurations, after the failed one exits
- prettify the output and highlight relevant info instead of the whole lines
2021-11-29 23:06:03 +03:00
Maxim Prokhorov
cf0315c231 scripts: formatting 2021-10-03 20:44:58 +03:00
Maxim Prokhorov
001ec79c8e ir: clean-up and refactoring of the existing module
- provide a queue for the outgoing messages, don't depend on the MQTT
  callback implementation details and always postpone the actual transfer.
- generate user input parsers using re2c, adds special PlatformIO build handlers
- add terminal command to show GPIO info and send a simple payload
- rework button<->action presets into value<->terminal command presets and custom ones
  through the use of `irCmd<VALUE>` settings, where the VALUE is taken from the simple payload
  (yet, it does not understand repeated codes, but that's something to add later *or* use rpnlib)
- add tx message integration for the relay module via `irRelayOn#` and `irRelayOff#`
- rework simple payload to include 'repeats' value for the 'IRsend::send()'
  also adds internal 'series', 'delay' and includes full 64bit 'value'
  (as uppercase HEX, instead of decimal)
- rework raw payload to use 'series' instead of 'repeats', and provide a
  clear distinction between the usec time and the options of the message
  by moving the required options to the front and separating them using ':'
  (just like the simple variant)
- make RX and TX pin a runtime setting, make RX and TX support a build flag
- small test framework to check whether internal string encode<->decode works

Also updates the hexEncode & hexDecode implementations to use
'iterators' instead of just pointer + index.
2021-10-03 20:44:58 +03:00
Maxim Prokhorov
bdd821db86 pio: check returncode of the git process
Since the Popen instance won't do that by itself. Handles the case
where there is `git` command present, but it's not a git repo underneath.
2021-08-17 14:35:20 +03:00
Maxim Prokhorov
a1e7941fa6 scripts: some more Core version fixes
Remove 2.3.0 code for ldscripts
Update
2021-06-18 12:12:08 +03:00
Maxim Prokhorov
4c33cacfdb pio: add build-and-copy, more configuration options for version
Multiple ways to specify version string through environment variables:
- `ESPURNA_BUILD_FULL_VERSION` to set full version string
By default it is empty, and the version is combined using the values specified below
- `ESPURNA_BUILD_VERSION` to modify the first part of the version string (1.15.0-dev)
By default, uses espurna/config/version.h APP_VERSION value
- `ESPURNA_BUILD_REVISION` to specify revision part of the version string
For example 12345678, which is expanded as either .git12345678 or -git12345678
(depending on whether the version string contains hyphen)
By default, use git to retrieve the first 8 characters of the current HEAD SHA value
- `ESPURNA_BUILD_VERSION_SUFFIX` to specify build metadata part of the string
For example nightly20210607, which is added to the full version as 1.15.0-dev+nightly20210607
Empty by defauld

Adds -t build-and-copy which uses the values above to copy firmware.bin, configurable with:
- `ESPURNA_BUILD_NAME` to set the suffix of the filename.
By default, uses the $PIOENV (aka the string after the env: in the .ini file)
- `ESPURNA_BUILD_DESTINATION` to specify where to copy the .bin files
By default, uses $PROJECT_DIR

Resulting file is stored at:
${ESPURNA_BUILD_DESTINATION}/${ESPURNA_BUILD_FULL_VERSION}/espurna-${ESPURNA_BUILD_FULL_VERSION}-${ESPURNA_BUILD_NAME}.bin

In addition, modify generate_release_sh.py to use the new environment variables.
2021-06-07 03:54:28 +03:00
Rui Marinho
bfa704c2fd sns: remove need to patch bme680 static library (#2429)
Upstream released a version of their proprietary library which does not require any modification to the linker script.
2021-03-31 08:48:09 +03:00
Maxim Prokhorov
071131260f pio: specify revision as prerelease 2021-01-20 23:39:28 +03:00
Maxim Prokhorov
7817e3abd5 pio: accept external revision string 2021-01-20 23:35:36 +03:00
Maxim Prokhorov
e1b643fd00 pio: update ldpath as soon as possible
trying to fix #2343
*** [.pio\build\$PIOENV\firmware.bin] TypeError
`expected str, bytes or os.PathLike object, not Dir' trying to evaluate `${__get_flash_size(__env__)}'

as it turns out, PIO platform internals (sometimes) did not use the correct ldscript path
2020-09-04 23:00:40 +03:00
Max Prokhorov
1d957506b3 PIO: remove Arduino Core 2.3.0 support (#2333)
As this is no longer an option since PIO 4.4.0
ref.
04694b4126
https://docs.platformio.org/en/latest/core/history.html

*...I have known you for so long
When we ran in circles...*
2020-08-22 01:36:44 +03:00
Rui Marinho
6266930a4d sns: Add BME680 (#2295)
Add support for BME680 using libalgobsec proprietary algorithms for precise Indoor Air Quality (IAQ) measurement. Unlike traditional CO2 sensors - and good ones are expensive - it measures nearly all VOCs compounds in the air (plus other gases) and compensates those measurements with its built-in temperature and humidity sensors to determine indoor air quality.

Co-authored-by: Max Prokhorov <prokhorov.max@outlook.com>
2020-08-02 09:12:38 +03:00
Max Prokhorov
cb8443dfa3 Use #include for single source build (#2267)
* [1/2] use #include for single source

* [2/2] use #include for single source
2020-05-31 05:48:47 +03:00
Maxim Prokhorov
50163fc051 Add line hint to the single source file
c/p from the InoToCpp converter that uses scons file node path
while we write binary data as utf-8 (and assume it is utf-8!),
we only ever need this in CI and source is always relative.
with luck, this is on the safe side.
2020-05-01 10:19:26 +03:00
Max Prokhorov
edb23dbfc4 Convert .ino -> .cpp (#2228)
- general conversion from .ino modules into a separate .cpp files
- clean-up internal headers, place libraries into .h. guard .cpp with _SUPPORT flags 
- fix some instances of shared variables instead of public methods
- tweak build system to still build a single source file via os environment variable ESPURNA_BUILD_SINGLE_SOURCE
2020-04-30 13:55:07 +03:00
Maxim Prokhorov
492a35926f ci: rework build.sh & release.sh generator
- don't depend on TRAVIS environment variables
- depend on CI flag to add release variables
- chmod +x
2020-04-08 23:28:43 +03:00
Max Prokhorov
db50be91bc PIO: fix env definitions (again) (#2212)
* base envs

* CI: speed up release process (since we still want some .bin files)

* fixup! CI: speed up release process (since we still want some .bin files)

* release dry run

* fixup! release dry run

* adjust

* fix .bin name

* it works

* minor cleanup for current git

* use pio suggestion about ldscript, reduce build_flags impact

* fix linker

* parse ${vars} instead of ignoring them

* add filtering and override file (sneak peak into tasmota's pio config)

* don't generate secure client (for now)

* formatting

* codacy
2020-04-07 21:20:32 +03:00
Max Prokhorov
a4d4231ae0 PIO: remove -ota envs, handle OTA condition in extra script (#2099)
* PIO: remove -ota envs, handle OTA condition in extra script
* Tweak ESPURNA_BOARD variable
* Support git and latest in ota script
* Handle ESPURNA_FLAGS too
* Try to handle env and projenv in pylint
* Add deprecation comment about -ota envs
* regen arduino.h
2020-01-20 17:41:10 +03:00
Maxim Prokhorov
b36e5ee396 test: allow to run a single configuration test, improve commandline handling 2019-10-22 15:17:22 +03:00
Max Prokhorov
c18490cc4a PIO: pass APP_REVISION via extra scripts (#1946)
* utils/version: use git description token as version, add memoization

* pio: move extra scripts to a separate directory

* pio: add -DAPP_REVISION=... as local build flag
2019-10-16 14:41:43 +03:00