<?xml version="1.0" encoding="UTF-8"?>

<rss version="2.0"
 xmlns:blogChannel="http://backend.userland.com/blogChannelModule"
>

<channel>
<title><![CDATA[Dobrica Pavlinušić's random unstructured stuff: STM32discovery]]></title>
<link>https://saturn.ffzg.hr/rot13/index.cgi?stm32discovery</link>
<description></description>
<pubDate>Thu, 13 Feb 2014 00:24:59 -0000</pubDate>
<webMaster>root@saturn.ffzg.hr</webMaster>
<generator>Socialtext Workspace v2.19.0.2</generator>

<item>
<title><![CDATA[STM32discovery]]></title>
<link>https://saturn.ffzg.hr/rot13/index.cgi?stm32discovery</link>
<description><![CDATA[<div>Creator: Dobrica Pavlinušić</div><hr/><div>Tags: hardware, STM32</div><hr/><div class="wiki">
<div class="nlw_phrase"><table class="wafl_container">
  <tr>
    <td>
      <div class="wafl_box">
        
          <div class="wafl_titlebox">
            <div class="wafl_title">
              
                Contents: [Dobrica Pavlinušić's random unstructured stuff]
              
            </div>
          </div>
          <div class="wafl_items">
            
              <div class="wiki">
<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#install_toolchain">Dobrica Pavlinušić's random unstructured stuff (Install toolchain)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Install toolchain} --></span></li>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#install_openocd">Dobrica Pavlinušić's random unstructured stuff (Install openocd)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Install openocd} --></span></li>

<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#start_openocd">Dobrica Pavlinušić's random unstructured stuff (start openocd)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] start openocd} --></span></li>
</ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#summon_toolchain">Dobrica Pavlinušić's random unstructured stuff (summon toolchain)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] summon toolchain} --></span></li>

<ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#openocd">Dobrica Pavlinušić's random unstructured stuff (openocd)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] openocd} --></span></li>
</ul>
<li><span class="nlw_phrase"><a title="section link" href="https://saturn.ffzg.hr/rot13/index.cgi?dobrica_pavlinu%C5%A1i%C4%87_s_random_unstructured_stuff#using_arduino_ide">Dobrica Pavlinušić's random unstructured stuff (Using Arduino IDE)</a><!-- wiki: {link: [Dobrica Pavlinušić's random unstructured stuff] Using Arduino IDE} --></span></li>
</ul>
</div>

            
            
          </div>
        
      </div>
    </td>
  </tr>
</table>
<!-- wiki: {toc: }
--></div><br /><br /><p>
STM32F100RBT6B</p>
<ul>
<li>different from <a target="_blank" title="(external link)" href="http://pulkomandy.tk/_/_Electronique/_Discovering%20the%20STM32F3%20Discovery">http://pulkomandy.tk/_/_Electronique/_Discovering%20the%20STM32F3%20Discovery</a></li>
</ul>
<pre>
dpavlin@blue:~$ lsusb | grep ST
Bus 003 Device 006: ID 0483:3744 SGS Thomson Microelectronics STLINK Pseudo disk
</pre>
<br /><h1 id="install_toolchain">Install toolchain</h1>
<pre>
dpkg --add-architecture i386
apt-get install libc6-i386
#wget https://launchpad.net/gcc-arm-embedded/4.7/4.7-2012-q4-major/+download/gcc-arm-none-eabi-4_7-2012q4-20121208-linux.tar.bz2
wget https://sourcery.mentor.com/GNUToolchain/package4463/public/arm-none-eabi/arm-2009q1-161-arm-none-eabi-i686-pc-linux-gnu.tar.bz2

</pre>
<br /><h1 id="install_openocd">Install openocd</h1>
<pre>
dpavlin@blue:~$ sudo apt-get install openocd
dpavlin@blue:~$ dpkg -l openocd
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                    Version          Architecture     Description
+++-=======================-================-================-====================================================
ii  openocd                 0.6.1-1          amd64            Open on-chip JTAG debug solution for ARM and MIPS sy
</pre>
<br /><h2 id="start_openocd">start openocd</h2>
<p>
Disable STLINKv1 SCSI emulation, see <a target="_blank" title="(external link)" href="https://github.com/texane/stlink">https://github.com/texane/stlink</a></p>
<pre>
root@blue:~# modprobe -r usb-storage &amp;&amp; modprobe usb-storage quirks=483:3744:i

root@blue:~# sudo openocd -f /usr/share/openocd/scripts/board/stm32vldiscovery.cfg
Open On-Chip Debugger 0.6.1 (2012-12-05-01:32)
Licensed under GNU GPL v2
For bug reports, read
       http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
</pre>
<br /><p>
Open another window and connect with telnet:</p>
<pre>
dpavlin@blue:~$ telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
&gt; reset init
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x08000b4c msp: 0x20000400
</pre>
<br /><h1 id="summon_toolchain">summon toolchain</h1>
<ul>
<li><a target="_blank" title="(external link)" href="https://github.com/esden/summon-arm-toolchain">https://github.com/esden/summon-arm-toolchain</a></li>
</ul>
<h2 id="openocd">openocd</h2>
<pre>
dpavlin@blue:~/sat$ sudo openocd -f /usr/share/openocd/scripts/board/stm32vldiscovery.cfg
[sudo] password for dpavlin: 
Open On-Chip Debugger 0.6.1 (2012-12-05-01:32)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
adapter speed: 1000 kHz
Info : clock speed 1000 kHz
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection from 4444
Warn : target was in unknown state when halt was requested
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x080001ce msp: 0x20001ff0
</pre>
<br /><p>
From different terminal</p>
<pre>
dpavlin@blue:~/sat$ telnet localhost 4444
Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Open On-Chip Debugger
&gt; halt
target was in unknown state when halt was requested
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x21000000 pc: 0x080001ce msp: 0x20001ff0
&gt; 

&gt; flash write_image erase /virtual/stm32discovery/libopencm3/examples/stm32/f1/stm32vl-discovery/fancyblink/fancyblink.hex
auto erase enabled
device id = 0x10016420
flash size = 128kbytes
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20001ff0
wrote 2048 bytes from file /virtual/stm32discovery/libopencm3/examples/stm32/f1/stm32vl-discovery/fancyblink/fancyblink.hex in 0.192207s (10.405 KiB/s)

</pre>
<br /><h1 id="using_arduino_ide">Using Arduino IDE</h1>
<p>
<a target="_blank" title="(external link)" href="http://forums.leaflabs.com/topic.php?id=630">http://forums.leaflabs.com/topic.php?id=630</a></p>
</div>
]]></description>
<author>Dobrica Pavlinu&#x161;i&#x107;</author>
<category>hardware, STM32</category>
<guid isPermaLink="true">https://saturn.ffzg.hr/rot13/index.cgi?stm32discovery</guid>
<pubDate>Thu, 13 Feb 2014 00:24:59 -0000</pubDate>
</item>
</channel>
</rss>