Skip to content

Commit 1458fe0

Browse files
committed
Add proper MuxTO bootloader
1 parent c2a6463 commit 1458fe0

File tree

5 files changed

+281
-3
lines changed

5 files changed

+281
-3
lines changed

boards.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1530,11 +1530,11 @@ d11d14as.menu.usb.none.build.pid=0x0856
15301530
# Arduino MuxTO
15311531
muxto.name=Arduino MuxTO
15321532
muxto.vid.0=0x2341
1533-
muxto.pid.0=0x8060
1533+
muxto.pid.0=0x5058
15341534
muxto.build.mcu=cortex-m0plus
15351535
muxto.build.mathlib=arm_cortexM0l_math
15361536
muxto.build.f_cpu=48000000L
1537-
muxto.build.usb_product="D11D14AS"
1537+
muxto.build.usb_product="Arduino Nano Every"
15381538
muxto.build.usb_manufacturer="Arduino LLC"
15391539
muxto.build.board=SAMD_ZERO
15401540
muxto.build.core=arduino
@@ -1606,7 +1606,7 @@ muxto.menu.timer.timer_1465Hz.build.timerconfig=TIMER_1465Hz
16061606
muxto.build.extra_flags=-D__SAMD11D14AS__ {build.usb_flags} -DARM_MATH_CM0PLUS
16071607
muxto.build.ldscript=flash_16KB.ld
16081608
muxto.build.openocdscript=openocd_scripts/SAMD11D14AS.cfg
1609-
muxto.bootloader.file=zero/binaries/sam_ba_Generic_D11D14AS_SAMD11D14AS.bin
1609+
muxto.bootloader.file=zero/binaries/sam_ba_arduino_MuxTO_SAMD11D14AM.bin
16101610
muxto.menu.bootloader.4kb=4KB_BOOTLOADER
16111611
muxto.menu.bootloader.4kb.build.bootloader_size=__4KB_BOOTLOADER__
16121612
muxto.menu.bootloader.4kb.build.ldscript_path=linker_scripts/gcc/4KB_Bootloader
Binary file not shown.

