Skip to content

Commit 70eff4b

Browse files
facchinmcmaglie
authored andcommitted
Initial porting of MKRGSM1400
PMIC handling needs to be decided; if we use the SDU method we could have troubles. Probably the best way is using sercoms directly. Anyway, the defaults SHOULD be almost ok (except the maximun charging current)
1 parent af14b97 commit 70eff4b

File tree

12 files changed

+948
-0
lines changed

12 files changed

+948
-0
lines changed

boards.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,35 @@ mkrfox1200.build.pid=0x8050
191191
mkrfox1200.bootloader.tool=openocd
192192
mkrfox1200.bootloader.file=mkrfox1200/samd21_sam_ba_arduino_mkrfox1200.bin
193193

194+
# Arduino MKRGSM1400
195+
# ---------------
196+
mkrgsm1400.name=Arduino MKRGSM1400
197+
mkrgsm1400.vid.0=0x2341
198+
mkrgsm1400.pid.0=0x8052
199+
mkrgsm1400.vid.1=0x2341
200+
mkrgsm1400.pid.1=0x0052
201+
202+
mkrgsm1400.upload.tool=bossac
203+
mkrgsm1400.upload.protocol=sam-ba
204+
mkrgsm1400.upload.maximum_size=262144
205+
mkrgsm1400.upload.use_1200bps_touch=true
206+
mkrgsm1400.upload.wait_for_upload_port=true
207+
mkrgsm1400.upload.native_usb=true
208+
mkrgsm1400.build.mcu=cortex-m0plus
209+
mkrgsm1400.build.f_cpu=48000000L
210+
mkrgsm1400.build.usb_product="Arduino MKRGSM1400"
211+
mkrgsm1400.build.usb_manufacturer="Arduino LLC"
212+
mkrgsm1400.build.board=SAMD_MKRGSM1400
213+
mkrgsm1400.build.core=arduino
214+
mkrgsm1400.build.extra_flags=-D__SAMD21G18A__ {build.usb_flags} -DUSE_BQ24195L_PMIC
215+
mkrgsm1400.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
216+
mkrgsm1400.build.openocdscript=openocd_scripts/arduino_zero.cfg
217+
mkrgsm1400.build.variant=mkrgsm1400
218+
mkrgsm1400.build.vid=0x2341
219+
mkrgsm1400.build.pid=0x8052
220+
mkrgsm1400.bootloader.tool=openocd
221+
mkrgsm1400.bootloader.file=mkrgsm1400/samd21_sam_ba_arduino_mkrgsm1400.bin
222+
194223
# Adafruit Circuit Playground M0
195224
# ------------------------------
196225
adafruit_circuitplayground_m0.name=Adafruit Circuit Playground Express

bootloaders/zero/board_definitions.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929
#include "board_definitions_arduino_mkrzero.h"
3030
#elif defined(BOARD_ID_arduino_mkrfox1200)
3131
#include "board_definitions_arduino_mkrfox1200.h"
32+
#elif defined(BOARD_ID_arduino_mkrgsm1400)
33+
#include "board_definitions_arduino_mkrgsm1400.h"
3234
#else
3335
#error You must define a BOARD_ID and add the corresponding definitions in board_definitions.h
3436
#endif

bootloaders/zero/build_all_bootloaders.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,8 @@ mv -v samd21_sam_ba_arduino_mkrzero.* ../mkrzero/
1616
BOARD_ID=arduino_mkrfox1200 NAME=samd21_sam_ba_arduino_mkrfox1200 make clean all
1717
mv -v samd21_sam_ba_arduino_mkrfox1200.* ../mkrfox1200/
1818

19+
BOARD_ID=arduino_mkrgsm1400 NAME=samd21_sam_ba_arduino_mkrgsm1400 make clean all
20+
mv -v samd21_sam_ba_arduino_mkrgsm1400.* ../mkrgsm1400/
21+
1922
echo Done building bootloaders!
2023

libraries/SDU/extras/SDUBoot/build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ buildSDUBootSketch "arduino:samd:arduino_zero_edbg" "$OUTPUT_PATH/zero.h"
2525
buildSDUBootSketch "arduino:samd:mkr1000" "$OUTPUT_PATH/mkr1000.h"
2626
buildSDUBootSketch "arduino:samd:mkrzero" "$OUTPUT_PATH/mkrzero.h"
2727
buildSDUBootSketch "arduino:samd:mkrfox1200" "$OUTPUT_PATH/mkrfox1200.h"
28+
buildSDUBootSketch "arduino:samd:mkrgsm1400" "$OUTPUT_PATH/mkrgsm1400.h"

