Skip to content

Commit 5f494e0

Browse files
committed
Harmonize build rules for cc+org boards
Main differences: * avrdude compatible vs bossac bootloader * flash location of user sketch (0x2000 vs 0x4000)
1 parent dac2df4 commit 5f494e0

File tree

2 files changed

+173
-5
lines changed

2 files changed

+173
-5
lines changed

boards.txt

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ arduino_zero_edbg.build.variant=arduino_zero
3939
arduino_zero_edbg.build.variant_system_lib=
4040
arduino_zero_edbg.build.vid=0x2341
4141
arduino_zero_edbg.build.pid=0x804d
42+
arduino_zero_edbg.build.section.start=0x2000
4243
arduino_zero_edbg.bootloader.tool=openocd
4344
arduino_zero_edbg.bootloader.file=zero/samd21_sam_ba.bin
4445

@@ -85,6 +86,7 @@ arduino_zero_native.build.variant=arduino_zero
8586
arduino_zero_native.build.variant_system_lib=
8687
arduino_zero_native.build.vid=0x2341
8788
arduino_zero_native.build.pid=0x804d
89+
arduino_zero_native.build.section.start=0x2000
8890
arduino_zero_native.bootloader.tool=openocd
8991
arduino_zero_native.bootloader.file=zero/samd21_sam_ba.bin
9092

@@ -130,6 +132,7 @@ mkr1000.build.openocdscript=openocd_scripts/arduino_zero.cfg
130132
mkr1000.build.variant=mkr1000
131133
mkr1000.build.vid=0x2341
132134
mkr1000.build.pid=0x804e
135+
mkr1000.build.section.start=0x2000
133136
mkr1000.bootloader.tool=openocd
134137
mkr1000.bootloader.file=mkr1000/samd21_sam_ba_arduino_mkr1000.bin
135138

@@ -159,6 +162,7 @@ mkrzero.build.openocdscript=openocd_scripts/arduino_zero.cfg
159162
mkrzero.build.variant=mkrzero
160163
mkrzero.build.vid=0x2341
161164
mkrzero.build.pid=0x804f
165+
mkrzero.build.section.start=0x2000
162166
mkrzero.bootloader.tool=openocd
163167
mkrzero.bootloader.file=mkrzero/samd21_sam_ba_arduino_mkrzero.bin
164168

@@ -191,3 +195,149 @@ adafruit_circuitplayground_m0.build.pid=0x8018
191195
adafruit_circuitplayground_m0.bootloader.tool=openocd
192196
adafruit_circuitplayground_m0.bootloader.file=circuitplay/circuitplay_m0_samd21g18_sam_ba.bin
193197