bootloaders/zero/board_definitions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@
5858
#include "board_definitions/board_definitions_arduino_m0.h"
5959
#elif defined(BOARD_ID_arduino_m0_pro)
6060
#include "board_definitions/board_definitions_arduino_m0_pro.h"
61+
#elif defined(BOARD_ID_arduino_MuxTO)
62+
#include "board_definitions/board_definitions_arduino_MuxTO.h"
6163
#else
6264
#error You must define a BOARD_ID and add the corresponding definitions in board_definitions.h
6365
#endif
Lines changed: 275 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,275 @@
1+
/*
2+
Copyright (c) 2017 MattairTech LLC. All right reserved.
3+
Copyright (c) 2015 Arduino LLC. All right reserved.
4+
Copyright (c) 2015 Atmel Corporation/Thibaut VIARD. All right reserved.
5+
6+
This library is free software; you can redistribute it and/or
7+
modify it under the terms of the GNU Lesser General Public
8+
License as published by the Free Software Foundation; either
9+
version 2.1 of the License, or (at your option) any later version.
10+
11+
This library is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14+
See the GNU Lesser General Public License for more details.
15+
16+
You should have received a copy of the GNU Lesser General Public
17+
License along with this library; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19+
*/
20+
21+
#ifndef _BOARD_DEFINITIONS_H_
22+
#define _BOARD_DEFINITIONS_H_
23+
24+
#include <sam.h>
25+
26+
/* The SAM-BA interface, which is used with both USB CDC and UART (TTL
27+
* serial), can operate in either binary (default) or terminal mode. If
28+
* TERMINAL_MODE_ENABLED is defined, additional terminal handling code
29+
* (add prompt, add \n\r to EOL, number formatting, etc.) will be compiled
30+
* in. To switch to terminal mode, type 'T#' (you should then see a prompt).
31+
* Then, type 'V#' to show version information. See README.md for more commands.
32+
* Size: ~228B. Enabled by default. Disable with 4KB bootloader.
33+
*/
34+
//#define TERMINAL_MODE_ENABLED
35+
36+
/* If SDCARD_ENABLED is defined, SD card bootloader support is compiled in.
37+
* See "SD Card Bootloader" section. This define can also be set from the
38+
* makefile (so it can be used with the build_all_bootloaders.sh script).
39+
* Size: ~2788B. Disabled by default. Available with 4KB bootloader.
40+
*/
41+
#ifndef SDCARD_ENABLED
42+
//#define SDCARD_ENABLED
43+
#endif
44+
45+
/* If SDCARD_ENABLED is defined, then all SDCARD_SPI_* defines must also be set.
46+
* When setting SDCARD_SPI_PADx defines, consult the appropriate header file
47+
* from CMSIS-Atmel (ie: ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-
48+
* Atmel/1.0.0-mattairtech-2/CMSIS/Device/ATMEL/sam<d21|d51|c21|l21|d11>/include/
49+
* <YOUR_CHIP>.h). SDCARD_SPI_PAD_SETTINGS values are in SDCard/diskio.h.
50+
* When using SDCARD_USE_PIN1 or SDCARD_USE_PIN2, the SPI peripheral and
51+
* associated pins are only initialized if either pin is active.
52+
*/
53+
#define SDCARD_SPI_SERCOM_INSTANCE 0
54+
#define SDCARD_SPI_PAD_SETTINGS SPI_RX_PAD0_TX_PAD2_SCK_PAD3
55+
#define SDCARD_SPI_PAD0 PINMUX_PA14C_SERCOM0_PAD0
56+
#define SDCARD_SPI_PAD1 PINMUX_UNUSED
57+
#define SDCARD_SPI_PAD2 PINMUX_PA10C_SERCOM0_PAD2
58+
#define SDCARD_SPI_PAD3 PINMUX_PA11C_SERCOM0_PAD3
59+
60+
/* If SDCARD_ENABLED is defined, then SDCARD_SPI_CS_PORT and SDCARD_SPI_CS_PIN
61+
* must also be defined. PORT can be 0 (Port A) or 1 (Port B).
62+
*/
63+
#define SDCARD_SPI_CS_PORT (0)
64+
#define SDCARD_SPI_CS_PIN (15)
65+
66+
/* If SDCARD_ENABLED is defined, then SDCARD_USE_PIN1 and SDCARD_USE_PIN2 can
67+
* optionally be defined. When SDCARD_USE_PIN2 is defined, SDCARD_USE_PIN1 must
68+
* also be defined. See "SD Card External Pins" section for more information. PORT
69+
* can be 0 (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or
70+
* PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN.
71+
* Size: ~60B for SDCARD_USE_PIN1, ~92B for both pins. By default, only pin1 used.
72+
*/
73+
//#define SDCARD_USE_PIN1
74+
#define SDCARD_PIN1_POLARITY PIN_POLARITY_ACTIVE_LOW
75+
#define SDCARD_PIN1_PORT (0)
76+
#define SDCARD_PIN1_PIN (3)
77+
#define SDCARD_PIN1_CONFIG INPUT_PULLUP
78+
79+
//#define SDCARD_USE_PIN2
80+
#define SDCARD_PIN2_POLARITY PIN_POLARITY_ACTIVE_LOW
81+
#define SDCARD_PIN2_PORT (0)
82+
#define SDCARD_PIN2_PIN (4)
83+
#define SDCARD_PIN2_CONFIG INPUT_PULLUP
84+
85+
/* If SDCARD_VERIFICATION_DISABLED is defined, then verification of the FLASH
86+
* after programming will not occur, nor will the initial check to see if the
87+
* FLASH contents are already the same as the file.
88+
* Size: ~284B. By default, this is not defined, so verification will be enabled.
89+
*/
90+
//#define SDCARD_VERIFICATION_DISABLED
91+
92+
/* If SDCARD_AUTORUN_DISABLED is defined, then the SD card bootloader will not
93+
* automatically run the firmware that was just installed. Instead, the LED will
94+
* blink with status code LED_STATUS_SUCCESS. This option also applies when the
95+
* binary file on the SD card already matches the installed firmware. In this
96+
* case, the LED will blink with status code LED_STATUS_FILE_ALREADY_MATCHES.
97+
* By default, SDCARD_AUTORUN_DISABLED is defined.
98+
*/
99+
#define SDCARD_AUTORUN_DISABLED
100+
101+
/* Two different binary files can be loaded, depending on external pin settings.
102+
* By default, the filenames are UPDATE.BIN and UPDATE2.BIN, but these can be
103+
* overridden by defining SDCARD_FILENAME_PRIMARY and SDCARD_FILENAME_SECONDARY.
104+
* If both pins are configured, SDCARD_FILENAME_PRIMARY (UPDATE.BIN) will be
105+
* loaded when PIN1 is enabled, and SDCARD_FILENAME_PRIMARY (UPDATE2.BIN) is
106+
* loaded when PIN2 is enabled. If only one pin or no pin is configured, only
107+
* SDCARD_FILENAME_PRIMARY is loaded.
108+
*/
109+
//#define SDCARD_FILENAME_PRIMARY "UPDATE.BIN"
110+
//#define SDCARD_FILENAME_SECONDARY "UPDATE2.BIN"
111+
112+
/* Set SAM_BA_INTERFACE to SAM_BA_USBCDC_ONLY, SAM_BA_UART_ONLY, SAM_BA_NONE, or
113+
* SAM_BA_BOTH_INTERFACES. With 4KB bootloaders, select only one interface (except
114+
* when using SDCARD_ENABLED, then set SAM_BA_INTERFACE to SAM_BA_NONE). The C21
115+
* lacks USB, so set to SAM_BA_UART_ONLY in this case. By default,
116+
* SAM_BA_USBCDC_ONLY is set (SAM_BA_UART_ONLY with the C21).
117+
*/
118+
#if defined(SDCARD_ENABLED)
119+
#define SAM_BA_INTERFACE SAM_BA_NONE
120+
#else
121+
#define SAM_BA_INTERFACE SAM_BA_USBCDC_ONLY
122+
#endif
123+
124+
/* If SAM_BA_INTERFACE_USE_PIN is defined, then the associated pin controls which
125+
* SAM-BA interface is used (if SAM_BA_BOTH_INTERFACES is defined). If only one
126+
* interface is used, then the pin acts as an enable. In both cases, the value of
127+
* SAM_BA_INTERFACE_PIN_POLARITY controls the polarity, with values of
128+
* PIN_POLARITY_ACTIVE_LOW or PIN_POLARITY_ACTIVE_HIGH for a single interface, and
129+
* PIN_POLARITY_USBCDC_LOW or PIN_POLARITY_USBCDC_HIGH when both interfaces are
130+
* enabled. PORT can be 0 (Port A) or 1 (Port B). Config can be INPUT, INPUT_PULLUP,
131+
* or INPUT_PULLDOWN.The USB/UART peripheral and pins will not be setup if the
132+
* device is not selected/enabled. If no interface is selected by the pin, the LED
133+
* will blink with status code LED_STATUS_NO_SAM_BA_INTERFACE.
134+
* Size: ~100B. By default, SAM_BA_INTERFACE_USE_PIN is not defined.
135+
*/
136+
//#define SAM_BA_INTERFACE_USE_PIN
137+
#define SAM_BA_INTERFACE_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW
138+
#define SAM_BA_INTERFACE_PIN_PORT (0)
139+
#define SAM_BA_INTERFACE_PIN_PIN (15)
140+
#define SAM_BA_INTERFACE_PIN_CONFIG INPUT_PULLUP
141+
142+
/* If ARDUINO_EXTENDED_CAPABILITIES is defined and set to 1, 3 additional commands
143+
* will become available which will speed up programming when using the Arduino
144+
* IDE or the bossac tool standalone. Set to 0 with 4KB bootloaders.
145+
* Size: ~904B. This is defined and set to 1 by default (except with 4KB).
146+
*/
147+
#define ARDUINO_EXTENDED_CAPABILITIES 0
148+
149+
/* The clock source must be chosen by setting CLOCKCONFIG_CLOCK_SOURCE to
150+
* CLOCKCONFIG_32768HZ_CRYSTAL, CLOCKCONFIG_HS_CRYSTAL, CLOCKCONFIG_INTERNAL,
151+
* or CLOCKCONFIG_INTERNAL_USB. If CLOCKCONFIG_32768HZ_CRYSTAL or
152+
* CLOCKCONFIG_HS_CRYSTAL is defined, then the PLL will be used. If
153+
* CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ must
154+
* also be defined with the crystal frequency in Hertz. CLOCKCONFIG_INTERNAL
155+
* uses the DFLL in open-loop mode, except with the C21 which lacks a DFLL, so
156+
* the internal 48MHz RC oscillator is used instead. CLOCKCONFIG_INTERNAL_USB
157+
* can be defined for the D21, D11, L21, or D51. It will also use the DFLL in
158+
* open-loop mode, except when connected to a USB port with data lines (and
159+
* not suspended), where it will calibrate against the USB SOF signal.
160+
*/
161+
#ifndef CLOCKCONFIG_CLOCK_SOURCE
162+
#define CLOCKCONFIG_CLOCK_SOURCE CLOCKCONFIG_INTERNAL_USB
163+
#endif
164+
165+
/* If CLOCKCONFIG_HS_CRYSTAL is defined, then HS_CRYSTAL_FREQUENCY_HERTZ
166+
* must also be defined with the external crystal frequency in Hertz.
167+
*/
168+
#define HS_CRYSTAL_FREQUENCY_HERTZ 16000000UL
169+
170+
/* If the PLL is used (CLOCKCONFIG_32768HZ_CRYSTAL, or CLOCKCONFIG_HS_CRYSTAL
171+
* defined), then PLL_FRACTIONAL_ENABLED can be defined, which will result in
172+
* a more accurate 48MHz output frequency at the expense of increased jitter.
173+
*/
174+
//#define PLL_FRACTIONAL_ENABLED
175+
176+
/* If both PLL_FAST_STARTUP and CLOCKCONFIG_HS_CRYSTAL are defined, the crystal
177+
* will be divided down to 1MHz - 2MHz, rather than 32KHz - 64KHz, before being
178+
* multiplied by the PLL. This will result in a faster lock time for the PLL,
179+
* however, it will also result in a less accurate PLL output frequency if the
180+
* crystal is not divisible (without remainder) by 1MHz. In this case, define
181+
* PLL_FRACTIONAL_ENABLED as well.
182+
*/
183+
//#define PLL_FAST_STARTUP
184+
185+
/* Master clock frequency (also Fcpu frequency). With the D51,
186+
* this can be either 120000000ul or 48000000ul. See README.md.
187+
*/
188+
#define VARIANT_MCK (48000000ul)
189+
190+
/* The fine calibration value for DFLL open-loop mode is defined here.
191+
* The coarse calibration value is loaded from NVM OTP (factory calibration values).
192+
*/
193+
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (512)
194+
195+
/* If USB_VENDOR_STRINGS_ENABLED is defined, then STRING_MANUFACTURER and
196+
* STRING_PRODUCT will be sent to the host.
197+
* Size: ~228B. By default, USB_VENDOR_STRINGS_ENABLED is defined (including 4KB).
198+
*/
199+
#define USB_VENDOR_STRINGS_ENABLED
200+
#define STRING_MANUFACTURER "Arduino"
201+
#define STRING_PRODUCT "MuxTO BL"
202+
203+
/* If USB CDC is used, then the USB vendor ID (VID) and product ID (PID) must be set. */
204+
#define USB_VID_HIGH 0x23
205+
#define USB_VID_LOW 0x41
206+
#define USB_PID_HIGH 0x50
207+
#define USB_PID_LOW 0x58
208+
209+
/* BOOT_USART_SERCOM_INSTANCE must be a single digit representing the SERCOM number.
210+
* See board_driver_serial.h for BOOT_USART_PAD_SETTINGS values. When setting
211+
* BOOT_USART_PADx defines, consult the appropriate header file from CMSIS-Atmel (ie:
212+
* ~/arduino15/packages/MattairTech_Arduino/tools/CMSIS-Atmel/1.0.0-mattairtech-2/
213+
* CMSIS/Device/ATMEL/sam<d21|d51|c21|l21|d11>/include/<YOUR_CHIP>.h). Use PINMUX_UNUSED
214+
* if not used. By default, this interface is not enabled (except with the C21).
215+
*/
216+
#define BOOT_USART_SERCOM_INSTANCE 0
217+
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
218+
#define BOOT_USART_PAD3 PINMUX_PA05C_SERCOM0_PAD3
219+
#define BOOT_USART_PAD2 PINMUX_PA04C_SERCOM0_PAD2
220+
#define BOOT_USART_PAD1 PINMUX_UNUSED
221+
#define BOOT_USART_PAD0 PINMUX_UNUSED
222+
223+
/*
224+
* If BOOT_DOUBLE_TAP_ENABLED is defined the bootloader is started by quickly
225+
* tapping two times on the reset button (within 1/2 second).
226+
* Size: ~96B. Enabled by default.
227+
*/
228+
//#define BOOT_DOUBLE_TAP_ENABLED
229+
230+
/*
231+
* If BOOT_LOAD_PIN_ENABLED is defined, the bootloader is started if the selected
232+
* pin is active after reset. There is a 10ms delay before testing the pin to
233+
* allow time for debouncing capacitors to charge (ie: button use). PORT can be 0
234+
* (Port A) or 1 (Port B). Polarity can be PIN_POLARITY_ACTIVE_LOW or
235+
* PIN_POLARITY_ACTIVE_HIGH. Config can be INPUT, INPUT_PULLUP, or INPUT_PULLDOWN.
236+
* Size: ~84B. Disabled by default.
237+
*/
238+
#define BOOT_LOAD_PIN_ENABLED
239+
#define BOOT_LOAD_PIN_POLARITY PIN_POLARITY_ACTIVE_LOW
240+
#define BOOT_LOAD_PIN_PORT (0)
241+
#define BOOT_LOAD_PIN (31)
242+
#define BOOT_LOAD_PIN_CONFIG INPUT_PULLUP
243+
244+
/*
245+
* If BOARD_LED_FADE_ENABLED is defined, then the main LED produces a PWM fade in an
246+
* "M-wave" pattern, otherwise, it simply turns on (if enabled). When the SD bootloader
247+
* is running, the fading will be twice as fast as the SAM-BA interface (USB CDC or UART).
248+
* Size: ~160B. Enabled by default.
249+
*/
250+
//#define BOARD_LED_FADE_ENABLED
251+
252+
/*
253+
* If the LED PORT is defined, then the LED on the associated pin is enabled.
254+
* Polarity can be either LED_POLARITY_HIGH_ON or LED_POLARITY_LOW_ON.
255+
* By default, only BOARD_LED is enabled.
256+
*/
257+
#if defined(SDCARD_ENABLED)
258+
#define BOARD_LED_PORT (0)
259+
#define BOARD_LED_PIN (16)
260+
#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON
261+
#else
262+
//#define BOARD_LED_PORT (0)
263+
//#define BOARD_LED_PIN (16)
264+
//#define BOARD_LED_POLARITY LED_POLARITY_HIGH_ON
265+
#endif
266+
267+
//#define BOARD_LEDRX_PORT (0)
268+
//#define BOARD_LEDRX_PIN (16)
269+
//#define BOARD_LEDRX_POLARITY LED_POLARITY_HIGH_ON
270+
271+
//#define BOARD_LEDTX_PORT (0)
272+
//#define BOARD_LEDTX_PIN (16)
273+
//#define BOARD_LEDTX_POLARITY LED_POLARITY_HIGH_ON
274+
275+
#endif // _BOARD_DEFINITIONS_H_

bootloaders/zero/build_all_bootloaders.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ BOARD_ID=arduino_mkrfox1200 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostl
8585
BOARD_ID=arduino_m0 MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean
8686
BOARD_ID=arduino_m0_pro MCU=SAMD21G18A SDCARD=SDCARD_DISABLED make all mostly_clean
8787

88+
BOARD_ID=arduino_MuxTO MCU=SAMD11D14AM SDCARD=SDCARD_DISABLED make all mostly_clean
8889

8990
# With SDCARD_ENABLED
9091
BOARD_ID=Xeno MCU=SAMD21J18A SDCARD=SDCARD_ENABLED make all mostly_clean

0 commit comments

Comments
 (0)