Skip to content

Commit 95c9ec6

Browse files
cmagliefacchinm
authored andcommitted
Added bootloader and boards definition for MKRFox1200 board
1 parent f7c8e94 commit 95c9ec6

13 files changed

+1408
-0
lines changed

boards.txt

+29
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,35 @@ mkrzero.build.pid=0x804f
162162
mkrzero.bootloader.tool=openocd
163163
mkrzero.bootloader.file=mkrzero/samd21_sam_ba_arduino_mkrzero.bin
164164

165+
# Arduino MKRFox1200
166+
# ---------------
167+
mkrfox1200.name=Arduino MKRFox1200
168+
mkrfox1200.vid.0=0x2341
169+
mkrfox1200.pid.0=0x8050
170+
mkrfox1200.vid.1=0x2341
171+
mkrfox1200.pid.1=0x0050
172+
173+
mkrfox1200.upload.tool=bossac
174+
mkrfox1200.upload.protocol=sam-ba
175+
mkrfox1200.upload.maximum_size=262144
176+
mkrfox1200.upload.use_1200bps_touch=true
177+
mkrfox1200.upload.wait_for_upload_port=true
178+
mkrfox1200.upload.native_usb=true
179+
mkrfox1200.build.mcu=cortex-m0plus
180+
mkrfox1200.build.f_cpu=48000000L
181+
mkrfox1200.build.usb_product="Arduino MKRFox1200"
182+
mkrfox1200.build.usb_manufacturer="Arduino LLC"
183+
mkrfox1200.build.board=SAMD_MKRFox1200
184+
mkrfox1200.build.core=arduino
185+
mkrfox1200.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags}
186+
mkrfox1200.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
187+
mkrfox1200.build.openocdscript=openocd_scripts/arduino_zero.cfg
188+
mkrfox1200.build.variant=mkrfox1200
189+
mkrfox1200.build.vid=0x2341
190+
mkrfox1200.build.pid=0x8050
191+
mkrfox1200.bootloader.tool=openocd
192+
mkrfox1200.bootloader.file=mkrfox1200/samd21_sam_ba_arduino_mkrfox1200.bin
193+
165194
# Adafruit Circuit Playground M0
166195
# ------------------------------
167196
adafruit_circuitplayground_m0.name=Adafruit Circuit Playground Express
Binary file not shown.

bootloaders/mkrfox1200/samd21_sam_ba_arduino_mkrfox1200.hex

+403
Large diffs are not rendered by default.

bootloaders/zero/board_definitions.h

+2
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
#include "board_definitions_genuino_mkr1000.h"
2828
#elif defined(BOARD_ID_arduino_mkrzero)
2929
#include "board_definitions_arduino_mkrzero.h"
30+
#elif defined(BOARD_ID_arduino_mkrfox1200)
31+
#include "board_definitions_arduino_mkrfox1200.h"
3032
#else
3133
#error You must define a BOARD_ID and add the corresponding definitions in board_definitions.h
3234
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
/*
2+
Copyright (c) 2016 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+
19+
#ifndef _BOARD_DEFINITIONS_H_
20+
#define _BOARD_DEFINITIONS_H_
21+
22+
/*
23+
* USB device definitions
24+
*/
25+
#define STRING_PRODUCT "Arduino MKRFox1200"
26+
#define USB_VID_HIGH 0x23
27+
#define USB_VID_LOW 0x41
28+
#define USB_PID_HIGH 0x00
29+
#define USB_PID_LOW 0x50
30+
31+
/*
32+
* If BOOT_DOUBLE_TAP_ADDRESS is defined the bootloader is started by
33+
* quickly tapping two times on the reset button.
34+
* BOOT_DOUBLE_TAP_ADDRESS must point to a free SRAM cell that must not
35+
* be touched from the loaded application.
36+
*/
37+
#define BOOT_DOUBLE_TAP_ADDRESS (0x20007FFCul)
38+
#define BOOT_DOUBLE_TAP_DATA (*((volatile uint32_t *) BOOT_DOUBLE_TAP_ADDRESS))
39+
40+
/*
41+
* If BOOT_LOAD_PIN is defined the bootloader is started if the selected
42+
* pin is tied LOW.
43+
*/
44+
//#define BOOT_LOAD_PIN PIN_PA21
45+
//#define BOOT_LOAD_PIN PIN_PA15
46+
47+
#define BOOT_USART_MODULE SERCOM5
48+
#define BOOT_USART_BUS_CLOCK_INDEX PM_APBCMASK_SERCOM5
49+
#define BOOT_USART_PER_CLOCK_INDEX GCLK_CLKCTRL_ID_SERCOM5_CORE_Val
50+
#define BOOT_USART_PAD_SETTINGS UART_RX_PAD3_TX_PAD2
51+
#define BOOT_USART_PAD3 PINMUX_PB23D_SERCOM5_PAD3
52+
#define BOOT_USART_PAD2 PINMUX_PB22D_SERCOM5_PAD2
53+
#define BOOT_USART_PAD1 PINMUX_UNUSED
54+
#define BOOT_USART_PAD0 PINMUX_UNUSED
55+
56+
/* Master clock frequency */
57+
#define CPU_FREQUENCY (48000000ul)
58+
#define VARIANT_MCK CPU_FREQUENCY
59+
60+
/* Frequency of the board main oscillator */
61+
#define VARIANT_MAINOSC (32768ul)
62+
63+
/* Calibration values for DFLL48 pll */
64+
#define NVM_SW_CALIB_DFLL48M_COARSE_VAL (58)
65+
#define NVM_SW_CALIB_DFLL48M_FINE_VAL (64)
66+
67+
/*
68+
* LEDs definitions
69+
*/
70+
// PA20 (digital pin 6)
71+
#define BOARD_LED_PORT (0)
72+
#define BOARD_LED_PIN (20)
73+
74+
// No RX/TX led
75+
//#define BOARD_LEDRX_PORT
76+
//#define BOARD_LEDRX_PIN
77+
78+
//#define BOARD_LEDTX_PORT
79+
//#define BOARD_LEDTX_PIN
80+
81+
#endif // _BOARD_DEFINITIONS_H_

