Skip to content

Commit 8228256

Browse files
committed
Add Raspberry Pi build instructions to BUILD.md
Documents the rpi and rpi64 platform options for building natively on 32-bit and 64-bit Raspberry Pi OS respectively.
1 parent 905fb09 commit 8228256

1 file changed

Lines changed: 185 additions & 0 deletions

File tree

docs/BUILD.md

Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
# Building Basic Station
2+
3+
## Prerequisites
4+
5+
### For Native Linux Build
6+
7+
```bash
8+
sudo apt-get install -y build-essential
9+
```
10+
11+
### For Yocto/Bitbake Build (MTCDT)
12+
13+
Requires a configured mts-device build environment with Yocto/OpenEmbedded.
14+
15+
## Building Locally (Native Linux)
16+
17+
### Build Variants
18+
19+
| Variant | Description |
20+
|---------|-------------|
21+
| `testsim` | Single SX1301 simulator for regression tests |
22+
| `testms` | Multi-slave SX1301 simulator for regression tests |
23+
| `testsim1302` | Single SX1302/SX1303 simulator for regression tests |
24+
| `testms1302` | Multi-slave SX1302/SX1303 simulator for regression tests |
25+
26+
### Build Commands
27+
28+
```bash
29+
# Build a specific variant
30+
make platform=linux variant=testsim
31+
32+
# Build output is in build-linux-<variant>/
33+
ls build-linux-testsim/bin/station
34+
```
35+
36+
## Building for Raspberry Pi
37+
38+
Basic Station can be built natively on a Raspberry Pi for use with SX1301-based
39+
concentrators (e.g., RAK2245, IMST iC880A).
40+
41+
### Platform Selection
42+
43+
| Platform | Architecture | Raspberry Pi OS |
44+
|----------|--------------|-----------------|
45+
| `rpi` | arm-linux-gnueabihf | 32-bit (armhf) |
46+
| `rpi64` | aarch64-linux-gnu | 64-bit (arm64) |
47+
48+
To check which architecture your Raspberry Pi is running:
49+
50+
```bash
51+
gcc -dumpmachine
52+
# Returns: arm-linux-gnueabihf (32-bit) or aarch64-linux-gnu (64-bit)
53+
```
54+
55+
### Build Commands
56+
57+
```bash
58+
# For 64-bit Raspberry Pi OS
59+
make platform=rpi64 variant=std
60+
61+
# For 32-bit Raspberry Pi OS
62+
make platform=rpi variant=std
63+
64+
# Build output
65+
ls build-rpi64-std/bin/station
66+
```
67+
68+
### Clean Rebuild
69+
70+
If switching platforms or encountering build issues, clean the dependencies:
71+
72+
```bash
73+
make super-clean
74+
make platform=rpi64 variant=std
75+
```
76+
77+
### Running
78+
79+
```bash
80+
cd examples/live-s2.sm.tc
81+
~/basicstation/build-rpi64-std/bin/station
82+
```
83+
84+
Configure your station by editing `station.conf` and providing appropriate
85+
certificates and server URIs for your LoRaWAN Network Server.
86+
87+
## Building for MTCDT (Yocto/Bitbake)
88+
89+
### Hardware Mappings
90+
91+
| Machine | Card Model | Chipset | Recipe |
92+
|---------|------------|---------|--------|
93+
| mtcdt | MTAC-003 | SX1303 | lora-basic-station-sx1303 |
94+
| mtcdt | MTAC-LORA-1.5 | SX1301 | lora-basic-station |
95+
| mtcap3 | - | SX1303 | lora-basic-station-sx1303 |
96+
| mtcap | - | SX1301 | lora-basic-station |
97+
| mtcap2 | - | SX1301 | lora-basic-station |
98+
99+
### Setup Build Environment
100+
101+
```bash
102+
cd /path/to/mts-device
103+
export MACHINE=mtcdt
104+
source oe-init-build-env build
105+
```
106+
107+
### Build Recipes
108+
109+
| Recipe | Description |
110+
|--------|-------------|
111+
| `lora-basic-station` | SX1301-based concentrators |
112+
| `lora-basic-station-sx1303` | SX1302/SX1303-based concentrators |
113+
114+
### Build Commands
115+
116+
```bash
117+
# Build SX1301 variant
118+
bitbake lora-basic-station
119+
120+
# Build SX1303 variant
121+
bitbake lora-basic-station-sx1303
122+
123+
# Force recompile after source changes
124+
bitbake lora-basic-station -c compile -f
125+
bitbake lora-basic-station
126+
```
127+
128+
### Output Location
129+
130+
IPK packages are generated in:
131+
```
132+
build/tmp/deploy/ipk/mtcdt/lora-basic-station_*.ipk
133+
build/tmp/deploy/ipk/mtcdt/lora-basic-station-sx1303_*.ipk
134+
```
135+
136+
### Modifying Source Code
137+
138+
Source code for the recipe is located at:
139+
```
140+
build/tmp/work/mtcdt-mlinux-linux-gnueabi/lora-basic-station/<version>/git/
141+
```
142+
143+
To apply changes:
144+
1. Copy modified files to the git directory
145+
2. Run `bitbake <recipe> -c compile -f` to force recompile
146+
3. Run `bitbake <recipe>` to package
147+
148+
## Running Regression Tests
149+
150+
```bash
151+
cd regr-tests
152+
153+
# Run all tests
154+
./run-regression-tests --nohw
155+
156+
# Run with verbose output
157+
./run-regression-tests --nohw --verbose
158+
159+
# Run specific variant
160+
./run-regression-tests --nohw --variant=testsim
161+
```
162+
163+
### Test Timing
164+
165+
| Environment | Duration | Notes |
166+
|-------------|----------|-------|
167+
| GitHub CI (parallel) | ~5 minutes | Full suite across all variants |
168+
| Local (single variant) | ~15-20 minutes | All tests for one variant |
169+
170+
Individual test durations (testms1302 variant):
171+
172+
| Test | Duration | Notes |
173+
|------|----------|-------|
174+
| test1-selftests | ~6s | Quick sanity check |
175+
| test2-pps | ~12s | PPS timing tests |
176+
| test3-updn-tls | ~80s | TLS handshake overhead |
177+
| test4-cups | ~46s | CUPS update protocol |
178+
| test7-respawn | ~7s | Daemon restart |
179+
180+
For a quick smoke test, run `test1-selftests`:
181+
182+
```bash
183+
cd regr-tests/test1-selftests
184+
TEST_VARIANT=testms1302 ./test.sh
185+
```

0 commit comments

Comments
 (0)