Getting started with ST-Link V2 & st-util

Hi everyone - I have been following a few posts here to try and get started with this but still need some help getting going here.

I built the latest branch of the spark/firmware repo as follows:

make USE_SWD_JTAG=y PLATFORM=photon clean all program-dfu

and then I flash this over dfu.

I then try to run st-util:

st-util -p 9025

and I get the following response:

2015-07-28T09:13:32 INFO src/stlink-usb.c: -- exit_dfu_mode
2015-07-28T09:13:32 INFO src/stlink-common.c: Loading device parameters....
2015-07-28T09:13:32 WARN src/stlink-common.c: unknown chip id! 0xe0042000

My guess is that I am probably missing an obvious step or something… any help?

  • make sure you power the Photon via USB as well.
  • Place the Photon in DFU mode before you enter st-util -p 9025 and see if it works

Thanks for the reply @kennethlimcp - I tried your suggestion but got the same response from st-util.

Are you using the JTAG shield? Make sure all the necessary pins including the 3V3 from the Photon to the STLINK is connected.

1 Like

Scratch that - got it working now so I have been able run st-util and attach via gdb.

One other thing though - any example I have seen, they seem to be running it with main.elf but when I built the firmware I didn’t get such a file. I tried running with user-part.elf but it seems to have had the names stripped from it and won’t break anywhere… Should I be building something different as a good starting point?

Try to add MODULAR=n to the make command and the system firmware + user firmware will be combined into one .elf file.

or another thing is to use COMPILE_LTO=n and see if it helps

1 Like

Hero… thats me rolling.