Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Harmonize build rules for cc+org boards
Main differences:

* avrdude compatible vs bossac bootloader
* flash location of user sketch (0x2000 vs 0x4000)
  • Loading branch information
facchinm committed Dec 16, 2016
commit 20150c528625583d31e8db3093c75fc82685bbf1
150 changes: 150 additions & 0 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ arduino_zero_edbg.build.variant=arduino_zero
arduino_zero_edbg.build.variant_system_lib=
arduino_zero_edbg.build.vid=0x2341
arduino_zero_edbg.build.pid=0x804d
arduino_zero_edbg.build.section.start=0x2000
arduino_zero_edbg.bootloader.tool=openocd
arduino_zero_edbg.bootloader.file=zero/samd21_sam_ba.bin

Expand Down Expand Up @@ -85,6 +86,7 @@ arduino_zero_native.build.variant=arduino_zero
arduino_zero_native.build.variant_system_lib=
arduino_zero_native.build.vid=0x2341
arduino_zero_native.build.pid=0x804d
arduino_zero_native.build.section.start=0x2000
arduino_zero_native.bootloader.tool=openocd
arduino_zero_native.bootloader.file=zero/samd21_sam_ba.bin

Expand Down Expand Up @@ -130,6 +132,7 @@ mkr1000.build.openocdscript=openocd_scripts/arduino_zero.cfg
mkr1000.build.variant=mkr1000
mkr1000.build.vid=0x2341
mkr1000.build.pid=0x804e
mkr1000.build.section.start=0x2000
mkr1000.bootloader.tool=openocd
mkr1000.bootloader.file=mkr1000/samd21_sam_ba_arduino_mkr1000.bin

Expand Down Expand Up @@ -159,5 +162,152 @@ mkrzero.build.openocdscript=openocd_scripts/arduino_zero.cfg
mkrzero.build.variant=mkrzero
mkrzero.build.vid=0x2341
mkrzero.build.pid=0x804f
mkrzero.build.section.start=0x2000
mkrzero.bootloader.tool=openocd
mkrzero.bootloader.file=mkrzero/samd21_sam_ba_arduino_mkrzero.bin

######################################################
#ARDUINO M0 PRO (WITH) BOOTLOADER - PROGRAMMING PORT
mzero_pro_bl_dbg.name=Arduino M0 Pro (Programming Port)
mzero_pro_bl_dbg.vid.0=0x03eb
mzero_pro_bl_dbg.pid.0=0x2111
mzero_pro_bl_dbg.upload.tool=openocd
mzero_pro_bl_dbg.upload.protocol=sam-ba
mzero_pro_bl_dbg.upload.maximum_size=262144
mzero_pro_bl_dbg.upload.use_1200bps_touch=false
mzero_pro_bl_dbg.upload.wait_for_upload_port=false
mzero_pro_bl_dbg.upload.native_usb=false
mzero_pro_bl_dbg.build.mcu=cortex-m0plus
mzero_pro_bl_dbg.build.f_cpu=48000000L
mzero_pro_bl_dbg.build.usb_product="Arduino M0 Pro"
mzero_pro_bl_dbg.build.board=SAM_ZERO
mzero_pro_bl_dbg.build.core=arduino
mzero_pro_bl_dbg.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags}
mzero_pro_bl_dbg.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
mzero_pro_bl_dbg.build.openocdscript=openocd_scripts/arduino_zero.cfg
mzero_pro_bl_dbg.build.variant=arduino_mzero
mzero_pro_bl_dbg.build.variant_system_lib=
mzero_pro_bl_dbg.build.vid=0x2a03
mzero_pro_bl_dbg.build.pid=0x804f
mzero_pro_bl_dbg.build.preferred_out_format=hex
mzero_pro_bl_dbg.build.section.start=0x4000

mzero_pro_bl_dbg.bootloader.tool=openocd
mzero_pro_bl_dbg.bootloader.cmd_unprotect=at91samd bootloader 0
mzero_pro_bl_dbg.bootloader.cmd_protect=at91samd bootloader 16384
mzero_pro_bl_dbg.bootloader.cmd_protect_verify=at91samd bootloader
mzero_pro_bl_dbg.bootloader.file=mzero/Bootloader_D21_M0_Pro_150427.hex

######################################################
#ARDUINO M0 PRO (WITH) BOOTLOADER - NATIVE PORT
mzero_pro_bl.name=Arduino M0 Pro (Native USB Port)
mzero_pro_bl.vid.0=0x2a03
mzero_pro_bl.pid.0=0x004d
mzero_pro_bl.vid.1=0x2a03
mzero_pro_bl.pid.1=0x804d
mzero_pro_bl.vid.2=0x2a03
mzero_pro_bl.pid.2=0x004f
mzero_pro_bl.vid.3=0x2a03
mzero_pro_bl.pid.3=0x804f
mzero_pro_bl.upload.tool=avrdude
mzero_pro_bl.upload.protocol=stk500v2
mzero_pro_bl.upload.maximum_size=262144
mzero_pro_bl.upload.use_1200bps_touch=true
mzero_pro_bl.upload.wait_for_upload_port=true
mzero_pro_bl.upload.native_usb=true
mzero_pro_bl.upload.speed=57600
mzero_pro_bl.build.mcu=cortex-m0plus
mzero_pro_bl.build.f_cpu=48000000L
mzero_pro_bl.build.usb_product="Arduino M0 Pro"
mzero_pro_bl.build.board=SAM_ZERO
mzero_pro_bl.build.core=arduino
mzero_pro_bl.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags}
mzero_pro_bl.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
mzero_pro_bl.build.variant=arduino_mzero
mzero_pro_bl.build.variant_system_lib=
mzero_pro_bl.build.vid=0x2a03
mzero_pro_bl.build.pid=0x804f
mzero_pro_bl.build.preferred_out_format=hex
mzero_pro_bl.build.section.start=0x4000
mzero_pro_bl.build.emu.mcu=atmega2560
mzero_pro_bl.bootloader.tool=avrdude
mzero_pro_bl.bootloader.low_fuses=0xff

