FOTB - Firmware Over The Bus: Difference between revisions

From KONNEKTING Wiki
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 3: Line 3:
Steps:
Steps:


Get SDUBoot.ino from https://github.com/arduino/ArduinoCore-samd/tree/master/libraries/SDU/extras/SDUBoot. Use this as starting point for an own version, let's say we name our version "MyBoot"
Get SDUBoot.ino from https://github.com/arduino/ArduinoCore-samd/tree/master/libraries/SDU/extras/SDUBoot. Use this as starting point for an own version, let's say we name our version "EFUBoot"


So we will have
So we will have


  MyBoot\
  EFUBoot\
  MyBoot\EFUBoot.ino
  EFUBoot\EFUBoot.ino


and we also need
and we also need


  MyBoot\boot
  EFUBoot\boot
  MyBoot\build.sh
  EFUBoot\build.sh


build.sh should contain something like this:
build.sh should contain something like this:
Line 21: Line 21:


ARDUINO=$ARDUINO_HOME/arduino
ARDUINO=$ARDUINO_HOME/arduino
SKETCH_NAME="MyBoot.ino"
SKETCH_NAME="EFUBoot.ino"
SKETCH="$PWD/$SKETCH_NAME"
SKETCH="$PWD/$SKETCH_NAME"
BUILD_PATH="$PWD/build"
BUILD_PATH="$PWD/build"

Revision as of 08:48, 8 March 2018

See: https://github.com/arduino/ArduinoCore-samd/pull/220

Steps:

Get SDUBoot.ino from https://github.com/arduino/ArduinoCore-samd/tree/master/libraries/SDU/extras/SDUBoot. Use this as starting point for an own version, let's say we name our version "EFUBoot"

So we will have

EFUBoot\
EFUBoot\EFUBoot.ino

and we also need

EFUBoot\boot
EFUBoot\build.sh

build.sh should contain something like this:

#!/bin/sh -x

ARDUINO=$ARDUINO_HOME/arduino
SKETCH_NAME="EFUBoot.ino"
SKETCH="$PWD/$SKETCH_NAME"
BUILD_PATH="$PWD/build"
OUTPUT_PATH="./boot"

if [[ "$OSTYPE" == "darwin"* ]]; then
	ARDUINO="/Applications/Arduino.app/Contents/MacOS/Arduino"
fi

buildSDUBootSketch() {
	BOARD=$1
	DESTINATION=$2

	$ARDUINO --verify --board $BOARD --preserve-temp-files --pref build.path="$BUILD_PATH" $SKETCH
	cat "$BUILD_PATH/$SKETCH_NAME.bin" | xxd -i > $DESTINATION
	rm -rf "$BUILD_PATH"
}

mkdir -p "$OUTPUT_PATH"

buildSDUBootSketch "arduino:samd:arduino_zero_edbg" "$OUTPUT_PATH/zero.h"

Make it executable with help of

chmod g+x build.sh

And finally run it with

./build.sh

After that, you have a .h file in your boot-folder.

Copy/paste SDU.cpp/SDU.h and let them point to the .h file you just created.

Write your sketch and include your version of SDU.h/SDU.cpp with "#include". Upload your sketch as usual.

If you now apply you update according to your own SDUBoot variant and reboot your arduino, the new sketch is applied to main memory and arduino starts up with the new sketch.