I looked into adding support for the stlink to OpenOCD about a year
ago - never got around to finishing as it required quite a bit of
work.
Seems someone else has taken the 'bull by the horns' and added support.
It is still being reviewed on our gerrit server but feel free to
checkout/comment before we get this added to master repo.
Cheers
Spen
Spencer> Hi, I looked into adding support for the stlink to OpenOCD
Spencer> about a year ago - never got around to finishing as it required
Spencer> quite a bit of work.
Spencer> Seems someone else has taken the 'bull by the horns' and added
Spencer> support. It is still being reviewed on our gerrit server but
Spencer> feel free to checkout/comment before we get this added to
Spencer> master repo.
Spencer> http://openocd.zylin.com/279
You you please give me a head start how to checkout/clone the code at zylin?
Thanks
--
Uwe Bonnes b...@elektron.ikp.physik.tu-darmstadt.de
Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
No problem.
Checkout the OpenOCD code as normal:
git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
the checkout the stlink patch (with configs)
git fetch http://openocd.zylin.com/p/openocd refs/changes/87/287/1 &&
git checkout FETCH_HEAD
build as normal
Here is my config - using STM32C-EVAL and STLINK-V2
set CPUTAPID 0x1ba01477
source [find interface/stlink-usb.cfg]
source [find target/stm32f2x_stlink.cfg]
Cheers
Spen
make sure to use the --enable-stlink when calling OpenOCD configure, eg.
./configure --enable-maintainer-mode --enable-stlink
make
I have only tested under ubuntu using libusb-1.0
Cheers
Spen
On 12/19/2011 12:18 PM, Spencer Oliver wrote:
> On 19 December 2011 12:06, Uwe Bonnes
> <b...@elektron.ikp.physik.tu-darmstadt.de> wrote:
>>
>> You you please give me a head start how to checkout/clone the code at zylin?
>>
>
> No problem.
>
> Checkout the OpenOCD code as normal:
> git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
>
> the checkout the stlink patch (with configs)
> git fetch http://openocd.zylin.com/p/openocd refs/changes/87/287/1&&
> git checkout FETCH_HEAD
This bit all worked ok...
>
> build as normal
ahhhh, this bit could do with some work.... the git checkout has a README, that
refers to a non-existant INSTALL file. There's no configure... The developers
guide, at http://openocd.sourceforge.net/doc/doxygen/html/index.html has no
section on building. The users guide:
http://openocd.sourceforge.net/doc/html/Developers.html#Developers refers to the
README file...
Ok, let's try "bootstrap" ok, now we have a configure..... and can run make...
Ok, now what?
> Here is my config - using STM32C-EVAL and STLINK-V2
>
> set CPUTAPID 0x1ba01477
> source [find interface/stlink-usb.cfg]
> source [find target/stm32f2x_stlink.cfg]
I don't get that far...
The documentation on where these damn .cfg files are located is pervese to say
the least. I resorted to "find" in the top level directory to look for them.
http://openocd.sourceforge.net/doc/html/Running.html#Running refers to the list
of search paths, but none of those names match any obvious directories in the
git package. Eventually, it seems that it's all underneath the tcl directory.
karlp@tera:~/src/openocd-git/src$ ./openocd -f ../tcl/interface/stlink-usb.cfg
Open On-Chip Debugger 0.6.0-dev-00294-ga84e2e3 (2011-12-28-20:31)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'stlink'
1 kHz
trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain
Error: Translation from khz to jtag_speed not implemented
Error: Translation from khz to jtag_speed not implemented
Error: Translation from jtag_speed to khz not implemented
Info : adapter-specific clock speed value 0
Error: BUG: current_target out of bounds
karlp@tera:~/src/openocd-git/src$
Now what? There's no "board" file I can see for any of the STM32 Discovery
boards, do I really need a board config to verify that I can talk to the programmer?
Later, I tried with the stm32f2x_stlink.cfg file, (I wasn't expecting to need a
different target config, I thought that was the point of the separation of
interface and target configs?) and it then _starts_, but commands like "reg"
don't do anything, nor does
> mdb 0x08000000 32
mdb ['phys'] address [count]
stm32.cpu mdb address [count]
in procedure 'mdb'
> stm32.cpu cget -coreid
65536
> stm32.cpu cget -variant
I can't really say whether this is user error or patch error at this point.
Cheers,
Karl P
Thats good.
>>
>> build as normal
>
> ahhhh, this bit could do with some work.... the git checkout has a README,
> that refers to a non-existant INSTALL file. There's no configure... The
> developers guide, at
> http://openocd.sourceforge.net/doc/doxygen/html/index.html has no section on
> building. The users guide:
> http://openocd.sourceforge.net/doc/html/Developers.html#Developers refers to
> the README file...
>
> Ok, let's try "bootstrap" ok, now we have a configure..... and can run
> make...
>
> Ok, now what?
>
INSTALL does exist.
As usual with Open Source projects some things may need tweaking -
patches are always welcome :)
The initial stlink support has been merged into master now so a simple
clone is required:
git clone git://openocd.git.sourceforge.net/gitroot/openocd/openocd
When building from git master then configure will need generating ...
./bootstrap
./configure --enable-maintainer-mode --enable-stlink
make
Cheers
Spen