simpler black magic probe in platform.txt

Post Reply
User avatar
Rick Kimball
Posts: 1038
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

simpler black magic probe in platform.txt

Post by Rick Kimball » Tue Nov 07, 2017 5:38 pm

I noticed that the tool.bmp_upload section of platform.txt is overly complex. : ) I'm not sure what I was thinking when I put that together. This replacement works just fine:
simpler wrote:# blackmagic probe upload
tools.bmp_upload.cmd=arm-none-eabi-gdb
tools.bmp_upload.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
tools.bmp_upload.upload.speed=115200
tools.bmp_upload.upload.params.verbose=-batch
tools.bmp_upload.upload.params.quiet=--batch-silent
tools.bmp_upload.upload.pattern="{path}{cmd}" -cd={build.path} -ex "file {build.project_name}.elf" -nh -b {upload.speed} {upload.verbose} -ex "target extended-remote {serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "stop" -ex "mon erase_mass" -ex "load"
You will note I removed the (") around the -cd= target. This is because it was complaining on linux. I'm not sure if what I did works on windows or os/x. Maybe someone could try : )
-rick

User avatar
Rick Kimball
Posts: 1038
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: simpler black magic probe in platform.txt

Post by Rick Kimball » Thu Nov 09, 2017 6:09 pm

Normally I run putty as a terminal program when I'm using serial output. However, lately I've been trying to use the features offered by the Arduino IDE. The setup for Black Magic Probe uploading isn't optimal. I was thinking it would make more sense if we specified the BMP upload port in the boards.txt instead of using the currently selected port on the Arduino IDE.

Here is the change I made to the platform.txt:
# blackmagic probe upload
tools.bmp_upload.cmd=arm-none-eabi-gdb
tools.bmp_upload.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
tools.bmp_upload.upload.speed=115200
tools.bmp_upload.upload.params.verbose=-batch
tools.bmp_upload.upload.params.quiet=--batch-silent
tools.bmp_upload.upload.pattern="{path}{cmd}" -cd={build.path} -ex "file {build.project_name}.elf" -nh -b {upload.speed} {upload.verbose} -ex "target extended-remote {upload.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "stop" -ex "mon erase_mass" -ex "load"
Then I created a custom bluepill entry in boards.txt:
################################################################################
bluepill.name=Blue Pill (128k/via Black Magic Probe)

bluepill.build.board=GENERIC_STM32F103C
bluepill.build.core=maple
bluepill.build.cpu_flags=-DMCU_STM32F103CB
bluepill.build.f_cpu=72000000L
bluepill.build.flags.ldspecs=
bluepill.build.flags.optimize=-Os -g
bluepill.build.ldscript=ld/jtag.ld
bluepill.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG
bluepill.build.variant=generic_stm32f103c
bluepill.build.vect=VECT_TAB_ADDR=0x8000000

bluepill.upload.file_type=bin
bluepill.upload.maximum_data_size=20480
bluepill.upload.maximum_size=131072
bluepill.upload.port=/dev/ttyACM0
bluepill.upload.protocol=gdb_bmp
bluepill.upload.tool=bmp_upload
I'm on linux so I used port=/dev/ttyACM0 for the BMP GDB port and in the IDE I selected /dev/ttyACM1, This allows me to upload without have to switch the board between the GDP port (ttyACM0) and the Virtual Com port (ttyACM1). You would have to change the board.txt port for windows.
-rick

User avatar
RogerClark
Posts: 7150
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: simpler black magic probe in platform.txt

Post by RogerClark » Thu Nov 09, 2017 9:40 pm

Rick Kimball wrote:
Tue Nov 07, 2017 5:38 pm
I noticed that the tool.bmp_upload section of platform.txt is overly complex. : ) I'm not sure what I was thinking when I put that together. This replacement works just fine:
simpler wrote:# blackmagic probe upload
tools.bmp_upload.cmd=arm-none-eabi-gdb
tools.bmp_upload.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
tools.bmp_upload.upload.speed=115200
tools.bmp_upload.upload.params.verbose=-batch
tools.bmp_upload.upload.params.quiet=--batch-silent
tools.bmp_upload.upload.pattern="{path}{cmd}" -cd={build.path} -ex "file {build.project_name}.elf" -nh -b {upload.speed} {upload.verbose} -ex "target extended-remote {serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "stop" -ex "mon erase_mass" -ex "load"
You will note I removed the (") around the -cd= target. This is because it was complaining on linux. I'm not sure if what I did works on windows or os/x. Maybe someone could try : )
I will update platform.txt when I get chance

Post Reply