goosen 发表于 2010-1-9 22:23:16

skyeye-1.3.0 运行 OKL4 3.0

基本测试通过。ok-linux也可以跑起来——别的,比如ntest、kbench、ctest等,也正常。
只是模拟s3c2410x存在问题,可作为进一步的工作——然后在真实的硬件上跑(MINI2440)。

1、环境及配置
okl4: okl4-3.0
环境: skyeye-1.3.0 模拟xscale的pxa_lubbock(pxa25x)开发板。

# cat skyeye.conf
arch:arm
cpu: pxa25x
mach: pxa_lubbock

mem_bank: map=M, type=RW, addr=0xA0000000, size=0x4000000
mem_bank: map=I, type=RW, addr=0x40000000, size=0x4C000000
uart: mod=term


2、其他准备工作
1)下载okl4-3.0
http://wiki.ok-labs.com/downloads/release-3.0/okl4_3.0.tar.gz

2)下载交叉编译器(官方提供的)
http://wiki.ok-labs.com/downloads/release-3.0/arm-linux-gnueabi-4.2.4.tar.gz
http://www.ertos.nicta.com.au/downloads/tools/arm-linux-3.4.4.tar.bz2

3) 修改 tools/toolchains.py
处理器是ARM, 请根据给自情况修改以下两个变量,
gnu_arm_eabi_toolchain =
generic_gcc_3_4_libgcc("/opt/okl/Linux-i386/arm/gcc-4.2.4-glibc-2.7/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-")
# 指定所使用的支持gnueabi的编译器

gnu_arm_toolchain = generic_gcc_3_4_libgcc("arm-linux-")
# 不支持gnueabi的编译器。只要版本不太旧,都没问题(2.95的编译器有问题)


3、编译okl4及测试项目
编译examples中的 pingpong
# tools/build.py machine=gumstix project=examples example=pingpong kdb_serial=True PYFREEZE=False

编译 ktest
# tools/build.py machine=gumstix project=ktest kdb_serial=True PYFREEZE=False


4、使用skyeye-1.3.0 测试
使用skyeye模拟(pingpong 示例),
# skyeye -c skyeye.conf -e build/images/image.boot

注:此处使用image.boot镜像,对于别的文件,比如image.sim、image.elf,skyeye均出现错误退出(原因不明)。

# 终端信息
OKL4 - (provider: Open Kernel Labs) built on Jan8 2010 10:57:13 using gcc version 3.4.4.
Ping-Pong will do 100 pings
Ping is alive.
Pong is alive.
Pong is finished. Total pongs: 100
Ping is finished. Total pings: 100
Ping-Pong complete. Exiting...


5、相关文档
http://wiki.ok-labs.com/downloads/release-3.0/
http://wiki.ok-labs.com/forum#nabble-td3798831

http://lists.okl4.org/pipermail/developer/2009-January/002118.html
# 模拟openmoko,下一步的工作(s3c241x处理器,用mini2440板子)

http://ertos.nicta.com.au/software/tools/eclipse-howto.pml
# 使用eclipse的,有待配置

[ 本帖最后由 goosen 于 2010-2-20 16:13 编辑 ]

goosen 发表于 2010-2-20 15:48:03

okl4 3.0 on gta01 (s3c2410)

在s3c2410上运行OKL4 3.0需做些调整。涉及到协处理器 p15 的一些设置。
$ vim arch/arm/pistachio/cpu/arm920t/include/syscon.h

/* Kernel mode - little endian, cached, write buffer, remap to 0xffff0000 */
#define C15_CONTROL_KERNEL      (C15_CONTROL_FIXED | C15_CONTROL_M | C15_CONTROL_C |
                                 C15_CONTROL_S | C15_CONTROL_I | C15_CONTROL_X | CONFIG_C15_CLOCK)

