sforkowany z mirror/meshtastic-firmware
moving build selection into platformio.ini rather than nasty #defines. thanks to @sensorslot
for the pointer to https://github.com/arendst/Tasmota - where I just borrowed heavily ;-)1.2-legacy
rodzic
5c4ae6c042
commit
d831beab3d
|
@ -12,7 +12,7 @@
|
||||||
"type": "platformio-debug",
|
"type": "platformio-debug",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "PIO Debug",
|
"name": "PIO Debug",
|
||||||
"executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/esp32/firmware.elf",
|
"executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/tbeam/firmware.elf",
|
||||||
"toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-xtensa32/bin",
|
"toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-xtensa32/bin",
|
||||||
"preLaunchTask": {
|
"preLaunchTask": {
|
||||||
"type": "PlatformIO",
|
"type": "PlatformIO",
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
"type": "platformio-debug",
|
"type": "platformio-debug",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"name": "PIO Debug (skip Pre-Debug)",
|
"name": "PIO Debug (skip Pre-Debug)",
|
||||||
"executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/esp32/firmware.elf",
|
"executable": "/home/kevinh/development/meshtastic/meshtastic-esp32/.pio/build/tbeam/firmware.elf",
|
||||||
"toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-xtensa32/bin",
|
"toolchainBinDir": "/home/kevinh/.platformio/packages/toolchain-xtensa32/bin",
|
||||||
"internalConsoleOptions": "openOnSessionStart"
|
"internalConsoleOptions": "openOnSessionStart"
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,9 +7,7 @@ source bin/version.sh
|
||||||
COUNTRIES="US EU433 EU865 CN JP"
|
COUNTRIES="US EU433 EU865 CN JP"
|
||||||
#COUNTRIES=US
|
#COUNTRIES=US
|
||||||
|
|
||||||
SRCMAP=.pio/build/esp32/output.map
|
|
||||||
SRCBIN=.pio/build/esp32/firmware.bin
|
|
||||||
SRCELF=.pio/build/esp32/firmware.elf
|
|
||||||
OUTDIR=release/latest
|
OUTDIR=release/latest
|
||||||
|
|
||||||
# We keep all old builds (and their map files in the archive dir)
|
# We keep all old builds (and their map files in the archive dir)
|
||||||
|
@ -17,25 +15,26 @@ ARCHIVEDIR=release/archive
|
||||||
|
|
||||||
rm -f $OUTDIR/firmware*
|
rm -f $OUTDIR/firmware*
|
||||||
|
|
||||||
|
function do_build {
|
||||||
|
ENV_NAME=$1
|
||||||
|
echo "Building for $ENV_NAME with $PLATFORMIO_BUILD_FLAGS"
|
||||||
|
SRCBIN=.pio/build/$ENV_NAME/firmware.bin
|
||||||
|
SRCELF=.pio/build/$ENV_NAME/firmware.elf
|
||||||
|
rm -f $SRCBIN $SRCMAP
|
||||||
|
pio run --environment $ENV_NAME # -v
|
||||||
|
cp $SRCBIN $OUTDIR/firmware-$ENV_NAME-$COUNTRY-$VERSION.bin
|
||||||
|
cp $SRCELF $OUTDIR/firmware-$ENV_NAME-$COUNTRY-$VERSION.elf
|
||||||
|
}
|
||||||
|
|
||||||
for COUNTRY in $COUNTRIES; do
|
for COUNTRY in $COUNTRIES; do
|
||||||
|
|
||||||
HWVERSTR="1.0-$COUNTRY"
|
HWVERSTR="1.0-$COUNTRY"
|
||||||
COMMONOPTS="-DAPP_VERSION=$VERSION -DHW_VERSION_$COUNTRY -DHW_VERSION=$HWVERSTR -Wall -Wextra -Wno-missing-field-initializers -Isrc -Os -Wl,-Map,.pio/build/esp32/output.map -DAXP_DEBUG_PORT=Serial"
|
COMMONOPTS="-DAPP_VERSION=$VERSION -DHW_VERSION_$COUNTRY -DHW_VERSION=$HWVERSTR -Wall -Wextra -Wno-missing-field-initializers -Isrc -Os -DAXP_DEBUG_PORT=Serial"
|
||||||
|
|
||||||
export PLATFORMIO_BUILD_FLAGS="-DT_BEAM_V10 $COMMONOPTS"
|
export PLATFORMIO_BUILD_FLAGS="$COMMONOPTS"
|
||||||
echo "Building with $PLATFORMIO_BUILD_FLAGS"
|
|
||||||
rm -f $SRCBIN $SRCMAP
|
|
||||||
pio run # -v
|
|
||||||
cp $SRCBIN $OUTDIR/firmware-TBEAM-$COUNTRY-$VERSION.bin
|
|
||||||
cp $SRCELF $OUTDIR/firmware-TBEAM-$COUNTRY-$VERSION.elf
|
|
||||||
#cp $SRCMAP $ARCHIVEDIR/firmware-TBEAM-$COUNTRY-$VERSION.map
|
|
||||||
|
|
||||||
export PLATFORMIO_BUILD_FLAGS="-DHELTEC_LORA32 $COMMONOPTS"
|
do_build "tbeam"
|
||||||
rm -f $SRCBIN $SRCMAP
|
do_build "heltec"
|
||||||
pio run # -v
|
|
||||||
cp $SRCBIN $OUTDIR/firmware-HELTEC-$COUNTRY-$VERSION.bin
|
|
||||||
cp $SRCELF $OUTDIR/firmware-HELTEC-$COUNTRY-$VERSION.elf
|
|
||||||
#cp $SRCMAP $ARCHIVEDIR/firmware-HELTEC-$COUNTRY-$VERSION.map
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# keep the bins in archive also
|
# keep the bins in archive also
|
||||||
|
|
|
@ -6,19 +6,21 @@ in these instructions I describe use of their command line tool.
|
||||||
1. Purchase a suitable radio (see above)
|
1. Purchase a suitable radio (see above)
|
||||||
2. Install [PlatformIO](https://platformio.org/platformio-ide)
|
2. Install [PlatformIO](https://platformio.org/platformio-ide)
|
||||||
3. Download this git repo and cd into it
|
3. Download this git repo and cd into it
|
||||||
4. Edit configuration.h and comment out *one* of the following two lines (depending on which board you are using):
|
4. Edit configuration.h and comment out _one_ of the following two lines (depending on which board you are using):
|
||||||
|
|
||||||
```
|
```
|
||||||
// #define T_BEAM_V10
|
// #define ARDUINO_T_Beam
|
||||||
#define HELTEC_LORA32
|
#define ARDUINO_HELTEC_WIFI_LORA_32_V2
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Plug the radio into your USB port
|
5. Plug the radio into your USB port
|
||||||
6. Type "pio run -t upload" (This command will fetch dependencies, build the project and install it on the board via USB)
|
6. Type "pio run -t upload" (This command will fetch dependencies, build the project and install it on the board via USB)
|
||||||
7. Platform IO also installs a very nice VisualStudio Code based IDE, see their [tutorial](https://docs.platformio.org/en/latest/tutorials/espressif32/arduino_debugging_unit_testing.html) if you'd like to use it
|
7. Platform IO also installs a very nice VisualStudio Code based IDE, see their [tutorial](https://docs.platformio.org/en/latest/tutorials/espressif32/arduino_debugging_unit_testing.html) if you'd like to use it
|
||||||
|
|
||||||
|
|
||||||
## Decoding stack traces
|
## Decoding stack traces
|
||||||
|
|
||||||
If you get a crash, you can decode the addresses from the `Backtrace:` line:
|
If you get a crash, you can decode the addresses from the `Backtrace:` line:
|
||||||
|
|
||||||
1. Save the `Backtrace: 0x....` line to a file, e.g., `backtrace.txt`.
|
1. Save the `Backtrace: 0x....` line to a file, e.g., `backtrace.txt`.
|
||||||
2. Run `bin/exception_decoder.py backtrace.txt` (this uses symbols from the
|
2. Run `bin/exception_decoder.py backtrace.txt` (this uses symbols from the
|
||||||
last `firmware.elf`, so you must be running the same binary that's still in
|
last `firmware.elf`, so you must be running the same binary that's still in
|
||||||
|
|
|
@ -9,10 +9,15 @@
|
||||||
; https://docs.platformio.org/page/projectconf.html
|
; https://docs.platformio.org/page/projectconf.html
|
||||||
|
|
||||||
[platformio]
|
[platformio]
|
||||||
|
default_envs = tbeam
|
||||||
|
|
||||||
[env:esp32]
|
[common]
|
||||||
|
; default to a US frequency range, change it as needed for your region and hardware (CN, JP, EU433, EU865)
|
||||||
|
hw_version = US
|
||||||
|
|
||||||
|
[env]
|
||||||
platform = espressif32
|
platform = espressif32
|
||||||
board = ttgo-t-beam
|
; board = ttgo-t-beam
|
||||||
; board = heltec_wifi_lora_32_V2
|
; board = heltec_wifi_lora_32_V2
|
||||||
framework = arduino
|
framework = arduino
|
||||||
|
|
||||||
|
@ -22,14 +27,13 @@ board_build.partitions = partition-table.csv
|
||||||
|
|
||||||
; note: we add src to our include search path so that lmic_project_config can override
|
; note: we add src to our include search path so that lmic_project_config can override
|
||||||
; FIXME: fix lib/BluetoothOTA dependency back on src/ so we can remove -Isrc
|
; FIXME: fix lib/BluetoothOTA dependency back on src/ so we can remove -Isrc
|
||||||
build_flags = -Wall -Wextra -Wno-missing-field-initializers -Isrc -Os -Wl,-Map,.pio/build/esp32/output.map -DAXP_DEBUG_PORT=Serial
|
build_flags = -Wall -Wextra -Wno-missing-field-initializers -Isrc -Os -Wl,-Map,.pio/build/output.map -DAXP_DEBUG_PORT=Serial -DHW_VERSION_${common.hw_version}
|
||||||
|
|
||||||
; not needed included in ttgo-t-beam board file
|
; not needed included in ttgo-t-beam board file
|
||||||
; also to use PSRAM https://docs.platformio.org/en/latest/platforms/espressif32.html#external-ram-psram
|
; also to use PSRAM https://docs.platformio.org/en/latest/platforms/espressif32.html#external-ram-psram
|
||||||
; -DBOARD_HAS_PSRAM
|
; -DBOARD_HAS_PSRAM
|
||||||
; -mfix-esp32-psram-cache-issue
|
; -mfix-esp32-psram-cache-issue
|
||||||
|
|
||||||
|
|
||||||
; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
; -DLOG_LOCAL_LEVEL=ESP_LOG_DEBUG -DCORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_DEBUG
|
||||||
|
|
||||||
upload_speed = 921600
|
upload_speed = 921600
|
||||||
|
@ -55,8 +59,6 @@ debug_tool = jlink
|
||||||
|
|
||||||
debug_init_break = tbreak setup
|
debug_init_break = tbreak setup
|
||||||
|
|
||||||
; Note: some libraries are specified by #ID where there are conflicting library
|
|
||||||
; names.
|
|
||||||
lib_deps =
|
lib_deps =
|
||||||
https://github.com/meshtastic/RadioHead.git
|
https://github.com/meshtastic/RadioHead.git
|
||||||
https://github.com/meshtastic/esp8266-oled-ssd1306.git ; ESP8266_SSD1306
|
https://github.com/meshtastic/esp8266-oled-ssd1306.git ; ESP8266_SSD1306
|
||||||
|
@ -68,9 +70,12 @@ lib_deps =
|
||||||
https://github.com/meshtastic/arduino-fsm.git
|
https://github.com/meshtastic/arduino-fsm.git
|
||||||
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git
|
https://github.com/meshtastic/SparkFun_Ublox_Arduino_Library.git
|
||||||
|
|
||||||
;[env:tbeam]
|
[env:tbeam]
|
||||||
;board = ttgo-t-beam
|
board = ttgo-t-beam
|
||||||
|
lib_deps =
|
||||||
|
${env.lib_deps}
|
||||||
|
AXP202X_Library
|
||||||
|
|
||||||
;[env:heltec]
|
[env:heltec]
|
||||||
;build_type = debug ; to make it possible to step through our jtag debugger
|
;build_type = debug ; to make it possible to step through our jtag debugger
|
||||||
;board = heltec_wifi_lora_32_V2
|
board = heltec_wifi_lora_32_V2
|
||||||
|
|
|
@ -40,9 +40,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Select which board is being used. If the outside build environment has sent a choice, just use that
|
// Select which board is being used. If the outside build environment has sent a choice, just use that
|
||||||
#if !defined(T_BEAM_V10) && !defined(HELTEC_LORA32)
|
#if !defined(ARDUINO_T_Beam) && !defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)
|
||||||
#define T_BEAM_V10 // AKA Rev1 (second board released)
|
// The platformio build environment should set this now
|
||||||
// #define HELTEC_LORA32
|
// #define ARDUINO_T_Beam // AKA Rev1 (second board released)
|
||||||
|
// #define ARDUINO_HELTEC_WIFI_LORA_32_V2
|
||||||
|
|
||||||
#define HW_VERSION_US // We encode the hardware freq range in the hw version string, so sw update can eventually install the
|
#define HW_VERSION_US // We encode the hardware freq range in the hw version string, so sw update can eventually install the
|
||||||
// correct build
|
// correct build
|
||||||
|
@ -50,7 +51,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled)
|
// If we are using the JTAG port for debugging, some pins must be left free for that (and things like GPS have to be disabled)
|
||||||
// we don't support jtag on the ttgo - access to gpio 12 is a PITA
|
// we don't support jtag on the ttgo - access to gpio 12 is a PITA
|
||||||
#ifdef HELTEC_LORA32
|
#ifdef ARDUINO_HELTEC_WIFI_LORA_32_V2
|
||||||
//#define USE_JTAG
|
//#define USE_JTAG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -105,7 +106,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
#define MOSI_GPIO 27
|
#define MOSI_GPIO 27
|
||||||
#define NSS_GPIO 18
|
#define NSS_GPIO 18
|
||||||
|
|
||||||
#if defined(T_BEAM_V10)
|
#if defined(ARDUINO_T_Beam)
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
// This string must exactly match the case used in release file names or the android updater won't work
|
||||||
#define HW_VENDOR "TBEAM"
|
#define HW_VENDOR "TBEAM"
|
||||||
|
|
||||||
|
@ -126,7 +127,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
// Leave undefined to disable our PMU IRQ handler
|
// Leave undefined to disable our PMU IRQ handler
|
||||||
#define PMU_IRQ 35
|
#define PMU_IRQ 35
|
||||||
|
|
||||||
#elif defined(HELTEC_LORA32)
|
#elif defined(ARDUINO_HELTEC_WIFI_LORA_32_V2)
|
||||||
// This string must exactly match the case used in release file names or the android updater won't work
|
// This string must exactly match the case used in release file names or the android updater won't work
|
||||||
#define HW_VENDOR "HELTEC"
|
#define HW_VENDOR "HELTEC"
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <driver/rtc_io.h>
|
#include <driver/rtc_io.h>
|
||||||
|
|
||||||
#ifdef T_BEAM_V10
|
#ifdef ARDUINO_T_Beam
|
||||||
#include "axp20x.h"
|
#include "axp20x.h"
|
||||||
AXP20X_Class axp;
|
AXP20X_Class axp;
|
||||||
bool pmu_irq = false;
|
bool pmu_irq = false;
|
||||||
|
@ -81,7 +81,7 @@ void scanI2Cdevice(void)
|
||||||
ssd1306_found = true;
|
ssd1306_found = true;
|
||||||
DEBUG_MSG("ssd1306 display found\n");
|
DEBUG_MSG("ssd1306 display found\n");
|
||||||
}
|
}
|
||||||
#ifdef T_BEAM_V10
|
#ifdef ARDUINO_T_Beam
|
||||||
if (addr == AXP192_SLAVE_ADDRESS) {
|
if (addr == AXP192_SLAVE_ADDRESS) {
|
||||||
axp192_found = true;
|
axp192_found = true;
|
||||||
DEBUG_MSG("axp192 PMU found\n");
|
DEBUG_MSG("axp192 PMU found\n");
|
||||||
|
@ -108,7 +108,7 @@ void scanI2Cdevice(void)
|
||||||
*/
|
*/
|
||||||
void axp192Init()
|
void axp192Init()
|
||||||
{
|
{
|
||||||
#ifdef T_BEAM_V10
|
#ifdef ARDUINO_T_Beam
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
|
if (!axp.begin(Wire, AXP192_SLAVE_ADDRESS)) {
|
||||||
DEBUG_MSG("AXP192 Begin PASS\n");
|
DEBUG_MSG("AXP192 Begin PASS\n");
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <driver/rtc_io.h>
|
#include <driver/rtc_io.h>
|
||||||
|
|
||||||
#ifdef T_BEAM_V10
|
#ifdef ARDUINO_T_Beam
|
||||||
#include "axp20x.h"
|
#include "axp20x.h"
|
||||||
extern AXP20X_Class axp;
|
extern AXP20X_Class axp;
|
||||||
#endif
|
#endif
|
||||||
|
@ -48,7 +48,7 @@ void setLed(bool ledOn)
|
||||||
digitalWrite(LED_PIN, ledOn);
|
digitalWrite(LED_PIN, ledOn);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef T_BEAM_V10
|
#ifdef ARDUINO_T_Beam
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
// blink the axp led
|
// blink the axp led
|
||||||
axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
|
axp.setChgLEDMode(ledOn ? AXP20X_LED_LOW_LEVEL : AXP20X_LED_OFF);
|
||||||
|
@ -60,7 +60,7 @@ void setGPSPower(bool on)
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Setting GPS power=%d\n", on);
|
DEBUG_MSG("Setting GPS power=%d\n", on);
|
||||||
|
|
||||||
#ifdef T_BEAM_V10
|
#ifdef ARDUINO_T_Beam
|
||||||
if (axp192_found)
|
if (axp192_found)
|
||||||
axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power
|
axp.setPowerOutPut(AXP192_LDO3, on ? AXP202_ON : AXP202_OFF); // GPS main power
|
||||||
#endif
|
#endif
|
||||||
|
@ -124,7 +124,7 @@ void doDeepSleep(uint64_t msecToWake)
|
||||||
|
|
||||||
setLed(false);
|
setLed(false);
|
||||||
|
|
||||||
#ifdef T_BEAM_V10
|
#ifdef ARDUINO_T_Beam
|
||||||
if (axp192_found) {
|
if (axp192_found) {
|
||||||
// No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would
|
// No need to turn this off if the power draw in sleep mode really is just 0.2uA and turning it off would
|
||||||
// leave floating input for the IRQ line
|
// leave floating input for the IRQ line
|
||||||
|
|
Ładowanie…
Reference in New Issue