bootloaders/zero/build_all_bootloaders.sh

+3
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,8 @@ mv -v samd21_sam_ba_genuino_mkr1000.* ../mkr1000/
1313
BOARD_ID=arduino_mkrzero NAME=samd21_sam_ba_arduino_mkrzero make clean all
1414
mv -v samd21_sam_ba_arduino_mkrzero.* ../mkrzero/
1515

16+
BOARD_ID=arduino_mkrfox1200 NAME=samd21_sam_ba_arduino_mkrfox1200 make clean all
17+
mv -v samd21_sam_ba_arduino_mkrfox1200.* ../mkrfox1200/
18+
1619
echo Done building bootloaders!
1720

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#
2+
# Arduino Zero OpenOCD script.
3+
#
4+
# Copyright (c) 2014-2015 Arduino LLC. 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+
# Define 'reset' command
22+
define reset
23+
24+
info reg
25+
26+
break main
27+
28+
# End of 'reset' command
29+
end
30+
31+
target remote | openocd -c "interface cmsis-dap" -c "set CHIPNAME at91samd21g18" -f target/at91samdXX.cfg -c "gdb_port pipe; log_output openocd.log"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
/*
2+
Copyright (c) 2014-2015 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+
19+
/* Linker script to configure memory regions.
20+
* Need modifying for a specific board.
21+
* FLASH.ORIGIN: starting address of flash
22+
* FLASH.LENGTH: length of flash
23+
* RAM.ORIGIN: starting address of RAM bank 0
24+
* RAM.LENGTH: length of RAM bank 0
25+
*/
26+
MEMORY
27+
{
28+
FLASH (rx) : ORIGIN = 0x00000000+0x2000, LENGTH = 0x00040000-0x2000 /* First 8KB used by bootloader */
29+
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
30+
}
31+
32+
/* Linker script to place sections and symbol values. Should be used together
33+
* with other linker script that defines memory regions FLASH and RAM.
34+
* It references following symbols, which must be defined in code:
35+
* Reset_Handler : Entry of reset handler
36+
*
37+
* It defines following symbols, which code can use without definition:
38+
* __exidx_start
39+
* __exidx_end
40+
* __copy_table_start__
41+
* __copy_table_end__
42+
* __zero_table_start__
43+
* __zero_table_end__
44+
* __etext
45+
* __data_start__
46+
* __preinit_array_start
47+
* __preinit_array_end
48+
* __init_array_start
49+
* __init_array_end
50+
* __fini_array_start
51+
* __fini_array_end
52+
* __data_end__
53+
* __bss_start__
54+
* __bss_end__
55+
* __end__
56+
* end
57+
* __HeapLimit
58+
* __StackLimit
59+
* __StackTop
60+
* __stack
61+
*/
62+
ENTRY(Reset_Handler)
63+
64+
SECTIONS
65+
{
66+
.text :
67+
{
68+
__text_start__ = .;
69+
70+
KEEP(*(.isr_vector))
71+
*(.text*)
72+
73+
KEEP(*(.init))
74+
KEEP(*(.fini))
75+
76+
/* .ctors */
77+
*crtbegin.o(.ctors)
78+
*crtbegin?.o(.ctors)
79+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
80+
*(SORT(.ctors.*))
81+
*(.ctors)
82+
83+
/* .dtors */
84+
*crtbegin.o(.dtors)
85+
*crtbegin?.o(.dtors)
86+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
87+
*(SORT(.dtors.*))
88+
*(.dtors)
89+
90+
*(.rodata*)
91+
92+
KEEP(*(.eh_frame*))
93+
} > FLASH
94+
95+
.ARM.extab :
96+
{
97+
*(.ARM.extab* .gnu.linkonce.armextab.*)
98+
} > FLASH
99+
100+
__exidx_start = .;
101+
.ARM.exidx :
102+
{
103+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
104+
} > FLASH
105+
__exidx_end = .;
106+
107+
/* To copy multiple ROM to RAM sections,
108+
* uncomment .copy.table section and,
109+
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
110+
/*
111+
.copy.table :
112+
{
113+
. = ALIGN(4);
114+
__copy_table_start__ = .;
115+
LONG (__etext)
116+
LONG (__data_start__)
117+
LONG (__data_end__ - __data_start__)
118+
LONG (__etext2)
119+
LONG (__data2_start__)
120+
LONG (__data2_end__ - __data2_start__)
121+
__copy_table_end__ = .;
122+
} > FLASH
123+
*/
124+
125+
/* To clear multiple BSS sections,
126+
* uncomment .zero.table section and,
127+
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
128+
/*
129+
.zero.table :
130+
{
131+
. = ALIGN(4);
132+
__zero_table_start__ = .;
133+
LONG (__bss_start__)
134+
LONG (__bss_end__ - __bss_start__)
135+
LONG (__bss2_start__)
136+
LONG (__bss2_end__ - __bss2_start__)
137+
__zero_table_end__ = .;
138+
} > FLASH
139+
*/
140+
141+
__etext = .;
142+
143+
.data : AT (__etext)
144+
{
145+
__data_start__ = .;
146+
*(vtable)
147+
*(.data*)
148+
149+
. = ALIGN(4);
150+
/* preinit data */
151+
PROVIDE_HIDDEN (__preinit_array_start = .);
152+
KEEP(*(.preinit_array))
153+
PROVIDE_HIDDEN (__preinit_array_end = .);
154+
155+
. = ALIGN(4);
156+
/* init data */
157+
PROVIDE_HIDDEN (__init_array_start = .);
158+
KEEP(*(SORT(.init_array.*)))
159+
KEEP(*(.init_array))
160+
PROVIDE_HIDDEN (__init_array_end = .);
161+
162+
163+
. = ALIGN(4);
164+
/* finit data */
165+
PROVIDE_HIDDEN (__fini_array_start = .);
166+
KEEP(*(SORT(.fini_array.*)))
167+
KEEP(*(.fini_array))
168+
PROVIDE_HIDDEN (__fini_array_end = .);
169+
170+
KEEP(*(.jcr*))
171+
. = ALIGN(16);
172+
/* All data end */
173+
__data_end__ = .;
174+
175+
} > RAM
176+
177+
.bss :
178+
{
179+
. = ALIGN(4);
180+
__bss_start__ = .;
181+
*(.bss*)
182+
*(COMMON)
183+
. = ALIGN(4);
184+
__bss_end__ = .;
185+
} > RAM
186+
187+
.heap (COPY):
188+
{
189+
__end__ = .;
190+
PROVIDE(end = .);
191+
*(.heap*)
192+
__HeapLimit = .;
193+
} > RAM
194+
195+
/* .stack_dummy section doesn't contains any symbols. It is only
196+
* used for linker to calculate size of stack sections, and assign
197+
* values to stack symbols later */
198+
.stack_dummy (COPY):
199+
{
200+
*(.stack*)
201+
} > RAM
202+
203+
/* Set stack top to end of RAM, and stack limit move down by
204+
* size of stack_dummy section */
205+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
206+
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
207+
PROVIDE(__stack = __StackTop);
208+
209+
__ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ;
210+
211+
/* Check if data + heap + stack exceeds RAM limit */
212+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
213+
}

0 commit comments

Comments
 (0)