######################################################
#ARDUINO M0 (WITH) BOOTLOADER
mzero_bl.name=Arduino M0
mzero_bl.vid.0=0x2a03
mzero_bl.pid.0=0x004d
mzero_bl.vid.1=0x2a03
mzero_bl.pid.1=0x804d
mzero_bl.vid.2=0x2a03
mzero_bl.pid.2=0x004e
mzero_bl.vid.3=0x2a03
mzero_bl.pid.3=0x804e
mzero_bl.upload.tool=avrdude
mzero_bl.upload.protocol=stk500v2
mzero_bl.upload.maximum_size=262144
mzero_bl.upload.use_1200bps_touch=true
mzero_bl.upload.wait_for_upload_port=true
mzero_bl.upload.native_usb=true
mzero_bl.upload.speed=57600
mzero_bl.build.mcu=cortex-m0plus
mzero_bl.build.f_cpu=48000000L
mzero_bl.build.usb_product="Arduino M0"
mzero_bl.build.board=SAM_ZERO
mzero_bl.build.core=arduino
mzero_bl.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags}
mzero_bl.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
mzero_bl.build.variant=arduino_mzero
mzero_bl.build.variant_system_lib=
mzero_bl.build.vid=0x2a03
mzero_bl.build.pid=0x804e
mzero_bl.build.preferred_out_format=hex
mzero_bl.build.section.start=0x4000
mzero_bl.build.emu.mcu=atmega2560
mzero_bl.bootloader.tool=avrdude
mzero_bl.bootloader.low_fuses=0xff

######################################################
#ARDUINO TIAN (WITH) BOOTLOADER

tian.name=Arduino Tian
tian.upload.via_ssh=true
tian.vid.0=0x10C4
tian.pid.0=0xEA70
tian.descriptor.0="Extended Port"

tian.upload.tool=avrdude
#tian.upload.protocol=stk500v2
tian.upload.protocol=wiring
tian.upload.maximum_size=262144
tian.upload.use_1200bps_touch=true
tian.upload.wait_for_upload_port=true
tian.upload.native_usb=true
tian.upload.speed=57600
tian.build.mcu=cortex-m0plus
tian.build.f_cpu=48000000L
tian.build.usb_product="Arduino Tian"
tian.build.board=SAMD_TIAN
tian.build.core=arduino
tian.build.extra_flags=-D__SAMD21G18A__ -mthumb {build.usb_flags}
tian.build.ldscript=linker_scripts/gcc/flash_with_bootloader.ld
tian.build.variant=arduino_mzero
tian.build.variant_system_lib=
tian.build.vid=0x2a03
tian.build.pid=0x8052
tian.build.preferred_out_format=hex
tian.build.section.start=0x4000
tian.build.emu.mcu=atmega2560
tian.bootloader.tool=avrdude
tian.bootloader.low_fuses=0xff
tian.bootloader.file=sofia/Sofia_Tian_151118.hex
tian.drivers=SiliconLabs-CP2105/Silicon Labs VCP Driver.pkg

######################################################
#ARDUINO TIAN CONSOLE PORT (NOT FOR UPLOAD)

tian_cons.name=Arduino Tian (Console port)
tian_cons.vid.0=0x10C4
tian_cons.pid.0=0xEA70
tian_cons.descriptor.0="Primary Port"
28 changes: 23 additions & 5 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ compiler.ar.cmd=arm-none-eabi-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=arm-none-eabi-objcopy
compiler.objcopy.eep.flags=-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0
compiler.elf2hex.flags=-O binary
compiler.elf2hex.bin.flags=-O binary
compiler.elf2hex.hex.flags=-O ihex -R .eeprom
compiler.elf2hex.cmd=arm-none-eabi-objcopy
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
compiler.size.cmd=arm-none-eabi-size
Expand Down Expand Up @@ -95,11 +96,16 @@ recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compil
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

## Create output (bin file)
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"
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"

## Create output (hex file)
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"

build.preferred_out_format=bin

## Save hex
recipe.output.tmp_file={build.project_name}.bin
recipe.output.save_file={build.project_name}.{build.variant}.bin
recipe.output.tmp_file={build.project_name}.{build.preferred_out_format}
recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_out_format}

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

#
# AVRDUDE
#
tools.avrdude.path={runtime.tools.avrdude.path}
tools.avrdude.cmd={path}/bin/avrdude
tools.avrdude.config.path={path}/etc/avrdude.conf

tools.avrdude.upload.params.verbose=-v -v
tools.avrdude.upload.params.quiet=-q -q
tools.avrdude.upload.params.noverify=-V
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"

#
# BOSSA
#
Expand All @@ -132,7 +150,7 @@ tools.openocd.cmd.windows=bin/openocd.exe

tools.openocd.upload.params.verbose=-d2
tools.openocd.upload.params.quiet=-d0
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"
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"

tools.openocd.program.params.verbose=-d2
tools.openocd.program.params.quiet=-d0
Expand Down