Black Magic Probe on an stm32f103c8

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

Re: Black Magic Probe on an stm32f103c8

Post by Rick Kimball » Mon Dec 05, 2016 7:51 pm

michael_l wrote: EDIT: found these from platform.h
* TMS = PA4 (input for SWDP)
... comments are nice but they don't seem to match the code ...

I'd look at the actual code:
https://github.com/blacksphere/blackmag ... form.h#L70

It seems like the code has it setup for PB14 not PA4

@RogerClark .. looking at the schematics, it doesn't seem like there is any USB enumeration pins.
-rick

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

Re: Black Magic Probe on an stm32f103c8

Post by RogerClark » Mon Dec 05, 2016 7:56 pm

Rick

Paypal link seems to be working again now. Perhaps it was an issue with paypal

can you try it again

Re: BMP not working on the Baite STLink dongle

ummm..

OK. I'm not sure what the difference is between the dongle and the Nucleo / Discovery hardware but perhaps it doesnt work on either at the moment

I don't want to reflash any of my Nucleos as there is no way to get back to the version of stlink that uses USB mass storage and also has USB Serial ( as that binary has never been hacked and released)

But I think my Discovery F4 board doesnt have the mass storage, so I guess I could blow that away, but I'd loose USB serial so I could not go back to the original config by loading the hacked version of stlinks for the dongle

michael_l
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: Black Magic Probe on an stm32f103c8

Post by michael_l » Mon Dec 05, 2016 8:12 pm

When I looked for a debugger I found "real" BMP just too expensive for a user beginning with STM32 boards. But the idea is great - to have GDB server ready on the board. Actually I started with Arduino's but quickly found out that there's not a decent debugger that does not cost fortune. I guess I'm the one of people who want sometimes do debugging step by step. 'That's why I started digging (in the other thread :-) ) how to use STM32Duino framework with ST Link with openocd. After some work and a patch in Arduino IDE debugging works. So with a little cost it's possible to buy stm32 boards and develop in Arduino framework and debug also. I'm a programmer for over 10+ years and I understand the value of debugging but if the BMP price had been around $20 I may have bought it. Roger, do you have a paypal button somewhere so I can donate to you ?

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

Re: Black Magic Probe on an stm32f103c8

Post by RogerClark » Mon Dec 05, 2016 8:31 pm

Michael

Re:Donations

Unfortunately if I accept donations, as it will almost certainly cause problems for me.

I provide the code etc, "as is". I don't make any guarantees that things work or that I will fix bugs.. As I simply don't have time.

I'm sure that if I added a Donate button, that some people would make a donation and then expect some bug to be fixed in return.

I already get loads of unsolicited emails asking me for help with various projects. I used to respond politely saying that I can't give individual help via email.
But I have received abusive emails when I've done that, so I simply do not reply to unsolicited emails any more.

Also. I'm sure the Australian Tax Office would tell me that "donations" were payment for services and hence taxable, and I'd need to individually account for each one, and declare them as part of the Business Activity Statement I have to do every 3 months

So the admin time involved would also make it not worth the hassle.

michael_l
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: Black Magic Probe on an stm32f103c8

Post by michael_l » Mon Dec 05, 2016 8:47 pm

RogerClark wrote:Michael

Re:Donations

Unfortunately if I accept donations, as it will almost certainly cause problems for me.

I provide the code etc, "as is". I don't make any guarantees that things work or that I will fix bugs.. As I simply don't have time.

I'm sure that if I added a Donate button, that some people would make a donation and then expect some bug to be fixed in return.

I already get loads of unsolicited emails asking me for help with various projects. I used to respond politely saying that I can't give individual help via email.
But I have received abusive emails when I've done that, so I simply do not reply to unsolicited emails any more.

Also. I'm sure the Australian Tax Office would tell me that "donations" were payment for services and hence taxable, and I'd need to individually account for each one, and declare them as part of the Business Activity Statement I have to do every 3 months

So the admin time involved would also make it not worth the hassle.
Ok, I understand. I just wanted to appreciate your work with something tangible.

