qemu emulator for the mini2440

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

qemu emulator for the mini2440

Post by buserror » Mon Feb 23, 2009 3:30 pm

I have done some work to have s3c2440 support into qemu, and have added the support for the mini2440 board. Right now u-boot starts, finds the nand etc, the dm9000 'almost' work (not very reliably) and I can boot the kernel. The kernel seems happy enough to run as if it was on the real hardware!
Still need to flash something on the fake flash and try it more in depth. It's really cool to be able to simulate the whole board like that :D

Code: Select all

[michel@yap /opt/qemu/qemu-trunk.git]% . ./mini2440_start.sh
s3c_gpio_write: Bad register 0xd0


U-Boot 1.3.2-moko12 (Feb  3 2009 - 18:53:41)

I2C:   ready
DRAM:  64 MB
Flash:  2 MB
NAND:  64 MiB
Found Environment offset in OOB..
USB:   S3C2410 USB Deviced
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
MINI2440 # s3c24xx speed get
FCLK = 405 MHz, HCLK = 101 MHz, PCLK = 50 MHz, UCLK = 48 MHz
MINI2440 # printenv
bootcmd=
bootdelay=3
baudrate=115200
ethaddr=08:08:11:18:12:27
ipaddr=10.0.0.111
serverip=10.0.0.4
netmask=255.255.255.0
usbtty=cdc_acm
bootargs_base=rootfstype=jffs2 root=/dev/mtdblock4 console=ttySAC0,115200
mtdids=nand0=mini2440-nand
mtdparts=mtdparts=mini2440-nand:256k@0(u-boot),128k(env),5m(kernel),-(root)
mini2440=4tb
bootargs=root=/dev/mtdblock4 rootfstype=jffs2 console=ttySAC0,115200 mini2440=4tb
partition=nand0,0
mtddevnum=0
mtddevname=u-boot

Environment size: 456/65532 bytes
MINI2440 # bootm
## Booting kernel from Legacy Image at 32000000 ...
   Image Name:
   Created:      2009-02-23   8:28:41 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2474204 Bytes =  2.4 MB
   Load Address: 30008000
   Entry Point:  30008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...

