New Horizons









Welcome to my blog

My name is Sven Andersson and I
work as a consultant in embedded
system design, implemented in ASIC
and FPGA.
In my spare time I write this blog
and I hope it will inspire others to
learn more about this fantastic field.
I live in Stockholm Sweden and have
my own company

Contact

You are welcome to contact me
and ask questions or make comments
about my blog.



Content

New Horizons
What's new
Starting a blog
Writing a blog
Using an RSS reader

Zynq Design From Scratch
Started February 2014
1 Introduction
Changes and updates
2 Zynq-7000 All Programmable SoC
3 ZedBoard and other boards
4 Computer platform and VirtualBox
5 Installing Ubuntu
6 Fixing Ubuntu
7 Installing Vivado
8 Starting Vivado
9 Using Vivado
10 Lab 1. Create a Zynq project
11 Lab 1. Build a hardware platform
12 Lab 1. Create a software application
13 Lab 1. Connect to ZedBoard
14 Lab 1. Run a software application
15 Lab 1. Benchmarking ARM Cortex-A9
16 Lab 2. Adding a GPIO peripheral
17 Lab 2. Create a custom HDL module
18 Lab 2. Connect package pins and implement
19 Lab 2. Create a software application and configure the PL
20 Lab 2. Debugging a software application
21 Running Linux from SD card
22 Installing PetaLinux
23 Booting PetaLinux
24 Connect to ZedBoad via ethernet
25 Rebuilding the PetaLinux kernel image
26 Running a DHCP server on the host
27 Running a TFTP server on the host
28 PetaLinux boot via U-boot
29 PetaLinux application development
30 Fixing the host computer
31 Running NFS servers
32 VirtualBox seamless mode
33 Mounting guest file system using sshfs
34 PetaLinux. Setting up a web server
35 PetaLinux. Using cgi scripts
36 PetaLinux. Web enabled application
37 Convert from VirtualBox to VMware
38 Running Linaro Ubuntu on ZedBoard
39 Running Android on ZedBoard
40 Lab2. Booting from SD card and SPI flash
41 Lab2. PetaLinux board bringup
42 Lab2. Writing userspace IO device driver
43 Lab2. Hardware debugging
44 MicroZed quick start
45 Installing Vivado 2014.1
46 Lab3. Adding push buttons to our Zynq system
47 Lab3. Adding an interrupt service routine
48 Installing Ubuntu 14.04
49 Installing Vivado and Petalinux 2014.2
50 Using Vivado 2014.2
51 Upgrading to Ubuntu 14.04
52 Using Petalinux 2014.2
53 Booting from SD card and SPI flash
54 Booting Petalinux 2014.2 from SD card
55 Booting Petalinux 2014.2 from SPI flash
56 Installing Vivado 2014.3

Chipotle Verification System
Introduction

EE Times Retrospective Series
It all started more than 40 years ago
My first job as an electrical engineer
The Memory (R)evolution
The Microprocessor (R)evolution

Four soft-core processors
Started January 2012
Introduction
Table of contents
Leon3
MicroBlaze
OpenRISC 1200
Nios II

Using the Spartan-6 LX9 MicroBoard
Started August 2011
Introduction
Table of contents
Problems, fixes and solutions

FPGA Design From Scratch
Started December 2006
Introduction
Table of contents
Index
Acronyms and abbreviations

Actel FPGA design
Designing with an Actel FPGA. Part 1
Designing with an Actel FPGA. Part 2
Designing with an Actel FPGA. Part 3
Designing with an Actel FPGA. Part 4
Designing with an Actel FPGA. Part 5

CAD
A hardware designer's best friend
Zoo Design Platform

Linux
Installing Cobra Command Tool
A processor benchmark

Mac
Porting a Unix program to Mac OS X
Fixing a HyperTerminal in Mac OS X
A dream come true

Bicycling
Stockholm by bike

Running
The New York City Marathon

Skiing/Skating
Kittelfjall Lappland

Tour skating in Sweden and around the world
Top
Introduction
SSSK
Wild skating
Tour day
Safety equipment
A look at the equipment you need
Skate maintenance
Links
Books, photos, films and videos
Weather forecasts

Travel
38000 feet above see level
A trip to Spain
Florida the sunshine state

Photo Albums
Seaside Florida
Ronda Spain
Sevilla Spain
Cordoba Spain
Alhambra Spain
KittelfjÀll Lapland
Landsort Art Walk
Skating on thin ice

Books
100 Power Tips for FPGA Designers

