Skip to content

Commit 83a853b

Browse files
pennamgiulcioffi
authored andcommitted
Add MCUBoot library
Access libbootutil functions confirmSketch example
1 parent a98a593 commit 83a853b

File tree

5 files changed

+67
-0
lines changed

5 files changed

+67
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
Blink
3+
Turns an LED on for one second, then off for one second, repeatedly.
4+
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
5+
it is attached to digital pin 13, on MKR1000 on pin 6. LED_BUILTIN is set to
6+
the correct LED pin independent of which board is used.
7+
If you want to know what pin the on-board LED is connected to on your Arduino
8+
model, check the Technical Specs of your board at:
9+
https://www.arduino.cc/en/Main/Products
10+
modified 8 May 2014
11+
by Scott Fitzgerald
12+
modified 2 Sep 2016
13+
by Arturo Guadalupi
14+
modified 8 Sep 2016
15+
by Colby Newman
16+
This example code is in the public domain.
17+
https://www.arduino.cc/en/Tutorial/BuiltInExamples/Blink
18+
*/
19+
20+
#include <MCUboot.h>
21+
22+
// the setup function runs once when you press reset or power the board
23+
void setup() {
24+
// initialize digital pin LED_BUILTIN as an output.
25+
pinMode(LED_BUILTIN, OUTPUT);
26+
// set confirmed flag to avoid MCUBoot reverts to previous application at next reset
27+
MCUboot::confirmSketch();
28+
}
29+
30+
// the loop function runs over and over again forever
31+
void loop() {
32+
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
33+
delay(1000); // wait for a second
34+
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
35+
delay(1000); // wait for a second
36+
}

libraries/MCUboot/library.properties

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
name=MCUboot
2+
version=0.0.1
3+
author=Arduino
4+
maintainer=Arduino <info@arduino.cc>
5+
sentence=Wrapper library for MCUboot
6+
paragraph=
7+
category=Other
8+
url=
9+
architectures=mbed,mbed_portenta
10+
precompiled=true
11+
ldflags=-lbootutil

libraries/MCUboot/src/MCUboot.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include "MCUboot.h"
2+
3+
extern "C" int boot_set_confirmed(void);
4+
5+
void MCUboot::confirmSketch()
6+
{
7+
boot_set_confirmed();
8+
}

libraries/MCUboot/src/MCUboot.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#ifndef MCUboot_h_
2+
#define MCUboot_h_
3+
4+
class MCUboot
5+
{
6+
7+
public:
8+
static void confirmSketch(void);
9+
10+
};
11+
12+
#endif // MCUboot_h_
1.41 MB
Binary file not shown.

0 commit comments

Comments
 (0)