@ -1,5 +1,9 @@
# How to compile the rnode firmware yourself
##
This document
## Dependencies
Make sure *git* , *make* , *python* and *pip* are instaled. Most likely these are already availble on your system. Otherwise do:
@ -13,6 +17,12 @@ Install Reticulum:
$ pip install rns --break-system-packages
Add rns software to path:
$ nano ~/.bashrc
Add `export PATH=~/.local/bin:$PATH` to the end of the file. Exit with `CTRL-x` and type `y` to save the changes.
Download arduino-cli:
$ cd
@ -24,6 +34,8 @@ Add arduino-cli to path by editing ~/.bashrc
Add `export PATH=~/bin:$PATH` to end of file. Exit with `CTRL-x` and type `y` to save the changes.
Now reload the shell so the changes to the path will take effect: `exec $SHELL` . You can also logout and login again.
## Clone git repo
$ git clone https://github.com/liberatedsystems/RNode_Firmware_CE.git
@ -35,13 +47,7 @@ Install the required BSP and libraries for the ESP32 system.
$ cd RNode_Firmware_CE/
$ make prep-esp32
This command stalled. I stopped the command by hiting CTRL-C and restarted it.
Add rns software to path:
$ nano ~/.bashrc
Add `export PATH=~/.local/bin:$PATH` to the end of the file. Exit with `CTRL-x` and type `y` to save the changes.
Sometimes this command stalls. If this happens, stop the command by hiting `CTRL-c` and restarted it.
## Test
@ -123,28 +129,36 @@ If we want to add support for a new board we have to add a new section for this
## Define new board for real
Let's say we want to add support for the Waveshare ESP32-S3 Pico with an SX1278 LoRa transceiver. First we have to make define both BOARD_MODEL and BOARD_VARIANT. Let's define BOARD_MODEL as 0x61 and BOARD_VARIANT as 0x31 as these numbers are not used yet. Here the 0x31 indicates the use of a SX1278 LoRa transceiver. In the future we can define more transceivers for this board. Then we make entries in the Makefile .
Let's say we want to add support for the Waveshare ESP32-S3 Pico with an SX1278 LoRa transceiver. First we have to define a BOARD_MODEL. This is a 8 bit value that is used in the source code to select the right code for the hardware. Let's choose 0x61 as the BOARD_MODEL as this number is not used yet .
# Added board from Mees Electronics
firmware-waveshare-esp32-s3-pico: check_bt_buffers
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\""
Now we add the following three entries in the Makefile. The exact place is not critical. But it is good practice to put them allongside the already present sections for firmware, upload and release.
# Added board from Mees Electronics
upload-waveshare-esp32-s3-pico:
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:esp32s3
@sleep 1
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin)
@sleep 3
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) --chip esp32-s3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
release-waveshare-esp32-s3-pico:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\" \"-DBOARD_VARIANT=0x31\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_waveshare-esp32-s3-pico.boot_app0
cp build/esp32.esp32.waveshare-esp32-s3-pico/RNode_Firmware_CE.ino.bin build/rnode_firmware_waveshare-esp32-s3-pico.bin
cp build/esp32.esp32.waveshare-esp32-s3-pico/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_waveshare-esp32-s3-pico.bootloader
cp build/esp32.esp32.waveshare-esp32-s3-pico/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_waveshare-esp32-s3-pico.partitions
zip --junk-paths ./Release/rnode_firmware_waveshare-esp32-s3-pico.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx126xrnode_firmware_waveshare-esp32-s3-pico.boot_app0 build/rnode_firmware_waveshare-esp32-s3-pico.bin build/rnode_firmware_waveshare-esp32-s3-pico.bootloader build/rnode_firmware_waveshare-esp32-s3-pico.partitions
rm -r build
```
# Added board from Mees Electronics
firmware-waveshare-esp32-s3-pico: check_bt_buffers
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\""
```
```
# Added board from Mees Electronics
upload-waveshare-esp32-s3-pico:
arduino-cli upload -p $(or $(port), /dev/ttyACM0) --fqbn esp32:esp32:esp32s3
@sleep 1
rnodeconf $(or $(port), /dev/ttyACM0) --firmware-hash $$(./partition_hashes ./build/esp32.esp32.esp32s3/RNode_Firmware_CE.ino.bin)
@sleep 3
python3 ./Release/esptool/esptool.py --port $(or $(port), /dev/ttyACM0) --chip esp32-s3 --baud 921600 --before default_reset --after hard_reset write_flash -z --flash_mode dio --flash_freq 80m --flash_size 4MB 0x210000 ./Release/console_image.bin
```
```
release-waveshare-esp32-s3-pico:
arduino-cli compile --fqbn "esp32:esp32:esp32s3:CDCOnBoot=cdc" $(COMMON_BUILD_FLAGS) --build-property "compiler.cpp.extra_flags=\"-DBOARD_MODEL=0x61\" \"-DBOARD_VARIANT=0x31\""
cp ~/.arduino15/packages/esp32/hardware/esp32/$(ARDUINO_ESP_CORE_VER)/tools/partitions/boot_app0.bin build/rnode_firmware_waveshare-esp32-s3-pico.boot_app0
cp build/esp32.esp32.waveshare-esp32-s3-pico/RNode_Firmware_CE.ino.bin build/rnode_firmware_waveshare-esp32-s3-pico.bin
cp build/esp32.esp32.waveshare-esp32-s3-pico/RNode_Firmware_CE.ino.bootloader.bin build/rnode_firmware_waveshare-esp32-s3-pico.bootloader
cp build/esp32.esp32.waveshare-esp32-s3-pico/RNode_Firmware_CE.ino.partitions.bin build/rnode_firmware_waveshare-esp32-s3-pico.partitions
zip --junk-paths ./Release/rnode_firmware_waveshare-esp32-s3-pico.zip ./Release/esptool/esptool.py ./Release/console_image.bin build/rnode_firmware_t3s3_sx126xrnode_firmware_waveshare-esp32-s3-pico.boot_app0 build/rnode_firmware_waveshare-esp32-s3-pico.bin build/rnode_firmware_waveshare-esp32-s3-pico.bootloader build/rnode_firmware_waveshare-esp32-s3-pico.partitions
rm -r build
```
In the file Boards.h make an entry for the new board inside the '#if MCU_VARIANT == MCU_ESP32':