Favorites
Adventures in ASIC
ChipHit
Computer History Museum
DeepChip
Design & Reuse
Dilbert
d9 Tech Blog
EDA Cafe
EDA DesignLine
Eli's tech Blog
Embedded.com
EmbeddedRelated.com
FPGA Arcade
FPGA Blog
FPGA Central
FPGA CPU News
FPGA developer
FPGA Journal
FPGA World
Lesley Shannon Courses
Mac 2 Ubuntu
Programmable Logic DesignLine
OpenCores
Simplehelp
SOCcentral
World of ASIC



If you want to be updated on this weblog Enter your email here:



rss feed



 
Wednesday, October 03, 2007
FPGA design from scratch. Part 46
Installing and running the Linux OS

Now when we have updated our hardware to meet all software requirements it is time to install and bootup the Linux kernel we finished in
part 43. Let's go through the following steps:
  1. Connect everything (see part 29)
  2. Generate a new netlist (Hardware->Generate Netlist)
  3. Generate a new bitstream (Hardware->Generate Bitstream)
  4. Download the bitstream (Device Configuration->Download Bitstream)
Disassembly of the Linux kernel

We use the following command to generate an assembly listing of the Linux kernel code: mb-obdump -d /tftpboot/image.elf > kernel.asm

Here is the start.

44000000 <_start>:
44000000:    94208001     mfs    r1, rmsr
44000004:    a421fffd     andi    r1, r1, -3
44000008:    9401c001     mts    rmsr, r1
4400000c:    b000441f     imm    17439
44000010:    31a0c000     addik    r13, r0, -16384    // 441fc000 <__init_begin>
44000014:    b000441e     imm    17438
44000018:    30408000     addik    r2, r0, -32768    // 441e8000 <_sdata>
4400001c:    b000441f     imm    17439
44000020:    3020bffc     addik    r1, r0, -16388
44000024:    b000441e     imm    17438
44000028:    33e082a8     addik    r31, r0, -32088    // 441e82a8 <init_task>
4400002c:    b0004400     imm    17408
44000030:    30c00c84     addik    r6, r0, 3204    // 44000c84 <machine_early_init>
44000034:    99fc3000     brald    r15, r6
44000038:    80000000     or    r0, r0, r0
4400003c:    b0004400     imm    17408
44000040:    31e00f68     addik    r15, r0, 3944    // 44000f68 <machine_halt>

and here is the end.

4421162c <cleanup_sunrpc>:
4421162c:    3021ffe4     addik    r1, r1, -28
44211630:    f9e10000     swi    r15, r1, 0
44211634:    b000fff8     imm    -8
44211638:    b9f4e828     brlid    r15, -6104    // 4419fe60 <cleanup_socket_xprt>
4421163c:    80000000     or    r0, r0, r0
44211640:    b000fff9     imm    -7
44211644:    b9f4ecc4     brlid    r15, -4924    // 441b0308 <unregister_rpc_pipefs>
44211648:    80000000     or    r0, r0, r0
4421164c:    b000fff9     imm    -7
44211650:    b9f4053c     brlid    r15, 1340    // 441a1b8c <rpc_destroy_mempool>
44211654:    80000000     or    r0, r0, r0
44211658:    b000441f     imm    17439
4421165c:    30a078d4     addik    r5, r0, 30932    // 441f78d4 <ip_map_cache>
44211660:    b000fff9     imm    -7
44211664:    b9f4bc30     brlid    r15, -17360    // 441ad294 <cache_unregister>
44211668:    80000000     or    r0, r0, r0
4421166c:    b000441d     imm    17437
44211670:    30a006a8     addik    r5, r0, 1704
44211674:    bc230028     bnei    r3, 40        // 4421169c
44211678:    b000fff9     imm    -7
4421167c:    b9f4f8a0     brlid    r15, -1888    // 441b0f1c <rpc_unregister_sysctl>
44211680:    80000000     or    r0, r0, r0
44211684:    b000fff9     imm    -7
44211688:    b9f4f7b8     brlid    r15, -2120    // 441b0e40 <rpc_proc_exit>
4421168c:    80000000     or    r0, r0, r0
44211690:    e9e10000     lwi    r15, r1, 0
44211694:    b60f0008     rtsd    r15, 8
44211698:    3021001c     addik    r1, r1, 28
4421169c:    b000ffdf     imm    -33
442116a0:    b9f49504     brlid    r15, -27388    // 4400aba4 <printk>
442116a4:    80000000     or    r0, r0, r0
442116a8:    b800ffd0     bri    -48        // 44211678
Disassembly of section .init.ivt:

44211e50 <__ivt_start>:
44211e50:    b0004400 b80821b0 b0004400 b80821c0     ..D...!...D...!.
44211e60:    b0004400 b8081fa0 b0004400 b8082450     ..D.......D...$P
44211e70:    b0004400 b80839f0 00000000 00000000     ..D...9.........
    ...