Uncompressing Linux............................................................................................................................................................. done, booting the kernel.
s3c_timers_write: Bad register 0x40
Initializing cgroup subsys cpu
Linux version 2.6.29-rc6-michel (michel@yap) (gcc version 4.2.4) #193 PREEMPT Mon Feb 23 08:28:38 GMT 2009
CPU: ARM920T [41129200] revision 0 (ARMv4T), cr=c0007177
CPU: VIVT data cache, VIVT instruction cache
Machine: MINI2440
Memory policy: ECC disabled, Data cache writeback
CPU S3C2440A (id 0x32440001)
S3C24XX Clocks, (c) 2004 Simtec Electronics
S3C244X: core 405.000 MHz, memory 101.250 MHz, peripheral 50.625 MHz
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 16256
Kernel command line: root=/dev/mtdblock4 rootfstype=jffs2 console=ttySAC0,115200 mini2440=4tb
irq: clearing subpending status 00000002
PID hash table entries: 256 (order: 8, 1024 bytes)
Console: colour dummy device 80x30
console [ttySAC0] enabled
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
allocated 327680 bytes of page_cgroup
please try cgroup_disable=memory option if you don't want
Memory: 64MB = 64MB total
Memory: 59220KB available (4592K code, 574K data, 160K init)
SLUB: Genslabs=12, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Calibrating delay loop... 395.67 BogoMIPS (lpj=989184)
Mount-cache hash table entries: 512
Initializing cgroup subsys ns
Initializing cgroup subsys cpuacct
Initializing cgroup subsys memory
CPU: Testing write buffer coherency: ok
net_namespace: 672 bytes
NET: Registered protocol family 16
MINI2440: Option string mini2440=4tb
MINI2440: LCD 0:240x320 1:800x480 2:1024x768 3:800x600 [4:640x480]
s3c24xx-pwm s3c24xx-pwm.1: tin at 25312500, tdiv at 25312500, tin=divclk, base 8
S3C2440: Initialising architecture
S3C2440: IRQ Support
S3C24XX DMA Driver, (c) 2003-2004,2006 Simtec Electronics
DMA channel 0 at c4808000, irq 33
DMA channel 1 at c4808040, irq 34
DMA channel 2 at c4808080, irq 35
DMA channel 3 at c48080c0, irq 36
S3C244X: Clock Support, DVS off
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
Bluetooth: Core ver 2.14
NET: Registered protocol family 31
Bluetooth: HCI device and connection manager initialized
Bluetooth: HCI socket layer initialized
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 2048 (order: 2, 16384 bytes)
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)
TCP: Hash tables configured (established 2048 bind 2048)
TCP reno registered
NET: Registered protocol family 1
NetWinder Floating Point Emulator V0.97 (extended precision)
audit: initializing netlink socket (disabled)
type=2000 audit(0.315:1): initialized
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
msgmni has been set to 115
alg: No test for stdrng (krng)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
Console: switching to colour frame buffer device 160x80
fb0: s3c2410fb frame buffer device
s3c2440-uart.0: s3c2410_serial0 at MMIO 0x50000000 (irq = 70) is a S3C2440
s3c2440-uart.1: s3c2410_serial1 at MMIO 0x50004000 (irq = 73) is a S3C2440
s3c2440-uart.2: s3c2410_serial2 at MMIO 0x50008000 (irq = 76) is a S3C2440
brd: module loaded
loop: module loaded
nbd: registered device at major 43
tun: Universal TUN/TAP device driver, 1.6
tun: (C) 1999-2004 Max Krasnyansky <maxk@qualcomm.com>
dm9000 Ethernet Driver, V1.31
eth0 (dm9000): not using net_device_ops yet
eth0: dm9000e at c486a300,c486e304 IRQ 51 MAC: 52:54:00:12:34:56 (chip)
Driver 'sd' needs updating - please use bus_type methods
S3C24XX NAND Driver, (c) 2004 Simtec Electronics
s3c2440-nand s3c2440-nand: Tacls=1, 9ns Twrph0=3 29ns, Twrph1=2 19ns
NAND device: Manufacturer ID: 0xec, Chip ID: 0x36 (Samsung NAND 64MiB 1,8V 8-bit)
Scanning device for bad blocks
Creating 4 MTD partitions on "NAND 64MiB 1,8V 8-bit":
0x000000000000-0x000000040000 : "u-boot"
uncorrectable error : <3>uncorrectable error : <5>0x000000040000-0x000000060000 : "u-boot-env"
uncorrectable error : <5>0x000000060000-0x000000560000 : "kernel"
uncorrectable error : <3>uncorrectable error : <5>0x000000560000-0x000004000000 : "root"
uncorrectable error : <3>uncorrectable error : <6>ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
s3c2410-ohci s3c2410-ohci: S3C24XX OHCI
s3c2410-ohci s3c2410-ohci: new USB bus registered, assigned bus number 1
s3c2410-ohci s3c2410-ohci: irq 42, io mem 0x49000000
s3c2410-ohci s3c2410-ohci: init err (00000000 0000)
ohci_hcd: can't start s3c24xx
s3c2410-ohci s3c2410-ohci: startup error -75
s3c2410-ohci s3c2410-ohci: USB bus 1 deregistered
s3c2410-ohci: probe of s3c2410-ohci failed with error -75
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
mice: PS/2 mouse device common for all mice
s3c2440-ts s3c2440-ts: Starting
s3c_adc_write: Bad register 0x8
  Created group ts filter len 12 depth 2 close 10 thresh 6
  Created Median ts filter len 20 depth 2 dec 24
  Created Mean ts filter len 4 depth 2 thresh 65535
  Created Linear ts filter depth 2
