Skip to content

Commit 295f67d

Browse files
author
Scott Powell
committed
Merge branch 'dev'
2 parents 603bd0e + e2571ac commit 295f67d

File tree

198 files changed

+2605
-499
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

198 files changed

+2605
-499
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ For developers;
3939
- Clone and open the MeshCore repository in Visual Studio Code.
4040
- See the example applications you can modify and run:
4141
- [Companion Radio](./examples/companion_radio) - For use with an external chat app, over BLE, USB or WiFi.
42+
- [KISS Modem](./examples/kiss_modem) - Serial KISS protocol bridge for host applications. ([protocol docs](./docs/kiss_modem_protocol.md))
4243
- [Simple Repeater](./examples/simple_repeater) - Extends network coverage by relaying messages.
4344
- [Simple Room Server](./examples/simple_room_server) - A simple BBS server for shared Posts.
4445
- [Simple Secure Chat](./examples/simple_secure_chat) - Secure terminal based text communication between devices.
46+
- [Simple Sensor](./examples/simple_sensor) - Remote sensor node with telemetry and alerting.
4547

4648
The Simple Secure Chat example can be interacted with through the Serial Monitor in Visual Studio Code, or with a Serial USB Terminal on Android.
4749

boards/t_beam_1w.json

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"build": {
3+
"arduino": {
4+
"ldscript": "esp32s3_out.ld",
5+
"memory_type": "qio_opi"
6+
},
7+
"core": "esp32",
8+
"extra_flags": [
9+
"-DBOARD_HAS_PSRAM",
10+
"-DLILYGO_TBEAM_1W",
11+
"-DARDUINO_USB_CDC_ON_BOOT=1",
12+
"-DARDUINO_USB_MODE=0",
13+
"-DARDUINO_RUNNING_CORE=1",
14+
"-DARDUINO_EVENT_RUNNING_CORE=1"
15+
],
16+
"f_cpu": "240000000L",
17+
"f_flash": "80000000L",
18+
"flash_mode": "qio",
19+
"psram_type": "opi",
20+
"hwids": [
21+
[
22+
"0x303A",
23+
"0x1001"
24+
]
25+
],
26+
"mcu": "esp32s3",
27+
"variant": "lilygo_tbeam_1w"
28+
},
29+
"connectivity": [
30+
"wifi",
31+
"bluetooth",
32+
"lora"
33+
],
34+
"debug": {
35+
"openocd_target": "esp32s3.cfg"
36+
},
37+
"frameworks": [
38+
"arduino"
39+
],
40+
"name": "LilyGo TBeam-1W",
41+
"upload": {
42+
"flash_size": "16MB",
43+
"maximum_ram_size": 327680,
44+
"maximum_size": 16777216,
45+
"require_upload_port": true,
46+
"speed": 921600
47+
},
48+
"url": "http://www.lilygo.cn/",
49+
"vendor": "LilyGo"
50+
}

build.sh

Lines changed: 51 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ sh build.sh <command> [target]
77
88
Commands:
99
help|usage|-h|--help: Shows this message.
10+
list|-l: List firmwares available to build.
1011
build-firmware <target>: Build the firmware for the given build target.
1112
build-firmwares: Build all firmwares for all targets.
1213
build-matching-firmwares <build-match-spec>: Build all firmwares for build targets containing the string given for <build-match-spec>.
@@ -46,19 +47,25 @@ $ sh build.sh build-firmware RAK_4631_repeater
4647
EOF
4748
}
4849

50+
# get a list of pio env names that start with "env:"
51+
get_pio_envs() {
52+
pio project config | grep 'env:' | sed 's/env://'
53+
}
54+
4955
# Catch cries for help before doing anything else.
5056
case $1 in
5157
help|usage|-h|--help)
5258
global_usage
5359
exit 1
5460
;;
61+
list|-l)
62+
get_pio_envs
63+
exit 0
64+
;;
5565
esac
5666

57-
58-
# get a list of pio env names that start with "env:"
59-
get_pio_envs() {
60-
echo $(pio project config | grep 'env:' | sed 's/env://')
61-
}
67+
# cache project config json for use in get_platform_for_env()
68+
PIO_CONFIG_JSON=$(pio project config --json-output)
6269