44211eb0:    b0004400 b8082320                       ..D...#


Download the Linux kernel

We will use the
Xilinx Microprosser Debugger (XMD) to help us download the image file.

-
> xmd

Xilinx Microprocessor Debug (XMD) Engine
Xilinx EDK 9.1.02 Build EDK_J_SP2.4
Copyright (c) 1995-2006 Xilinx, Inc.  All rights reserved.

XMD% connect mb mdm

.....
......

JTAG chain configuration
--------------------------------------------------
Device   ID Code        IR Length    Part Name
 1       0a001093           8        System_ACE
 2       05059093          16        XCF32P
 3       01e58093          10        XC4VFX12
 4       09608093           8        xc95144xl

MicroBlaze Processor Configuration :
-------------------------------------
Version............................6.00.b
No of PC Breakpoints...............2
No of Read Addr/Data Watchpoints...0
No of Write Addr/Data Watchpoints..0
Instruction Cache Support..........off
Data Cache Support.................off
Exceptions  Support................off
FPU  Support.......................off
Hard Divider Support...............off
Hard Multiplier Support............on - (Mul32)
Barrel Shifter Support.............off
MSR clr/set Instruction Support....on
Compare Instruction Support........on

Connected to MDM UART Target
Connected to "mb" target. id = 0
Starting GDB server for "mb" target (id = 0) at TCP port no 1234

XMD% dow -data /tftpboot/image.bin 0x44000000

This command will download the Linux kernel image to the SDRAM starting at address 0x44000000

Let's read the first and last memory locations to find out if the download was successful.

XMD% mrd 0x44000000
mrd 0x44000000
44000000:   94208001

XMD% mrd 0x44211EB0
mrd 0x44211eb0
44211EB0:   B0004400

To start the Linux bootup sequence we use the following command:

XMD% con 0x44000000
con 0x44000000
Info:Processor started. Type "stop" to stop processor

RUNNING> XMD% stop
stop
XMD% Info:User Interrupt, Processor Stopped at 0x440044c8

We are having a problem here. It seems like the bootup sequence hangs and never finishes. This is what the code looks like around address
0x440044c8:

440044c4 <early_printk_putc>:
440044c4:    90a50060     sext8   r5, r5
440044c8:    b000a000     imm     -24576
440044cc:    e8600008     lwi     r3, r0, 8
440044d0:    a4630008     andi    r3, r3, 8
440044d4:    be23fff4     bneid   r3, -12        // 440044c8
440044d8:    a46500ff     andi    r3, r5, 255
440044dc:    b000a000     imm     -24576
440044e0:    f8600004     swi     r3, r0, 4
440044e4:    b60f0008     rtsd    r15, 8
440044e8:    80000000     or      r0, r0, r0

Let's set a breakpoint at address 0x440044c4 and start from the beginning.

XMD% bps 0x440044c4
bps 0x440044c4
Setting breakpoint at 0x440044c4

XMD% con 0x44000000
c
on 0x44000000
Info:Processor started. Type "stop" to stop processor

RUNNING> XMD% Info:Software Breakpoint 0 Hit, Processor Stopped at 0x440044c4

Let's single step and see what happens.

XMD% stp
stp
440044C8:   B000A000  imm      -24576

XMD% stp
stp
440044D0:   A4630008  andi     r3 , r3 , 8

XMD% stp
stp
440044D4:   BE23FFF4  bneid    r3 , -12

XMD% stp
stp
440044C8:   B000A000  imm      -24576

XMD% stp
stp
440044D0:   A4630008  andi     r3 , r3 , 8

XMD% stp
stp
440044D4:   BE23FFF4  bneid    r3 , -12


We are caught in this loop. Here are the register values:

XMD% rr
rr
    r0: 00000000      r8: 00000000     r16: 440044c4     r24: 00000000 
    r1: 441fbd94      r9: 00000000     r17: 00000000     r25: 00000000 
    r2: 441e8000     r10: 00000008     r18: ffffffda     r26: 00000000 
    r3: 00000046     r11: ffffffff     r19: 441fbdd4     r27: 00000000 
    r4: 441e8ee0     r12: 0000002d     r20: 00000000     r28: 00000000 
    r5: 00000046     r13: 441fc000     r21: 00000000     r29: 00000000 
    r6: 441fbdd4     r14: 00000000     r22: 00000024     r30: 00000000 
    r7: 00000026     r15: 44004514     r23: 00000046     r31: 441e82a8 
    pc: 440044c8     msr: 00000000
XMD%

I am building a new kernel. See part 43.


Top Next  Previous



Posted at 15:37 by

 

Leave a Comment:

Name


Homepage (optional)


Comments




Previous Entry Home Next Entry