libraries/SDU/src/SDU.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ unsigned char sduBoot[0x4000] = {
3030
#include "boot/mkrzero.h"
3131
#elif defined(ARDUINO_SAMD_MKRFox1200)
3232
#include "boot/mkrfox1200.h"
33+
#elif defined(ARDUINO_SAMD_MKRGSM1400)
34+
#include "boot/mkrgsm1400.h"
3335
#else
3436
#error "Unsupported board!"
3537
#endif
Lines changed: 31 additions & 0 deletions
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"
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
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(*(.sketch_boot))
71+
72+
/* After the constructors, call PMIC handling stuff (precompiled) */
73+
KEEP(*(.init_pmic_variant))
74+
75+
. = ALIGN(0x2000);
76+
KEEP(*(.isr_vector))
77+
*(.text*)
78+
79+
KEEP(*(.init))
80+
KEEP(*(.fini))
81+
82+
/* .ctors */
83+
*crtbegin.o(.ctors)
84+
*crtbegin?.o(.ctors)
85+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
86+
*(SORT(.ctors.*))
87+
*(.ctors)
88+
89+
90+
/* .dtors */
91+
*crtbegin.o(.dtors)
92+
*crtbegin?.o(.dtors)
93+
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
94+
*(SORT(.dtors.*))
95+
*(.dtors)
96+
97+
*(.rodata*)
98+
99+
KEEP(*(.eh_frame*))
100+
} > FLASH
101+
102+
.ARM.extab :
103+
{
104+
*(.ARM.extab* .gnu.linkonce.armextab.*)
105+
} > FLASH
106+
107+
__exidx_start = .;
108+
.ARM.exidx :
109+
{
110+
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
111+
} > FLASH
112+
__exidx_end = .;
113+
114+
/* To copy multiple ROM to RAM sections,
115+
* uncomment .copy.table section and,
116+
* define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
117+
/*
118+
.copy.table :
119+
{
120+
. = ALIGN(4);
121+
__copy_table_start__ = .;
122+
LONG (__etext)
123+
LONG (__data_start__)
124+
LONG (__data_end__ - __data_start__)
125+
LONG (__etext2)
126+
LONG (__data2_start__)
127+
LONG (__data2_end__ - __data2_start__)
128+
__copy_table_end__ = .;
129+
} > FLASH
130+
*/
131+
132+
/* To clear multiple BSS sections,
133+
* uncomment .zero.table section and,
134+
* define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
135+
/*
136+
.zero.table :
137+
{
138+
. = ALIGN(4);
139+
__zero_table_start__ = .;
140+
LONG (__bss_start__)
141+
LONG (__bss_end__ - __bss_start__)
142+
LONG (__bss2_start__)
143+
LONG (__bss2_end__ - __bss2_start__)
144+
__zero_table_end__ = .;
145+
} > FLASH
146+
*/
147+
148+
__etext = .;
149+
150+
.data : AT (__etext)
151+
{
152+
__data_start__ = .;
153+
*(vtable)
154+
*(.data*)
155+
156+
. = ALIGN(4);
157+
/* preinit data */
158+
PROVIDE_HIDDEN (__preinit_array_start = .);
159+
KEEP(*(.preinit_array))
160+
PROVIDE_HIDDEN (__preinit_array_end = .);
161+
162+
. = ALIGN(4);
163+
/* init data */
164+
PROVIDE_HIDDEN (__init_array_start = .);
165+
KEEP(*(SORT(.init_array.*)))
166+
KEEP(*(.init_array))
167+
PROVIDE_HIDDEN (__init_array_end = .);
168+
169+
170+
. = ALIGN(4);
171+
/* finit data */
172+
PROVIDE_HIDDEN (__fini_array_start = .);
173+
KEEP(*(SORT(.fini_array.*)))
174+
KEEP(*(.fini_array))
175+
PROVIDE_HIDDEN (__fini_array_end = .);
176+
177+
KEEP(*(.jcr*))
178+
. = ALIGN(16);
179+
/* All data end */
180+
__data_end__ = .;
181+
182+
} > RAM
183+
184+
.bss :
185+
{
186+
. = ALIGN(4);
187+
__bss_start__ = .;
188+
*(.bss*)
189+
*(COMMON)
190+
. = ALIGN(4);
191+
__bss_end__ = .;
192+
} > RAM
193+
194+
.heap (COPY):
195+
{
196+
__end__ = .;
197+
PROVIDE(end = .);
198+
*(.heap*)
199+
__HeapLimit = .;
200+
} > RAM
201+
202+
/* .stack_dummy section doesn't contains any symbols. It is only
203+
* used for linker to calculate size of stack sections, and assign
204+
* values to stack symbols later */
205+
.stack_dummy (COPY):
206+
{
207+
*(.stack*)
208+
} > RAM
209+
210+
/* Set stack top to end of RAM, and stack limit move down by
211+
* size of stack_dummy section */
212+
__StackTop = ORIGIN(RAM) + LENGTH(RAM);
213+
__StackLimit = __StackTop - SIZEOF(.stack_dummy);
214+
PROVIDE(__stack = __StackTop);
215+
216+
__ram_end__ = ORIGIN(RAM) + LENGTH(RAM) -1 ;
217+
218+
/* Check if data + heap + stack exceeds RAM limit */
219+
ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
220+
}

0 commit comments

Comments
 (0)