Skip to content

Add support for Black Magic Probe #186

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 9 commits into from
23 changes: 23 additions & 0 deletions platform.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,26 @@ tools.openocd.erase.pattern=
tools.openocd.bootloader.params.verbose=-d2
tools.openocd.bootloader.params.quiet=-d0
tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -f interface/{program.protocol}.cfg -c "{program.setup_command}" -f target/{upload.target}.cfg -c "init; halt; nrf51 mass_erase; program {{{runtime.platform.path}/cores/nRF5/SDK/components/softdevice/{softdevice}/hex/{softdevice}_{upload.target}_{softdeviceversion}_softdevice.hex}} verify reset; shutdown;"

# blackmagic probe upload
tools.bmp_upload.cmd=arm-none-eabi-gdb
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A more descriptive name than bmp_upload would be nice, maybe blackmagicprobe?

Thoughts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandeepmistry sounds good

tools.bmp_upload.path={runtime.tools.gcc-arm-none-eabi-5_2-2015q4.path}/bin/
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use {compiler.path} here or another key, just to make it easier to upgrade the toolchain in the future?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a direct copy from the openocd path in boards.txt. Ill investigate (because im not familiar enough with this work) and make changes if there is no issue

Copy link
Contributor Author

@micooke micooke Sep 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sandeepmistry - doesnt look like we have access to this as a global parameter :
Arduino-IDE-1.5-3rd-party-Hardware-specification.

It might be better to add a runtime define path to the gcc tools and openocd around line 20, like they do in
esp8266 platform.txt

After some experimenting, tools only have access to their recipe parameters and the default global parameters. I looked at the platform link, the tool uses a static link not the global (because it doesnt work).

Compiler options can use any global you define, which doesnt help.

Some ways to make it easier to upgrade:

  1. Remove the version number from the folder - maybe create a changes.txt or readme in the base folder for each tool?
  2. Keep it how it is - i noticed that samd atleast uses static version numbers
  3. Define the tool..path (only) at the top, and the rest of the parameters in a block. This is pretty messy though


tools.bmp_upload.upload.speed=230400
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do different boards need different values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that ive noticed. Ive tried two different nrf51822 chips over 3 boards and have never had an issue.

@rogerclarkmelbourne - have you had any problems with this upload speed with your nRF51 or nRF52 boards?


tools.bmp_upload.erase.params.verbose=
tools.bmp_upload.erase.params.quiet=-q --batch-silent
tools.bmp_upload.erase.pattern="{path}{cmd}" -quiet -cd "{build.path}" -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "monitor erase mass" -ex "echo \n\n\Erase finished!" -ex "detach" -ex "quit"

tools.bmp_upload.upload.params.verbose=
tools.bmp_upload.upload.params.quiet=-q --batch-silent
tools.bmp_upload.upload.pattern="{path}{cmd}" -quiet -cd "{build.path}" -b {upload.speed} -l 10 -ex "set debug remote 0" -ex "set target-async off" -ex "set remotetimeout 10" -ex "set mem inaccessible-by-default off" -ex "set confirm off" -ex "set height 0" -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "file {build.project_name}.elf" -ex "load" -ex "tbreak main" -ex "run" -ex "echo \n\n\nUpload finished!\n" -ex "quit"

tools.bmp_upload.program.params.verbose=
tools.bmp_upload.program.params.quiet=-q --batch-silent
tools.bmp_upload.program.pattern="{path}{cmd}" -quiet -cd "{build.path}" -b {upload.speed} -l 10 -ex "set debug remote 0" -ex "set target-async off" -ex "set remotetimeout 10" -ex "set mem inaccessible-by-default off" -ex "set confirm off" -ex "set height 0" -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "file {build.project_name}.elf" -ex "load" -ex "tbreak main" -ex "run" -ex "echo \n\n\nProgram finished!\n" -ex "quit"
#tools.bmp_upload.program.pattern="{path}{cmd}" -quiet -cd "{build.path}" -b {upload.speed} -l 10 -ex "set debug remote 0" -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "file {build.project_name}.elf" -ex "load" -ex "run" -ex "echo \n\n\nProgram finished!\n" -ex "quit"

tools.bmp_upload.bootloader.params.verbose=
tools.bmp_upload.bootloader.params.quiet=-q --batch-silent
tools.bmp_upload.bootloader.pattern="{path}/{cmd}" -quiet -cd "{runtime.platform.path}/cores/nRF5/SDK/components/softdevice/{softdevice}/hex/" -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "monitor erase mass" -ex "detach" -ex "target extended-remote \\.\{serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "load {softdevice}_{upload.target}_{softdeviceversion}_softdevice.hex" -ex "echo \n\n\nSoftdevice Uploaded!\n" -ex "detach" -ex "quit"
10 changes: 10 additions & 0 deletions programmers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,13 @@ cmsisdap.protocol=cmsis-dap
cmsisdap.program.protocol=cmsis-dap
cmsisdap.program.tool=openocd
cmsisdap.program.setup_command=;

bmp.name=BMP (Black Magic Probe)
bmp.communication=USB
bmp.protocol=
bmp.program.protocol=
bmp.erase.tool=bmp_upload
bmp.upload.tool=bmp_upload
bmp.program.tool=bmp_upload
bmp.bootloader.tool=bmp_upload
bmp.program.extra_params=;