Skip to content

Firmware Over-The-Air (OTA) update capability #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 49 commits into from
Jun 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
008848f
The topic name for the OTA input and output topic will be stored as m…
aentinger Apr 27, 2020
04db350
Providing capability for a unified interface described via class OTAS…
aentinger Apr 27, 2020
b323ef1
Replacing direct storing of ota storage class with injecting it via '…
aentinger Apr 28, 2020
4eaf3a0
Subscribe to OTA in topic which is used to receive the update binary …
aentinger Apr 28, 2020
8b9b744
Adding first draft of class containing business logic for handling OT…
aentinger Apr 28, 2020
7e94a09
Basic implementation of OTA business logic
aentinger Apr 28, 2020
eb5fe52
Adding test code for invalid CRC32
aentinger Apr 29, 2020
f55c5ec
Adding method to determine the type of the provide OTAStorage medium.…
aentinger Apr 30, 2020
9c1c3ec
The type of the available OTA storage is set to the hidden property '…
aentinger Apr 30, 2020
80056c8
Passing OTA storage object upon construction of OTALogic simplifies e…
aentinger Apr 30, 2020
42050d1
The complete OTA storage medium handling is now encapsulated within t…
aentinger Apr 30, 2020
3fd32f2
Pass on received OTA data to OTALogic is an OTALogic object has been …
aentinger Apr 30, 2020
07adcfd
Adding enum class OTAError which allows a more granular feedback on t…
aentinger May 4, 2020
e38d7e8
Add OTAError::ChecksumMismatch which occures then the expected checks…
aentinger May 4, 2020
b5b4d81
Only allow external access of internal state when using this for test…
aentinger May 4, 2020
68ff14c
Also directly return the error state when calling the update method
aentinger May 4, 2020
80b651e
Adding fakeIt mock framework
aentinger May 4, 2020
6c3a6ce
Replacing self written OTAStorage_Mock with fakeit mocking framework
aentinger May 4, 2020
60bd9ae
When the OTAStorage::init operation fails the OTA logic should transi…
aentinger May 4, 2020
539ace2
When the opening of the file on the OTA storage device for the update…
aentinger May 4, 2020
aa454bb
When the writing to the file on the OTA storage device for the update…
aentinger May 4, 2020
6a26662
Assigning defined values to the various error types in order to have …
aentinger May 4, 2020
671e495
ESP8266 isn't as advanced as Arduino framework concerning modern C++ …
aentinger May 4, 2020
a7357da
Method 'error()' is only available when compiling for host, there is …
aentinger May 5, 2020
0abcbf1
Adding hidden property OTA_ERROR which contains an integer encoded er…
aentinger May 5, 2020
b892ce9
When a data overrun occurs because the MQTT OTA data buffer is full b…
aentinger May 5, 2020
3330034
Extracting initialisation of MQTT OTA buffer and control data for bin…
aentinger May 5, 2020
f963616
Fixing typos in order to satisfy CI spell check
aentinger May 5, 2020
d2b4fd8
The OTA out topic is not being used, therefore it can be removed from…
aentinger May 5, 2020
1e8b8b9
Add GitHub Actions workflow to run unit tests and check code coverage
per1234 May 5, 2020
67b82fb
Add --coverage flags in CMakeLists.txt to get code coverage report data
per1234 May 6, 2020
9a3a46b
Adding python tool for extending a binary firmware file with the leng…
aentinger May 12, 2020
5570e6c
Adding small README describing what bin2ota.py does and how its used
aentinger May 12, 2020
60e4b36
Improve board-specific configuration system in compile-examples CI wo…
per1234 May 13, 2020
6e3f135
Adding scripts for upload a base64 encoded OTA binary to a device
aentinger May 13, 2020
9d71e95
Restoring Arduino_MKRMEM as dependent library for WiFi/GSM/NB CI builds
aentinger May 13, 2020
051b323
Renaming bin2base64.py to bin2json.py in order to directly create a j…
aentinger May 13, 2020
7f1bc1e
Bugfix: SFU expects the update firmware image to be named 'UPDATE.BIN…
aentinger May 28, 2020
68c0d9b
Renaming ArduinoIoTCloud_Defines.h to ArduinoIoTCloud_Config.h
aentinger May 28, 2020
d79a564
Deleting OTA_Config.h and moving its content into ArduinoIoTCloud_Con…
aentinger May 28, 2020
14a8f54
Only compile OTA related components when at least one OTA memory stor…
aentinger May 28, 2020
2857c98
Conditional compilation of OTA logic only if OTA_ENABLED is defined to 1
aentinger May 28, 2020
81fa9eb
Deactivating OTA_STORAGE_MKRMEM in code hosted on master
aentinger May 28, 2020
d456c1d
Bugfix - OTA logic was not excluded everywhere
aentinger May 28, 2020
409ed1f
Extenting tool for configuring server with the desired chunk size and…
aentinger May 28, 2020
8af7200
Allow compilation for unit tests regardless of the configuration with…
aentinger May 28, 2020
2dc6251
Excluding extras/test/external from spell check action
aentinger May 28, 2020
ca5c266
Redesigning OTALogic in a way that allows it to be kept on the stack …
aentinger May 28, 2020
50927c8
Disable OTA_STORAGE_MKRMEM and therefore OTA_STORAGE per default - ne…
aentinger May 28, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
# WiFi boards
- board:
type: "wifi"
libraries: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "WiFi101" "WiFiNINA"'
libraries: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "WiFi101" "WiFiNINA" "Arduino_MKRMEM"'
sketch-paths: '"examples/utility/Provisioning" "examples/utility/WiFi_Cloud_Blink"'
# LoRaWAN boards
- board:
Expand All @@ -51,12 +51,12 @@ jobs:
# GSM boards
- board:
type: "gsm"
libraries: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "MKRGSM"'
libraries: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "MKRGSM" "Arduino_MKRMEM"'
sketch-paths: '"examples/utility/Provisioning" "examples/utility/GSM_Cloud_Blink"'
# NB boards
- board:
type: "nb"
libraries: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "MKRNB"'
libraries: '"ArduinoBearSSL" "ArduinoECCX08" "RTCZero" "MKRNB" "Arduino_MKRMEM"'
sketch-paths: '"examples/utility/Provisioning" "examples/utility/NB_Cloud_Blink"'
# ESP8266 boards
- board:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/spell-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ jobs:
uses: arduino/actions/libraries/spell-check@master
with:
ignore-words-list: extras/codespell-ignore-words-list.txt
skip-paths: ./extras/test/external
48 changes: 48 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Unit Tests

