FreeBSD on Zedboard (Xilinx Zynq-7000)

Thomas Skibo ThomasSkibo at sbcglobal.net
Sat Dec 29 20:43:49 UTC 2012


Hello.

I have been tinkering with this for several weeks:  I booted FreeBSD
on a Zedboard (a low-cost evaluation board for the Xilinx Zynq-7000 SoC).

It was just a matter of coming up with a device tree file, implementing
a UART driver, attaching the generic sdhci driver to the Zynq's SD
hardware, and adding a new CPU id.  I don't have an ethernet driver yet
but I've started on it.

I created an sdhci_fdt driver based on sdhci_pci.c.  It should be
useful for other platforms.  I won't be surprised if somebody points
out there is one already.

One thing that stumped me for a while is that the interrupt controller
driver, gic.c, does not initialize the priority mask register
(GICC_PMR).  The boot-loader left it at zero which masked all
interrupts.  For now, I plug 0xff into it in my initarm_late_init()
function in zynq7_machdep.c.

I'll provide my source soon.  I want to do a few clean-ups of course
and I'll take any feed-back on my naming conventions and how I organized 
the files.

Thanks,

-- 
--------
Thomas Skibo
ThomasSkibo at sbcglobal.net









-------------- next part --------------

zed-boot> tftp 0x100000 kernel.bin
Using zynq_gem device
TFTP from server 192.168.2.10; our IP address is 192.168.2.11
Filename 'kernel.bin'.
Load address: 0x100000
Loading: *#################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################################################
	 #################################
done
Bytes transferred = 2829752 (2b2db8 hex)
zed-boot> go 0x100000
## Starting application at 0x00100000 ...
KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2012 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 10.0-CURRENT #146 r244768M: Sat Dec 29 10:14:43 PST 2012
    root at freebsd:/usr/obj/arm.arm/usr/home/skibo/src/sys/ZEDBOARD arm
Preloaded elf kernel "kernel" at 0xc03cdfd0.
CPU: Cortex A9-r3 rev 0 (Cortex-A core)
 Supported features: ARM_ISA THUMB2 JAZELLE THUMBEE ARMv4 Security_Ext
 WB disabled EABT branch prediction enabled
LoUU:2 LoC:1 LoUIS:2 
Cache level 1: 
 32KB/32B 4-way data cache WB Read-Alloc Write-Alloc
 32KB/32B 4-way instruction cache Read-Alloc
real memory  = 536870912 (512 MB)
Physical memory chunk(s):
0x001000 - 0x0fffff, 1044480 bytes (255 pages)
0x488000 - 0x1f5bbfff, 521355264 bytes (127284 pages)
avail memory = 519708672 (495 MB)
random device not loaded; using insecure entropy
null: <null device, zero device>
openfirm: <Open Firmware control device>
random: <entropy source, Software, Yarrow>
mem: <memory>
fdtbus0: <FDT main bus>
simplebus0: <Flattened device tree simple bus> on fdtbus0
gic0: <ARM Generic Interrupt Controller> mem 0xf8f01000-0xf8f01fff,0xf8f00100-0xf8f001ff on simplebus0
gic0: pn 0x390, arch 0x1, rev 0x2, implementer 0x43b nirqs 96
mp_tmr0: <ARM Generic MPCore Timers> mem 0xf8f00200-0xf8f002ff,0xf8f00600-0xf8f0061f irq 27,29 on simplebus0
Timecounter "ARM MPCore Timecounter" frequency 50000000 Hz quality 1000
Event timer "ARM MPCore Eventtimer" frequency 50000000 Hz quality 1000
l2cache0: <PL310 L2 cache controller> mem 0xf8f02000-0xf8f02fff on simplebus0
  L2 Cache: 512KB/32B 8 ways