s3c2440-ts s3c2440-ts: 4 filter(s) initialized
s3c2440-ts s3c2440-ts: successfully loaded
input: s3c2410 TouchScreen as /devices/virtual/input/input0
S3C24XX RTC, (c) 2004,2006 Simtec Electronics
s3c2410-rtc s3c2410-rtc: rtc disabled, re-enabling
s3c2410-rtc s3c2410-rtc: rtc core: registered s3c as rtc0
i2c /dev entries driver
s3c2440-i2c s3c2440-i2c: slave address 0x10
s3c2440-i2c s3c2440-i2c: bus frequency set to 98 KHz
s3c_i2c_write: Bad register 0x10
s3c2440-i2c s3c2440-i2c: i2c-0: S3C I2C adapter
S3C2410 Watchdog Timer, (c) 2004 Simtec Electronics
s3c2410-wdt s3c2410-wdt: watchdog inactive, reset disabled, irq enabled
Bluetooth: Generic Bluetooth USB driver ver 0.4
usbcore: registered new interface driver btusb
Bluetooth: Generic Bluetooth SDIO driver ver 0.1
cpuidle: using governor ladder
mapped channel 0 to 0
s3c2440-sdi s3c2440-sdi: powered down.
s3c2440-sdi s3c2440-sdi: initialisation done.
s3c2440-sdi s3c2440-sdi: running at 0kHz (requested: 0kHz).
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).
s3c2440-sdi s3c2440-sdi: running at 198kHz (requested: 197kHz).
s3c_mmci_readw: FIFO underrun
Registered led device: led1
Registered led device: led2
Registered led device: led3
Registered led device: led4
usbcore: registered new interface driver hiddev
usbcore: registered new interface driver usbhid
usbhid: v2.6:USB HID core driver
Advanced Linux Sound Architecture Driver Version 1.0.18a.
No device for DAI UDA134X
No device for DAI s3c24xx-i2s
S3C24XX_UDA134X SoC Audio driver
UDA134X SoC Audio Codec
asoc: UDA134X <-> s3c24xx-i2s mapping ok
ALSA device list:
  #0: S3C24XX_UDA134X (UDA134X)
TCP cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
NET: Registered protocol family 15
Bridge firewalling registered
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
registered taskstats version 1
s3c2410-rtc s3c2410-rtc: setting system clock to 2009-02-23 23:21:21 UTC (1235431281)
Root-NFS: No NFS server available, giving up.
VFS: Unable to mount root fs via NFS, trying floppy.
List of all partitions:
1f00             256 mtdblock0 (driver?)
1f01             128 mtdblock1 (driver?)
1f02            5120 mtdblock2 (driver?)
1f03           60032 mtdblock3 (driver?)
No filesystem could mount root, tried:  jffs2
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(2,0)

LeshaK
Posts: 35
Joined: Wed Jan 14, 2009 1:01 am

Re: qemu emulator for the mini2440

Post by LeshaK » Mon Feb 23, 2009 9:58 pm

Great work!
My qq2440 page
Sorry, it's russian, but you can use http://translate.google.com/ (ru > en/...)

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

Re: qemu emulator for the mini2440

Post by buserror » Mon Feb 23, 2009 11:59 pm

LeshaK, maybe at some point we should 'regroup' our codebase into just one; I saw your patch it's pretty neat : I even found the fix for the SD card -110 in there, so well done on that one :D

For qemu I'll wrap it up and post it on a repo.or.cz git tree today hopefully.. It's still a work in progress..

LeshaK
Posts: 35
Joined: Wed Jan 14, 2009 1:01 am

Re: qemu emulator for the mini2440

Post by LeshaK » Tue Feb 24, 2009 6:41 am

I think, to make one patch - very good idea, but I support qq2440 and mini2440 and many of the functions we have implemented in different ways. I studied your patch and interested in your realization of audio, I do not want to spend a lot of time on it.
My qq2440 page
Sorry, it's russian, but you can use http://translate.google.com/ (ru > en/...)

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

Re: qemu emulator for the mini2440

Post by buserror » Tue Feb 24, 2009 7:03 am

Yes we have different ways of doing it. I tried as much as I could to re-study all the datasheets and re-do all the initializations 'properly'. I had find various implementations, all different so I decided to start from scratch using just the schematics and the available documents and no cut/paste/try :D It's a lot of work !

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

Re: qemu emulator for the mini2440

Post by buserror » Tue Feb 24, 2009 7:56 am

I posted the source code tree there : http://repo.or.cz/w/qemu/mini2440.git

You need a u-boot.bin and a binary kernel of course. You can reasonably expect to be able to run a nand image downloaded from the mini2440 via vivi, but I haven't tested it. The network drive tends to lock up fairly rapidly, so don't expect too much :D

scootklein
Posts: 7
Joined: Tue Feb 24, 2009 3:35 pm

Re: qemu emulator for the mini2440