on:
pull_request:
paths:
- ".github/workflows/unit-tests.yml"
- 'extras/test/**'
- 'src/**'

push:
paths:
- ".github/workflows/unit-tests.yml"
- 'extras/test/**'
- 'src/**'

jobs:
test:
name: Run unit tests
runs-on: ubuntu-latest

env:
BUILD_PATH: "${{ github.workspace }}/extras/test/build"

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Run unit tests
run: |
mkdir "$BUILD_PATH"
cd "$BUILD_PATH"
cmake ..
make
bin/testArduinoIoTCloud

- name: Check code coverage
run: |
cd "$BUILD_PATH"
sudo apt-get --assume-yes install lcov > /dev/null
lcov --directory . --capture --output-file coverage.info
lcov --quiet --remove coverage.info '*/extras/test/*' '/usr/*' --output-file coverage.info
lcov --list coverage.info

- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v1
with:
file: "${{ env.BUILD_PATH }}/coverage.info"
fail_ci_if_error: true
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
*~
.vscode
*.orig
.vs
.vs
build
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
=================
[![Compile Examples](https://github.com/arduino-libraries/ArduinoIoTCloud/workflows/Compile%20Examples/badge.svg)](https://github.com/arduino-libraries/ArduinoIoTCloud/actions?workflow=Compile+Examples)
[![Spell Check](https://github.com/arduino-libraries/ArduinoIoTCloud/workflows/Spell%20Check/badge.svg)](https://github.com/arduino-libraries/ArduinoIoTCloud/actions?workflow=Spell+Check)
[![Unit Tests](https://github.com/arduino-libraries/ArduinoIoTCloud/workflows/Unit%20Tests/badge.svg)](https://github.com/arduino-libraries/ArduinoIoTCloud/actions?workflow=Unit+Tests)
[![codecov](https://codecov.io/gh/arduino-libraries/ArduinoIoTCloud/branch/master/graph/badge.svg)](https://codecov.io/gh/arduino-libraries/ArduinoIoTCloud)

### What?
The `ArduinoIoTCloud` library is the central element of the firmware enabling certain Arduino boards to connect to the [Arduino IoT Cloud](https://www.arduino.cc/en/IoT/HomePage). The following boards are supported:
Expand Down
5 changes: 5 additions & 0 deletions extras/codespell-ignore-words-list.txt
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
wan
nd
atleast
derrived
aline
anid
50 changes: 50 additions & 0 deletions extras/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
##########################################################################

cmake_minimum_required(VERSION 2.8)

##########################################################################

project(testArduinoIoTCloud)

##########################################################################

include_directories(include)
include_directories(../../src/utility/ota)
include_directories(external/catch/v2.12.1/include)
include_directories(external/fakeit/v2.0.5/include)

##########################################################################

set(CMAKE_CXX_STANDARD 11)

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

##########################################################################

set(TEST_TARGET testArduinoIoTCloud)

set(TEST_SRCS
src/test_main.cpp
src/test_OTALogic.cpp
src/OTATestData.cpp
../../src/utility/ota/crc.cpp
../../src/utility/ota/OTALogic.cpp
)

##########################################################################

add_compile_definitions(HOST)
add_compile_options(-Wall -Wextra -Wpedantic -Werror)

set(CMAKE_C_FLAGS ${CMAKE_C_FLAGS} "--coverage")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "--coverage")

##########################################################################

add_executable(
${TEST_TARGET}
${TEST_SRCS}
)

##########################################################################

Loading