stm32duino core with System Workbench for bluepill

Development environment specific, Arduino, Eclipse, VS2013,Em::Blocks etc
User avatar
Rick Kimball
Posts: 1077
Joined: Tue Apr 28, 2015 1:26 am
Location: Eastern NC, US
Contact:

Re: stm32duino core with System Workbench for bluepill

Post by Rick Kimball » Mon Apr 17, 2017 1:20 pm

You probably want '-nostartfiles' instead of '-nostdlib'.

-nostartfiles lets you provide your own startup code but lets you link with the nano.specs libc stuff.

As far as code bloat goes, you need to spend some time with arm-none-eabi-objdump -CS yoursketch.ino.cpp.elf | less to see what is causing your code to bloat.
-rick

ag123
Posts: 854
Joined: Thu Jul 21, 2016 4:24 pm

Re: stm32duino core with System Workbench for bluepill

Post by ag123 » Mon Apr 17, 2017 2:24 pm

i'm thinking that it is possibly better to simply call init() prior to calling main() in start_c(), that would make the code more readable. But in the mean time that constructor 'black magic' works, hence, i'd guess we'd leave it, until it doesn't :D

gcc is interesting, with so many obscure/often ignored features in elf sections
http://www.cs.stevens.edu/~jschauma/810/elf.html
http://refspecs.linuxbase.org/LSB_3.0.0 ... tions.html

paksoft
Posts: 15
Joined: Sun Apr 10, 2016 3:16 am

Re: stm32duino core with System Workbench for bluepill

Post by paksoft » Fri Nov 24, 2017 4:44 pm

I've tried to use Rick's bluepill.zip with AC6 in Windows 10 (64 bit), because setting up Linux is too difficult for me. I use blue pill and ST-Link from ebay.
I'm just newbie with eclipse software. I try to make several parameters adjustment and but finally, I've got error message. Does it look like fake ST-Link error?

Please give some suggestion.

pak
Attachments
bluepill_STLink_Debug_Error.jpg
bluepill_STLink_Debug_Error.jpg (136.6 KiB) Viewed 219 times

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

Re: stm32duino core with System Workbench for bluepill

Post by Rick Kimball » Fri Nov 24, 2017 6:00 pm

You should probably create a new test project using System Workbench without using my project configuration. Verify that you can compile and debug on windows. It looks like you are specifying the wrong stlink device, based on the vid/pid mismatch.

VID/PID 0x0483 0x3748 for ST-Link/V2
VID/PID 0x0483 0x374b for ST-Link/V2-1

I setup the project expecting an stlink-v2 ... if you are using a "nucleo like" device you could change:
source [find interface/stlink-v2.cfg]
to
source [find interface/stlink-v2-1.cfg]

This was the openocd.cfg I used.

Code: Select all

# An openocd config for the jc66_coreboard board with a single STM32F103C8Tx chip.
source [find interface/stlink-v2.cfg]
set WORKAREASIZE 0x4000
transport select hla_swd
source [find target/stm32f1x_stlink.cfg]
adapter_khz 950
# use software reset
reset_config none
-rick

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

Re: stm32duino core with System Workbench for bluepill

Post by Rick Kimball » Fri Nov 24, 2017 6:32 pm

So I just upgraded my System Workbench. It seems the auto generated one now only actually works with stlink-v2-1 ...
# This is an bluepill board with a single STM32F103CBTx chip
#
# Generated by System Workbench for STM32
# Take care that such file, as generated, may be overridden without any early notice. Please have a look to debug launch configuration setup(s)

source [find interface/stlink.cfg]

set WORKAREASIZE 0x5000

transport select "hla_swd"

set CHIPNAME STM32F103CBTx

# Enable debug when in low power modes
set ENABLE_LOW_POWER 1

# Stop Watchdog counters when halt
set STOP_WATCHDOG 1

# STlink Debug clock frequency
set CLOCK_FREQ 4000

# use hardware reset, connect under reset
# connect_assert_srst needed if low power mode application running (WFI...)
reset_config srst_only srst_nogate connect_assert_srst
set CONNECT_UNDER_RESET 1

source [find target/stm32f1x.cfg]
Searching in my Ac6 directory I find stlink.cfg .. has this:
$ find . -iname 'stlink.cfg'
./SystemWorkbench/plugins/fr.ac6.mcu.debug_2.1.3.201710251246/resources/openocd/st_scripts/interface/stlink.cfg
$ vi $(find . -iname 'stlink.cfg')

...
#
# STMicroelectronics ST-LINK in-circuit debugger/programmer
#

interface hla
hla_layout stlink
hla_device_desc "ST-LINK/V2-1"
hla_vid_pid 0x0483 0x374b
You are going to have to use a custom openocd.cfg file you can't use the auto generated one any more.

Note: It is a constant struggle to keep things working that once worked. Vendors upgrade their "features" and usually the people who are doing the changes don't care about maintaining things working with previous versions. ... I think Raul Julia got them started on this path:

https://www.youtube.com/watch?v=AjGXn249Fc0
-rick

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

Re: stm32duino core with System Workbench for bluepill

Post by Rick Kimball » Fri Nov 24, 2017 7:45 pm

Since I last looked it seems they have added a new feature, the st-link server. It appears to offer access to both the debug interface along with the Serial Wire Viewer (SWV) monitoring port.

https://my.st.com/content/my_st_com/en/ ... erver.html

You might want to check that out.
-rick

paksoft
Posts: 15
Joined: Sun Apr 10, 2016 3:16 am

Re: stm32duino core with System Workbench for bluepill

Post by paksoft » Sat Nov 25, 2017 6:54 pm

@Rick
You should probably create a new test project using System Workbench without using my project configuration. Verify that you can compile and debug on windows. It looks like you are specifying the wrong stlink device, based on the vid/pid mismatch.
I created new project with the code generated by STMCubeMx.
It works, now I need to replace CMSIS with stm32duino core. Could you please give some guidelines for porting stm32duino core?


pak
Attachments
AC6_WS - Debug - Blink_BluePill_HAL_Driver_Src_stm32f1xx_hal_gpio.c - Eclipse.jpg
AC6_WS - Debug - Blink_BluePill_HAL_Driver_Src_stm32f1xx_hal_gpio.c - Eclipse.jpg (183.09 KiB) Viewed 174 times

Post Reply