[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [microblaze-uclinux] Building uClinux for Insight/Memec S3MB1500 board
Marco, thanks for the confirmation. Below are some verbose notes on how
I got the uClinux kernel running on the Insight/Memec S3MB1500
development board. I hope it may be useful to other people starting
completely from scratch with both Xilinx MicroBlaze and uClinux.
Prior to a few days ago I've never touched an FPGA or uClinux before,
but I have 20 years of application software development experience on
Windows, Linux and FreeBSD. I was given an Insight/Memec S3MB1500 board
and the Xilinx ISE and EDK version 7.1 and needed to get a reasonable
development environment running on it fast as possible.
Choosing uClinux for this board was right for me because it's free,
stable and I hope similar to standard Linux and BSD environments I've
worked with in the past. I don't yet know the implication of the no-MMU
part, but I'll worry about that down the road.
I read over information on the MicroBlaze uCLinux Project Home Page at
http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux/ but I didn't have
enough of an understanding to the hardware and software environment to
make much sense of it. I saw references to mbvanilla and some to a
"new" uClinux-auto platform. Once again, it didn't make make sense to
me at the time.
As it turns out, it seems mbvanilla was the original porting mechanism
for uClinux to the MicroBlaze platform. Basically, one had to customize
the uClinux kernel to the specific hardware information in the
system.mhs file created/used by the Xilinx EDK. This apparently
involved a lot of tedious hunting down and editing of parameters spread
across the kernel sources. As an alternative to this, the uClinux-auto
platform takes a single file output from the Xilinx EDK and configures
the kernel information for a hardware platform. More specific
information is found in the uClinux_auto platform
(uClinux_auto_6_30_b.zip) README file. Because I have the Insight/Memec
S3MB1500 development board I went straight for it's download
(s3mb1000_uclinux_EDK63a.zip) which explains none of this. Not having
this bit of information caused me to be stuck for several hours figuring
stuff out.
I'm still very new to all of this and may get some terminology wrong,
but the following is what I did to get uClinux running on the
Insight/Memec S3MB1500.
First, I installed the Xilinx ISE and EDK software and service packs.
I'm using version 7.1 of the Xilinx tools on Windows XP. I don't know a
whole lot about these tools, but a friend helped me get far enough to
get the MicroBlaze "Hello World" application going on the Insight/Memec
S3MB1500 development board. This demonstrated I had at least the
basics in terms of software and hardware going.
Next I downloaded the "uClinux BSP Package" edk_user_repository.zip from
the MicroBlaze uCLinux Web Site and uncompressed this to the
C:\edk_user_repository directory on my system. Next, I downloaded the
S3MB1500 project s3mb1000_uclinux_EDK63a.zip from the MicroBlaze uCLinux
Web Site and uncompressed it as a projects folder for the Xilinx
Platform Studio to load. These files can all be found at the following URL:
http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux/Downloads/platforms.html
I started up the Xilinx Platform Studio and opened the 'system.xmp'
project file within the s3mb1000_uclinux_EDK63a project directory. This
is a EDK 6.1 project, but it automatically converted fine to an EDK 7.1
project. It had some trouble finding the uClinux BSP package files in
the C:\edk_user_repository, but this can be resolved in by setting the
directory in the Options->Project Options->Device and Repository dialog
to set the Peripheral Repository Directory.
I then did a Tools->Clean->All to make sure the project was clean and
then did Tools->Download to build everything and download the assembled
bitstream to the development board. This took 30 to 45 minutes on my
system. Once completed, I then used Hyperterminal to connect to the
S3MB1500 serial port at 115K baud, 8 bits, no parity and no hardware
handshaking and saw the following loop endlessly:
==============================================================
bootling uClinux...
Copying kernel image...done
==============================================================
This indicates the uClinux bootloader is running on the MicroBlaze.
However, because the uClinux kernel is not loaded into Flash it just
loops continuously.
To load the kernel, I used the dl.sh script in the
s3mb1000_uclinux_EDK63a project directory. This should be called from
the Xilinx Cygwin Shell which can be found in the start menu with the
other EDK tools.
==============================================================
Mike@HUEY ~
$ pwd
/cygdrive/c/Documents and Settings/Mike
Mike@HUEY ~
$ cd /cygdrive/c/Xilinx/projects/s3mb1000_uclinux_EDK63a/
Mike@HUEY /cygdrive/c/Xilinx/projects/s3mb1000_uclinux_EDK63a
$ ./dl.sh image.bin
==============================================================
The dl.sh script calls the xmd (a debugger I think) to load the
image.bin (uClinux kernel file) into DDR memory on the development board
and then execute it.
Unfortunately, the image.bin (the uClinux kernel) did not work for me.
It looks like the kernel would start to come up, but it got stuck
somewhere. Therefore, my next step was get a working kernel.
OK, I don't have a Linux system and didn't want try to get things
compiled under Cygwin. However, VMWare has made it's "VMware Server
Beta" available for free and they have pre-build virtual appliance
images you anyone to download and run. I installed VMware Server Beta
on my Windows XP system and chose the Ubuntu Linux virtual appliance.
This pretty gave me an instant Linux system running on my Windows XP
system. I won't go into the hairy details, but you will need to load
additional Ubuntu packages to compile the uClinux kernel under Ubuntu
Linux. The CVS package, zlib development package, make package and gcc
packages come to mind as extra things I had to add to the plain vanilla
Ubuntu system. VMWare Server and the virtual appliance image can all be
downloaded from the www.vmware.com website.
Next came getting the MicroBlaze cross compilation toolchain and the
uClinux kernel and distribution source on the Ubuntu Linux system. For
this, I basically followed the directions on the MicroBlaze uCLinux
Project at the following URLs:
http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux/Documentation/toolchains.html
http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux/Documentation/obtaining_sources.html
Make sure the symbolic link in uClinux-dist to the uClinux-2.4.x
directory is created is described in the directions.
On my Ubuntu Linux system I ended up with the following directories:
~/microblaze/microblaze-elf-tools
~/microblaze/uClinux-2.4.x
~/microblaze/uClinux-dist
Now, here comes the tricky part that took me a bit to figure out.
Before you configure and compile the kernel, you need to get the
auto-config.in built by the EDK. On my system, I got the file from the
following directory under the s3mb1000_uclinux_EDK63a project:
C:\Xilinx\projects\s3mb1000_uclinux_EDK63a\microblaze_0\libsrc\uclinux_v1_00_a
The auto-config.in file needs to be converted to have Unix style eol
characters (the default DOS eol characters cause problems) and copied to
the Ubuntu Linux system. The UltraEdit editor took care of this
conversion for me, but there are other ways of doing this too. The
virtual Ubuntu Linux system was able to access the "Shared Documents"
folder on my Windows XP system and this is how I got files cross between
the two environments.
The auto-config.in is copied to the following directory on the Ubuntu
Linux system:
~/microblaze/uClinux-dist/linux-2.4.x/arch/microblaze/platform
From the ~/microblaze/uClinux-dist I then did the following:
==============================================================
$ make clean
$ make menuconfig
==============================================================
Select "Vendor/Product Selection --->" and choose Xilinx as the vendor
and uclinux-auto as the Xilinx Products. Then Exit.
Select "Kernel/Library/Defaults Selection --->" and choose uClibc as the
Libc Version and check "Default all settings (lose changes)". Then Exit.
Then Exit again to leave the menuconfig. The configuration process will
then start. It asked me about three questions which I hit Return for
the default setting.
Then I did the following:
==============================================================
$ make dep
$ make all
==============================================================
The entire kernel was built and I ended up with an "image.bin" file in
the ~/microblaze/uClinux-dist/images directory. It is the "image.bin"
file I then transfered back to my Windows XP environment, again using
the "Shared Documents" folder and finally copying the file into my
s3mb1000_uclinux_EDK63a folder.
From within the Xilinx Platform Studio I then downloaded the bitstream
again to get the following showing up in HyperTerminal.
==============================================================
bootling uClinux...
Copying kernel image...done
==============================================================
Then, from the Xilinx Cygwin Shell I used the dl.sh script in the
s3mb1000_uclinux_EDK63a project directory to load the uClinux kernel
into memory. You should see something like the following:
==============================================================
Mike@HUEY ~
$ pwd
/cygdrive/c/Documents and Settings/Mike
Mike@HUEY ~
$ cd /cygdrive/c/Xilinx/projects/s3mb1000_uclinux_EDK63a/
Mike@HUEY /cygdrive/c/Xilinx/projects/s3mb1000_uclinux_EDK63a
$ ./dl.sh image.bin
Kimage is image.bin
Kparams are
Xilinx Microprocessor Debug (XMD) Engine
Xilinx EDK 7.1.2 Build EDK_H.12.5.1
Copyright (c) 1995-2005 Xilinx, Inc. All rights reserved.
XMD%
Loading MHS File..
WARNING:Portability:111 - Message file "EDK.msg" wasn't found.
Processor(s) in System ::
Microblaze(1) : microblaze_0
Address Map for Processor microblaze_0
(0x00000000-0x00003fff) dlmb_cntlr dlmb
(0x00000000-0x00003fff) ilmb_cntlr ilmb
(0x84000000-0x8400ffff) opb_timer_1 mb_opb
(0x84010000-0x8401ffff) opb_intc_0 mb_opb
(0x84020000-0x8402ffff) debug_module mb_opb
(0x84030000-0x8403ffff) USB_UART mb_opb
(0x84040000-0x8404ffff) RS232 mb_opb
(0x84050000-0x8405ffff) Push_Buttons_2Bit mb_opb
(0x84060000-0x8406ffff) LEDs_4Bit mb_opb
(0x84070000-0x8407ffff) LED_7Segment2 mb_opb
(0x84080000-0x8408ffff) LED_7Segment1 mb_opb
(0x84090000-0x8409ffff) FLASH_READY mb_opb
(0x840a0000-0x840affff) FLASH_2Mx16 mb_opb
(0x840b0000-0x840bffff) Ethernet_MAC mb_opb
(0x840c0000-0x840cffff) DIP_Switches_8Bit mb_opb
(0x84400000-0x847fffff) FLASH_2Mx16 mb_opb
(0x86000000-0x87ffffff) DDR_SDRAM_16Mx16 mb_opb
Connecting to cable (Parallel Port - LPT1).
Checking cable driver.
Driver windrvr6.sys version = 7.0.1.0. LPT base address = 0378h.
ECP base address = 0778h.
ECP hardware is detected.
Cable connection established.
Connecting to cable (Parallel Port - LPT1) in ECP mode.
Checking cable driver.
Driver xpc4drvr.sys version = 1.0.4.0. LPT base address = 0378h.
Cable Type = 1, Revision = 3.
Setting cable speed to 5 MHz.
Cable connection established.
JTAG chain configuration
--------------------------------------------------
Device ID Code IR Length Part Name
1 05046093 8 XCF04S
2 05044093 8 XCF01S
3 01434093 6 XC3S1500
Assuming, Device No: 3 contains the MicroBlaze system
Connected to the JTAG MicroProcessor Debug Module (MDM)
No of processors = 1
MicroBlaze Processor 1 Configuration :
-------------------------------------
Version............................3.00.a
No of PC Breakpoints...............2
No of Read Addr/Data Watchpoints...1
No of Write Addr/Data Watchpoints..1
Instruction Cache Support..........on
Instruction Cache Base Address.....0x86000000
Instruction Cache High Address.....0x87ffffff
Data Cache Support.................on
Data Cache Base Address............0x86000000
Data Cache High Address............0x87ffffff
MBsfsl(0)-MDMmfsl(0) Connected..........Yes
JTAG MDM Connected to MicroBlaze 1
Connected to MicroBlaze "mdm" target. id = 0
Starting GDB server for "mdm" target (id = 0) at TCP port no 1234
Note:: "mbconnect" command is Deprecated. Use "connect mb" command
Setting current target to target id 0
List of connected targets
Target ID Target Type
------------------------------
0 MicroBlaze MDM-based (hw) Target *
XMD% INFO:MDT - MHS File already loaded
XMD%
Processor (1) Already Connected
XMD% Downloading kernel image...
XMD% This will only take a few seconds!
XMD% XMD% setting kernel command line
XMD%
XMD% "cmdline is "
XMD% 2
XMD% 0x100
XMD% > > > > XMD% XMD% XMD% XMD% Processor started. Type "stop" to stop
processo
r
RUNNING> Done already WOW!
RUNNING> Closing MDM communication with Processor 1
==============================================================
In the HyperTerminal window I then saw the uClinux Kernel boot up and I
could login with the username root and the password root as shown below:
==============================================================
Copying kernel image...done
Linux version 2.4.32-uc0 (ubuntu@ubuntu) (gcc version 3.4.1 ( Xilinx EDK
8.1 Bui
ld EDK_I.17 121005 )) #11 Tue Mar 21 08:16:29 GMT 2006
On node 0 totalpages: 8192
zone(0): 8192 pages.
zone(1): 0 pages.
zone(2): 0 pages.
CPU: MICROBLAZE
Kernel command line:
Console: xmbserial on UART
Calibrating delay loop... 37.06 BogoMIPS
Memory: 32MB = 32MB total
Memory: 30256KB available (1091K code, 1057K data, 48K init)
Dentry cache hash table entries: 4096 (order: 3, 32768 bytes)
Inode cache hash table entries: 2048 (order: 2, 16384 bytes)
Mount cache hash table entries: 512 (order: 0, 4096 bytes)
Buffer cache hash table entries: 1024 (order: 0, 4096 bytes)
Page-cache hash table entries: 8192 (order: 3, 32768 bytes)
POSIX conformance testing by UNIFIX
Linux NET4.0 for Linux 2.4
Based upon Swansea University Computer Society NET3.039
Initializing RT netlink socket
Microblaze UARTlite serial driver version 1.00
ttyS0 at 0x84040000 (irq = 2) is a Microblaze UARTlite
ttyS1 at 0x84030000 (irq = 3) is a Microblaze UARTlite
Starting kswapd
xgpio #0 at 0x84060000 mapped to 0x84060000
xgpio #1 at 0x84080000 mapped to 0x84080000
xgpio #2 at 0x84070000 mapped to 0x84070000
xgpio #3 at 0x84050000 mapped to 0x84050000
xgpio #4 at 0x840C0000 mapped to 0x840C0000
xgpio #5 at 0x84090000 mapped to 0x840
Xilinx GPIO registered
RAMDISK driver initialized: 16 RAM disks of 4096K size 1024 blocksize
eth0: using fifo mode.
eth0: Xilinx EMAC #0 at 0x840B0000 mapped to 0x840B0000, irq=1
eth0: id 2.0h; block id 7, type 1
MicroBlaze auto-config flash probe(0x84400000,8388608,4): 800000 at 84400000
CFI: Found no Flash device at location zero
Search for id:(02 06) interleave(2) type(2)
Search for id:(02 06) interleave(2) type(2)
Search for id:(02 06) interleave(2) type(2)
Search for id:(02 02) interleave(2) type(1)
Search for id:(02 02) interleave(2) type(1)
Search for id:(02 02) interleave(2) type(1)
Search for id:(02 0a) interleave(4) type(2)
Search for id:(02 0a) interleave(4) type(2)
Search for id:(02 0a) interleave(4) type(2)
Search for id:(02 06) interleave(4) type(1)
Search for id:(02 06) interleave(4) type(1)
Search for id:(02 06) interleave(4) type(1)
JEDEC: Found no Flash device at location zero
MicroBlaze auto-config ram probe(0x861490b0,856064,4): d1000 at 861490b0
Creating 1 MTD partitions on "RAM":
0x00000000-0x000d1000 : "Romfs"
NET4: Linux TCP/IP 1.0 for NET4.0
IP Protocols: ICMP, UDP, TCP
IP: routing cache hash table of 512 buckets, 4Kbytes
TCP: Hash tables configured (established 2048 bind 4096)
NET4: Unix domain sockets 1.0/SMP for Linux NET4.0.
VFS: Mounted root (romfs filesystem) readonly.
Freeing init memory: 48K
Mounting proc:
Mounting var:
Populating /var:
Running local start scripts.
Mounting /etc/config:
Populating /etc/config:
flatfsd: Nonexistent or bad flatfs (-48), creating new one...
flatfsd: Failed to write flatfs (-48): No such device
flatfsd: Created 3 configuration files (142 bytes)
Setting hostname:
Setting up interface lo:
Starting DHCP client:
Starting thttpd:
eth0: Link carrier lost.
uclinux-auto login: root
Password:
# ls
bin dev etc home lib mnt proc sbin tmp usr var
# ps
PID PORT STAT SIZE SHARED %CPU COMMAND
1 S 139K 0K 2.1 /sbin/init
2 S 0K 0K 0.0 keventd
3 R 0K 0K 0.0 ksoftirqd_CPU0
4 S 0K 0K 0.0 kswapd
5 S 0K 0K 0.0 bdflush
6 S 0K 0K 0.0 kupdated
7 S 0K 0K 1.6 mtdblockd
33 S 133K 0K 1.2 /bin/dhcpcd
37 S 151K 0K 1.6 thttpd -c *.cgi
39 S0 S 134K 0K 2.9 -sh
40 S 133K 0K 1.2 /bin/flatfsd
42 S0 R 71K 0K 0.0 ps
#
==============================================================
OK, so that is the long story of how I got a functioning uCLinux kernel
running on my Insight/Memec S3MB1500 development board. None of this
was obvious to me when I first started and I spent several hours
scratching my head getting past some areas. I hope that these long
notes will be useful to someone else down the road.
Mike Thompson
___________________________
microblaze-uclinux mailing list
microblaze-uclinux@xxxxxxxxxxxxxx
Project Home Page : http://www.itee.uq.edu.au/~jwilliams/mblaze-uclinux
Mailing List Archive : http://www.itee.uq.edu.au/~listarch/microblaze-uclinux/