I just flashed latest BMP binary from their site to bluepill - it does not enumerate. Ricks binary in the first page enumerates.

Rick, do you know if latest BMP source contains some important fixes ? Or should I be fine with this version ? Thanks

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

Re: Black Magic Probe on an stm32f103c8

Post by Rick Kimball » Mon Dec 05, 2016 9:09 pm

michael_l wrote:Rick, do you know if latest BMP source contains some important fixes ? Or should I be fine with this version ? Thanks
I know there are lots of new things, more targets, code rearranged, and general dusting and cleaning. However, if you are just using the stm32f103 series you probably aren't going to experience anything new as our STM32F103 chips are old. We are using chips from 10+ years ago. I'm actually running the latest BMP stlink platform with a few code tweaks (I dumped the dfu stuff, removed the vector table relocation, and put the TMS pin on PA4 ) all in all, about 10 lines of code different. The main reason for using the new version of the code is that it lets me debug/flash Nordic nrf51822 chips.
michael_l wrote: .. and does SWO pin work too ?
You asked about the SWO, it isn't included in the stlink platform or my jc66_corebord. Not something I have used or will probably use so I never bothered to see what it would take to get going. If that is something you want, take a look at the native platform and look at the Makefile.inc and platform.* changes.

As far as the led pins, I've never wired them up.

There are so many choices now that actually work. When I started this stuff BMP was pretty new, openocd didn't even support SWD and the Raspberry PI didn't even exist. Now I can use this latest BMP code on a $3 clone board from china, or a $13 TI Tiva Launchpad board. If I use openocd, I can buy a Nucleo board for around $10, or even more amazingly, use a $5 raspberry pi running linux using its GPIO pins as a programmer. You should all be happy, we live in amazing times.

-rick
Last edited by Rick Kimball on Mon Dec 05, 2016 9:46 pm, edited 4 times in total.
-rick

michael_l
Posts: 337
Joined: Mon Aug 24, 2015 6:11 pm

Re: Black Magic Probe on an stm32f103c8

Post by michael_l » Mon Dec 05, 2016 9:17 pm

Thanks Rick for the help. Sorry if this is a basic question but does BMP need any drivers for Windows 7 ?

Image

Edit: found

http://www.blacksphere.co.nz/downloads/driver.w32.zip

Hmm.. these drivers don't seem to work and install

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

Re: Black Magic Probe on an stm32f103c8

Post by Rick Kimball » Mon Dec 05, 2016 9:58 pm

Changes I made to the latest standard BMP stlink platform to get it to run on a bluepill:

Code: Select all

# I copied the src/platforms/stlink to src/platforms/bluepill
# then in the BMP/src directory:
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   Makefile

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	platforms/bluepill/

no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
diff --git a/src/Makefile b/src/Makefile
index 8bc2659..55bc99e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -108,6 +108,6 @@ all_platforms:
 
 include/version.h: FORCE
        $(Q)echo "  GIT     include/version.h"
-       $(Q)echo "#define FIRMWARE_VERSION \"`git describe --always --dirty`\"" > $@
+       $(Q)echo "#define FIRMWARE_VERSION \"`git describe --always --dirty`-rk\"" > $@
 
 -include *.d
$ diff platforms/bluepill platforms/stlink
diff platforms/bluepill/Makefile.inc platforms/stlink/Makefile.inc
14c14
< LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8000000
---
> LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8002000
24c24
< .phony: install all host_clean
---
> all:	blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex dfu_upgrade.bin dfu_upgrade.hex
26c26,32
< all:	blackmagic.bin
---
> blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o
> 	@echo "  LD      $@"
> 	$(Q)$(CC) $^ -o $@ $(LDFLAGS_BOOT)
> 
> dfu_upgrade: dfu_upgrade.o dfucore.o dfu_f1.o
> 	@echo "  LD      $@"
> 	$(Q)$(CC) $^ -o $@ $(LDFLAGS)
31,32d36
< install:
< 	openocd -f ~/openocd_cfg/st_nucleo_f103rb.cfg -c 'program blackmagic verify reset exit'
diff platforms/bluepill/platform.c platforms/stlink/platform.c
104c104
< 	//SCB_VTOR = 0x2000; /* Relocate interrupt vector table here */
---
> 	SCB_VTOR = 0x2000; /* Relocate interrupt vector table here */
diff platforms/bluepill/platform.h platforms/stlink/platform.h
66c66
< #define TMS_PORT	GPIOA
---
> #define TMS_PORT	GPIOB
70c70
< #define TMS_PIN		GPIO4
---
> #define TMS_PIN		GPIO14
$ make PROBE_HOST=bluepill clean all install 
Then unplug/replug and it should enumerate as a BMP device.