simplebus1: <Flattened device tree simple bus> on fdtbus0
uart0: <zynq7_uart> mem 0xe0001000-0xe0001fff irq 82 on simplebus1
uart0: fast interrupt
uart0: console (115200,n,8,1)
sdhci_fdt0: <Zynq-7000 generic fdt SDHCI controller> mem 0xe0100000-0xe0100fff irq 56 on simplebus1
sdhci_fdt0-slot0: 48MHz HS 4bits 3.3V DMA
sdhci_fdt0-slot0: ============== REGISTER DUMP ==============
sdhci_fdt0-slot0: Sys addr: 0x00000000 | Version:  0x00008901
sdhci_fdt0-slot0: Blk size: 0x00000000 | Blk cnt:  0x00000000
sdhci_fdt0-slot0: Argument: 0x00000000 | Trn mode: 0x00000000
sdhci_fdt0-slot0: Present:  0x01ff0000 | Host ctl: 0x00000000
sdhci_fdt0-slot0: Power:    0x00000000 | Blk gap:  0x00000000
sdhci_fdt0-slot0: Wake-up:  0x00000000 | Clock:    0x00000000
sdhci_fdt0-slot0: Timeout:  0x00000000 | Int stat: 0x00000000
sdhci_fdt0-slot0: Int enab: 0x01ff00fb | Sig enab: 0x01ff00fb
sdhci_fdt0-slot0: AC12 err: 0x00000000 | Slot int: 0x00000000
sdhci_fdt0-slot0: Caps:     0x69ef30b0 | Max curr: 0x00000001
sdhci_fdt0-slot0: ===========================================
sdhci_fdt0: 1 slot(s) allocated
mmc0: <MMC/SD bus> on sdhci_fdt0
Timecounters tick every 10.000 msec
tcp_init: net.inet.tcp.tcbhashsize auto tuned to 8192
lo0: bpf attached
sdhci_fdt0-slot0: Divider 128 for freq 187500 (max 48000000)
mmc0: Probing bus
mmc0: SD 2.0 interface conditions: OK
mmc0: SD probe: OK (OCR: 0x00ff8000)
mmc0: Current OCR: 0x00ff8000
mmc0: Probing cards
mmc0: New card detected (CID 02544d53413034470621d53fcb00ab00)
mmc0: New card detected (CSD 400e00325b5900001d6f7f800a400000)
mmc0: Card at relative address 4660 added:
mmc0:  card: SDHC SA04G 0.6 SN 567623627 MFG 11/2010 by 2 TM
mmc0:  bus: 4bit, 50MHz, high speed timing
mmc0:  memory: 7716864 blocks, erase sector 8192 blocks
mmc0: setting transfer rate to 48.000MHz (high speed timing)
sdhci_fdt0-slot0: Divider 0 for freq 48000000 (max 48000000)
mmcsd0: 3768MB <SDHC SA04G 0.6 SN 567623627 MFG 11/2010 by 2 TM> at mmc0 48.0MHz/4bit/65535-block
GEOM: new disk mmcsd0
mmc0: setting bus width to 4 bits
GEOM_PART: partition 1 is not aligned on 4194304 bytes
GEOM_PART: partition 2 is not aligned on 4194304 bytes
GEOM_PART: partition 3 is not aligned on 4194304 bytes
Trying to mount root from ufs:mmcsd0s2 []...
warning: no time-of-day clock registered, system time will not be set accurately
start_init: trying /sbin/init
Setting hostuuid: 9067c94c-514d-11e2-858f-b779e79d1ea7.
Setting hostid: 0x7bb52ebc.
No suitable dump device was found.
Entropy harvesting: interrupts ethernet point_to_pointsha256: /kernel: No such file or directory
 kickstart.
Starting file system checks:
/dev/mmcsd0s2: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/mmcsd0s2: clean, 69012 free (28 frags, 8623 blocks, 0.0% fragmentation)
Mounting local file systems:.
Writing entropy file:.
Setting hostname: zedboard.
Starting Network: lo0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384	options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
	inet 127.0.0.1 netmask 0xff000000 
Starting devd.
Creating and/or trimming log files.
Starting syslogd.
syslogd: timed out waiting for child
/etc/rc: WARNING: failed to start syslogd
realpath: /dev/dumpdev: No such file or directory
/etc/rc: WARNING: Dump device does not exist.  Savecore not run.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
Clearing /tmp (X related).
Updating motd:.
Starting cron.
Starting background file system checks in 60 seconds.

Sat Dec 29 03:51:49 UTC 2012

FreeBSD/arm (zedboard) (ttyu0)

login: root
Dec 29 03:53:03 zedboard login: ROOT LOGIN (root) ON ttyu0
Last login: Sat Dec 29 03:13:12 on ttyu0
FreeBSD 10.0-CURRENT (ZEDBOARD) #146 r244768M: Sat Dec 29 10:14:43 PST 2012

Welcome to FreeBSD!

...[edited]...

root at zedboard:/ # uname -a
FreeBSD zedboard 10.0-CURRENT FreeBSD 10.0-CURRENT #146 r244768M: Sat Dec 29 10:14:43 PST 2012     root at freebsd:/usr/obj/arm.arm/usr/home/skibo/src/sys/ZEDBOARD  arm
root at zedboard:/ # halt
Dec 29 04:07:36 zedboard halt: halted by root
Dec 29 04:07:39 zedboard syslogd: exiting on signal 15
Waiting (max 60 seconds) for system process `vnlru' to stop...done
Waiting (max 60 seconds) for system process `bufdaemon' to stop...done
Waiting (max 60 seconds) for system process `syncer' to stop...
Syncing disks, vnodes remaining...2 1 0 done
Syncing disks, buffers remaining... 6 6 6 6 6 6 6 6 6 6 5 5 5 5 5 5 5 5 5 5 5 5 4 4 4 4 4 4 4 4 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 
Final sync complete
Uptime: 52m51s

The operating system has halted.
Please press any key to reboot.




More information about the freebsd-arm mailing list