2011/10/02からのアクセス回数 10586
ねむいさんのぶろぐSWD専用Versaloonクックブック のハンダ付けにギブアップして諦めていたSTM8S-Discoveryを見事復活させ、SWD版Versaloonにする方法を紹介します。
元ネタは、 Bingo氏のサイト で紹介されている STM32 DiscoveryのVersaloon化の手順書 です。
私の方法は、トラ技オフ会で頂いたSTM32L-DiscoveryのST-LINK機能を使ってfirmwareをSTM8Sに書き込むのがポイントです。
STM32LのCN3のジャンパー線を外すとSTM32LをST-LINKとして使うことができます。
STM32LのSWDのピンコネクタの上から1番ピン
2 SWCLK 3 GND 4 SWDIO 5 TNRST
を
STM8SのCN5のJTAGピンに接続します。
4 SWCLK (JTCK) 5 SWDIO (JTMS) 7 GND 8 JNRST
VersaloonのfirmwareをSTM32LのST-LINKで書き込みます。 使用するアプリケーションは、STの純正ユーティリティST-LINK Utilityです。
ST-LINK Utilityは、以下のサイトからダウンロードし、インストールします。
今回のOpenOCDに合ったfirmwareは、 Vsprog SWD working on STM8 and STM32VL embedded debuggers によると、
です。
これを展開し、STM8S/No-Bootloader/Versaloon_GCC-SVN.819-STM8S-offs-0x0000.hexをWindowsにコピーします。
STM32とSTM8Sを以下のように接続します。
ST8Sのfirmwareは、そのままではRead Protectが掛かっているので、最初にこれを外します。
&ref(): File not found: "正常に書き込み後の画面.png" at page "arm/STM8S-DiscoveryをVersaloonにする簡単な方法";
これで、STM8SのVersaloon化は完成です。(簡単でしょう!)
実際にARMマイコンパーフェクト学習基板にプログラムを書き込んでみます。
STM8SのCN7の左から1番
2 SWDIO 3 GND 4 SWCLK
をARMマイコンパーフェクト学習基板のP1コネクタの左から1番
2 SWIO 3 SWCLK 8 GND
に接続します。
書き込みは無事成功しました。
Versaloon(0x32)by Simon(compiled on Aug 14 2011)
の0x32がどうやらSTM8SのVersaloonの識別子みたいです。
$ /usr/local/bin/openocd -f interface/vsllink_swd.cfg -f target/lpc1343_swd_flash.cfg -c "mt_flash main.elf" Open On-Chip Debugger 0.5.0-dev-00783-g0123985-dirty (2011-10-02-18:39) Licensed under GNU GPL v2 For bug reports, read http://openocd.berlios.de/doc/doxygen/bugs.html Warn : must select a transport. Info : OpenOCD runs in SWD mode adapter_nsrst_delay: 200 jtag_ntrst_delay: 200 trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain Info : OpenOCD runs in SWD mode Info : Versaloon(0x32)by Simon(compiled on Aug 14 2011) Info : USB_TO_XXX abilities: 0x00000009:0x00000040:0xC0000006 Info : RCLK (adaptive clock speed) Info : lpc1343.cpu: hardware has 6 breakpoints, 4 watchpoints target state: halted target halted due to debug-request, current mode: Thread xPSR: 0x21000000 pc: 0x000004b0 msp: 0x10001fc8 flash 'lpc2000' found at 0x00000000 auto erase enabled wrote 4096 bytes from file main.elf in 0.492170s (8.127 KiB/s) verified 2968 bytes in 0.126431s (22.925 KiB/s) requesting target halt and executing a soft reset target state: halted target halted due to breakpoint, current mode: Thread xPSR: 0x01000000 pc: 0x000000c0 msp: 0x10001fe0 shutdown command invoked
皆様のご意見、ご希望をお待ちしております。