需将 C15_CONTROL_C 去除,Disable data cache,即
#define C15_CONTROL_KERNEL      (C15_CONTROL_FIXED | C15_CONTROL_M |
                                 C15_CONTROL_S | C15_CONTROL_I | C15_CONTROL_X | CONFIG_C15_CLOCK)

1)build okl4
$ tools/build.py machine=gta01 project=examples example=hello kdb_serial=True PYFREEZE=False


2)start skyeye-1.3.0

$ skyeye -c skyeye_s3c2410x.conf -e build/images/image.boot
SkyEye is an Open Source project under GPL. All rights of different parts or modules are reserved by their author. Any modification or redistributions of SkyEye should note remove or modify the annoucement of SkyEye copyright.
Get more information about it, please visit the homepage http://www.skyeye.org.
Type "help" to get command list.
(skyeye)start
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
In do_mach_option, mach info: name s3c2410x, mach_init addr 0xb70e3d30

uart_mod:3, desc_in:, desc_out:, converter:
In create_uart_console
SKYEYE: use arm920t mmu ops
exec file "build/images/image.boot"'s format is elf32-little.
load section kernel.text: addr = 0x30000000size = 0x00014ab0.
load section kernel.rodata: addr = 0x30014ab0size = 0x00007df7.
load section kernel.kdebug: addr = 0x3001c8a7size = 0x0000428d.
load section kernel.init: addr = 0x30020b34size = 0x00001900.
load section kernel.roinit: addr = 0x30022434size = 0x00000004.
load section kernel.elfweaver_info: addr = 0x30022438size = 0x00000068.
load section kernel.data: addr = 0x30022800size = 0x000015cc.
load section kernel.got: addr = 0x30023dccsize = 0x00000004.
load section kernel.got.plt: addr = 0x30023dd0size = 0x0000000c.
load section kernel.kdebug-data: addr = 0x30023ddcsize = 0x000003b0.
not load section kernel.bss: addr = 0x3002418csize = 0x00002b78 .
load section hello.data: addr = 0x3002740csize = 0x0000014c.
load section hello.got: addr = 0x30027558size = 0x00000010.
not load section hello.bss: addr = 0x30027568size = 0x00000324 .
load section kernel.kspace: addr = 0x30028000size = 0x00004000.
load section kernel.traps: addr = 0x3002c000size = 0x00001000.
load section kernel.utcb_page: addr = 0x3002d000size = 0x00001000.
load section initscript: addr = 0x3002e000size = 0x00001000.
load section hello.text: addr = 0x30030000size = 0x00005bd8.
load section hello.rodata: addr = 0x30035bd8size = 0x00001834.
load section hello.cell_environment: addr = 0x30038000size = 0x00000a24.
not load section elfweaver.notes: addr = 0x00000000size = 0x00000304 .
In SIM_start, Set PC to the address 0x30000000

(skyeye)run
(running)

3)xterm log

Connecting to goosen-desktop:41081
OKL4 - (provider: Open Kernel Labs) built on Feb 20 2010 13:19:25 using gcc vers
ion 3.4.4.
Hello, world!
--- KD# User: L4 Rootserver exit ---
> arch
/arch> cp15dump
Main Id         : 41009200
Cache Type      : 0d172172
----
Control Reg   : c000317b
----
TTBase0         : 30028000
----
FCSE/PID      : 00000000
DACR            : 55555555
D-Fault Sts   : 000000f5
Fault Addr      : 00200004
/arch> prior
> dependgraph
Nodes:

Thread (Thread 'idle_thread' with priority -1)
Thread (Thread 'f0103d20' with priority 255)

Edges:


4)skyeye_s3c2410x.conf

$ cat skyeye_s3c2410x.conf
# skyeye config file for S3C2410x
arch: arm
cpu: arm920t
mach: s3c2410x

# physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x10000000
mem_bank: map=M, type=RW, addr=0x30000000, size=0x08000000

# all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x18000000

# mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020
# net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=0:4:3:2:1:f, ethmod=tuntap,hostip=10.0.0.1
# nandflash: type=s3c2410x,name=K9F1208U0B,dump=./nand.dump
# lcd: type=s3c2410x, mod=gtk
# regfile:r1=193

# dbct:state=on
uart: mod=term

[ 本帖最后由 goosen 于 2010-2-20 16:04 编辑 ]

goosen 发表于 2010-2-20 16:10:35

前后持续了一个星期,从中断/异常处理、再进而怀疑到MMU相关,最后是协处理器 p15 的设置,然后开始检查p15的一些设置,并做实验。

其中有个值得注意的地方是,发觉在某处设置CP15之后,MMU工作不正常(无法通过虚拟地址访问成到物理地址,比如寄存器的设置),PC值为 0xffff0018(IRQ中断),接下来就一直是 0xfff0014(未定义)。

由于串口无法正常工作(能正常就不是问题了)。
前后有利用skyeye提供的log-pc记录pc值,结合objdump 获取到的符号表进行分析。接下,则有在skyeye中加些更为详尽的log,比如对协处理器 p15及特殊寄存器的读写,进而确定了出现异常的较精确的位置。

goosen 发表于 2010-2-20 19:40:06

OKL4 3.0 在 MINI2440 上基本跑起来。接下来的重点则是oklinux。

+---------------------------------------------+
| S3C2440A USB Downloader ver R0.03 2004 Jan|
+---------------------------------------------+
USB: IN_ENDPOINT:1 OUT_ENDPOINT:3
FORMAT: <ADDR(DATA):4>+<SIZE(n+10):4>+<DATA:n>+<CS:2>
NOTE: Power off/on or press the reset button for 1 sec
      in order to get a valid USB device address.

### main_loop entered: bootdelay=2

### main_loop: bootcmd="tftpboot 32000000 image.boot;bootelf 32000000"
Hit any key to stop autoboot:0
Booting Linux ...
dm9000 i/o: 0x20000000, id: 0x90000a46
DM9000: running in 16 bit mode
MAC: 08:00:3e:26:0a:5b
could not establish link
TFTP from server 10.0.0.4; our IP address is 10.0.0.188
Filename 'image.boot'.
Load address: 0x32000000
Loading: #################################################################
       ########
