The key is to not let the core code disable your SWD pins. If you define CONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 the compiler will leave the SWD pins alone and let you use stlink again and again.
This is the my custom boards.txt entry:
#####################################################################
# ebay stm32f103c8t6 minimal development board
ebay_f103c8_micro.name=ebay stm32f103c8t6 micro (stlink)
ebay_f103c8_micro.build.common_flags=-mthumb -march=armv7-m -D__STM32F1__ -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1
ebay_f103c8_micro.build.core=maple
ebay_f103c8_micro.build.cpu_flags=-DMCU_STM32F103C8
ebay_f103c8_micro.build.error_led_pin=1
ebay_f103c8_micro.build.error_led_port=GPIOB
ebay_f103c8_micro.build.f_cpu=72000000L
ebay_f103c8_micro.build.ldscript=ld/jtag_c8.ld
ebay_f103c8_micro.build.mcu=cortex-m3
ebay_f103c8_micro.build.variant=generic_stm32f103c
ebay_f103c8_micro.build.variant_system_lib=libmaple.a
ebay_f103c8_micro.build.vect=VECT_TAB_ADDR=0x8000000
ebay_f103c8_micro.upload.file_type=hex
ebay_f103c8_micro.upload.flash.maximum_size=65536
ebay_f103c8_micro.upload.maximum_size=65536
ebay_f103c8_micro.upload.protocol=stlinkv2_upload
ebay_f103c8_micro.upload.ram.maximum_size=20480
ebay_f103c8_micro.upload.tool=stlinkv2_upload
Thanks.
I will need to double check whats going on, because I thought I’d checked and my STLink clone seemed to work OK with my small generic F103C8 board.
However on Windows the issue seemed to be that I had to put Boot0 to High (same as for Serial uploads).
I think @ahull was also testing STLink on Linux and he didnt report any issues.
I will PM @ahull and perhaps he can comment on what he did to get it working for him
Thanks so much for your explanation.
I have updated the boards.txt so that what was the “STM32 to Flash (no bootloader)” board is now called “STM32F103C8 to Flash – No bootloader” and changed the settings for this board, when you select STLink as the upload method
If you take a look at the board.txt file, the sub menus can control all the settings that the main board settings control, so its possible to have one config for STlink and another for serial upload
I have tested it with my cheapy STM32F103C8 board, which I suspect is the same as yours, and it works like a charm !
https://github.com/rogerclarkmelbourne/ … ools/linux
The linux version is missing serial_upload and stlink_upload. The stlink and stm32flash binaries are also missing.
For the binaries it might be worthwhile to have 2 folders for the binaries (32 and 64)
Sorry About Linux
I meant to put the OSX script in the Linux folder
I agree we need to have Linux 32 and 64, if you can post me either of texans stlink let me know.
Ps source for texans stlink is in the repo as a sub module under tools src from what I remember
I added an entry like this to your latest boards.txt:
##############################################################
## F103C8 flash via stlink (overwrites bootloader)
## -------------------------
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink=F103C8(64k) via stlink (overwrite bootloader)
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink.build.ldscript=ld/jtag_c8.ld
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink.build.cpu_flags=-DMCU_STM32F103C8
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink.build.vect=VECT_TAB_ADDR=0x8000000
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink.build.extra_flags=-DMCU_STM32F103C8 -mthumb -march=armv7-m -D__STM32F1__ -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink.upload.maximum_size=65536
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink.upload.ram.maximum_size=20480
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink.upload.flash.maximum_size=65536
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink.upload.altID=1
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink.upload.protocol=stlink_upload
GenericSTM32F103C.menu.cpu_upload_menu.c8stlink.upload.tool=stlink_upload
IMHO the uploader router should be removed. I don’t think its required as the same result can be achieved with an UpLoader sub menu.
Long story…. but the upload router was a contrib. I didn’t write it. But I agree that’s no excuse.
I will try adding a separate upload menu to the generic stm32f103c board, or perhaps you could give it try and let me know.
Copy the one from the board I referenced and change the board Id name at the front to match the Generic STM32F103C board identifier
I was just asking about the board you added. I was fine with the way it was with a generic STM32F103C and then having to pick the C8 or CB and the upload method. It just lacking an stlink option on the cpu & upload.
Seems like the whole boards menu needs to get consistent for the handling of the generic boards. The STM32F103Z does it one way .. and the STM32F103C does it differenly.
https://github.com/rogerclarkmelbourne/ … ools/linux
The linux version is missing serial_upload and stlink_upload. The stlink and stm32flash binaries are also missing.
For the binaries it might be worthwhile to have 2 folders for the binaries (32 and 64)
OK.
I’ll try to sort this mess out
The problem is that I dont generally use Linux. Not because I dislike it, but just because all my other machines are tied up running Windows or Mac OS etc
I don’t think the upload router is necessary at all, I should endevour to remove it and do the same job in the menus, now that some things have been simplified in terms of the number of menu options for the generic boards
PS. I agree that all generic boards need to have the same menu’s, but I only have a finite amount of time to spend on this
I took a first stab at cleaning it up some. Still needs a lot of work
Thanks
I will endeavour to sort some issues out this weekend, and I will try to get Linux onto a dedicated machine, rather than having to swap disks or dual boot or run via a VM etc
I also want to finish off the Bootloader 2.0 . The consensus with the bootloader is that the upload to RAM is pointless and unreliable and needs to be removed.