Arduino CLI build system with HAL-based test architecture
Build and upload tool (arduino-build.sh): - Compile, upload, and monitor via arduino-cli - Device discovery with USB ID identification (--devices) - Persistent reconnecting serial monitor (--watch) - Split compile/upload workflow (--verify, --upload-only) - First-time setup wizard (--setup) - Comprehensive --help with troubleshooting and RedBoard specs Testable application architecture: - Hardware abstraction layer (lib/hal/) decouples logic from Arduino API - Google Mock HAL for unit tests (exact call verification) - Simulated HAL for system tests (GPIO state, virtual clock, I2C devices) - Example I2C temperature sensor simulator (TMP102) - Host-side test suite via CMake + Google Test (21 tests) Example sketch: - blink/ -- LED blink with button-controlled speed, wired through HAL
This commit is contained in:
79
README.md
Normal file
79
README.md
Normal file
@@ -0,0 +1,79 @@
|
||||
# SparkFun RedBoard Projects
|
||||
|
||||
Arduino sketches for SparkFun RedBoard, built and uploaded via `arduino-build.sh`.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [arduino-cli](https://arduino.github.io/arduino-cli/)
|
||||
- Run `./arduino-build.sh --setup` once after installing
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
./arduino-build.sh --devices # find your board
|
||||
./arduino-build.sh --monitor ./blink # build, upload, serial console
|
||||
```
|
||||
|
||||
## Project Layout
|
||||
|
||||
```
|
||||
sparkfun/
|
||||
arduino-build.sh Build/upload/monitor tool (run --help)
|
||||
blink/
|
||||
blink.ino LED blink + serial hello world
|
||||
```
|
||||
|
||||
## Two-Terminal Workflow
|
||||
|
||||
```bash
|
||||
# Terminal 1: persistent serial monitor
|
||||
./arduino-build.sh --watch
|
||||
|
||||
# Terminal 2: edit, build, upload (monitor reconnects automatically)
|
||||
./arduino-build.sh ./blink
|
||||
```
|
||||
|
||||
## Adding a New Sketch
|
||||
|
||||
```bash
|
||||
mkdir my_sketch
|
||||
# Create my_sketch/my_sketch.ino (filename must match directory)
|
||||
./arduino-build.sh --verify ./my_sketch # compile check
|
||||
./arduino-build.sh ./my_sketch # build + upload
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Ubuntu: Board not detected (CH340 / RedBoard)
|
||||
|
||||
On Ubuntu, `brltty` (a braille display daemon) may claim the CH340 USB-serial
|
||||
interface before the `ch341` kernel driver can bind to it. The board will appear
|
||||
in `lsusb` but no `/dev/ttyUSB*` device is created.
|
||||
|
||||
Symptoms in `dmesg`:
|
||||
|
||||
```
|
||||
usb 1-3.1.3: usbfs: interface 0 claimed by ch341 while 'brltty' sets config #1
|
||||
ch341-uart ttyUSB0: ch341-uart converter now disconnected from ttyUSB0
|
||||
```
|
||||
|
||||
If you are not using a braille display, remove `brltty` entirely:
|
||||
|
||||
```bash
|
||||
sudo systemctl stop brltty-udev
|
||||
sudo systemctl disable brltty-udev
|
||||
sudo systemctl stop brltty
|
||||
sudo systemctl disable brltty
|
||||
sudo apt remove brltty
|
||||
```
|
||||
|
||||
Alternatively, to keep `brltty` installed but block it from claiming CH340
|
||||
devices, add a udev rule:
|
||||
|
||||
```bash
|
||||
sudo tee /etc/udev/rules.d/99-ch340-no-brltty.rules << 'EOF'
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", ENV{BRLTTY_BRAILLE_DRIVER}="none"
|
||||
EOF
|
||||
sudo udevadm control --reload-rules
|
||||
sudo udevadm trigger
|
||||
```
|
||||
Reference in New Issue
Block a user