198+
######################################################
199+
#ARDUINO M0 PRO (WITH) BOOTLOADER - PROGRAMMING PORT
200+
mzero_pro_bl_dbg.name=Arduino M0 Pro (Programming Port)
201+
mzero_pro_bl_dbg.vid.0=0x03eb
202+
mzero_pro_bl_dbg.pid.0=0x2111
203+
mzero_pro_bl_dbg.upload.tool=openocd
204+
mzero_pro_bl_dbg.upload.protocol=sam-ba
205+
mzero_pro_bl_dbg.upload.maximum_size=262144
206+
mzero_pro_bl_dbg.upload.use_1200bps_touch=false
207+
mzero_pro_bl_dbg.upload.wait_for_upload_port=false
208+
mzero_pro_bl_dbg.upload.native_usb=false
209+
mzero_pro_bl_dbg.build.mcu=cortex-m0plus
210+
mzero_pro_bl_dbg.build.f_cpu=48000000L
211+
mzero_pro_bl_dbg.build.usb_product="Arduino M0 Pro"
212+
mzero_pro_bl_dbg.build.board=SAM_ZERO
213+
mzero_pro_bl_dbg.build.core=arduino
214+
mzero_pro_bl_dbg.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags}
215+
mzero_pro_bl_dbg.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
216+
mzero_pro_bl_dbg.build.openocdscript=openocd_scripts/arduino_zero.cfg
217+
mzero_pro_bl_dbg.build.variant=arduino_mzero
218+
mzero_pro_bl_dbg.build.variant_system_lib=
219+
mzero_pro_bl_dbg.build.vid=0x2a03
220+
mzero_pro_bl_dbg.build.pid=0x804f
221+
mzero_pro_bl_dbg.build.preferred_out_format=hex
222+
mzero_pro_bl_dbg.build.section.start=0x4000
223+
224+
mzero_pro_bl_dbg.bootloader.tool=openocd
225+
mzero_pro_bl_dbg.bootloader.cmd_unprotect=at91samd bootloader 0
226+
mzero_pro_bl_dbg.bootloader.cmd_protect=at91samd bootloader 16384
227+
mzero_pro_bl_dbg.bootloader.cmd_protect_verify=at91samd bootloader
228+
mzero_pro_bl_dbg.bootloader.file=mzero/Bootloader_D21_M0_Pro_150427.hex
229+
230+
######################################################
231+
#ARDUINO M0 PRO (WITH) BOOTLOADER - NATIVE PORT
232+
mzero_pro_bl.name=Arduino M0 Pro (Native USB Port)
233+
mzero_pro_bl.vid.0=0x2a03
234+
mzero_pro_bl.pid.0=0x004d
235+
mzero_pro_bl.vid.1=0x2a03
236+
mzero_pro_bl.pid.1=0x804d
237+
mzero_pro_bl.vid.2=0x2a03
238+
mzero_pro_bl.pid.2=0x004f
239+
mzero_pro_bl.vid.3=0x2a03
240+
mzero_pro_bl.pid.3=0x804f
241+
mzero_pro_bl.upload.tool=avrdude
242+
mzero_pro_bl.upload.protocol=stk500v2
243+
mzero_pro_bl.upload.maximum_size=262144
244+
mzero_pro_bl.upload.use_1200bps_touch=true
245+
mzero_pro_bl.upload.wait_for_upload_port=true
246+
mzero_pro_bl.upload.native_usb=true
247+
mzero_pro_bl.upload.speed=57600
248+
mzero_pro_bl.build.mcu=cortex-m0plus
249+
mzero_pro_bl.build.f_cpu=48000000L
250+
mzero_pro_bl.build.usb_product="Arduino M0 Pro"
251+
mzero_pro_bl.build.board=SAM_ZERO
252+
mzero_pro_bl.build.core=arduino
253+
mzero_pro_bl.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags}
254+
mzero_pro_bl.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
255+
mzero_pro_bl.build.variant=arduino_mzero
256+
mzero_pro_bl.build.variant_system_lib=
257+
mzero_pro_bl.build.vid=0x2a03
258+
mzero_pro_bl.build.pid=0x804f
259+
mzero_pro_bl.build.preferred_out_format=hex
260+
mzero_pro_bl.build.section.start=0x4000
261+
mzero_pro_bl.build.emu.mcu=atmega2560
262+
mzero_pro_bl.bootloader.tool=avrdude
263+
mzero_pro_bl.bootloader.low_fuses=0xff
264+
265+
######################################################
266+
#ARDUINO M0 (WITH) BOOTLOADER
267+
mzero_bl.name=Arduino M0
268+
mzero_bl.vid.0=0x2a03
269+
mzero_bl.pid.0=0x004d
270+
mzero_bl.vid.1=0x2a03
271+
mzero_bl.pid.1=0x804d
272+
mzero_bl.vid.2=0x2a03
273+
mzero_bl.pid.2=0x004e
274+
mzero_bl.vid.3=0x2a03
275+
mzero_bl.pid.3=0x804e
276+
mzero_bl.upload.tool=avrdude
277+
mzero_bl.upload.protocol=stk500v2
278+
mzero_bl.upload.maximum_size=262144
279+
mzero_bl.upload.use_1200bps_touch=true
280+
mzero_bl.upload.wait_for_upload_port=true
281+
mzero_bl.upload.native_usb=true
282+
mzero_bl.upload.speed=57600
283+
mzero_bl.build.mcu=cortex-m0plus
284+
mzero_bl.build.f_cpu=48000000L
285+
mzero_bl.build.usb_product="Arduino M0"
286+
mzero_bl.build.board=SAM_ZERO
287+
mzero_bl.build.core=arduino
288+
mzero_bl.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags}
289+
mzero_bl.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
290+
mzero_bl.build.variant=arduino_mzero
291+
mzero_bl.build.variant_system_lib=
292+
mzero_bl.build.vid=0x2a03
293+
mzero_bl.build.pid=0x804e
294+
mzero_bl.build.preferred_out_format=hex
295+
mzero_bl.build.section.start=0x4000
296+
mzero_bl.build.emu.mcu=atmega2560
297+
mzero_bl.bootloader.tool=avrdude
298+
mzero_bl.bootloader.low_fuses=0xff
299+
300+
######################################################
301+
#ARDUINO TIAN (WITH) BOOTLOADER
302+
303+
tian.name=Arduino Tian
304+
tian.upload.via_ssh=true
305+
tian.vid.0=0x10C4
306+
tian.pid.0=0xEA70
307+
tian.descriptor.0="Extended Port"
308+
309+
tian.upload.tool=avrdude
310+
#tian.upload.protocol=stk500v2
311+
tian.upload.protocol=wiring
312+
tian.upload.maximum_size=262144
313+
tian.upload.use_1200bps_touch=true
314+
tian.upload.wait_for_upload_port=true
315+
tian.upload.native_usb=true
316+
tian.upload.speed=57600
317+
tian.build.mcu=cortex-m0plus
318+
tian.build.f_cpu=48000000L
319+
tian.build.usb_product="Arduino Tian"
320+
tian.build.board=SAMD_TIAN
321+
tian.build.core=arduino
322+
tian.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags}
323+
tian.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
324+
tian.build.variant=arduino_mzero
325+
tian.build.variant_system_lib=
326+
tian.build.vid=0x2a03
327+
tian.build.pid=0x8052
328+
tian.build.preferred_out_format=hex
329+
tian.build.section.start=0x4000
330+
tian.build.emu.mcu=atmega2560
331+
tian.bootloader.tool=avrdude
332+
tian.bootloader.low_fuses=0xff
333+
tian.bootloader.file=sofia/Sofia_Tian_151118.hex
334+
tian.drivers=SiliconLabs-CP2105/Silicon Labs VCP Driver.pkg
335+
336+
######################################################
337+
#ARDUINO TIAN CONSOLE PORT (NOT FOR UPLOAD)
338+
339+
tian_cons.name=Arduino Tian (Console port)
340+
tian_cons.vid.0=0x10C4
341+
tian_cons.pid.0=0xEA70
342+
tian_cons.descriptor.0="Primary Port"
343+
>>>>>>> Harmonize build rules for cc+org boards

