Config for ebay stm32f103c8t6 minimal board

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

Config for ebay stm32f103c8t6 minimal board

Postby 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:

Code: Select all

#####################################################################
# 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


I use this openocd config with my board.

Code: Select all

# This is for the $4.66 ebay STM32F103C8 micro dev board

source [find interface/stlink-v2.cfg]

transport select hla_swd

set WORKAREASIZE 0x2000
source [find target/stm32f1x.cfg]

reset_config none


I'm on linux so I use a couple of xterminals to run openocd in one window and arm-none-eabi-gdb.

-rick
Last edited by Rick Kimball on Sun May 31, 2015 4:59 pm, edited 1 time in total.
-rick

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

Re: Config for ebay stm32f103c8t6 minimal board

Postby 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

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

Re: Config for ebay stm32f103c8t6 minimal board

Postby 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 !

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

Re: Config for ebay stm32f103c8t6 minimal board

Postby 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)
-rick

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

Re: Config for ebay stm32f103c8t6 minimal board

Postby 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

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

Re: Config for ebay stm32f103c8t6 minimal board

Postby 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:

Code: Select all

##############################################################
## 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


Note the last line ... .upload.tool, with that entry it seems to actual invoke the correct script instead of defaulting to default_router. The upload.protocol doesn't seem to affect anything.

Is there a reason you wanted to add another STM32F103C board specific entry other than to get the upload stuff to work?
-rick

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

Re: Config for ebay stm32f103c8t6 minimal board

Postby 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

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

Re: Config for ebay stm32f103c8t6 minimal board

Postby 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.
-rick

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

Re: Config for ebay stm32f103c8t6 minimal board

Postby RogerClark » Wed Apr 29, 2015 9:49 pm

Agreed

;-)

User avatar
ahull
Posts: 1397
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: Config for ebay stm32f103c8t6 minimal board

Postby 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)


I am indeed doing things by hand. I installed openocd and am telneting to port 4444 and issuing commands from there. I haven't had much time over the last few days to play with this, but I'll write up my method eventually.
- Andy Hull -


Return to “STLink”

Who is online

Users browsing this forum: No registered users and 1 guest