💾 Archived View for thatit.be › 2024-07-07-09-38-07.gmi captured on 2024-07-09 at 00:38:59. Gemini links have been rewritten to link to archived content

View Raw

More Information

➡️ Next capture (2024-08-18)

-=-=-=-=-=-=-

building meshtastic from git at the cli

I cloned the meshtastic repo a few weeks back but was still using the browser based flasher and the images they package. The instructions for building from the CLI seemed absent from the repository. Or at least I didn’t see them.

What follows will be an explanation of how to do it.

The Process

Required Software

Platformio and whatever its dependencies are. On NixOS I just use the package. I assume it’s the same for other distributions, but you know, following whatever that distribution does for installing. I did have a bit of a snag where it didn’t want to use a virtual environment from platformio when platformio tried to pip install dependencies.

On Nix I used a temporary shell to do all of this instead of putting everything on my system.

nix-shell -p platformio esptool pkg-config \
             python3Packages.pip python3Packages.protobuf \
             python3Packages.grpcio python3Packages.grpcio-tools

All the other commands were done under this shell.

Clone

I cloned from here: https://github.com/meshtastic/firmware.git

git clone https://github.com/meshtastic/firmware.git

I forget if it used submodules, I’ll confirm it later.

git submodules init

Select Board

Edit the platformio.ini file your board by locating the [platformio] section and setting the .default_envs. I’m using the LilyGo T-Deck, so mine looks like this:

[platformio]
default_envs = t-deck

Build

platformio run

This might take a while. It fetches dependencies and does the build. When it completes, one of the last things it will say is the path to the newly built firmware file, that’s needed for the next step.

Wrote 0x1e66c0 bytes to file /home/stephen/firmware/.pio/build/t-deck/f
irmware.factory.bin, ready to flash to offset 0x0
==================== [SUCCESS] Took 192.52 seconds ====================

Environment    Status    Duration
-------------  --------  ------------
t-deck         SUCCESS   00:03:12.524
===================== 1 succeeded in 00:03:12.524 =====================

It looks like it went into .pio/build/t-deck/firmware.factory.bin.

Flash

In order to flash, you must put the device into flash mode and you need to know the path to the device.

To put the device in flash mode, turn off the power, hold the track ball down (you should feel it click softly), turn the power back on, and wait about 8 seconds before releasing the track ball.

You can discover what the device is by listing them with the device sub-command of platformio:

[stephen@sasahi:~/firmware]$ platformio device list
/dev/ttySAC0
------------
Hardware ID: n/a
Description: n/a

/dev/ttyACM0
------------
Hardware ID: USB VID:PID=303A:1001 SER=DCDA0C3A924C LOCATION=1-1:1.0
Description: Espressif Systems LilyGO T-Deck (16 MB FLASH, 8 MB PSRAM) - 
TinyUSB CDC

I still don’t know what /dev/ttySAC0 is, but on my system, /dev/ttyACM0 is the target.

To perform the flashing (from the firmware clone directory):

esptool.py write_flash 0x00 .pio/build/t-deck/firmware.factory.bin 

If the flashing is successful, you will see:

[nix-shell:~/firmware]$ esptool.py write_flash 0x00 .pio/build/t-deck/firmware.factory.bin
esptool.py v4.7.0
Found 2 serial ports
Serial port /dev/ttySAC0
/dev/ttySAC0 failed to connect: Could not open /dev/ttySAC0, the port is busy or doesn't exist.
([Errno 13] could not open port /dev/ttySAC0: [Errno 13] Permission denied: '/dev/ttySAC0')

Hint: Try to add user into dialout group: sudo usermod -a -G dialout $USER

Serial port /dev/ttyACM0
Connecting...
Detecting chip type... ESP32-S3
Chip is ESP32-S3 (QFN56) (revision v0.2)
Features: WiFi, BLE, Embedded PSRAM 8MB (AP_3v3)
Crystal is 40MHz
MAC: dc:da:0c:3a:92:4c
Uploading stub...
Running stub...
Stub running...
Configuring flash size...
Flash will be erased from 0x00000000 to 0x001ecfff...
Compressed 2019280 bytes to 1247036...
Wrote 2019280 bytes (1247036 compressed) at 0x00000000 in 15.4 seconds (effective 1045.8 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

When it finishes flashing, you may still need to manually reboot the device.

Conclusion

That’s it. It’s built and flashed.

The original raw notes from exploring this can be found here:

Tags

#index

#cli

#meshtastic

Navigation

index

tags

prev ⏰

Backlinks

2024-07-07 - tinkering with the meshtastic build stuff

updated: 2024-07-07 10:44:35

generated: 2024-07-08