Post by scootklein » Wed Feb 25, 2009 2:28 pm

hi,

could you post that mini2440.sh file you execute above? i haven't used qemu before; however, i did build qemu along with your custom bootloader and custom linx. i just need the command to load up the u-boot.bin and zImage file (and maybe the linux modules?) into qemu for emulation. any help is appreciated.

thanks,
scott klein

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

Re: qemu emulator for the mini2440

Post by buserror » Wed Feb 25, 2009 3:42 pm

Actually it's in the git tree, called "mini2440_start.sh". It tries to load uboot, a kernel, and a flash image... the flash image should be created with :

((64 * 1024 * 1024) / 512) * (512 + 16) = 69206016
64MB divided by 512 (page size) times 512+16 (NAND page size)

dd if=/dev/zero of=mini2440_nand.bin bs=69206016 count=1

I have managed to flash stuff on the nand, and boot the kernel but so far I haven't been able to run from a jffs2 in the nand. As I mentioned it's a work in progress !
I added support for 'steppingstone' the early bootloader from Samsung, and that almost works. I also worked on the DM9000 driver that is currently quite unuseable and found a couple of issues with it -- more to come from there too.. I think this has a lot of potential...

buserror
Posts: 92
Joined: Thu Jan 22, 2009 12:28 am

Re: qemu emulator for the mini2440

Post by buserror » Wed Feb 25, 2009 3:52 pm

Oh and scott, do load a uImage, not a zImage.. qemu will try to load it at 0x32000000 as usual, so you just have to do a 'bootm' to start it -- make sure to set your environmnent, it will be saved in the nand if you do a :
# dynenv set 40000
# saveenv
# reset

You can also play with the nand flash, but if you want to load a jffs2 you will have to edit mini2440.c and load it at the base or the ram so you can 'flash' it (the code is already in there just commented out, I think)

scootklein
Posts: 7
Joined: Tue Feb 24, 2009 3:35 pm

Re: qemu emulator for the mini2440

Post by scootklein » Wed Feb 25, 2009 10:36 pm

I still can't find the shell file to launch qemu. After "git clone" i executed "find ./ -name "*mini2440*sh*"" and it returned nothing. As for the linux image, i did "make uImage" and tried to load up the qemu system. The result may have to do with the start address, but that may be due to using the default qemu bootloader. I checked online and only found the options -kernel and -initrd.

scott@SCOTTKLEINUBUNTU:/share/qemu_test$ qemu-system-arm -kernel /share/git/linux/mini2440/arch/arm/boot/uImage -initrd mini2440_nand.bin
qemu: fatal: Trying to execute code outside RAM or ROM at 0x30008000

R00=00000000 R01=00000113 R02=00000100 R03=00000000
R04=00000000 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00000000 R13=00000000 R14=00000000 R15=30008000
PSR=400001d3 -Z-- A svc32
s00=00000000( 0) s01=00000000( 0) d00=0000000000000000( 0)
s02=00000000( 0) s03=00000000( 0) d01=0000000000000000( 0)
s04=00000000( 0) s05=00000000( 0) d02=0000000000000000( 0)
s06=00000000( 0) s07=00000000( 0) d03=0000000000000000( 0)
s08=00000000( 0) s09=00000000( 0) d04=0000000000000000( 0)
s10=00000000( 0) s11=00000000( 0) d05=0000000000000000( 0)
s12=00000000( 0) s13=00000000( 0) d06=0000000000000000( 0)
s14=00000000( 0) s15=00000000( 0) d07=0000000000000000( 0)
s16=00000000( 0) s17=00000000( 0) d08=0000000000000000( 0)
s18=00000000( 0) s19=00000000( 0) d09=0000000000000000( 0)
s20=00000000( 0) s21=00000000( 0) d10=0000000000000000( 0)
s22=00000000( 0) s23=00000000( 0) d11=0000000000000000( 0)
s24=00000000( 0) s25=00000000( 0) d12=0000000000000000( 0)
s26=00000000( 0) s27=00000000( 0) d13=0000000000000000( 0)
s28=00000000( 0) s29=00000000( 0) d14=0000000000000000( 0)
s30=00000000( 0) s31=00000000( 0) d15=0000000000000000( 0)
FPSCR: 00000000
Aborted

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests