diff --git a/boards.txt b/boards.txt index 2b41fa80d7..4ec2ea2fb0 100644 --- a/boards.txt +++ b/boards.txt @@ -795,6 +795,7 @@ GenF1.build.mcu=cortex-m3 GenF1.build.series=STM32F1xx GenF1.build.cmsis_lib_gcc=arm_cortexM3l_math GenF1.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial} {build.bootloader_flags} +GenF1.build.openocd_script=openocd.cfg # BLUEPILL_F103C6 board GenF1.menu.pnum.BLUEPILL_F103C6=BluePill F103C6 (32K) diff --git a/platform.txt b/platform.txt index f9109293f1..ccde38d61a 100644 --- a/platform.txt +++ b/platform.txt @@ -210,3 +210,28 @@ tools.remoteproc_gen.script=run_arduino_gen.sh tools.remoteproc_gen.upload.params.verbose= tools.remoteproc_gen.upload.params.quiet= tools.remoteproc_gen.upload.pattern="{busybox}" sh "{path}/{script}" generate "{build.path}/{build.project_name}.elf" "{build.path}/run_arduino_{build.project_name}.sh" + +# +# OpenOCD, for upload using programmer +# +tools.openocd.path={runtime.tools.openocd-0.10.0-arduino7.path} +tools.openocd.cmd=bin/openocd +tools.openocd.cmd.windows=bin/openocd.exe + +tools.openocd.program.params.verbose=-d2 +tools.openocd.program.params.quiet=-d0 +tools.openocd.program.init_args=-c "telnet_port disabled" -s "{path}/share/openocd/scripts/" +tools.openocd.program.interface_args=-c "source [find interface/{program.interface}]" +tools.openocd.program.board_args=-f "{runtime.platform.path}/variants/{build.variant}/{build.openocd_script}" +tools.openocd.program.program_args=-c "program {{build.path}/{build.project_name}.elf} verify reset; shutdown" +tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} {program.init_args} {program.interface_args} {program.board_args} {program.program_args} + +# Used for burn bootloader, must exist even if empty +tools.openocd.erase.params.verbose=-d2 +tools.openocd.erase.params.quiet=-d0 +tools.openocd.erase.pattern= + +# Upload bootloader, but which? +#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" diff --git a/programmers.txt b/programmers.txt index e69de29bb2..48fb424a7e 100644 --- a/programmers.txt +++ b/programmers.txt @@ -0,0 +1,15 @@ +cmsis_dap.name=CMSIS-DAP compatible programmer +cmsis_dap.communication=USB +cmsis_dap.protocol= +cmsis_dap.program.protocol= +cmsis_dap.program.interface=cmsis-dap.cfg +cmsis_dap.program.tool=openocd +cmsis_dap.program.extra_params= + +stlink.name=ST-LINK +stlink.communication=USB +stlink.protocol= +stlink.program.protocol= +stlink.program.interface=stlink.cfg +stlink.program.tool=openocd +stlink.program.extra_params= diff --git a/variants/PILL_F103XX/openocd.cfg b/variants/PILL_F103XX/openocd.cfg new file mode 100644 index 0000000000..0938a078a1 --- /dev/null +++ b/variants/PILL_F103XX/openocd.cfg @@ -0,0 +1 @@ +source [find target/stm32f1x.cfg]