Compile Arduino examples in CI
This commit is contained in:
parent
f926cd4a81
commit
949cad80cf
7
.github/workflows/ci.yml
vendored
7
.github/workflows/ci.yml
vendored
@ -13,3 +13,10 @@ jobs:
|
|||||||
cmake ..
|
cmake ..
|
||||||
make
|
make
|
||||||
./nanomodbus_tests
|
./nanomodbus_tests
|
||||||
|
- name: Compile Arduino examples
|
||||||
|
run: |
|
||||||
|
pushd build
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
|
||||||
|
popd
|
||||||
|
export PATH="build/bin:$PATH"
|
||||||
|
./examples/arduino/compile-examples.sh
|
||||||
|
|||||||
@ -4,3 +4,7 @@ This folder contains nanoMODBUS examples for Arduino.
|
|||||||
To build and load a sketch with the Arduino IDE, copy `nanomodbus.c` and `nanomodbus.h` inside its folder.
|
To build and load a sketch with the Arduino IDE, copy `nanomodbus.c` and `nanomodbus.h` inside its folder.
|
||||||
|
|
||||||
`client-rtu` and `server-rtu` are meant to be used with two Arduinos connected via their TX0/RX0 serial pins.
|
`client-rtu` and `server-rtu` are meant to be used with two Arduinos connected via their TX0/RX0 serial pins.
|
||||||
|
|
||||||
|
If you have [arduino-cli](https://github.com/arduino/arduino-cli) installed, you can run
|
||||||
|
`examples/arduino/compile-examples.sh` from the top-level nanoMODBUS directory to compile the examples.
|
||||||
|
They will be available in the `build` folder.
|
||||||
|
|||||||
24
examples/arduino/compile-examples.sh
Executable file
24
examples/arduino/compile-examples.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/env bash
|
||||||
|
set -e -o pipefail
|
||||||
|
|
||||||
|
# Set default board
|
||||||
|
BOARD=$1
|
||||||
|
if [ -z "${BOARD}" ]
|
||||||
|
then
|
||||||
|
echo No board specified, using arduino:avr:uno
|
||||||
|
BOARD=arduino:avr:uno
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set up example folders
|
||||||
|
mkdir -p build/arduino
|
||||||
|
cp -r examples/arduino build
|
||||||
|
cp nanomodbus.h nanomodbus.c build/arduino/server-rtu/
|
||||||
|
cp nanomodbus.h nanomodbus.c build/arduino/client-rtu/
|
||||||
|
|
||||||
|
# Ensure ardunio-cli is up to date
|
||||||
|
arduino-cli core update-index
|
||||||
|
arduino-cli core install arduino:avr
|
||||||
|
|
||||||
|
# Compile both examples
|
||||||
|
arduino-cli compile -b $BOARD --output-dir build/arduino -- build/arduino/server-rtu/server-rtu.ino
|
||||||
|
arduino-cli compile -b $BOARD --output-dir build/arduino -- build/arduino/client-rtu/client-rtu.ino
|
||||||
Loading…
Reference in New Issue
Block a user