Skip to content

Commit e765971

Browse files
author
Jim Lindblom
committed
Adding bootload pin support to bootloader.
1 parent c96c3da commit e765971

14 files changed

+506
-1491
lines changed

Firmware/Bootloader/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ SIZE=$(ARM_GCC_PATH)size
5858
# -----------------------------------------------------------------------------
5959
# Boards definitions
6060
BOARD_ID?=sparkfun_9dof
61-
NAME?=SparkFun_9DoF_Razor
61+
NAME?=SparkFun_9DoF_Razor_M0
62+
#SparkFun_9DoF_Razor
6263

6364
# -----------------------------------------------------------------------------
6465
# Compiler options

Firmware/Bootloader/SparkFun_9DoF_Razor.hex

Lines changed: 0 additions & 415 deletions
This file was deleted.
6.45 KB
Binary file not shown.

Firmware/Bootloader/SparkFun_9DoF_Razor_M0.hex

Lines changed: 418 additions & 0 deletions
Large diffs are not rendered by default.

Firmware/Bootloader/board_definitions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "board_definitions_genuino_mkr1000.h"
2828
#elif defined(BOARD_ID_sparkfun_9dof)
2929
#include "board_definitions_sparkfun_9dofRazor.h"
30+
#elif defined(BOARD_ID_sparkfun_samd21_dev)
31+
#include "board_definitions_sparkfun_samd21dev.h"
3032
#else
3133
#error You must define a BOARD_ID and add the corresponding definitions in board_definitions.h
3234
#endif

Firmware/Bootloader/board_definitions_sparkfun_9dofRazor.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,7 @@
4242
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
4343
* pin is tied LOW.
4444
*/
45-
//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7
46-
//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5
45+
#define BOOT_LOAD_PIN PIN_PA23 // PA23 is SCL on the 9DoF Razor
4746

4847
#define BOOT_USART_MODULE SERCOM0
4948
#define BOOT_USART_BUS_CLOCK_INDEX PM_APBCMASK_SERCOM0
@@ -54,7 +53,6 @@
5453
#define BOOT_USART_PAD1 PINMUX_UNUSED
5554
#define BOOT_USART_PAD0 PINMUX_UNUSED
5655

57-
5856
/* Master clock frequency */
5957
#define CPU_FREQUENCY (48000000ul)
6058
#define VARIANT_MCK CPU_FREQUENCY
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
Copyright (c) 2015 Arduino LLC. All right reserved.
3+
Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved.
4+
5+
This library is free software; you can redistribute it and/or
6+
modify it under the terms of the GNU Lesser General Public
7+
License as published by the Free Software Foundation; either
8+
version 2.1 of the License, or (at your option) any later version.
9+
10+
This library is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13+
See the GNU Lesser General Public License for more details.
14+
15+
You should have received a copy of the GNU Lesser General Public
16+
License along with this library; if not, write to the Free Software
17+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18+
*/
19+
20+
#ifndef _BOARD_DEFINITIONS_H_
21+
#define _BOARD_DEFINITIONS_H_
22+
23+
/*
24+
* USB device definitions
25+
*/
26+
#define STRING_PRODUCT "SparkFun SAMD21"
27+
#define USB_VID_HIGH 0x1B
28+
#define USB_VID_LOW 0x4F
29+
#define USB_PID_HIGH 0x8D
30+
#define USB_PID_LOW 0x21
31+
32+
/*
33+
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
34+
* quickly tapping two times on the reset button.
35+
* BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
36+
* be touched from the loaded application.
37+
*/
38+
#define BOOT_DOUBLE_TAP_ADDRESS (0x20007FFCul)
39+
#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))
40+
41+
/*
42+
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
43+
* pin is tied LOW.
44+
*/
45+
//#define BOOT_LOAD_PIN PIN_PA21 // Pin 7
46+
//#define BOOT_LOAD_PIN PIN_PA15 // Pin 5
47+
48+
#define BOOT_USART_MODULE SERCOM0
49+
#define BOOT_USART_BUS_CLOCK_INDEX PM_APBCMASK_SERCOM0
50+
#define BOOT_USART_PER_CLOCK_INDEX GCLK_ID_SERCOM0_CORE
51+
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
52+
#define BOOT_USART_PAD3 PINMUX_PA11C_SERCOM0_PAD3
53+
#define BOOT_USART_PAD2 PINMUX_PA10C_SERCOM0_PAD2
54+
#define BOOT_USART_PAD1 PINMUX_UNUSED
55+
#define BOOT_USART_PAD0 PINMUX_UNUSED
56+
57+
58+
/* Master clock frequency */
59+
#define CPU_FREQUENCY (48000000ul)
60+
#define VARIANT_MCK CPU_FREQUENCY
61+
62+
/* Frequency of the board main oscillator */
63+
#define VARIANT_MAINOSC (32768ul)
64+
65+
/* Calibration values for DFLL48 pll */
66+
#define NVM_SW_CALIB_DFLL48M_COARSE_VAL (58)
67+
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (64)
68+
69+
/*
70+
* LEDs definitions
71+
*/
72+
#define BOARD_LED_PORT (0)
73+
#define BOARD_LED_PIN (17)
74+
75+
#define BOARD_LEDRX_PORT (1)
76+
#define BOARD_LEDRX_PIN (3)
77+
78+
#define BOARD_LEDTX_PORT (0)
79+
#define BOARD_LEDTX_PIN (27)
80+
81+
#endif // _BOARD_DEFINITIONS_H_

Firmware/Bootloader/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ uint32_t* pulSketch_Start_Address;
108108
return;
109109
}
110110

111-
/*
111+
112112
#if defined(BOOT_LOAD_PIN)
113113
volatile PortGroup *boot_port = (volatile PortGroup *)(&(PORT->Group[BOOT_LOAD_PIN / 32]));
114114
volatile bool boot_en;
@@ -127,7 +127,7 @@ uint32_t* pulSketch_Start_Address;
127127
return;
128128
}
129129
#endif
130-
*/
130+
131131

132132
// LED_on();
133133

Firmware/Bootloader/samd21_sam_ba.atsln

Lines changed: 0 additions & 22 deletions
This file was deleted.
-6.45 KB
Binary file not shown.

0 commit comments

Comments
 (0)