Skip to content

Commit 5084e65

Browse files
committed
Rename OTA library to SDU and adjust align to 0x2000
1 parent 2b38eb3 commit 5084e65

File tree

12 files changed

+54
-36
lines changed

12 files changed

+54
-36
lines changed

libraries/OTA/extras/OTA_SD/OTA_SD.ino renamed to libraries/SDU/extras/SDUBoot/SDUBoot.ino

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1+
/*
2+
Copyright (c) 2017 Arduino LLC. All right reserved.
3+
4+
This library is free software; you can redistribute it and/or
5+
modify it under the terms of the GNU Lesser General Public
6+
License as published by the Free Software Foundation; either
7+
version 2.1 of the License, or (at your option) any later version.
8+
9+
This library is distributed in the hope that it will be useful,
10+
but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12+
See the GNU Lesser General Public License for more details.
13+
14+
You should have received a copy of the GNU Lesser General Public
15+
License along with this library; if not, write to the Free Software
16+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17+
*/
18+
119
#include <SD.h>
220
#include <FlashStorage.h>
321

4-
#define OTA_START 0x2000
5-
#define OTA_SIZE 0x4000
22+
#define SDU_START 0x2000
23+
#define SDU_SIZE 0x4000
624

7-
#define SKETCH_START (uint32_t*)(OTA_START + OTA_SIZE)
25+
#define SKETCH_START (uint32_t*)(SDU_START + SDU_SIZE)
826

927
#ifndef SDCARD_SS_PIN
1028
#define SDCARD_SS_PIN 4
@@ -29,10 +47,10 @@ int main() {
2947
uint32_t updateSize = updateFile.size();
3048
bool updateFlashed = false;
3149

32-
if (updateSize > OTA_SIZE) {
33-
// skip the OTA section
34-
updateFile.seek(OTA_SIZE);
35-
updateSize -= OTA_SIZE;
50+
if (updateSize > SDU_SIZE) {
51+
// skip the SDU section
52+
updateFile.seek(SDU_SIZE);
53+
updateSize -= SDU_SIZE;
3654

3755
uint32_t flashAddress = (uint32_t)SKETCH_START;
3856

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh -x
22

33
ARDUINO=arduino
4-
SKETCH_NAME="OTA_SD.ino"
4+
SKETCH_NAME="SDUBoot.ino"
55
SKETCH="$PWD/$SKETCH_NAME"
66
BUILD_PATH="$PWD/build"
77
OUTPUT_PATH="../../src/boot"
@@ -10,7 +10,7 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
1010
ARDUINO="/Applications/Arduino.app/Contents/MacOS/Arduino"
1111
fi
1212

13-
buildOTASketch() {
13+
buildSDUBootSketch() {
1414
BOARD=$1
1515
DESTINATION=$2
1616

@@ -21,6 +21,6 @@ buildOTASketch() {
2121

2222
mkdir -p "$OUTPUT_PATH"
2323

24-
buildOTASketch "arduino:samd:arduino_zero_edbg" "$OUTPUT_PATH/zero.h"
25-
buildOTASketch "arduino:samd:mkr1000" "$OUTPUT_PATH/mkr1000.h"
26-
buildOTASketch "arduino:samd:mkrzero" "$OUTPUT_PATH/mkrzero.h"
24+
buildSDUBootSketch "arduino:samd:arduino_zero_edbg" "$OUTPUT_PATH/zero.h"
25+
buildSDUBootSketch "arduino:samd:mkr1000" "$OUTPUT_PATH/mkr1000.h"
26+
buildSDUBootSketch "arduino:samd:mkrzero" "$OUTPUT_PATH/mkrzero.h"

libraries/OTA/keywords.txt renamed to libraries/SDU/keywords.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#######################################
2-
# Syntax Coloring Map For OTA
2+
# Syntax Coloring Map For SDU
33
#######################################
44

55
#######################################
66
# Datatypes (KEYWORD1)
77
#######################################
88

9-
OTA KEYWORD1
9+
SDU KEYWORD1
1010

1111
#######################################
1212
# Methods and Functions (KEYWORD2)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
name=OTA
1+
name=SDU
22
version=1.0.0
33
author=Arduino
44
maintainer=Arduino <info@arduino.cc>
5-
sentence=Update sketches on your board without USB
5+
sentence=Update the sketch on your board from an SD card
66
paragraph=Requires an SD card
77
category=Other
8-
url=http://www.arduino.cc/en/Reference/OTA
8+
url=http://www.arduino.cc/en/Reference/SDU
99
architectures=samd

libraries/OTA/src/OTA.cpp renamed to libraries/SDU/src/SDU.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2016 Arduino LLC. All right reserved.
2+
Copyright (c) 2017 Arduino LLC. All right reserved.
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Lesser General Public
@@ -18,10 +18,10 @@
1818

1919
#include <Arduino.h>
2020

21-
#include "OTA.h"
21+
#include "SDU.h"
2222

23-
__attribute__ ((section(".ota_boot")))
24-
unsigned char otaBoot[0x4000] = {
23+
__attribute__ ((section(".sketch_boot")))
24+
unsigned char sduBoot[0x4000] = {
2525
#if defined(ARDUINO_SAMD_ZERO)
2626
#include "boot/zero.h"
2727
#elif defined(ARDUINO_SAMD_MKR1000)
@@ -33,14 +33,14 @@ unsigned char otaBoot[0x4000] = {
3333
#endif
3434
};
3535

36-
OTAClass::OTAClass() {
36+
SDUClass::SDUClass() {
3737
}
3838

39-
void OTAClass::reset() {
39+
void SDUClass::reset() {
4040
// Reset the device
4141
NVIC_SystemReset() ;
4242

4343
while (true);
4444
}
4545

46-
OTAClass OTA;
46+
SDUClass SDU;

libraries/OTA/src/OTA.h renamed to libraries/SDU/src/SDU.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
Copyright (c) 2016 Arduino LLC. All right reserved.
2+
Copyright (c) 2017 Arduino LLC. All right reserved.
33
44
This library is free software; you can redistribute it and/or
55
modify it under the terms of the GNU Lesser General Public
@@ -16,16 +16,16 @@
1616
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1717
*/
1818

19-
#ifndef _OTA_H_INCLUDED
20-
#define _OTA_H_INCLUDED
19+
#ifndef _SDU_H_INCLUDED
20+
#define _SDU_H_INCLUDED
2121

22-
class OTAClass {
22+
class SDUClass {
2323
public:
24-
OTAClass();
24+
SDUClass();
2525

2626
void reset();
2727
};
2828

29-
extern OTAClass OTA;
29+
extern SDUClass SDU;
3030

3131
#endif
File renamed without changes.
File renamed without changes.
File renamed without changes.

variants/arduino_zero/linker_scripts/gcc/flash_with_bootloader.ld

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ SECTIONS
6767
{
6868
__text_start__ = .;
6969

70-
KEEP(*(.ota_boot))
70+
KEEP(*(.sketch_boot))
7171

72-
. = ALIGN(256);
72+
. = ALIGN(0x2000);
7373
KEEP(*(.isr_vector))
7474
*(.text*)
7575

0 commit comments

Comments
 (0)