Skip to content

(SNU) Cleaning up second stage bootloader for board with WiFi NINA module #1

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 5 commits into from
Nov 20, 2019
Merged
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
28 changes: 22 additions & 6 deletions libraries/SNU/extras/NiNaBoot/NiNaBoot.ino
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,15 @@
#include <WiFiNINA.h>
#include <FlashStorage.h>

#ifdef ARDUINO_SAMD_MKRVIDOR4000
#include <VidorPeripherals.h>
#endif /* ARDUINO_SAMD_MKRVIDOR4000 */

#ifdef ARDUINO_SAMD_MKRVIDOR4000
#define NINA_GPIO0 FPGA_NINA_GPIO0
#define NINA_RESETN FPGA_SPIWIFI_RESET
#endif /* ARDUINO_SAMD_MKRVIDOR4000 */

#define SDU_START 0x2000
#define SDU_SIZE 0x4000

Expand All @@ -38,13 +47,20 @@ int main() {

delay(1);

// NINA - SPI boot
pinMode(NINA_GPIO0, OUTPUT);
digitalWrite(NINA_GPIO0, HIGH);

// disable NINA
pinMode(NINA_RESETN, OUTPUT);
#if defined(ARDUINO_SAMD_MKRVIDOR4000)
FPGA.begin();
/* NINA select SPI mode and enable (by setting RESETN = '1') */
FPGA.pinMode (NINA_GPIO0, OUTPUT);
FPGA.digitalWrite(NINA_GPIO0, HIGH);
FPGA.pinMode (NINA_RESETN, OUTPUT);
FPGA.digitalWrite(NINA_RESETN, HIGH);
#elif defined(ARDUINO_SAMD_MKRWIFI1010)
/* NINA select SPI mode and enable (by setting RESETN = '1') */
pinMode (NINA_GPIO0, OUTPUT);
digitalWrite(NINA_GPIO0, HIGH);
pinMode (NINA_RESETN, OUTPUT);
digitalWrite(NINA_RESETN, HIGH);
#endif

if (WiFi.status() == WL_NO_SHIELD) {
goto boot;
Expand Down
9 changes: 1 addition & 8 deletions libraries/SNU/extras/NiNaBoot/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,5 @@ buildSDUBootSketch() {

mkdir -p "$OUTPUT_PATH"

buildSDUBootSketch "arduino:samd:arduino_zero_edbg" "$OUTPUT_PATH/zero.h"
buildSDUBootSketch "arduino:samd:mkr1000" "$OUTPUT_PATH/mkr1000.h"
buildSDUBootSketch "arduino:samd:mkrzero" "$OUTPUT_PATH/mkrzero.h"
buildSDUBootSketch "arduino:samd:mkrfox1200" "$OUTPUT_PATH/mkrfox1200.h"
buildSDUBootSketch "arduino:samd:mkrgsm1400" "$OUTPUT_PATH/mkrgsm1400.h"
buildSDUBootSketch "arduino:samd:mkrwan1300" "$OUTPUT_PATH/mkrwan1300.h"
buildSDUBootSketch "arduino:samd:mkrnb1500" "$OUTPUT_PATH/mkrnb1500.h"
buildSDUBootSketch "arduino:samd:mkrwifi1010" "$OUTPUT_PATH/mkrwifi1010.h"
buildSDUBootSketch "arduino:samd:mkrvidor" "$OUTPUT_PATH/mkrvidor4000.h"
buildSDUBootSketch "arduino:samd:mkrvidor4000" "$OUTPUT_PATH/mkrvidor4000.h"
16 changes: 3 additions & 13 deletions libraries/SNU/src/SNU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,10 @@

__attribute__ ((section(".sketch_boot")))
unsigned char sduBoot[0x4000] = {
#if defined(ARDUINO_SAMD_ZERO)
#include "boot/zero.h"
#elif defined(ARDUINO_SAMD_MKR1000)
#include "boot/mkr1000.h"
#elif defined(ARDUINO_SAMD_MKRZERO)
#include "boot/mkrzero.h"
#elif defined(ARDUINO_SAMD_MKRFox1200)
#include "boot/mkrfox1200.h"
#elif defined(ARDUINO_SAMD_MKRGSM1400)
#include "boot/mkrgsm1400.h"
#elif defined(ARDUINO_SAMD_MKRWAN1300)
#include "boot/mkrwan1300.h"
#elif defined(ARDUINO_SAMD_MKRWIFI1010)
#if defined(ARDUINO_SAMD_MKRWIFI1010)
#include "boot/mkrwifi1010.h"
#elif defined(ARDUINO_SAMD_MKRVIDOR4000)
#include "boot/mkrvidor4000.h"
#else
#error "Unsupported board!"
#endif
Expand Down
Empty file removed libraries/SNU/src/boot/mkr1000.h
Empty file.
Empty file.
Empty file.
Empty file removed libraries/SNU/src/boot/mkrnb1500.h
Empty file.
56,987 changes: 56,987 additions & 0 deletions libraries/SNU/src/boot/mkrvidor4000.h

Large diffs are not rendered by default.

Empty file.
1,704 changes: 896 additions & 808 deletions libraries/SNU/src/boot/mkrwifi1010.h

Large diffs are not rendered by default.

Empty file removed libraries/SNU/src/boot/mkrzero.h
Empty file.
Empty file removed libraries/SNU/src/boot/zero.h
Empty file.