-
Notifications
You must be signed in to change notification settings - Fork 16
/
platformio.ini
152 lines (140 loc) · 6.57 KB
/
platformio.ini
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
; iown-homecontrol PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
; Documentation: https://docs.platformio.org/page/projectconf.html
;
; Common Problems/Fixes
;
; - Show Computed Configuration:
; $> pio project config
;
; - Code Completion/Linting (clang) Errors:
; - PlatformIO: Rebuild IntelliSense Index
; - Generate 'compile_commands.json':
; $> pio run --target compiledb
; - Download LLVM (clang* tools):
; https://releases.llvm.org/download.html
; - VSCode Extensions:
; - ms-vscode.cpptools (comes with PlatformIO)
; - llvm-vs-code-extensions.vscode-clangd (ignore warnings or disable)
; - VSCode Extensions Settings (or use supplied "settings.json"):
; - Set C_Cpp.clang_format_path if non-standard path
; - Set C_Cpp.codeAnalysis.clangTidy.path if non-standard path
; - "C_Cpp.codeAnalysis.clangTidy.enabled": true,
; - "C_Cpp.default.compileCommands": "compile_commands.json",
; - "C_Cpp.default.cppStandard": "gnu++20",
; - "C_Cpp.default.cStandard": "gnu17",
;
; NOTE
;
; - Config is targeted towards ESP32.
; - Use 'extends' for non ESP32 platforms like ESP32S3, RPi, ESP8266, etc.
; - Inherit common config (${env.*}) when changing/adding options
; - Clone branch and set package folder name to "name"
; name=https://github.com/user/repo.git#branch
;
; TODO
;
; - Get GitRev/Version in firmware for debug
; - https://community.platformio.org/t/how-to-build-got-revision-into-binary-for-version-output/15380/6
; - https://github.com/sblantipodi/platformio_version_increment
; - https://piolabs.com/blog/insights/cicd-testing-coverage-versioning.html
;
[platformio]
name = iown-homecontrol
description = io-homecontrol for LoRa32 boards
default_envs = heltec_wifi_lora_32_V2
data_dir = extras ; Contents and Filesystem folder. Arduino standard is 'extras'.
; GLOBAL OPTIONS FOR ALL ENVIRONMENTS [env:*]
[env]
framework = arduino
platform = espressif32
;
; GLOBAL BUILD OPTIONS
board_build.filesystem = littlefs
build_unflags = -std=gnu++11 -Os ; unset to use other C/C++ features
build_flags = -std=gnu++2a -O3 ; use latest (available) C/C++ features
; https://gcc.gnu.org/onlinedocs/gcc/Xtensa-Options.html
-mtarget-align ; align instructions to reduce branch penalties at expense of code density
-mlongcalls ; translate direct calls to indirect unless target is in range
-DCMAKE_EXPORT_COMPILE_COMMANDS=1 ; clangd.llvm.org/installation#project-setup
-DPIO_FRAMEWORK_ARDUINO_NO_USB ; Arduino NO_USB options can be used via PIO_FRAMEWORK_ARDUINO_*
;
; GLOBAL LIBRARY OPTIONS
lib_compat_mode = off ; check environment compatibility against manifest (library.*)
;lib_ldf_mode = deep+ ; parse sources and dependencies recursively
; Global Environment Dependencies - Order Matters!
; Some libs don't declare built-in libs as dependencies: Declare them first!
lib_deps = SPI
https://github.com/jgromes/RadioLib
https://github.com/Velocet/LoRa32
;
; GLOBAL UPLOAD OPTIONS
upload_speed = 921600
;
; GLOBAL MONITOR OPTIONS
monitor_speed = 115200
monitor_echo = yes
monitor_eol = LF
monitor_filters = default ; remove typical control codes
colorize ; colored output
esp32_exception_decoder ; crash exception decoder
send_on_enter ; send text on ENTER
time ; add timestamp
;
; GLOBAL CHECK OPTIONS
check_skip_packages = yes ; exclude third-party package checks
check_tool = clangtidy, cppcheck
check_flags = clangtidy: --format-style=file --fix-errors
; https://sourceforge.net/p/cppcheck/wiki/ListOfChecks
cppcheck: --enable=style --std=c++20
check_severity = high ; high=Bugs | medium=Defensive | low=Cleanup/Performance
;
; GLOBAL CUSTOM OPTIONS
custom_iown_version = 0.6.9 ; custom options start with custom_! See "platformio.py"
; DEBUG OPTIONS
[env:debug]
build_type = debug ; avoid project rebuild on debug
; DEBUG BUILD OPTIONS
build_flags = ${env.build_flags} ; inherit option
-DCORE_DEBUG_LEVEL=4 ; 0=None, 1=Error, 2=Warn, 3=Info, 4=Debug, 5=Verbose
; debug_build_flags = -O0 -ggdb3 -g3 ; override for even more debug output
;
; DEBUG MONITOR OPTIONS
; targets = upload, monitor ; build -> upload -> show serial monitor
; monitor_filters = ${env.monitor_filters} ; inherit option
; debug ; print all sent and received
; RASPBERRY PI RP2040 PLATFORM OPTIONS (usage: 'extends = platform_raspberrypi')
[platform_raspberrypi]
platform = raspberrypi
; ... more options ...
; ESP32 PLATFORM OPTIONS (usage: 'extends = platform_espressif32')
[platform_espressif32]
platform = espressif32
; ESP32 PLATFORM MANIFEST OPTIONS (board_*)
board_build.f_cpu = 240000000L ; cpu frequency: 240MHz
board_connectivity = wifi, bluetooth ; untested: disable can, ethernet
board_frameworks = arduino ; untested: disable espidf
; ESP32 LATEST PLATFORM OPTIONS (usage: 'extends = platform_espressif32_latest')
; PlatformIO: gcc @ 8.4->12.2, IDF @ 4.4->5.1, ArduinoESP32 @ 2.x->3.x
[platform_espressif32_latest]
extends = platform_espressif32
platform_packages = framework-arduinoespressif32 @ https://github.com/espressif/arduino-esp32.git#3.0.0-rc1
framework-arduinoespressif32-libs @ https://github.com/espressif/esp32-arduino-libs.git#idf-release/v5.1
; ESP32 PLATFORM MANIFEST OPTIONS (board_*)
build_flags = ${env.build_flags}
-std=gnu++2b -O3 ; use C++23 + GNU extensions
; BOARD OPTIONS: Heltec WiFi LoRa 32 (V2) - heltec_wifi_lora_32_V2.json
; https://docs.platformio.org/en/latest/boards/espressif32/heltec_wifi_lora_32_V2.html
[env:heltec_wifi_lora_32_V2]
extends = platform_espressif32
board = heltec_wifi_lora_32_V2
board_url = https://resource.heltec.cn/download/WiFi_LoRa_32 ; correct board manifest url
; BOARD OPTIONS: TTGO LoRa32-OLED v2.1.6 - ttgo-lora32-v21.json
; https://docs.platformio.org/en/latest/boards/espressif32/ttgo-lora32-v21.html
[env:ttgo-lora32-v21]
extends = platform_espressif32
board = ttgo-lora32-v21