diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b883398 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +ARG FROM=ubuntu:latest +FROM ${FROM} +ENV PATH="~/.local/bin:${PATH}" +RUN apt update && \ + DEBIAN_FRONTEND=noninteractive apt --yes upgrade && \ + DEBIAN_FRONTEND=noninteractive apt --yes install bzip2 curl git make python3 python3-pip && \ + rm -rf /var/lib/apt/lists/* && \ + update-alternatives --install /usr/bin/python python /usr/bin/python3 1 && \ + curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=/usr/local/bin sh -s 1.1.1 + +# How to build/run this container (should also work with docker CLI): +# nerdctl build --file Dockerfile --tag rnode-builder:latest . +# nerdctl run --interactive \ +# --mount src=${PWD},target=/RNode_Firmware_CE,type=bind \ +# --mount src=${HOME},target=/root,type=bind \ +# --tty --rm rnode-builder:latest + +# Arduino expects the same name of the directory inside the container as it is named outside, e.g.: "RNode_Firmware_CE". +# See https://github.com/microsoft/vscode-arduino/issues/1665#issuecomment-1764234405 + +# Once there's a release after "1.2.0", we can remove the "-s" option for the installer script. +# See https://github.com/arduino/arduino-cli/issues/2860 +# See https://arduino.github.io/arduino-cli/latest/installation diff --git a/Documentation/BUILDING.md b/Documentation/BUILDING.md index d995d31..ddd42ac 100644 --- a/Documentation/BUILDING.md +++ b/Documentation/BUILDING.md @@ -4,7 +4,7 @@ The build system of this repository is based on GNU Make. The `Makefile` is in t Firstly, figure out which MCU platform your supported board is based on. The table below can help you. -| Board name | Link | Transceiver | MCU | Description | +| Board name | Link | Transceiver | MCU | Description | | :--- | :---: | :---: | :---: | :---: | | Handheld v2.x RNodes | [Buy here](https://unsigned.io/shop/product/handheld-rnode) | SX1276 | ESP32 | | RAK4631 | [Buy here](https://store.rakwireless.com/products/rak4631-lpwan-node?m=5&h=wisblock-core) | SX1262 | nRF52 | @@ -13,7 +13,8 @@ Firstly, figure out which MCU platform your supported board is based on. The tab | LilyGO LoRa32 v2.0 | No link | SX1276/8 | ESP32 | Discontinued? | | LilyGO LoRa32 v2.1 | [Buy here](https://www.lilygo.cc/products/lora3) | SX1276/8 | ESP32 | With and without TCXO | | Heltec LoRa32 v2 | No link | SX1276/8 | ESP32 | Discontinued? | -| Heltec LoRa32 v3 | [Buy here](https://heltec.org/project/wifi-lora-32-v3/) | SX1262 | ESP32 | +| Heltec LoRa32 v3 | [Buy here](https://heltec.org/project/wifi-lora-32-v3/) | SX1262 | ESP32 | +| Heltec T114 v2.0 | [Buy here](https://heltec.org/project/mesh-node-t114/) | SX1262 | nRF52 | | Homebrew ESP32 boards | | Any supported | ESP32 | This can be any board with an Adafruit Feather (or generic) ESP32 chip | ### ESP32 @@ -24,7 +25,7 @@ If your board is nRF52-based, please run `make prep-nrf` to install the required ## Compiling Next, you need to find the name of the target for your board. Please reference the table below to do so: -| Board name | Target | +| Board name | Target | | :--- | :---: | | Handheld v2.x RNodes | `rnode_ng_20` | | RAK4631 | `rak4631` | @@ -34,7 +35,8 @@ Next, you need to find the name of the target for your board. Please reference t | LilyGO LoRa32 v2.0 | `lora32_v20` | | LilyGO LoRa32 v2.1 | `lora32_v21` | | Heltec LoRa32 v2 | `heltec32_v2` | -| Heltec LoRa32 v3 | `heltec32_v3` | +| Heltec LoRa32 v3 | `heltec32_v3` | +| Heltec T114 v2.0 | `heltec_t114` or `heltec_t114_gps` | | Homebrew ESP32 boards | `genericesp32` | After you've ascertained the target for the board simply run the following to compile for the board: @@ -64,48 +66,57 @@ After flashing a custom board, you will also need to provision the EEPROM before - platform must either be AVR, ESP32 or NRF52 - hwrev is required (any integer between 1 and 255) -- model should be something from the list below without the leading `0x` and in lowercase (example `e8`): +- model should be something from the list below without the leading `0x` and in lowercase (example `e8`; See `Boards.h`): ``` -0x11: [430000000, 510000000, 22, "430 - 510 MHz", "rnode_firmware_rak4631.zip", "SX1262"], -0x12: [779000000, 928000000, 22, "779 - 928 MHz", "rnode_firmware_rak4631.zip", "SX1262"], -0xA4: [410000000, 525000000, 14, "410 - 525 MHz", "rnode_firmware.hex", "SX1278"], -0xA9: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware.hex", "SX1276"], -0xA1: [410000000, 525000000, 22, "410 - 525 MHz", "rnode_firmware_t3s3.zip", "SX1268"], -0xA6: [820000000, 1020000000, 22, "820 - 960 MHz", "rnode_firmware_t3s3.zip", "SX1262"], -0xA2: [410000000, 525000000, 17, "410 - 525 MHz", "rnode_firmware_ng21.zip", "SX1278"], -0xA7: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware_ng21.zip", "SX1276"], -0xA3: [410000000, 525000000, 17, "410 - 525 MHz", "rnode_firmware_ng20.zip", "SX1278"], -0xA8: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware_ng20.zip", "SX1276"], -0xB3: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_lora32v20.zip", "SX1278"], -0xB8: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_lora32v20.zip", "SX1276"], -0xB4: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_lora32v21.zip", "SX1278"], -0xB9: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_lora32v21.zip", "SX1276"], 0x04: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_lora32v21_tcxo.zip", "SX1278"], 0x09: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_lora32v21_tcxo.zip", "SX1276"], +0x11: [430000000, 510000000, 22, "430 - 510 MHz", "rnode_firmware_rak4631.zip", "SX1262"], +0x12: [779000000, 928000000, 22, "779 - 928 MHz", "rnode_firmware_rak4631.zip", "SX1262"], +0xA1: [410000000, 525000000, 22, "410 - 525 MHz", "rnode_firmware_t3s3.zip", "SX1268"], +0xA2: [410000000, 525000000, 17, "410 - 525 MHz", "rnode_firmware_ng21.zip", "SX1278"], +0xA3: [410000000, 525000000, 17, "410 - 525 MHz", "rnode_firmware_ng20.zip", "SX1278"], +0xA4: [410000000, 525000000, 14, "410 - 525 MHz", "rnode_firmware.hex", "SX1278"], +0xA6: [820000000, 1020000000, 22, "820 - 960 MHz", "rnode_firmware_t3s3.zip", "SX1262"], +0xA7: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware_ng21.zip", "SX1276"], +0xA8: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware_ng20.zip", "SX1276"], +0xA9: [820000000, 1020000000, 17, "820 - 1020 MHz", "rnode_firmware.hex", "SX1276"], +0xB3: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_lora32v20.zip", "SX1278"], +0xB4: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_lora32v21.zip", "SX1278"], +0xB8: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_lora32v20.zip", "SX1276"], +0xB9: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_lora32v21.zip", "SX1276"], 0xBA: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_lora32v10.zip", "SX1278"], 0xBB: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_lora32v10.zip", "SX1276"], 0xC4: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_heltec32v2.zip", "SX1278"], -0xC9: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_heltec32v2.zip", "SX1276"], 0xC5: [470000000, 510000000, 21, "470 - 510 MHz", "rnode_firmware_heltec32v3.zip", "SX1262"], +0xC7: [863000000, 928000000, 22, "863 - 928 MHz", "rnode_firmware_heltec_t114.zip", "SX1262"], +0xC9: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_heltec32v2.zip", "SX1276"], 0xCA: [863000000, 928000000, 21, "863 - 928 MHz", "rnode_firmware_heltec32v3.zip", "SX1262"], -0xE4: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_tbeam.zip", "SX1278"], -0xE9: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_tbeam.zip", "SX1276"], +0xCB: [863000000, 928000000, 22, "863 - 928 MHz", "rnode_firmware_heltec_t114_gps.zip", "SX1262"], 0xE3: [420000000, 520000000, 22, "420 - 520 MHz", "rnode_firmware_tbeam_sx1262.zip", "SX1268"], +0xE4: [420000000, 520000000, 17, "420 - 520 MHz", "rnode_firmware_tbeam.zip", "SX1278"], 0xE8: [850000000, 950000000, 22, "850 - 950 MHz", "rnode_firmware_tbeam_sx1262.zip", "SX1262"], +0xE9: [850000000, 950000000, 17, "850 - 950 MHz", "rnode_firmware_tbeam.zip", "SX1276"], 0xFE: [100000000, 1100000000, 17, "(Band capabilities unknown)", None, "Unknown"], 0xFF: [100000000, 1100000000, 14, "(Band capabilities unknown)", None, "Unknown"], ``` -- product should be a code from the following list below without the leading `0x` and in lowercase (example `f0`): +- product should be a code from the following list below without the leading `0x` and in lowercase (example `f0`; See `Boards.h`): ``` -PRODUCT_RAK4631 = 0x10 -PRODUCT_RNODE = 0x03 -PRODUCT_T32_10 = 0xB2 -PRODUCT_T32_20 = 0xB0 -PRODUCT_T32_21 = 0xB1 -PRODUCT_H32_V2 = 0xC0 -PRODUCT_H32_V3 = 0xC1 -PRODUCT_TBEAM = 0xE0 -PRODUCT_HMBRW = 0xF0 +PRODUCT_RNODE = 0x03 +PRODUCT_RAK4631 = 0x10 +PRODUCT_TECHO = 0x15 +PRODUCT_OPENCOM_XL = 0x20 +PRODUCT_T32_20 = 0xB0 +PRODUCT_T32_21 = 0xB1 +PRODUCT_T32_10 = 0xB2 +PRODUCT_H32_V2 = 0xC0 +PRODUCT_H32_V3 = 0xC1 +PRODUCT_HELTEC_T114 = 0xC2 +PRODUCT_H_W_PAPER = 0xC3 +PRODUCT_TDECK_V1 = 0xD0 +PRODUCT_TBEAM = 0xE0 +PRODUCT_TBEAM_S_V1 = 0xEA +PRODUCT_XIAO_ESP32S3 = 0xEB +PRODUCT_HMBRW = 0xF0 ``` **Please note**, you must re-compile the firmware each time you make changes **before** you flash it, else you will just be flashing the previous version of the firmware without the new changes! diff --git a/Makefile b/Makefile index f529c1d..f1d895e 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,7 @@ firmware-opencom-xl: arduino-cli compile --fqbn rakwireless:nrf52:WisCoreRAK4631Board $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x52\" \"-DBOARD_VARIANT=0x21\"" firmware-heltec_t114: + python3 ./Scripts/heltec_nrf52_bsp_prep.py arduino-cli compile --log --fqbn Heltec_nRF52:Heltec_nRF52:HT-n5262 -e --build-property "build.partitions=no_ota" --build-property "upload.maximum_size=2097152" --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x3C\"" firmware-heltec_t114_gps: diff --git a/README.md b/README.md index 7185960..4cf07bf 100644 --- a/README.md +++ b/README.md @@ -35,18 +35,18 @@ You must have at least version `2.1.3` of `rnodeconf` installed to update your R | openCom XL | [Liberated Embedded Systems](https://liberatedsystems.co.uk) | [Buy here](https://store.liberatedsystems.co.uk/product/opencom-xl/) | SX1262 & SX1280 | nRF52 | Supports utilisation of both modems at once | ### Homebrew devices -| Board name | Link | Transceiver | MCU | Description | +| Board name | Link | Transceiver | MCU | Description | | :--- | :---: | :---: | :---: | :---: | | RAK4631 | [Buy here](https://store.rakwireless.com/products/rak4631-lpwan-node?m=5&h=wisblock-core) | SX1262 | nRF52 | | LilyGO T-BEAM v1.1 | [Buy here](https://www.lilygo.cc/products/t-beam-v1-1-esp32-lora-module) | SX1276/8 or SX1262 | ESP32 | -| LilyGO T-Beam Supreme | [Buy here](https://lilygo.cc/products/t-beam-supreme) | SX1262 | ESP32-S3 | +| LilyGO T-Beam Supreme | [Buy here](https://lilygo.cc/products/t-beam-supreme) | SX1262 | ESP32-S3 | | LilyGO LoRa32 v1.0 | [Buy here](https://www.lilygo.cc/products/lora32-v1-0) | SX1276/8 | ESP32 | | LilyGO LoRa32 v2.0 | No link | SX1276/8 | ESP32 | Discontinued? | | LilyGO LoRa32 v2.1 | [Buy here](https://www.lilygo.cc/products/lora3) | SX1276/8 | ESP32 | With and without TCXO | | Heltec LoRa32 v2 | No link | SX1276/8 | ESP32 | Discontinued? | -| Heltec LoRa32 v3 | [Buy here](https://heltec.org/project/wifi-lora-32-v3/) | SX1262 | ESP32 | +| Heltec LoRa32 v3 | [Buy here](https://heltec.org/project/wifi-lora-32-v3/) | SX1262 | ESP32 | | LilyGo T3S3 v1.0 | [Buy here](https://lilygo.cc/products/t3s3-v1-0) | SX1262 or SX1276 or SX1280 | ESP32-S3 | -| Heltec T114 | [Buy here](https://heltec.org/project/mesh-node-t114/) | SX1262 | nRF52 | +| Heltec T114 v2.0 | [Buy here](https://heltec.org/project/mesh-node-t114/) | SX1262 | nRF52 | | Homebrew ESP32 boards | | Any supported | ESP32 | This can be any board with an Adafruit Feather (or generic) ESP32 chip | It's easy to create your own RNodes from one of the supported development boards and devices. If a device or board you want to use is not yet supported, you are welcome to [join the effort](Documentation/CONTRIBUTING.md) and help create a board definition and pin mapping for it! @@ -158,7 +158,7 @@ Please see [here](Documentation/FAQ.md). ## License & Use The upstream RNode Firmware is Copyright © 2024 Mark Qvist / [unsigned.io](https://unsigned.io). -The modified RNode Firmware CE (community edition) is Copyright © Jacob Eva / [Liberated Embedded Systems](https://liberatedsystems.co.uk) and is made available under the **GNU General Public License v3.0**. +The modified RNode Firmware CE (community edition) is Copyright © Jacob Eva / [Liberated Embedded Systems](https://liberatedsystems.co.uk) and is made available under the **GNU General Public License v3.0**. The source code includes an SX1276 driver that is released under MIT License, and Copyright © 2018 Sandeep Mistry / Mark Qvist. The SX126x and SX128x drivers are adaptations of this original driver. diff --git a/Scripts/heltec_nrf52_bsp_prep.py b/Scripts/heltec_nrf52_bsp_prep.py new file mode 100755 index 0000000..2372767 --- /dev/null +++ b/Scripts/heltec_nrf52_bsp_prep.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python + +# This is a helper script to perform some additional preparation steps before +# building. This helper script may be deleted once some upstream bugs go away. +# Tested with Python 3.13.2 on Linux. +# See https://github.com/liberatedsystems/RNode_Firmware_CE/blob/master/Documentation/BUILDING.md + +# There's a minor issue when building images for "Heltec T114" boards. The fix +# has been merged but there's no release after "1.7.0" containing this yet. As +# a result, we need to correct some files between the "make prep-nrf" and "make +# firmware-heltec_t114_gps" steps. +# See https://github.com/HelTecAutomation/Heltec_nRF52/issues/4 +# See https://github.com/HelTecAutomation/Heltec_nRF52/pull/3 + +# An equivalent shell command for doing this would be the following (GNU sed, not BSD sed): +# find ~/.arduino15/packages/Heltec_nRF52 -name 'platform.txt' | xargs \ +# sed -i 's/recipe\.objcopy\.uf2\.pattern="{tools\.uf2conv\.cmd}"/recipe\.objcopy\.uf2\.pattern={tools\.uf2conv\.cmd}/' + + +from fnmatch import fnmatch +from os import environ, path, walk +from re import sub +from shutil import move +from tempfile import mkstemp + + +def find_all_files_to_fix() -> list: + found = [] + for root, dirs, files in walk( + f'{environ["HOME"]}/.arduino15/packages/Heltec_nRF52' + ): + for file in files: + if fnmatch(file, 'platform.txt'): + found.append(path.join(root, file)) + return found + + +def sed_fix_files_in_place(files: list = []) -> None: + for file in files: + fd, temp = mkstemp() + with open(file, 'r') as source, open(temp, 'w') as dest: + for line in source: + out = sub( + r'recipe.objcopy.uf2.pattern="{tools.uf2conv.cmd}"', + r'recipe.objcopy.uf2.pattern={tools.uf2conv.cmd}', + line, + ) + dest.write(out) + move(temp, file) + + +if '__main__' == __name__: + sed_fix_files_in_place(find_all_files_to_fix())