-rick
Last edited by Rick Kimball on Mon Dec 05, 2016 10:36 pm, edited 2 times in total.
-rick

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

Re: Black Magic Probe on an stm32f103c8

Post by RogerClark » Mon Dec 05, 2016 10:00 pm

Michael

I'm not sure if these are the same file but...

Try


https://github.com/rogerclarkmelbourne/ ... ter/driver

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

Re: Black Magic Probe on an stm32f103c8

Post by RogerClark » Mon Dec 05, 2016 10:02 pm

Rick Kimball wrote:Changes I made to the standard BMP stlink platform to get it to run on a bluepill:

Code: Select all

# I copied the src/platforms/stlink to src/platforms/bluepill
# in the BMP/src directory:
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   Makefile

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	platforms/bluepill/

no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
diff --git a/src/Makefile b/src/Makefile
index 8bc2659..55bc99e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -108,6 +108,6 @@ all_platforms:
 
 include/version.h: FORCE
        $(Q)echo "  GIT     include/version.h"
-       $(Q)echo "#define FIRMWARE_VERSION \"`git describe --always --dirty`\"" > $@
+       $(Q)echo "#define FIRMWARE_VERSION \"`git describe --always --dirty`-rk\"" > $@
 
 -include *.d
$ diff platforms/bluepill platforms/stlink
diff platforms/bluepill/Makefile.inc platforms/stlink/Makefile.inc
14c14
< LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8000000
---
> LDFLAGS = $(LDFLAGS_BOOT) -Wl,-Ttext=0x8002000
24c24
< .phony: install all host_clean
---
> all:	blackmagic.bin blackmagic_dfu.bin blackmagic_dfu.hex dfu_upgrade.bin dfu_upgrade.hex
26c26,32
< all:	blackmagic.bin
---
> blackmagic_dfu: usbdfu.o dfucore.o dfu_f1.o
> 	@echo "  LD      $@"
> 	$(Q)$(CC) $^ -o $@ $(LDFLAGS_BOOT)
> 
> dfu_upgrade: dfu_upgrade.o dfucore.o dfu_f1.o
> 	@echo "  LD      $@"
> 	$(Q)$(CC) $^ -o $@ $(LDFLAGS)
31,32d36
< install:
< 	openocd -f ~/openocd_cfg/st_nucleo_f103rb.cfg -c 'program blackmagic verify reset exit'
diff platforms/bluepill/platform.c platforms/stlink/platform.c
104c104
< 	//SCB_VTOR = 0x2000; /* Relocate interrupt vector table here */
---
> 	SCB_VTOR = 0x2000; /* Relocate interrupt vector table here */
diff platforms/bluepill/platform.h platforms/stlink/platform.h
66c66
< #define TMS_PORT	GPIOA
---
> #define TMS_PORT	GPIOB
70c70
< #define TMS_PIN		GPIO4
---
> #define TMS_PIN		GPIO14
$ make PROBE_HOST=bluepill clean all install 
Thanks Rick

I will give that a try.

BTW.

@denis also posted a different set of diffs a few months ago, to make the latest version of the BMP work with the Baite STLink, but when I tried to use git apply, the diffs would not "apply", as there seemed to be some difference in the original version from the version number he posted

Can you let me know what commit version you currently have, (before you added your changes)

Locked