Skip to content

Add Blackmagic (BMP) support for Generic F103 #238

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 3 commits into from
Closed

Add Blackmagic (BMP) support for Generic F103 #238

wants to merge 3 commits into from

Conversation

evark
Copy link
Contributor

@evark evark commented Apr 27, 2018

A small addition to boards/platform files to support Blackmagic probe as uploading method for Generic F103 devices.

@fpistm fpistm self-assigned this Apr 27, 2018
@fpistm fpistm added the enhancement New feature or request label Apr 27, 2018
@fpistm fpistm self-requested a review May 10, 2018 08:51
Copy link
Member

@fpistm fpistm left a comment

Choose a reason for hiding this comment

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

Thansk for this PR.
I assume you have tested with bmp_upload provided with Arduino_Tools?
Could you test with the compiler path and update your PR. I do not have BMP to do the test.
Thanks in advance

platform.txt Outdated

# blackmagic upload for generic STM32
tools.bmp_upload.cmd=arm-none-eabi-gdb
tools.bmp_upload.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
Copy link
Member

Choose a reason for hiding this comment

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

I think you should use
tools.bmp_upload.path={compiler.path}

which is set on top of platform.txt
compiler.path={runtime.tools.arm-none-eabi-gcc-6-2017-q2-update.path}/bin/
This will avoid any issue if compiler version change

@fpistm fpistm added review on going waiting feedback Further information is required labels May 10, 2018
@sabas1080
Copy link
Contributor

I can try in a few days with my BMP

@RickKimball
Copy link
Contributor

RickKimball commented May 10, 2018

It looks like you are using the original version of the BMP command line I wrote a long time ago. I've since simplified the parameters so that it isn't doing a lot of extra work. You might look at doing something like this:

# blackmagic probe upload
...
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"

I started a post a while back http://www.stm32duino.com/viewtopic.php?f=37&t=2802 but I don't think it went anywhere.

Seeing as you are adding something new to this core, you might think about how to select the debug BMP port a different way so you can still use the serial console without having to switch the port between the debug port and the virtual com port. I had some ideas in that post thread.

@evark
Copy link
Contributor Author

evark commented May 10, 2018

I tried the path
tools.bmp_upload.path={compiler.path}

but it seems that this is not evaluated correctly (why?), so I have to define the compiler path again

tools.bmp_upload.path={runtime.tools.arm-none-eabi-gcc-6-2017-q2-update.path}/bin/

The command line of gdb can be simplified, according blackmagic wiki and looking how the gdb is used in platformio as

tools.bmp_upload.upload.pattern="{path}{cmd}" -nx --batch -ex "set confirm off" -ex "target extended-remote {serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "load" -ex "compare-sections" -ex "kill" "{build.path}/{build.project_name}.elf"

There is no need to full erase the chip on every download.

@fpistm
Copy link
Member

fpistm commented May 19, 2018

Seeing as you are adding something new to this core, you might think about how to select the debug BMP port a different way so you can still use the serial console without having to switch the port between the debug port and the virtual com port. I had some ideas in that post thread.

@RickKimball , I see your point. The only way I see is to add script file to perform this but as I cannot perform any test it will be too risky and bring several support I guess

Edit:
One request has been submitted to add programmer serial port menu:
arduino/Arduino#5554

tools.bmp_upload.upload.speed=230400
tools.bmp_upload.upload.params.verbose=-batch
tools.bmp_upload.upload.params.quiet=--batch-silent
tools.bmp_upload.upload.pattern="{path}{cmd}" -nx {upload.verbose} -ex "set confirm off" -ex "target extended-remote {serial.port}" -ex "monitor swdp_scan" -ex "attach 1" -ex "load" -ex "compare-sections" -ex "kill" "{build.path}/{build.project_name}.elf"
Copy link
Member

Choose a reason for hiding this comment

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

There are some extra space btw:
{serial.port}" -ex "monitor swdp_scan
and
-ex "monitor swdp_scan" -ex "attach 1"

# blackmagic upload for generic STM32
tools.bmp_upload.cmd=arm-none-eabi-gdb
tools.bmp_upload.path={runtime.tools.arm-none-eabi-gcc-6-2017-q2-update.path}/bin/
tools.bmp_upload.upload.speed=230400
Copy link
Member

Choose a reason for hiding this comment

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

upload speed is not used in the cmd? It should be fine to add it, no?
-b {upload.speed}

Copy link
Contributor

Choose a reason for hiding this comment

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

It is really a USB CDCACM so it doesn't really matter. It is going to go USB speed. But you can add it without issue

@fpistm
Copy link
Member

fpistm commented May 19, 2018

I've tested under windows, it seems it could not expand properly {runtime.tools.arm-none-eabi-gcc-6-2017-q2-update.path} at upload step.... I need to investigate this. You use it under Linux?
Update:
only {runtime.tools.arm-none-eabi-gcc.path} is really expanded... but when Arduino Due is installed, this is the arm gdb 4.8.3 which is used. :(

@fpistm
Copy link
Member

fpistm commented May 21, 2018

I've opened an issue at Arduino side:
arduino/Arduino#7616


# blackmagic upload for generic STM32
tools.bmp_upload.cmd=arm-none-eabi-gdb
tools.bmp_upload.path={runtime.tools.arm-none-eabi-gcc-6-2017-q2-update.path}/bin/
Copy link
Member

Choose a reason for hiding this comment

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

Based on @facchinm comment in arduino/Arduino#7616 (comment)
{runtime.tools.arm-none-eabi-gcc} will be used by default in git repo.
I will update path when releasing the package to set the gcc version as it is done for other upload tools.

@fpistm fpistm added this to the 1.2.1/1.3.0 milestone May 28, 2018
@fpistm fpistm closed this in 5ae76ac May 29, 2018
@fpistm
Copy link
Member

fpistm commented May 29, 2018

Thanks @evark
It is merged with small fix.

@fpistm fpistm removed waiting feedback Further information is required review on going labels May 30, 2018
benwaffle pushed a commit to benwaffle/Arduino_Core_STM32 that referenced this pull request Apr 10, 2019
Based and closes stm32duino#238

Signed-off-by: EvArk <arkalis.e@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants