#freeze
[[FrontPage]]

#contents

2010/03/31からのアクセス回数 &counter;

しばらくARMから離れていたら、最新のOpenOCDが大きく、
機能アップしており、様変わりしていました。

** 最新のOpenOCD(ver. 0.4.0)を使ってフラッシュに書き込む [#j7436274]
新しい機能で面白いと思ったのが、(([[xoのブログ>http://www.yza.jp/blog/item/1022]]を参考にしました))
- sourceコマンドでfind指定でファイルをインクルードする機能
- コンフィグファイル内に関数(proc)を記述できること

sourceコマンドでのfind指定は以下のような形式で使用します。
#pre{{
source [find target/lpc2214.cfg]
}}

これまで、JTAGとボードに合わせてopenocd.cfgを作っていましたが、
#pre{{
telnet_port 4444
gdb_port 3333

source [find interface/my-jtag.cfg]
source [find target/lpc2214.cfg]
}}
のように簡単に記述することができます。

コンフィグ内のprocを使うと、フラッシュへの書き込みとデバッグ用のコンフィグファイルを1つにまとめることができます。私の場合lpc2214に書き込むため、xoさんのブログとは書き込み手順がことなりますが、これで何とか書き込めるようになりました。

#pre{{
# OpenOCD lpc2214 cfg with Flash proc
telnet_port 4444
gdb_port 3333

source [find interface/my-jtag.cfg]
source [find target/lpc2214.cfg]
# 高速書き込みのために追加
arm7_9 dcc_downloads enable
arm7_9 fast_memory_access enable

proc flash_program {ELF_FILENAME} {
	halt
	flash probe 0
	flash write_image erase $ELF_FILENAME
	echo "flash program complete. reset and run"
	resume
	reset run
	exit
}

init
}}

できあがったopenocd.cfgを使ってlpc2214のフラッシュに書き込むときには、以下のように-cオプションに続いて、flash_program ELFファイル名を指定します。
#pre{{
$ /opt/local/bin/openocd -f openocd.cfg -c "flash_program blink.elf"
Open On-Chip Debugger 0.4.0 (2010-03-29-18:37)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.berlios.de/doc/doxygen/bugs.html
trst_and_srst srst_pulls_trst srst_gates_jtag trst_push_pull srst_open_drain
jtag_nsrst_delay: 100
jtag_ntrst_delay: 100
2000 kHz
dcc downloads are enabled
fast memory access is enabled
Info : clock speed 2000 kHz
Info : JTAG tap: lpc2214.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
Info : Embedded ICE version 4
Info : lpc2214.cpu: hardware has 2 breakpoint/watchpoint units
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x200000d3 pc: 0x0000015c
flash 'lpc2000' found at 0x00000000
auto erase enabled
Warn : Verification will fail since checksum in image (0xea00002d) to be written to flash is
 different from calculated vector checksum (0x9edfff21).
Warn : To remove this warning modify build tools on developer PC to inject correct LPC 
vector checksum.
wrote 8192 bytes from file blink.elf in 0.308415s (25.939 kb/s)
flash program complete. reset and run
Info : JTAG tap: lpc2214.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
}}

LPCベクターのチェックサムが合わない旨エラーがでますが、無視してもかまわないそうです。

http://forum.sparkfun.com/viewtopic.php?t=16417&sid=fab1a425677c437f66796c677ef3c6e1

** Eclipseを使ったデバッグ [#cbc6ba80]
新しいOpenOCDでは、デバッグの設定も変わっていました。

以下のURLで使える設定を見つけました。

http://homepage3.nifty.com/zus/ARM_LPC2388_Dev_Main.html

上記サイトを参考にCommandsタグのInitialize commandsを以下のように設定しました。

#pre{{
target remote localhost:3333
file blink.elf
monitor reset
monitor halt
monitor debug_level 2
load
monitor soft_reset_halt
set mem inaccessible-by-default off
monitor debug_level 0
thbreak main
}}
** コメント [#a4539b8a]
#vote(おもしろかった[3],そうでもない[0],わかりずらい[0])

皆様のご意見、ご希望をお待ちしております。
#comment_kcaptcha

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS
SmartDoc