C:\work>arm-elf-gcc -v Using built-in specs. Target: arm-elf Configured with: ../gcc-4.2.1/configure --target=arm-elf --prefix=/home/yagarto-4.2.1/yagarto --disable-nls --disable-shared --disable-threads --with-gcc --with-gnu-ld --with-gnu-as --with-stabs --enable-languages=c,c++ --enable-interwork --enable-multilib --with-newlib --disable-libssp --disable-libstdcxx-pch --disable-libmudflap --enable-win32-registry=yagarto -v Thread model: single gcc version 4.2.1 C:\work>OpenOCDのバージョンは以下の通りです。
C:\work>openocd-ftd2xx --help Info: openocd.c:93 main(): Open On-Chip Debugger (2008-02-02 15:00 CET) svn: 279 Info: openocd.c:94 main(): $URL: http://svn.berlios.de/svnroot/repos/openocd/trunk/src/openocd.c $ Open On-Chip Debugger (c) 2005 by Dominic Rath (snapshot r279 from SVN tree + giveio, no official release, compiled my mifi) --help | -h display this help --file | -f use configuration file--debug | -d set debug level <0-3> --log_output | -l redirect log output to file C:\work>
$ tar jxvf monix-YYYYMMDD.tbz2なお、YYYYMMDDは、ダウンロードしたファイルのものに読み換えてください。
c:\work>cd monix\olimex_lpcl2294 c:\work>makeこれにより、
C:\work\monix\olimex_lpcl2294>openocd-ftd2xx -f openocd_program_iflash.cfg Info: openocd.c:93 main(): Open On-Chip Debugger (2008-02-02 15:00 CET) svn: 279 Info: openocd.c:94 main(): $URL: http://svn.berlios.de/svnroot/repos/openocd/trunk/src/openocd.c $ Info: jtag.c:1261 jtag_examine_chain(): JTAG device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f0, Version: 0x4) Warning: arm7_9_common.c:755 arm7_9_assert_reset(): srst resets test logic, too Info: target.c:233 target_init_handler(): executing reset script 'openocd_program_iflash.script' Info: configuration.c:50 configuration_output_handler(): dcc downloads are enabled Info: configuration.c:50 configuration_output_handler(): waiting for target halted... Info: configuration.c:50 configuration_output_handler(): target halted Info: configuration.c:50 configuration_output_handler(): target state: halted Info: configuration.c:50 configuration_output_handler(): target halted in ARM state due to debug request, current mode: Supervisor Info: configuration.c:50 configuration_output_handler(): cpsr: 0x600000d3 pc: 0x810003d4 Info: configuration.c:50 configuration_output_handler(): flash 'lpc2000' found at 0x00000000 Info: configuration.c:50 configuration_output_handler(): erased sectors 0 through 16 on flash bank 0 in 0s 173000us Info: configuration.c:50 configuration_output_handler(): wrote 45668 byte from file monix.bin to flash bank 0 at offset 0x00000000 in 1s 590000us (28.048840 kb/s) Warning: arm7_9_common.c:755 arm7_9_assert_reset(): srst resets test logic, too C:\work\monix\olimex_lpcl2294>
次に電源を入れます。 外部フラッシュメモリに何も入ってない場合、以下のような表示になります。
MONIX Ver.0.3 (Apr 20 2008, 00:46:11) BootMode: 0x08 ElfValidate: Not an ELF Not an ELF image. 1:なお、外部フラッシュにELFイメージが入っている場合は、それを実行しようとします。・・・※
※ MONIX電源投入/リセット時の動作 (スイッチ「BUT」について)
MONIXは、 電源投入/リセット時、スイッチ「BUT」が押されていないと、 外部フラッシュメモリ(0x80000000番地)にELFイメージが存在するかどうか見て、 存在する場合、それを実行しようとします。
(スイッチ「BUT」を押しながら、電源投入すると、あるいはスイッチ「RST」を押すと、 MONIXのプロンプトが表示されて、コマンドを入力できる状態になります。)
MONIX Ver.0.3 (Apr 20 2008, 00:46:11) BootMode: 0x00 1:
なので、MONIXでは、 MACアドレス保持用に外部フラッシュメモリ(の最後のセクタ:0x801f0000番地)を 使うことにしました。
1:mac 00:02:cb:02:46:c5 Ethernet Address : 00:02:cb:02:46:c5 1:もちろん、MACアドレスは他とぶつからないものを設定する必要があります。
1:db 0x801f0000 32 →外部フラッシュの最後のセクタの先頭を見てみる 801f0000 0002 cb02 46c5 ffff - ffff ffff ffff ffff ....F........... →MACアドレスが書き込まれた 801f0010 ffff ffff ffff ffff - ffff ffff ffff ffff ................ 1:ネットワークも動かして確認します。
1:dhcp EtherInit DONE. Ethernet Address : 00:02:cb:02:46:c5 BOOTP DONE. my_ip=192.168.0.3, bootfile=, server_ip(BOOTP)=192.168.0.1 1:
1:flash-ce Flash ROM: Chip Erase... Check...DONE. →1分ぐらいかかります 1:
1:flash-se 0x80000000 →セクタアドレスを指定します Flash ROM: Erase Sector 0x80000000 (size=8192)... Check...DONE. 1:
1:tftp 192.168.0.2 xram-prog.elf 0x80000000 EtherInit DONE. Ethernet Address : 00:02:cb:02:46:c5 BOOTP DONE. my_ip=192.168.0.3, bootfile=, server_ip(BOOTP)=192.168.0.1 ==> my_ip=192.168.0.3, bootfile=xram-prog.elf, server_ip(TFTP)=192.168.0.2, loadaddr=0x80000000 TFTP Start...erasing flash sectors....................... and downloading....(335 blocks) DONE. 1:
なお、最後のセクタについては、MACアドレス保持用に使うことにしているのでイレースしないようにしてます。 (openocd_program_xflash.script参照)
C:\work\monix\olimex_lpcl2294>openocd-ftd2xx -f openocd_program_xflash.cfg Info: openocd.c:93 main(): Open On-Chip Debugger (2008-02-02 15:00 CET) svn: 279 Info: openocd.c:94 main(): $URL: http://svn.berlios.de/svnroot/repos/openocd/trunk/src/openocd.c $ Info: jtag.c:1261 jtag_examine_chain(): JTAG device found: 0x4f1f0f0f (Manufacturer: 0x787, Part: 0xf1f0, Version: 0x4) Warning: arm7_9_common.c:755 arm7_9_assert_reset(): srst resets test logic, too Info: target.c:233 target_init_handler(): executing reset script 'openocd_program_xflash.script' Info: configuration.c:50 configuration_output_handler(): dcc downloads are enabled Info: configuration.c:50 configuration_output_handler(): waiting for target halted... Info: configuration.c:50 configuration_output_handler(): target halted Info: configuration.c:50 configuration_output_handler(): target state: halted Info: configuration.c:50 configuration_output_handler(): target halted in ARM state due to debug request, current mode: Supervisor Info: configuration.c:50 configuration_output_handler(): cpsr: 0x600000d3 pc: 0x810003c8 Info: configuration.c:50 configuration_output_handler(): flash 'cfi' found at 0x80000000 Info: configuration.c:50 configuration_output_handler(): cleared protection for sectors 0 through 37 on flash bank 0 Info: configuration.c:50 configuration_output_handler(): erased sectors 0 through 37 on flash bank 0 in 20s 817000us Warning: target.c:563 target_alloc_working_area(): not enough working area available Warning: target.c:563 target_alloc_working_area(): not enough working area available Info: cfi.c:1127 cfi_intel_write_block(): Using target buffer at 0x40000038 and of size 0x2000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80000000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80002000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80004000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80006000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80008000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x8000a000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x8000c000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x8000e000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80010000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80012000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80014000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80016000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80018000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x8001a000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x8001c000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x8001e000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80020000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80022000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80024000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x2000 bytes to flash at 0x80026000 Info: cfi.c:1145 cfi_intel_write_block(): Write 0x1e3a bytes to flash at 0x80028000 Info: cfi.c:1787 cfi_write(): Fixup 1 unaligned tail bytes Info: configuration.c:50 configuration_output_handler(): wrote 171579 byte from file xram-prog.elf to flash bank 0 at offset 0x00000000 in 4s 154000us (40.336451 kb/s) Warning: arm7_9_common.c:755 arm7_9_assert_reset(): srst resets test logic, too C:\work\monix\olimex_lpcl2294>