6370
# $1 should be the string to find (case insensitive)
6471
get_pio_envs_containing_string() {
@@ -82,6 +89,25 @@ get_pio_envs_ending_with_string() {
8289
done
8390
}
8491

92+
# get platform flag for a given environment
93+
# $1 should be the environment name
94+
get_platform_for_env() {
95+
local env_name=$1
96+
echo "$PIO_CONFIG_JSON" | python3 -c "
97+
import sys, json, re
98+
data = json.load(sys.stdin)
99+
for section, options in data:
100+
if section == 'env:$env_name':
101+
for key, value in options:
102+
if key == 'build_flags':
103+
for flag in value:
104+
match = re.search(r'(ESP32_PLATFORM|NRF52_PLATFORM|STM32_PLATFORM|RP2040_PLATFORM)', flag)
105+
if match:
106+
print(match.group(1))
107+
sys.exit(0)
108+
"
109+
}
110+
85111
# disable all debug logging flags if DISABLE_DEBUG=1 is set
86112
disable_debug_flags() {
87113
if [ "$DISABLE_DEBUG" == "1" ]; then
@@ -91,6 +117,8 @@ disable_debug_flags() {
91117

92118
# build firmware for the provided pio env in $1
93119
build_firmware() {
120+
# get env platform for post build actions
121+
ENV_PLATFORM=($(get_platform_for_env $1))
94122

95123
# get git commit sha
96124
COMMIT_HASH=$(git rev-parse --short HEAD)
@@ -121,27 +149,31 @@ build_firmware() {
121149
# build firmware target
122150
pio run -e $1
123151

124-
# build merge-bin for esp32 fresh install
125-
if [ -f .pio/build/$1/firmware.bin ]; then
152+
# build merge-bin for esp32 fresh install, copy .bins to out folder (e.g: Heltec_v3_room_server-v1.0.0-SHA.bin)
153+
if [ "$ENV_PLATFORM" == "ESP32_PLATFORM" ]; then
126154
pio run -t mergebin -e $1
155+
cp .pio/build/$1/firmware.bin out/${FIRMWARE_FILENAME}.bin 2>/dev/null || true
156+
cp .pio/build/$1/firmware-merged.bin out/${FIRMWARE_FILENAME}-merged.bin 2>/dev/null || true
127157
fi
128158

129-
# build .uf2 for nrf52 boards
130-
if [[ -f .pio/build/$1/firmware.zip && -f .pio/build/$1/firmware.hex ]]; then
159+
# build .uf2 for nrf52 boards, copy .uf2 and .zip to out folder (e.g: RAK_4631_Repeater-v1.0.0-SHA.uf2)
160+
if [ "$ENV_PLATFORM" == "NRF52_PLATFORM" ]; then
131161
python3 bin/uf2conv/uf2conv.py .pio/build/$1/firmware.hex -c -o .pio/build/$1/firmware.uf2 -f 0xADA52840
162+
cp .pio/build/$1/firmware.uf2 out/${FIRMWARE_FILENAME}.uf2 2>/dev/null || true
163+
cp .pio/build/$1/firmware.zip out/${FIRMWARE_FILENAME}.zip 2>/dev/null || true
132164
fi
133165

134-
# copy .bin, .uf2, and .zip to out folder
135-
# e.g: Heltec_v3_room_server-v1.0.0-SHA.bin
136-
# e.g: RAK_4631_Repeater-v1.0.0-SHA.uf2
137-
138-
# copy .bin for esp32 boards
139-
cp .pio/build/$1/firmware.bin out/${FIRMWARE_FILENAME}.bin 2>/dev/null || true
140-
cp .pio/build/$1/firmware-merged.bin out/${FIRMWARE_FILENAME}-merged.bin 2>/dev/null || true
166+
# for stm32, copy .bin and .hex to out folder
167+
if [ "$ENV_PLATFORM" == "STM32_PLATFORM" ]; then
168+
cp .pio/build/$1/firmware.bin out/${FIRMWARE_FILENAME}.bin 2>/dev/null || true
169+
cp .pio/build/$1/firmware.hex out/${FIRMWARE_FILENAME}.hex 2>/dev/null || true
170+
fi
141171

142-
# copy .zip and .uf2 of nrf52 boards
143-
cp .pio/build/$1/firmware.uf2 out/${FIRMWARE_FILENAME}.uf2 2>/dev/null || true
144-
cp .pio/build/$1/firmware.zip out/${FIRMWARE_FILENAME}.zip 2>/dev/null || true
172+
# for rp2040, copy .bin and .uf2 to out folder
173+
if [ "$ENV_PLATFORM" == "RP2040_PLATFORM" ]; then
174+
cp .pio/build/$1/firmware.bin out/${FIRMWARE_FILENAME}.bin 2>/dev/null || true
175+
cp .pio/build/$1/firmware.uf2 out/${FIRMWARE_FILENAME}.uf2 2>/dev/null || true
176+
fi
145177

146178
}
147179

docs/cli_commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ This document provides an overview of CLI commands that can be sent to MeshCore
644644
**Usage:**
645645
- `region`
646646

647-
**Serial Only:** Yes
647+
**Serial Only:** For firmware older than 1.12.0
648648

649649
---
650650

0 commit comments

Comments
 (0)