Config for ebay stm32f103c8t6 minimal board

Rick Kimball
Tue Apr 28, 2015 5:55 pm
I have one of those $4.66 generic stmf103 micro boards I’ve been using with an old stm32f0 discovery board that has an on-board stlink-v2 device. At first it seemed like I could only get it to load an arduino sketch one time and then the debugger would stop responding. You have to configure your board slightly differently if you want to program and debug with with an stlink device. The generic stm32f103c configuration disables the SWD pins and makes them GPIO pins. That took me “a few minutes” to find. The symptom is that you can program it once after you erase it with the STLink app from STMicro but then you can’t attach to it ever again unless you mess with the boot0 pin.

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


RogerClark
Wed Apr 29, 2015 6:07 am
Rick

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


RogerClark
Wed Apr 29, 2015 11:25 am
Rick,

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 !


Rick Kimball
Wed Apr 29, 2015 12:15 pm
If @ ahull is using stlink on linux he must be doing it by hand like me. The linux directory is missing many of the required scripts and binaries

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)


RogerClark
Wed Apr 29, 2015 12:27 pm
Rick

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


Rick Kimball
Wed Apr 29, 2015 1:00 pm
The reason I created a board specific entry and jammed my upload tool info into it was mainly because there didn’t seem to be an stlink_upload option in the cpu and upload menu. However, even if there was, the whole thing seems to be broken. It always tries to use the upload_router script. Which looks like it is DFU specific ( not sure where the router part comes in).

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


RogerClark
Wed Apr 29, 2015 8:15 pm
Rick

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


Rick Kimball
Wed Apr 29, 2015 8:36 pm
What I posted works… hmm

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.


RogerClark
Wed Apr 29, 2015 9:49 pm
Agreed

;-)


ahull
Wed Apr 29, 2015 11:12 pm
Rick Kimball wrote:If @ ahull is using stlink on linux he must be doing it by hand like me. The linux directory is missing many of the required scripts and binaries

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)


RogerClark
Thu Apr 30, 2015 2:27 am
Guys

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


Rick Kimball
Thu Apr 30, 2015 3:07 am
I created a fork of your repository in: https://github.com/RickKimball/Arduino_STM32

I took a first stab at cleaning it up some. Still needs a lot of work


RogerClark
Fri May 01, 2015 9:58 pm
Rick

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.


Leave a Reply

Your email address will not be published. Required fields are marked *