platform.txt

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ compiler.ar.cmd=arm-none-eabi-ar
4444
compiler.ar.flags=rcs
4545
compiler.objcopy.cmd=arm-none-eabi-objcopy
4646
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
47-
compiler.elf2hex.flags=-O binary
47+
compiler.elf2hex.bin.flags=-O binary
48+
compiler.elf2hex.hex.flags=-O ihex -R .eeprom
4849
compiler.elf2hex.cmd=arm-none-eabi-objcopy
4950
compiler.ldflags=-mcpu={build.mcu} -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align
5051
compiler.size.cmd=arm-none-eabi-size
@@ -95,11 +96,16 @@ recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compil
9596
recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" --specs=nano.specs --specs=nosys.specs {compiler.ldflags} -o "{build.path}/{build.project_name}.elf" {object_files} -Wl,--start-group {compiler.arm.cmsis.ldflags} -lm "{build.path}/{archive_file}" -Wl,--end-group
9697

9798
## Create output (bin file)
98-
recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
99+
recipe.objcopy.bin.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.bin.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.bin"
100+
101+
## Create output (hex file)
102+
recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
103+
104+
build.preferred_out_format=bin
99105

100106
## Save hex
101-
recipe.output.tmp_file={build.project_name}.bin
102-
recipe.output.save_file={build.project_name}.{build.variant}.bin
107+
recipe.output.tmp_file={build.project_name}.{build.preferred_out_format}
108+
recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_out_format}
103109

104110
## Compute size
105111
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
@@ -109,6 +115,18 @@ recipe.size.regex=\.text\s+([0-9]+).*
109115
# Uploader tools
110116
# --------------
111117

118+
#
119+
# AVRDUDE
120+
#
121+
tools.avrdude.path={runtime.tools.avrdude.path}
122+
tools.avrdude.cmd={path}/bin/avrdude
123+
tools.avrdude.config.path={path}/etc/avrdude.conf
124+
125+
tools.avrdude.upload.params.verbose=-v -v
126+
tools.avrdude.upload.params.quiet=-q -q
127+
tools.avrdude.upload.params.noverify=-V
128+
tools.avrdude.upload.pattern="{cmd}" "-C{config.path}" {upload.verbose} -p{build.emu.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
129+
112130
#
113131
# BOSSA
114132
#
@@ -132,7 +150,7 @@ tools.openocd.cmd.windows=bin/openocd.exe
132150

133151
tools.openocd.upload.params.verbose=-d2
134152
tools.openocd.upload.params.quiet=-d0
135-
tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{{build.path}/{build.project_name}.bin}} verify reset 0x00002000; shutdown"
153+
tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; program {{{build.path}/{build.project_name}.bin}} verify reset {build.section.start}; shutdown"
136154

137155
tools.openocd.program.params.verbose=-d2
138156
tools.openocd.program.params.quiet=-d0

0 commit comments

Comments
 (0)