/var/log/messages

Apr 13, 2014 - 2 minute read - Comments - programming

bare-metal 着手

根性無くって #gFab に行けず、フテていても仕方がないので諸々着手。

ARM RaspberryPi Tutorial C からファイルを作って make してみると以下な出力が。

arm-unknown-eabi-gcc: error: fomit-frame-pointer: No such file or directory

これ、Makefile に以下な記述があるのが原因らしい。

Makefile:BASEFLAGS   += -ffreestanding fomit-frame-pointer -mcpu=arm1176jzf-s

あら、これってもしかして “-” が無いだけかな。

Makefile は以下なカンジで。

{% gist 10571587 %}

とりあえず、この minimal な kernel で JTAG デバッガの動作確認を。

つうか

スタートアップなソレを修正しないと、なのかな。baremetal 本を見つつすすめてみます。つうかその前に OpenOCD が使える状態になっていないと、なのか。

とりあえず /usr/local 配下に openocd-0.7.0 を導入。

あと、baremetal 本ベースで云々するとなると rpi_lib/gpio 配下のソレが必要になってくる模様。init_gpio しとけば良いのかどうか。

とりあえず ld なシンボルを無理矢理辻褄を合わせて実行ファイルはできたのかどうか。かなり無理矢理 merge してる感がありますがとりあえず。あと Makefile を修正。

あと、OpenOCD の設定ファイルは以下から、なのかどうか。

とりあえず clone して armjtag/raspi.cfg を使えば良いのかな。

準備できたみたいなので

デバッガ接続。lsusb の出力が以下。

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 002: ID 8087:0020 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 051: ID 05e3:0608 Genesys Logic, Inc. USB-2.0 4-Port HUB
Bus 001 Device 053: ID 0a5c:217f Broadcom Corp. Bluetooth Controller
Bus 001 Device 058: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC
Bus 001 Device 034: ID 17ef:4816 Lenovo 
Bus 002 Device 052: ID 15ba:002a Olimex Ltd. ARM-USB-TINY-H JTAG interface

認識できてます。RasPI の電源を入れて OpenOCD 起動

$ sudo openocd  -f /usr/local/share/openocd/scripts/interface/olimex-arm-usb-tiny-h.cfg -f armjtag/raspi.cfg 
Open On-Chip Debugger 0.7.0 (2014-04-13-15:37)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : only one transport option; autoselect 'jtag'
adapter speed: 1000 kHz
none separate
raspi.arm
Info : max TCK change to: 30000 kHz
Info : clock speed 1000 kHz
Error: JTAG scan chain interrogation failed: all ones
Error: Check JTAG interface, timings, target power, etc.
Error: Trying to use configured scan chain anyway...
Error: raspi.arm: IR capture error; saw 0x1f not 0x01
Warn : Bypassing JTAG setup events due to errors
Error: 'arm11 target' JTAG error SCREG OUT 0x1f
Error: unexpected ARM11 ID code
Polling target raspi.arm failed, GDB will be halted. Polling again in 100ms

む、Error って出てますね。これって実機側でターゲットなプログラムが動いてないと駄目なのかどうか。

とりあえずコンパイルしてみたらコンパイルエラーになってしまってびっくりしたのですが、main.c に以下を追加したら何とかなりました。

#include "rpi_lib/rpi.h"

とは言え、JTAG scan chain interrogation failed なソレはまだ出たまま。とりあえずデバイスとして認識してるはずではあるのでここの問題を解決しないと駄目なのかどうか。

以下なドキュメントを見つけてますが今日はもう限界。

Just resolved an identical looking issue by connecting the Pi’s ground pin to pin 7 in the lower row, counting from the lower left (following the numbering convention in the referenced link). Had it plugged into the lower right most pin (lower pin 10). dwelch’s howto specifically mentions pin 2 in the lower row as not being ground but it seems that pin 10 may not be ground either.

JTAG scan chain interrogation failed: all ones より引用

raspbian シリアル接続の件 rake 備忘

comments powered by Disqus