-
Notifications
You must be signed in to change notification settings - Fork 52
9. Build from Source
Language: English. Chinese version: 9. Build from Source (中文)
This page is for developers rather than first-time users. It answers a different question: if you plan to modify code locally, validate targets, follow the current branch, or adapt new hardware, how should you understand the repository’s current build paths.
If your goal is only to flash a device and get started, read [[3. Installation & Flashing]] first.
Trail Mate is no longer a single-toolchain project. The main repository currently has at least two real build paths in active use:
-
PlatformIO + Arduinofor the existing ESP32 handheld targets and the current nRF52 target -
ESP-IDFfor the shared-shell large-screen line centered ontab5andt_display_p4
The longer-term architecture documents also leave room for Linux paths, but that is not the main stable user-facing route today.
For daily builds, regression checks, or mainline debugging, start with:
tlora_pager_sx1262tdeckgat562_mesh_evb_pro
The reason is practical:
-
tlora_pager_sx1262andtdeckare closest to a full feature loop today -
gat562_mesh_evb_proexposes resource-constrained boundaries early
If you start with Tab5 or T-Display P4, you will often be debugging bring-up and platform-evolution issues before you are really looking at the main Trail Mate path itself.
platformio run -e tlora_pager_sx1262
platformio run -e tdeck
platformio run -e gat562_mesh_evb_proThe repository already contains several debug environments, for example:
platformio run -e tlora_pager_sx1262_debug
platformio run -e tlora_pager_sx1280_debug
platformio run -e tdeck_debug
platformio run -e lilygo_twatch_s3_debugThese enable additional logging-related macros such as:
MESHCORE_LOG_ENABLELORA_LOG_ENABLEAPP_EVENT_LOG_ENABLE
That makes them useful for protocol, radio, and board-level diagnosis, but not automatically ideal for every constrained target during normal validation.
The root platformio.ini now mainly carries shared configuration. Specific target environments are distributed under:
variants/*/envs/*.ini
So when you are looking for build differences, do not stop at the root config. Screen size, input model, radio variant, and debug macro differences often live inside the target-specific environment files.
The README currently names these IDF targets explicitly:
tab5t_display_p4
idf.py -B build.tab5 -DTRAIL_MATE_IDF_TARGET=tab5 reconfigure build
idf.py -B build.tab5 -DTRAIL_MATE_IDF_TARGET=tab5 -p COM6 flash
idf.py -B build.tab5 -DTRAIL_MATE_IDF_TARGET=tab5 monitor-
apps/esp_idfis the shared IDF application-shell root - each board target hangs off
apps/esp_idf/targets/<board>/ -
sdkconfiglives with the build directory rather than polluting the repository root
If you are used to “one board, one whole app tree”, the project is intentionally moving away from that model and toward “shared shell plus board-specific target metadata”.
The top-level directories most relevant to development are:
apps/
boards/
modules/
platform/
variants/
tools/
docs/
Their roles can be summarized like this:
-
apps/: app shells and entry points -
boards/: board runtime and board-specific facts -
modules/: shared business logic and protocol, map, Team, UI cores -
platform/: platform adaptation layers -
variants/: PlatformIO target environments and build differences -
tools/: helper scripts -
docs/: design, protocol, and focused technical notes
The repository does not currently express “release” and “debug” as one unified global switch. Instead, those differences are mostly modeled through target environments.
The practical distinctions are usually:
- whether extra protocol, radio, or event logs are enabled
- whether the configuration remains suitable for constrained targets
- whether the result matches the mainline validation path more closely
So if your goal is “is this feature still working”, start with the ordinary environment. If your goal is “why is this protocol or board path behaving strangely”, then move to the debug environment.
A successful firmware build does not mean the whole feature set is ready to demonstrate. In Trail Mate, code and resources are separate concerns.
Even after firmware builds correctly:
- maps still need offline tiles
- routes still need
/routes/*.kml - track workflows still need
/trackers/*
When validating features, treat resource preparation as part of the test setup rather than assuming build success implies full behavior.
This is more common than many C++ errors. It includes cases such as choosing the wrong Pager radio variant or trying to validate the mainline through an experimental large-screen target.
If a piece of code suddenly depends directly on Arduino, ESP-IDF, FreeRTOS, or LVGL headers from inside what should be a shared module, the problem may be an architectural boundary violation rather than a simple build break.
Targets like GAT562 are not just another compile destination. They have explicit resource and feature boundaries, so assumptions that are harmless on larger ESP32 devices may not survive there.
If you plan to change code, this order usually builds the right context fastest:
[[10. Codebase Overview]][[11. Architecture]][[12. Design Decisions]]- then come back to the target-specific env, board, and platform implementation
That order helps prevent a common mistake: reading one .cpp file in isolation and confusing the current local implementation with the project’s intended long-term boundary.
English
- Home
- 0. Why This Exists
- 1. Quick Start
- 2. Supported Hardware
- 3. Installation & Flashing
- 3.5 Configuration Guide
- 4. Protocols & Data
- 4.1 Reticulum, LXMF and RNode Bridge
- 5. Offline Maps
- 6. Trail Mate Center
- 7. Team Features
- 8. UI Overview
- 9. Build from Source
- 10. Codebase Overview
- 11. Architecture
- 12. Design Decisions
- 13. FAQ
- 14. Troubleshooting
- 15. Logging and Debugging
- 16. Roadmap
- 17. Contributing
- 18. License and Third-Party
- 19. GPS Setting Guide
中文
- Home (中文)
- 0. Why This Exists (中文)
- 1. Quick Start (中文)
- 2. Supported Hardware (中文)
- 3. Installation & Flashing (中文)
- 3.5 Configuration Guide (中文)
- 4. Protocols & Data (中文)
- 4.1 Reticulum, LXMF and RNode Bridge (中文)
- 5. Offline Maps (中文)
- 6. Trail Mate Center (中文)
- 7. Team Features (中文)
- 8. UI Overview (中文)
- 9. Build from Source (中文)
- 10. Codebase Overview (中文)
- 11. Architecture (中文)
- 12. Design Decisions (中文)
- 13. FAQ (中文)
- 14. Troubleshooting (中文)
- 15. Logging and Debugging (中文)
- 16. Roadmap (中文)
- 17. Contributing (中文)
- 18. License and Third-Party (中文)