Would it be possible to change pin mapping so that pins available in the headers would be changed into SWD pins. So it would be possible to do debugging via SWD pins on Maple Mini and that would be kind of awesome. Thanks.
If we enable them as SWD we loose them as GPIO.
But you can change the settings in boards.txt for your local installation
e.g.
Look at line 207
genericSTM32F103C.menu.upload_method.STLinkMethod.build.upload_flags=-DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 -DSERIAL_USB -DGENERIC_BOOTLOADER
You could add that define to your maple mini build
D21 – PA14 – SWCLK
D22 – PA13 – SWDIO
(gdb)arm-none-eabi-gdb.exe -b 115200
GNU gdb (GNU Tools for ARM Embedded Processors) 7.6.0.20140731-cvs
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-w64-mingw32 --target=arm-none-eabi".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
(gdb) target extended-remote \\.\COM25
Remote debugging using \\.\COM25
(gdb) monitor swdp_scan
Target voltage: Not Implemented!
SW-DP scan failed!
(gdb)
Just lock it in its internal bootloader mode, by pressing and holding the “Button” and press and release Reset
After you upload 1 sketch using BMP you will not need to do that again, as the sketch will no longer disable the SWD Pins

So I did the change you said and could see that g++/gcc got the new flag to enable SWD pins. When that sketch is uploaded and run shouldn’t the SWD be enabled in pins 21,22 ?
EDIT: I think I got it now what you meant Are SWD pins (21,22) always enabled in ‘Internal Bootloader’ mode ?
If you upload a sketch via the bootloader, the sketch compile options cause the init code in the core to disable the SWD pins so that they are usable as GPIO
So. Normally this problem comes about when people upload a sketch via the bootloader then try to upload via STLInk or BMP, in which case as the sketch will be running a few secs after the board is powered up, the pins will be disabled, so you won’t be able to upload
Hence, just for the first STLInk or BMP upload, the easiest option is to put the MCU into its own internal (hardware) serial bootloader by pulling Boot0 high as in this mode SWD is also enabled.


Ok, I got it working but only if I power mini from e.g Vin pin. If I power it from USB then it doesn’t work. Seems strange? Well I tried that in a bit of a hurry so I’ll have to verify that later.
Done once and done forever. The WiKi can explain the mapping and any mumbo-jumbo manual steps…
Ray
1. Very few of the boards have useful names or even model numbers on them
2. The IDE and boards menu is not well suited to multiple boards
We already have 14 variant folders, and some of these variants have 4 sub types, selected via the menus
I think people have to realise that sometimes they are in a very small minority, and they will need to customise their installation to match their specific needs.
Note. I often get requests to make changes which one person wants, but which would mess up thinks for 99% of users, e.g. someone wanted me to remove USB support by default ( for everyone) because it interfered with something they were doing ( I think they wanted to use the USB pins for GPIO and the code doesnt really support that)
So perhaps the solution is a wiki page describing how to change the settings in boards.txt
<…>
I think people have to realise that sometimes they are in a very small minority, and they will need to customise their installation to match their specific needs.
<…>
Its nice to have your voice of sanity back on the forum
Its nice to have your voice of sanity back on the forum