done
Bytes transferred = 373452 (5b2cc hex)
Loading kernel.text @ 0x30000000 (84784 bytes)
Loading kernel.rodata @ 0x30014b30 (33671 bytes)
Loading kernel.kdebug @ 0x3001ceb7 (17013 bytes)
Loading kernel.init @ 0x3002112c (7904 bytes)
Loading kernel.roinit @ 0x3002300c (4 bytes)
Loading kernel.elfweaver_info @ 0x30023010 (104 bytes)
Loading kernel.data @ 0x30023400 (5580 bytes)
Loading kernel.got @ 0x300249cc (4 bytes)
Loading kernel.got.plt @ 0x300249d0 (12 bytes)
Loading kernel.kdebug-data @ 0x300249dc (944 bytes)
Clearing kernel.bss @ 0x30024d8c (11128 bytes)
Loading kernel.kspace @ 0x30028000 (16384 bytes)
Loading kernel.traps @ 0x3002c000 (4096 bytes)
Loading kernel.utcb_page @ 0x3002d000 (4096 bytes)
Loading pingpong.data @ 0x3002e5e4 (332 bytes)
Loading pingpong.got @ 0x3002e730 (16 bytes)
Clearing pingpong.bss @ 0x3002e740 (808 bytes)
Loading initscript @ 0x3002f000 (4096 bytes)
Loading pingpong.text @ 0x30030000 (30404 bytes)
Loading pingpong.rodata @ 0x300376c4 (7968 bytes)
Loading pingpong.cell_environment @ 0x3003a000 (2613 bytes)
## Starting application at 0x30000000 ...
Initialized tracebuffer @ 30140000
Initializing kernel space @ f0024eb8...
Initializing kernel debugger...
Initializing interrupts...
System running with alignment exceptions enabled
Processor Id => 41129200: v4T, ARM920, rev 0
TLB lock: vectors @ ffff0000
TLB lock: utcb @ ff000000
TLB lock: kernel @ f0000000
Locked kernel into TLB
domain pairs: (0, 1)
Initialising scheduler...
Switching to idle thread
CREATE_CLIST: id=0, max_caps=1024
CREATE_SPACE: id=0, space{0:256}, clist{0:256}, mutex{0:256), max_phys_segs=7, utcb_area{0x115000:2^0xc}, max_prio=255 has_kresources 1
CREATE_SEGMENT_LIST: entries=7
ASSIGN IRQ: irq=0x21
ASSIGN IRQ: irq=0x20
CREATE_THREAD: cap_slot=0, priroity=255, ip=0x100000, sp=0x114000, utcb_addr=0x115000
SETUP_SEGMENT: P:0x30700000..0x38000000, rwx:7, attrib:ff
SETUP_SEGMENT: P:0x30030000..0x3003a000, rwx:5, attrib:ff
MAP_MEMORY: V:0x100000 O:0x0 (P=30030000) S:0xa000 N:0x1 A=0x3 R=0x5
SETUP_SEGMENT: P:0x3002e000..0x3002f000, rwx:6, attrib:ff
MAP_MEMORY: V:0x111000 O:0x0 (P=3002e000) S:0x1000 N:0x2 A=0x3 R=0x6
SETUP_SEGMENT: P:0x3003b000..0x3003c000, rwx:6, attrib:ff
MAP_MEMORY: V:0x113000 O:0x0 (P=3003b000) S:0x1000 N:0x3 A=0x3 R=0x6
SETUP_SEGMENT: P:0x50000000..0x50001000, rwx:6, attrib:ff
MAP_MEMORY: V:0x114000 O:0x0 (P=50000000) S:0x1000 N:0x4 A=0x0 R=0x6
SETUP_SEGMENT: P:0x30600000..0x30700000, rwx:6, attrib:ff
MAP_MEMORY: V:0x200000 O:0x0 (P=30600000) S:0x100000 N:0x5 A=0x3 R=0x6
SETUP_SEGMENT: P:0x3003a000..0x3003b000, rwx:6, attrib:ff
MAP_MEMORY: V:0x112000 O:0x0 (P=3003a000) S:0x1000 N:0x6 A=0x3 R=0x6
--- KD# System started (press 'g' to continue)---
> arch
/arch> cp15dump
Main Id         : 41129200
Cache Type      : 0d172172
----
Control Reg   : c000317b
----
TTBase0         : 30028000
----
FCSE/PID      : 00000000
DACR            : 55555555
D-Fault Sts   : 00000025
Fault Addr      : e0001f00
/arch> prior
> go
Ping-Pong will do 100 pings
Ping is alive.
Pong is alive.
Pong is finished. Total pongs: 100
Ping is finished. Total pings: 100
Ping-Pong complete. Exiting...

iampiggy 发表于 2010-3-10 09:57:08

hi goosen!

hi goosen!
您把iamge.boot直接下载到mini2440的内存中运行还是什么以什么方式运行的?下载到0x32000000是吗?
哪里有okl4移植到arm9的资料阿,可以传一份给我吗,谢谢了!email [email protected]

goosen 发表于 2010-3-12 20:35:47

回复 5# iampiggy 的帖子

### main_loop: bootcmd="tftpboot 32000000 image.boot;bootelf 32000000"

下载到0x32000000,用bootelf来运行的。
OKL4-3.0到ARM9的处理器,应该已经是支持的来。目前知道的是支持gta01这个平台(2410,2440也可以)。剩下的,只是大量查阅maillist与论坛。
页: [1]
查看完整版本: skyeye-1.3.0 运行 OKL4 3.0