Skip to content
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

support for nano33iot without breaking legacy #653

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
51 changes: 51 additions & 0 deletions libraries/SDU/extras/SDUBoot/Board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
Copyright (c) 2021 Arduino LLC. All right reserved.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifndef _BOARD_H_INCLUDED
#define _BOARD_H_INCLUDED


/*SDU_SIZE is not specifically for nano 33 iot but it's core version dependent.
From 1.8.11 the core footprint is too big to fit 0x4000.
If you need to recompile SDUBoot.ino for */


#ifdef ARDUINO_SAM_ZERO
#define SDU_START 0x4000
#else
#define SDU_START 0x2000
#endif
#if defined(ARDUINO_SAMD_NANO_33_IOT)
#define SDU_SIZE 0x6000
#else
#define SDU_SIZE 0x4000
#endif

#define SKETCH_START (uint32_t*)(SDU_START + SDU_SIZE)

#define UPDATE_FILE "UPDATE.BIN"

#if defined(USE_ARDUINO_MKR_PIN_LAYOUT)
#ifndef SDCARD_SS_PIN
#define SDCARD_SS_PIN 4
#endif
#else
#define SDCARD_SS_PIN 10
#endif

#endif
19 changes: 1 addition & 18 deletions libraries/SDU/extras/SDUBoot/SDUBoot.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,10 @@
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#include "Board.h"
#include <SD.h>
#include <FlashStorage.h>

#ifdef ARDUINO_SAM_ZERO
#define SDU_START 0x4000
#else
#define SDU_START 0x2000
#endif
#define SDU_SIZE 0x4000

#define SKETCH_START (uint32_t*)(SDU_START + SDU_SIZE)

#ifndef SDCARD_SS_PIN
#define SDCARD_SS_PIN 4
#endif

#define UPDATE_FILE "UPDATE.BIN"

FlashClass flash;

// Initialize C library
Expand Down Expand Up @@ -93,5 +78,3 @@ int main() {
// jump to reset handler
asm("bx %0"::"r"(resetHandlerAddress));
}


5 changes: 3 additions & 2 deletions libraries/SDU/src/SDU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@
*/

#include <Arduino.h>

#include "SDU.h"

__attribute__ ((section(".sketch_boot")))
unsigned char sduBoot[0x4000] = {
unsigned char sduBoot[SDU_SIZE] = {
#if defined(ARDUINO_SAMD_ZERO)
#include "boot/zero.h"
#elif defined(ARDUINO_SAMD_MKR1000)
Expand All @@ -40,6 +39,8 @@ unsigned char sduBoot[0x4000] = {
#include "boot/mkrnb1500.h"
#elif defined(ARDUINO_SAM_ZERO)
#include "boot/mzero.h"
#elif defined(ARDUINO_SAMD_NANO_33_IOT)
#include "boot/nano33iot.h"
#else
#error "Unsupported board!"
#endif
Expand Down
4 changes: 1 addition & 3 deletions libraries/SDU/src/SDU.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,5 @@

#ifndef _SDU_H_INCLUDED
#define _SDU_H_INCLUDED

// nothing for now

#include "../extras/Board.h"
#endif
Loading