connected the BMP to the generic STM32F103 using SWD
power the STM32F103 from it’s own USB, as the BMP does not provide power to the target (whereas ST-LinkV2 does provide power)
application builds ok,
when doing upload - Im getting some output mixed from two sources:
Uploading .pio\build\genericSTM32F103C8\firmware.elf
Section .isr_vector, range 0x80000\\.\COM25: No such file or directory.
00 "monitor" command not supported by this target.
-- Don't know how to attach. Try "help target".
0x8You can't do that when your target is `exec'
000warning: One or more sections of the target image does not match
10cthe loaded file
: m
atcThe program is not being run.
hed.
Section .text, range 0x800010c -- 0x8000ae0: matched.
Section .rodata, range 0x8000ae0 -- 0x8000b00: matched.
Section .init_array, range 0x8000b00 -- 0x8000b04: matched.
Section .fini_array, range 0x8000b04 -- 0x8000b08: matched.
Section .data, range 0x8000b08 -- 0x8000b14: MIS-MATCHED!
I was able to solve this with the help from 1BitSquared:
The Black Magic Probe appears as 2 COM ports, one for debugging and one std serial monitor. If you let PlatformIO auto-detect, it auto-detected the wrong one in my case, resulting in the upload task not working. To figure out the correct COM-port, you can do one of the following:
go to Device Manager, open the properties of the COM port and take a look at details | Hardware IDs. You need the port with hardware ID ending on MI_00
or
open a terminal, start gdb (Gnu Debugger) and manually connect with the gdb command target extended-remote \\.\COM26 (replace 26 with your COM port number). When on the correct port, gdb will return the prompt for additional commands. When on the wrong port, the command above does not work…
Note : note that I refer to the COM port as \\.\COM26 io. COM26. Often the BMP ports get COM port numbers with 2 digits. It seems there is a windows bug that requires those ports to be named with the \\.\ prefix, in order to work with gdb
@ivankravets@maxgerhardt Maybe add the above info about how to select the correct port to the documentation. Also, in the documentation the link to the BMP Wiki is out of date.
PS C:\Users\pasca\Documents\Projects\UA\BlinkPio> pio device list
COM25
-----
Hardware ID: USB VID:PID=1D50:6018 SER=98B71F95 LOCATION=1-3:x.2
Description: USB Serial Device (COM25)
COM26
-----
Hardware ID: USB VID:PID=1D50:6018 SER=98B71F95 LOCATION=1-3:x.0
Description: USB Serial Device (COM26)
I think the x.2 and x.0 also reveal which port is debug / monitor
Debugging the generic STM32F103C8 via the Black Magic Probe is also working.
Again, the debug_port must be explicitly set, auto detection does not seem to work for me.
the patch installed without issues (see log below)
checked the presence of the Black Magic Probe, and it’s still on the same ports : Debug/Upload = COM26, Monitor = COM25 (see log below)
then outcommented the upload_port in platformio.ini to let auto-detect do it’s work, but it’s again choosing COM25 and then hangs as the probe does not respond on this port
PS C:\Users\pasca\Documents\Projects\UA\BlinkPio> pip install -U https://github.com/platformio/platformio-core/archive/refs/heads/feature/debug-bmp-issue.zip
Collecting https://github.com/platformio/platformio-core/archive/refs/heads/feature/debug-bmp-issue.zip
Downloading https://github.com/platformio/platformio-core/archive/refs/heads/feature/debug-bmp-issue.zip
\ 559.8 kB 3.9 MB/s 0:00:00
Preparing metadata (setup.py) ... done
Requirement already satisfied: bottle==0.12.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.12.23)
Requirement already satisfied: click<9,>=8.0.4 in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (8.1.3)
Requirement already satisfied: colorama in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.4.6)
Requirement already satisfied: marshmallow==3.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (3.18.0)
Requirement already satisfied: pyelftools<1,>=0.27 in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.29)
Requirement already satisfied: pyserial==3.5.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (3.5)
Requirement already satisfied: requests==2.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (2.28.1)
Requirement already satisfied: semantic_version==2.10.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (2.10.0)
Requirement already satisfied: tabulate==0.9.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.9.0)
Requirement already satisfied: zeroconf<1 in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.39.4)
Requirement already satisfied: aiofiles==22.1.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (22.1.0)
Requirement already satisfied: ajsonrpc==1.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (1.2.0)
Collecting starlette==0.22.*
Downloading starlette-0.22.0-py3-none-any.whl (64 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.3/64.3 kB ? eta 0:00:00
Collecting uvicorn==0.20.*
Downloading uvicorn-0.20.0-py3-none-any.whl (56 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 56.9/56.9 kB ? eta 0:00:00
Requirement already satisfied: wsproto==1.2.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (1.2.0)
Requirement already satisfied: packaging>=17.0 in c:\users\pasca\.platformio\penv\lib\site-packages (from marshmallow==3.*->platformio==6.1.6a4) (21.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\pasca\.platformio\penv\lib\site-packages (from requests==2.*->platformio==6.1.6a4) (2022.9.24)
Requirement already satisfied: idna<4,>=2.5 in c:\users\pasca\.platformio\penv\lib\site-packages (from requests==2.*->platformio==6.1.6a4) (3.4)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\pasca\.platformio\penv\lib\site-packages (from requests==2.*->platformio==6.1.6a4) (1.26.12)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\users\pasca\.platformio\penv\lib\site-packages (from requests==2.*->platformio==6.1.6a4) (2.1.1)
Requirement already satisfied: anyio<5,>=3.4.0 in c:\users\pasca\.platformio\penv\lib\site-packages (from starlette==0.22.*->platformio==6.1.6a4) (3.6.2)
Requirement already satisfied: typing-extensions>=3.10.0 in c:\users\pasca\.platformio\penv\lib\site-packages (from starlette==0.22.*->platformio==6.1.6a4) (4.4.0)
Requirement already satisfied: h11>=0.8 in c:\users\pasca\.platformio\penv\lib\site-packages (from uvicorn==0.20.*->platformio==6.1.6a4) (0.14.0)
Requirement already satisfied: async-timeout>=4.0.1 in c:\users\pasca\.platformio\penv\lib\site-packages (from zeroconf<1->platformio==6.1.6a4) (4.0.2)
Requirement already satisfied: ifaddr>=0.1.7 in c:\users\pasca\.platformio\penv\lib\site-packages (from zeroconf<1->platformio==6.1.6a4) (0.2.0)
Requirement already satisfied: sniffio>=1.1 in c:\users\pasca\.platformio\penv\lib\site-packages (from anyio<5,>=3.4.0->starlette==0.22.*->platformio==6.1.6a4) (1.3.0)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\users\pasca\.platformio\penv\lib\site-packages (from packaging>=17.0->marshmallow==3.*->platformio==6.1.6a4) (3.0.9)
Building wheels for collected packages: platformio
Building wheel for platformio (setup.py) ... done
Created wheel for platformio: filename=platformio-6.1.6a4-py3-none-any.whl size=415499 sha256=8b340286cbd7794bcd725af5d8ffc5a1549fe2a165146809af266550d21544a0
Stored in directory: c:\users\pasca\appdata\local\pip\cache\wheels\02\37\ca\892e0b2874e6dd9a606616bc5b2004843d2d9210c621923257
Successfully built platformio
Installing collected packages: uvicorn, starlette, platformio
Attempting uninstall: uvicorn
Found existing installation: uvicorn 0.19.0
Uninstalling uvicorn-0.19.0:
Successfully uninstalled uvicorn-0.19.0
Attempting uninstall: starlette
Found existing installation: starlette 0.21.0
Uninstalling starlette-0.21.0:
Successfully uninstalled starlette-0.21.0
Attempting uninstall: platformio
Found existing installation: platformio 6.1.5
Uninstalling platformio-6.1.5:
Successfully uninstalled platformio-6.1.5
Successfully installed platformio-6.1.6a4 starlette-0.22.0 uvicorn-0.20.0
[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
PS C:\Users\pasca\Documents\Projects\UA\BlinkPio> pio device list
[notice] To update, run: python.exe -m pip install --upgrade pip
PS C:\Users\pasca\Documents\Projects\UA\BlinkPio> pio device list
Please wait while upgrading PlatformIO...
PlatformIO has been successfully upgraded to 6.1.6a4!
Output of pio device list
PS C:\Users\pasca\Documents\Projects\UA\BlinkPio> pio device list
COM12
-----
Hardware ID: BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0000\7&39577A6B&0&000000000000_00000000
Description: Standard Serial over Bluetooth link (COM12)
COM25
-----
Hardware ID: USB VID:PID=1D50:6018 SER=98B71F95 LOCATION=1-3.3.2.4.4:x.2
Description: USB Serial Device (COM25)
COM13
-----
Hardware ID: BTHENUM\{00001101-0000-1000-8000-00805F9B34FB}_LOCALMFG&0002\7&39577A6B&0&0006666754BB_C00000000
Description: Standard Serial over Bluetooth link (COM13)
COM26
-----
Hardware ID: USB VID:PID=1D50:6018 SER=98B71F95
Description: USB Serial Device (COM26)
PS C:\Users\pasca\Documents\Projects\UA\BlinkPio> pip install -U https://github.com/platformio/platformio-core/archive/refs/heads/feature/debug-bmp-issue.zip
Collecting https://github.com/platformio/platformio-core/archive/refs/heads/feature/debug-bmp-issue.zip
Downloading https://github.com/platformio/platformio-core/archive/refs/heads/feature/debug-bmp-issue.zip
\ 559.8 kB 3.9 MB/s 0:00:00
Preparing metadata (setup.py) ... done
Requirement already satisfied: bottle==0.12.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.12.23)
Requirement already satisfied: click<9,>=8.0.4 in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (8.1.3)
Requirement already satisfied: colorama in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.4.6)
Requirement already satisfied: marshmallow==3.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (3.18.0)
Requirement already satisfied: pyelftools<1,>=0.27 in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.29)
Requirement already satisfied: pyserial==3.5.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (3.5)
Requirement already satisfied: requests==2.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (2.28.1)
Requirement already satisfied: semantic_version==2.10.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (2.10.0)
Requirement already satisfied: tabulate==0.9.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.9.0)
Requirement already satisfied: zeroconf<1 in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.39.4)
Requirement already satisfied: aiofiles==22.1.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (22.1.0)
Requirement already satisfied: ajsonrpc==1.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (1.2.0)
Requirement already satisfied: starlette==0.22.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.22.0)
Requirement already satisfied: uvicorn==0.20.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (0.20.0)
Requirement already satisfied: wsproto==1.2.* in c:\users\pasca\.platformio\penv\lib\site-packages (from platformio==6.1.6a4) (1.2.0)
Requirement already satisfied: packaging>=17.0 in c:\users\pasca\.platformio\penv\lib\site-packages (from marshmallow==3.*->platformio==6.1.6a4) (21.3)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\users\pasca\.platformio\penv\lib\site-packages (from requests==2.*->platformio==6.1.6a4) (2.1.1)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\pasca\.platformio\penv\lib\site-packages (from requests==2.*->platformio==6.1.6a4) (2022.9.24)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\pasca\.platformio\penv\lib\site-packages (from requests==2.*->platformio==6.1.6a4) (1.26.12)
Requirement already satisfied: idna<4,>=2.5 in c:\users\pasca\.platformio\penv\lib\site-packages (from requests==2.*->platformio==6.1.6a4) (3.4)
Requirement already satisfied: anyio<5,>=3.4.0 in c:\users\pasca\.platformio\penv\lib\site-packages (from starlette==0.22.*->platformio==6.1.6a4) (3.6.2)
Requirement already satisfied: typing-extensions>=3.10.0 in c:\users\pasca\.platformio\penv\lib\site-packages (from starlette==0.22.*->platformio==6.1.6a4) (4.4.0)
Requirement already satisfied: h11>=0.8 in c:\users\pasca\.platformio\penv\lib\site-packages (from uvicorn==0.20.*->platformio==6.1.6a4) (0.14.0)
Requirement already satisfied: async-timeout>=4.0.1 in c:\users\pasca\.platformio\penv\lib\site-packages (from zeroconf<1->platformio==6.1.6a4) (4.0.2)
Requirement already satisfied: ifaddr>=0.1.7 in c:\users\pasca\.platformio\penv\lib\site-packages (from zeroconf<1->platformio==6.1.6a4) (0.2.0)
Requirement already satisfied: sniffio>=1.1 in c:\users\pasca\.platformio\penv\lib\site-packages (from anyio<5,>=3.4.0->starlette==0.22.*->platformio==6.1.6a4) (1.3.0)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\users\pasca\.platformio\penv\lib\site-packages (from packaging>=17.0->marshmallow==3.*->platformio==6.1.6a4) (3.0.9)
[notice] A new release of pip available: 22.3 -> 22.3.1
[notice] To update, run: python.exe -m pip install --upgrade pip
PS C:\Users\pasca\Documents\Projects\UA\BlinkPio>
Output of the build / upload:
Linking .pio\build\genericSTM32F103C8\firmware.elf
Checking size .pio\build\genericSTM32F103C8\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [ ] 4.0% (used 828 bytes from 20480 bytes)
Flash: [== ] 16.7% (used 10952 bytes from 65536 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, cmsis-dap, dfu, jlink, serial, stlink
CURRENT: upload_protocol = blackmagic
Looking for BlackMagic port...
_reveal_device_port [<serial.tools.list_ports_common.ListPortInfo object at 0x000001E87B2C6A60>, <serial.tools.list_ports_common.ListPortInfo object at 0x000001E87B2C6340>] True
Auto-detected: \\.\COM25
Uploading .pio\build\genericSTM32F103C8\firmware.elf
I notice the output of pio device list is different from before (very first msg in this topic), ie. the x.0 is no longer there. Other than that, it’s not selecting the correct com port for the probe.