Skip to content
Snippets Groups Projects
Commit 51369814 authored by Martino Facchin's avatar Martino Facchin
Browse files

Introduce openocd-withbootsize programmer

Otherwise a compulsory property should be added to every board (3rd paty hell).
The bug is related with IDE's uploadUsingPreferences; the property map used to expand the receipe is derived from board properties and overwritten by the programmer's properties.
So no default can exist, and no global variable either.
parent ac07f6b5
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,6 @@ 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.sketch.start=0x2000
arduino_zero_edbg.bootloader.tool=openocd
arduino_zero_edbg.bootloader.file=zero/samd21_sam_ba.bin
......@@ -86,7 +85,6 @@ 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.sketch.start=0x2000
arduino_zero_native.bootloader.tool=openocd
arduino_zero_native.bootloader.file=zero/samd21_sam_ba.bin
......@@ -132,7 +130,6 @@ mkr1000.build.openocdscript=openocd_scripts/arduino_zero.cfg
mkr1000.build.variant=mkr1000
mkr1000.build.vid=0x2341
mkr1000.build.pid=0x804e
mkr1000.build.sketch.start=0x2000
mkr1000.bootloader.tool=openocd
mkr1000.bootloader.file=mkr1000/samd21_sam_ba_arduino_mkr1000.bin
......@@ -162,7 +159,6 @@ mkrzero.build.openocdscript=openocd_scripts/arduino_zero.cfg
mkrzero.build.variant=mkrzero
mkrzero.build.vid=0x2341
mkrzero.build.pid=0x804f
mkrzero.build.sketch.start=0x2000
mkrzero.bootloader.tool=openocd
mkrzero.bootloader.file=mkrzero/samd21_sam_ba_arduino_mkrzero.bin
......@@ -200,7 +196,7 @@ adafruit_circuitplayground_m0.bootloader.file=circuitplay/circuitplay_m0_samd21g
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.tool=openocd-withbootsize
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
......@@ -219,7 +215,7 @@ 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.sketch.start=0x4000
mzero_pro_bl_dbg.bootloader.size=0x4000
mzero_pro_bl_dbg.bootloader.tool=openocd
mzero_pro_bl_dbg.bootloader.cmd_unprotect=at91samd bootloader 0
......@@ -257,7 +253,7 @@ 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.sketch.start=0x4000
mzero_pro_bl.bootloader.size=0x4000
mzero_pro_bl.build.emu.mcu=atmega2560
mzero_pro_bl.bootloader.tool=avrdude
mzero_pro_bl.bootloader.low_fuses=0xff
......@@ -292,7 +288,7 @@ 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.sketch.start=0x4000
mzero_bl.bootloader.size=0x4000
mzero_bl.build.emu.mcu=atmega2560
mzero_bl.bootloader.tool=avrdude
mzero_bl.bootloader.low_fuses=0xff
......@@ -326,7 +322,7 @@ tian.build.variant_system_lib=
tian.build.vid=0x2a03
tian.build.pid=0x8052
tian.build.preferred_out_format=hex
tian.build.sketch.start=0x4000
tian.bootloader.size=0x4000
tian.build.emu.mcu=atmega2560
tian.bootloader.tool=avrdude
tian.bootloader.low_fuses=0xff
......
......@@ -50,6 +50,7 @@ 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
compiler.define=-DARDUINO=
compiler.readelf.cmd=arm-none-eabi-readelf
# this can be overriden in boards.txt
build.extra_flags=
......@@ -74,11 +75,6 @@ build.usb_flags=-DUSB_VID={build.vid} -DUSB_PID={build.pid} -DUSBCON '-DUSB_MANU
# numeric vendor ID if available or by board's specific value.
build.usb_manufacturer="Unknown"
# Sketch and bootloader start section
# -----------------------------------
build.sketch.start=0x2000
build.bootloader.start=0x0000
# Compile patterns
# ----------------
......@@ -115,7 +111,6 @@ recipe.output.save_file={build.project_name}.{build.variant}.{build.preferred_ou
recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=\.text\s+([0-9]+).*
# Uploader tools
# --------------
......@@ -154,8 +149,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 {build.sketch.start}; 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 0x2000; shutdown"
# Program flashes the binary at 0x0000, so use the linker script without_bootloader
tools.openocd.program.params.verbose=-d2
......@@ -169,3 +163,29 @@ tools.openocd.erase.pattern=
tools.openocd.bootloader.params.verbose=-d2
tools.openocd.bootloader.params.quiet=-d0
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown"
#
# OpenOCD sketch upload - version with configurable bootloader size
# FIXME: this programmer is a workaround for default options being overwritten by uploadUsingPreferences
#
tools.openocd-withbootsize.path={runtime.tools.openocd-0.9.0-arduino.path}
tools.openocd-withbootsize.cmd=bin/openocd
tools.openocd-withbootsize.cmd.windows=bin/openocd.exe
tools.openocd-withbootsize.upload.params.verbose=-d2
tools.openocd-withbootsize.upload.params.quiet=-d0
tools.openocd-withbootsize.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 {bootloader.size}; shutdown"
# Program flashes the binary at 0x0000, so use the linker script without_bootloader
tools.openocd-withbootsize.program.params.verbose=-d2
tools.openocd-withbootsize.program.params.quiet=-d0
tools.openocd-withbootsize.program.pattern="{path}/{cmd}" {program.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}.elf}} verify reset; shutdown"
tools.openocd-withbootsize.erase.params.verbose=-d3
tools.openocd-withbootsize.erase.params.quiet=-d0
tools.openocd-withbootsize.erase.pattern=
tools.openocd-withbootsize.bootloader.params.verbose=-d2
tools.openocd-withbootsize.bootloader.params.quiet=-d0
tools.openocd-withbootsize.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/share/openocd/scripts/" -f "{runtime.platform.path}/variants/{build.variant}/{build.openocdscript}" -c "telnet_port disabled; init; halt; at91samd bootloader 0; program {{{runtime.platform.path}/bootloaders/{bootloader.file}}} verify reset; shutdown"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment