2010-06-21 NetBSD/netwalker #3
割り込みキタ━━━━━━(゚∀゚)━━━━━━!!
というか cpsie(I32_bit) するだけであっさり割り込んだ件について。結局ロードアドレスは関係なかったのであった。 enable_interrupts(I32_bit) は一度試した気がするんだけど、それで割り込まなかったのはtzicや割り込みプライオリティマスクあたりの設定がまずかったのかなぁ。 まぁ動いたから無駄に過去を振り返るのはやめよう。謎なハマり方をするのはよくあることだ。
NetWalker/linuxの方もcross buildできるようにして、たっぷりprintfを入れて何度か動かしたので、ちょっとずつわかってきた。
というわけでガリガリと各種ドライバのテンプレを書く。
タイマは最初はEPIT(Enhanced Periodic Interrupt Timer)を使っていたのだが、GPT(General Porpose Timer)を使えば一つのタイマで3つのカウンタを使って割り込みかけられるので、 gptを使ってhardclockとstatclockを動かすことにする。gpt_timer_intr: が実際の割り込みルーチンのdebug printf。
wdogはとりあえずリセットしないようにするだけで中身はほとんど空。iMX51のwatchdogは起動後デフォルトがenableになっていて、CPU起動後16秒以内にレジスタを設定しないと電源が落ちてしまう。
ipuはいわゆるフレームバッファ。wsdisplayになるはず。
gpioはNetWalkerでは色々なデバイスのスイッチに使っているので、これも必須。
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc. All rights reserved. Copyright (c) 1982, 1986, 1989, 1991, 1993 The Regents of the University of California. All rights reserved. NetBSD 5.99.31 (IMX51NETWALKER) #71: Mon Jun 21 20:02:50 JST 2010 ryo@phenomena:/src/cvs/NetBSD/sys/arch/evbarm/compile/IMX51NETWALKER total memory = 512 MB avail memory = 499 MB mainbus0 (root) cpu0 at mainbus0: Cortex-A8 r2p1 (Cortex core) cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled cpu0: 32KB/64B 4-way Instruction cache cpu0: 32KB/64B 4-way write-back-locking-C Data cache cpu0: 256KB/64B 8-way L2 cache axi0 at mainbus0: AMBA AXI interface tzic0 at axi0 addr 0xe0000000-0xe0000fff: TrustZone Interrupt Controller imx51gpt0 at axi0 addr 0x73fa0000-0x73fa0027 irq 39: General Purpose Timer imx51gpio0 at axi0 addr 0x73f84000-0x73f8401f irq 42-51: General Purpose Input/Output imx51gpio1 at axi0 addr 0x73f88000-0x73f8801f irq 52-53: General Purpose Input/Output imx51gpio2 at axi0 addr 0x73f8c000-0x73f8c01f irq 54-55: General Purpose Input/Output imx51gpio3 at axi0 addr 0x73f90000-0x73f9001f irq 56-57: General Purpose Input/Output imx51wdog0 at axi0 addr 0x73f98000-0x73f98009 irq 58: Watch Dog Timer imx51wdog1 at axi0 addr 0x73f9c000-0x73f9c009 irq 59: Watch Dog Timer imx51ipu0 at axi0 addr 0x40000000-0x5fffffff irq 10-11: Image Processing Unit imxuart0 at axi0 addr 0x73fbc000-0x73fbc0ff irq 31: IMX51UART gpt_timer_intr:237: HARDCLOCK: cnt=2212495 gpt_timer_intr:246: STATCLOCK: cnt=2347191 gpt_timer_intr:237: HARDCLOCK: cnt=2452585 gpt_timer_intr:237: HARDCLOCK: cnt=2692698 gpt_timer_intr:246: STATCLOCK: cnt=2745547 boot device: <unknown> root device: gpt_timer_intr:237: HARDCLOCK: cnt=2933043 gpt_timer_intr:246: STATCLOCK: cnt=3120642 gpt_timer_intr:237: HARDCLOCK: cnt=3173110 gpt_timer_intr:237: HARDCLOCK: cnt=3413178 gpt_timer_intr:246: STATCLOCK: cnt=3495705 gpt_timer_intr:237: HARDCLOCK: cnt=3653243 gpt_timer_intr:246: STATCLOCK: cnt=3870767 gpt_timer_intr:237: HARDCLOCK: cnt=3894077 : : : :
EOF