PetaLinux Platform From Scratch

Objectives

The goal of tutorial is to create a new PetaLinux ready MicroBlaze design from scratch and building a PetaLinux kernel image. This documentation uses ML401 development board as example, but is broadly applicable to any BSB-supported development board.

PetaLinux on MicroBlaze Hardware Platform Requirements

The minimum requirements to build a PetaLinux ready hardware platform are

  1. MicroBlaze soft core processor
  2. Timer
  3. Interrupt controller
  4. Standard input and output devices
  5. External memory controller
    1. ROM – not volatile data (optional ) such as Flash memory
    2. RAM – accessible data section such as home dir, an example of this is DDR-SDRAM

If you wish to use XMD to download the PetaLinux solution images, you need to have Microprocessor Debug Module enabled to use of JTAG for downloading uClinux into the board. The download link can be either use FSL (allows faster download speed) or debug interface via OPB bus.

Note: Without a Flash memory device, you are required to download the kernel image every time you power up the hardware.

Hardware Overview

The hardware platform consist of followings

  • MicroBlaze with I/D Cache
  • 8K of BRAM - used for First Stage Bootloader
  • Timer
  • Interrupt Controller
  • EMC for DDR-SDRAM
  • EMC for Flash
  • Ethernet – Networking support
  • UART – standard input/output devices
  • MDM – used for debugging

Certain core and software parameters must be set correctly in order to build a successful MicroBlaze-PetaLinux hardware design.

This section provides a step by step guide to setting up the PetaLinux environment and a PetaLinux ready hardware design on ML401 development board.

System Setup

This section provides a step by step guide to setting up the PetaLinux environment and the ML401 development board.

System Requirements

It is expected that PetaLinux development will be performed on a "workstation-class" PC. Minimum recommended specifications are:

  • PENTIUM4 2GHz CPU clock or equivalent
  • 1 Gbyte RAM
  • 5 Gbyte of free HDD space

Smaller memory, or slower CPUs can be used, however time to build a complete PetaLinux system will be negatively impacted.

The following external peripheral support is also required on the host machine.

  • A serial port (or USB-serial dongle) for terminal display
  • A Network connection between development board and host computer
  • A Xilinx-supported JTAG configuration solution (only one of the following is required need?)
    • A spare serial port for Xilinx Platform Cable III
    • A parallel port for Xilinx Platform Cable IV
    • A spare usb port for Xilinx USB Platform Cable IV

Environment Setup

Host Machine

The following must be installed on the development machine.

  • Xilinx EDK/ISE tools with the latest service packs
  • TFTP server service
  • RedHat Enterprise Linux 3 and clones - VMWare / CoLinux? OK

Note: For installing Xilinx's EDK 8.1 and ISE 8.1 tools with latest service packs, follow the instructions as per provided in the Xilinx's EDK8.1 Getting Started Guide.

Install PetaLinux

Refer to the PetaLinux Installation Guide for details.

Run PetaLinux Setup Script

Before using PetaLinux, it is required to run the settings.sh or settings.csh script to set up the appropriate environment variables. This sets up the path and the PETALINUX variable, so the build system knows where everything is located.

$ cd petalinux 
$ source ./settings.sh 

Note use the appropriate script for your shell environment.

Adding your Custom Platform to PetaLinux

There are 2 main tasks when it comes to adding a new platform support into PetaLinux. First is to create a new vendor / platform variant in the PetaLinux build framework and the other is to build a system design for your custom platform into PetaLinux. This section will discuss howto add a new platform support into PetaLinux.

Create a New Vendor Platform Variant

Using petalinux-new-platform Script

PetaLinux provides a platform creation script to allow users to easily create a new vendor platform variant in PetaLinux. Refer to the PetaLinux Tools Chapter of the User Guide for more information on this script.

Use the 'petalinux-new-platform' script to create a new vendor and platform combination for your target system.

$ cd $PETALINUX/software/petalinux-dist
$ petalinux-new-platform -v MyVendorName -p MyPlatformName -k 2.6
New platform for MyVendorName MyPlatformName successfully created

The above example will create a new platform "MyPlatformName" under the new vendor "MyVendorName" for the 2.6 kernel. Substitute these values as per appropriate.

The petalinux-remove-platform script can be used to remove any wrongly created platform.

Select your Vendor & Platform

Now that the software and hardware components of the project has been added to PetaLinux. The next step is to select your vendor and platform as the current build target, this allows the user to edit and subsequently save the settings configured for this platform.

Use the menuconfig tool to select your vendor and platform variant from the Vendor/Product Selection menu. The menuconfig can be started from the petalinux-dist directory.

$ cd $PETALINUX/software/petalinux-dist
$ make menuconfig

The user should see the Vendor/Product Selection menu similar to the example give below.

[Vendor/Product Selection]→
     --- Select the Vendor you wish to target
     (MyVendorName) Vendor
     --- Select the Product you wish to target
     (MyPlatformName) MyVendorName Products

Save and exit from the configuration session.

    Do you wish to save your new kernel configuration?
                 < (Yes) >  < No >

As this is the first time this vendor and platform is selected, the kernel configuration tool may prompt the user for answers to whether certain configuration needs to be included. At this stage, the user can simply press "Enter" to all the prompt.

The initial configuration used for your new platform is a default configuration. This default configuration provide the user with a baseline to start configuring their platform, so as to shorten the configuration process.

Note that the default hardware configurations included for your platform is not correct, these values will be automatically updated by PetaLinux AutoConfig framework once the hardware project is built. The user can ignore them at this stage of the migration.

Create a Hardware Design Project Directory

1. Create a new directory in petalinux/hardware/user-platforms/XX-YY, Name should reflect vendor, board, and EDK version e.g. Xilinx-Spartan3E500-RevC-edk91 or <Vendor>-<Platform>-<edkEDKVersion> or similar

$ cd $PETALINUX/hardware/user-platforms/
$ mkdir Customer-Project-demo-edk91

Note: Make sure that none of the directories in your directory path have spaces in them. For example, if you create a folder call "my demo" you will end up with an XST 426 error when you finally get to the generate netlist section.

2. Copy the edk_user_repository/bsp into /bsp in the project folder Create a symbolic link for Xilinx EDK tools to be able to access the PetaLinux BSP files.

$ cd $PETALINUX/hardware/user-platforms/Customer-Project-demo-edk91
$ ln -s ../../edk_user_repository edk_user_repository

Create A Base System

This Chapter provides a step by step procedure to create a simple PetaLinux ready hardware system using Xilinx Platform Studio. This involves configurating system hardware and software configurations.

Create A Base System Hardware Design

This section intended to serve as a step by step procedure to generate a basic hardware design using XPS - Base System Builder (BSB).

Using Base System Builder (BSB)

Go to $PETALINUX/hardware/user-platforms/Customer-Project-demo-edk91 directory. Start XPS by entering the command "xps" in the shell console

$ cd $PETALINUX/hardware/user-platforms/Customer-Project-demo-edk91
$ xps

Using Base System Builder

Use Base System Builder Wizard to create a new design project. Choose a directory on your hard drive where the project will reside. Choose browse to change the directory( "$PETALINUX/hardware/user-platforms/Customer-Project-demo-edk91/" is used for this instance).

Board select & Processor configuration

During board select & processor configuration, using the following attributes.

Attribute Value
Board Select
Vendor Xilinx*
Board Virtex 4 ML401 Evaluation Platform*
Version 1*
Processor Configuration
Reference Clock Frequency 100.00 MHz*
Processor-Bus Clock Frequency 66.67 MHz*
Reset Polarity Active LOW*
On-chip H/W debug module Enable
Local Memory 8K
Cache Enable Cache link**
Cached Memory DDR_SDRAM_64x32*

Note:
Make sure Processor-Bus Clock Frequency is greater/equal than/to the minimum operating frequency for DDR memory
* indicates development board dependants.
** Prefered.

Adding Periperals

Enable following periperals and add OPB Timer to the processor system and .

Attribute Value
RS232 Uart
Device Enable
Baudrate 115200
Interrupt Enable
Flash 2Mx32#
Device Enable
DDR SDRAM 64Mx32#
Device Enable
Ethernet MAC
Device Enable
DMA mode Simple DMA
Interrupt Enable
OPB TIMER
Device Enable
One timer present Enable
Bit Width 32
Interrupt Enable

Note:
# Development board dependants.

Processor Cache Setup

Configurating Instruction and Data cahce, suing following attributes:

Attribute Value
Dcache 8k
ICache 8k
Dcache from DDR_SDRAM_64MBx32#
Icache from DDR_SDRAM_64MBx32#

Note:
# Development board dependants.

Stand Input & Output and Test Application

Enable stand input & output and Test Application.

Attribute Value
STDIN RS232_Uart
STDOUT RS232_Uart
Memory test Optional
Peripheral selftest Optional

Addding Hardware Platform Settting Without FSL

This scetion describes the steps to configurating debug module interrupt and connect to interrupt controller.

Attribute Value
User
Enable the UART Interface on OPB Disable
Interrtup Enable

  1. Ensure the H/W version of opb_mdm is "2.01.a" (This step is only required for for Virtex 4-LX25 (XC4LX25) ES devices, please refer to Xilinx Answer Database).
  2. Change the filter to "Bus Interface"
  3. Double click on "debug_moudle" instance to edit its property.
  4. Untick "Enable the UART Interface on OPB".
  5. Press "OK" to finish.
  6. Change the filter to "Ports", Expand debug_module’s tree
  7. Enable Interrupt for debug_module by change it’s interrupt Net to "debug_module_interrupt"
  8. Expand opb_intc_0’s tree and double click on Intr’s Net
  9. Add debug_module_interrupt to Interrupt Controller, you can change the interrupt priority order if you wish.

Enabling FSL support (Optional)

This section describes the steps to enable a unidirectional Fast Simplex Link(FSL) to a MicroBlaze system for high speed download.If you don’t wish to use FSL as fast download link, please skip this section.

  1. Change the filter to "Bus Connections" and expand debug_module’s tree
  2. Add a "New Connection" to MFSL0
  3. Click on "fsl_v20_0" and rename it to "fdlink" and you should see debug_module’s MFSL0 is change to "fdlink" as well.
  4. Double Click on "debug_module" instance.
  5. Tick "Enable Fast Download Write Port".
  6. Click "OK" to save setting.
  7. Double click on "fdlink" instance.
  8. Change "External Reset Active High" to ‘0’ .
  9. Double click on "fdlink" instance.
  10. Double click on "microblaze_0" instance and click on "Bus Interfaces" tab.
  11. Change the Number of FSL links to ‘1’.
  12. Click "OK" to continue.
  13. Select "fdlink" as bus connection for "SFSL0"
  14. Click on the "Ports" filter
  15. In the fdlink section, add FSL_Clk port and change the FSL_Clk Net Name to "sys_clk_s".
  16. Add SYS_Rst port and change the SYS_Rst Net Name to "sys_rst_s".

Inclduing PetaLinux BSP

This section decribes the methods to include the ModuleSearchPath variable in the system.xmp file. This will tell the Xilinx EDK tools where to locate the PetaLinux BSP files.

Attribute Value
Device and Repository
Periperheral Respository ./Customer-Project-demo-edk91/edk_user_repository

  1. Click on Project menu -> Project Options, a Project Options dialog box is displayed.
  2. In the Device and Repository tab, Set the Periperheral Respository to ./Customer-Project-demo-edk91/edk_user_repository
  3. Click OK to accept the change.

Alternative way, update the "system.xmp" file to include the "ModuleSearchPath: edk_user_repository/" string. Refer to the example below.

XmpVersion: 9.1.01
IntStyle: default
ModuleSearchPath: edk_user_repository/
MHS File: system.mhs
MSS File: system.mss
NPL File: projnav/system.ise
Architecture: virtex4

Adding FS-Boot Bootloader

PetaLinux includes a 2-phase bootloader solution, refer to the !PetaLinux Bootloader Solutions Chapter of the User Guide for more information, this section will add the first stage bootloader to your project.

  1. Select the Applications tab and double click “Add Software Application Project” to add a new software project.
  2. An Add software Application Project box is displayed. Name the project “FS-Boot” and click OK.
Attribute Value
Project Name fs-boot
Processor microblaze_0
  1. Right-click Sources under Project: FS-Boot and select Add Existing Files…
  2. Browse to the $PETALINUX/hardware/fs-boot/ folder and select the fs-boot.c, srec.c and time.c files
  3. Right-click Header under Project: FS-Boot and select Add Existing Files…
  4. Browse to the $PETALINUX/hardware/fs-boot/ folder and select the fs-boot.h, srec.h and time.h files
Attribute Value
Source File fs-boot.c
Source File srec.c
Source File time.c
Header File fs-boot.h
Header File srec.h
Header File time.h
  1. Right-click Project: FS-Boot and select "Set Compiler Options…", a Set Compiler Options dialog is displayed
  2. Within Environment tabl, ensure the Application Mode is set to Executable
  3. Tick Use default Linker Script
  4. Change the Stack Size to 1K
  5. Click on "Debug and Optiomization" tab
  6. Change the Optimization Level to "Size Optimized(-Os)
  7. Click on "Advance" tab
  8. Within "Other Compiler Options to Append" box, Add "-Wall" options to be appended to the compiler command
  9. Click "OK" to save settings.
Attribute Value
Environment
Application Mode executable
Output ELF file default value
Linker Script Use default Linker Script
Stack Size 1K
Debug and Optimisation
Optimization Level Size Optimized (-Os)
Advance
Other Compiler Options to Append -Wall
  1. Right-click on other projects and select Make Project Inactive
  2. Repeat step 16 for all the project except Project: FS-Boot
  3. Right-click "Project: FS-Boot" and select "Mark Initialize to BRAMs"

Alternative way to add FS-Boot Bootloader - Update the system.xmp File

To add FS-Boot Bootloader by including the following code in system.xmp file

SwProj: fs-boot
Processor: microblaze_0
Executable: fs-boot/executable.elf
Source: ../../fs-boot/fs-boot.c
Source: ../../fs-boot/srec.c
Source: ../../fs-boot/time.c
Header: ../../fs-boot/fs-boot.h
Header: ../../fs-boot/srec.h
Header: ../../fs-boot/time.h
DefaultInit: EXECUTABLE
InitBram: 1
Active: 1
CompilerOptLevel: 4
GlobPtrOpt: 0
DebugSym: 1
ProfileFlag: 0
AsmOpt: 
LinkOpt: 
ProgStart: 
StackSize: 1k
HeapSize: 
LinkerScript: 
ProgCCFlags: -Wall

Ensure that no other application has set the option ‘Mark to Initialize BRAMs’ enabled, else the init_bram make procedure will fail.

System Software Settings

This section describes the basic PetaLinux software configurations within XPS.

Configuring system software settings with following attributes:

Attribute Value
Processor, Driver Parameters and Interrupt Handlers
CORE_CLOCK_FREQUENCY 66666667
xmdstub_peripheral none
OS & Library Settings petalinux
PetaLinux version 1.00.b
OS and Library
lmb_memory dlmb_cntlr
main_memory DDR_SDRAM_64MBx32
main_memory_bank 0
flash_memory FLASH_2MBx32
flash_memory_bank 0
stdout RS232_Uart
stdin RS232_Uart
  1. In Xilinx Platform Studio, select "Project" tab and click on "Software Platform settings" submenu. A Software Platform Settings dialog is displayed.
  2. Select "Processor, Driver Parameters and Interrupt Handlers" tab, change the xmdstub_peripheral to "none".
  3. Change CORE_CLOCK_FREQUENCY to ‘66666667’ (Processor clock frequency).
  4. In the "OS & Library Settings" box, change the OS to "petalinux" and the OS version to "1.00.b".
  5. Click on "OS and Library" tab.
  6. Change lmb_memory to "dlmb_cntlr".
  7. Change main_memory to "DDR_SDRAM_64MBx32".
  8. Change flash_memory to "FLASH_2MBx32".
  9. Change main_memory_bank and flash_memory_bank to ‘0’.
  10. Set stdout and stdin to "RS232_Uart".
  11. Leave Target_DIR blank.
  12. Press "OK" to finish.
  13. Select the "Software" menu and "Generate Libraries and BSP" submenu.
  14. Select the "Hardware" menu and "Generate Netlist" submenu, this will take a while.
  15. Select the "Hardware" menu and "Generate Bitstream" submenu, this will take a while.

Hardware Testing

This section describes the steps to boot up the ML401 board with the newly built images.

  1. Start the kermit program.
    $ kermit -c
    
  2. Once Generate Bitstream is finished, select the "Device Configuration" menu and "Download Bitstream" submenu, to download the bitstream into development board.
  3. The DONE pin (LED) goes high when bitstream download is completed.
  4. The following output should displayed in kermit.
    =================================================
    FS-BOOT First Stage Bootloader (c) 2006 PetaLogix
    =================================================
    FS-BOOT: System initialisation completed.
    FS-BOOT: Booting from FLASH. Press 's' for image download.
    
  5. On the Kermit window, hold down the "Control" and forward-slash ("\") keys simultaneously, then press "c" to activate the kermit prompt. Tyep "exit" in kermit prompt to exit Kermit

PetaLinux Configration

Setup AutoConfig

The AutoConfig technology allows automated synchronisation of hardware and software system configurations. To enable the AutoConfig framework within the PetaLinux environment, the following instruction needs to be executed to set up the link between the hardware and software project.

In the $PETALINUX/hardware/user-platforms/Customer-Project-demo-edk91 directory, execute the following commands.

$ petalinux-copy-autoconfig

This command will automatically detect your vendor and platform selection on your current PetaLinux tree and install the hardware AutoConfig files into the appropriate directories.

Platform Configurations

Next the user will have to reconfigure the platform settings of their custom platform into PetaLinux as per what was done previously for the old development environment. This step requires the user to run through the following configuration options.

  1. Start the menuconfig tool
    $ cd $PETALINUX/software/petalinux-dist 
    $ make menuconfig
    

  1. Select the Vendor/User Settings option.
      ┌─────────────────── Kernel/Library/Defaults Selection ───────────────────
      │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
      │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
      │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.     │
      │  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable     │
      │ ┌─────────────────────────────────────────────────────────────────────┐ │
      │ │             (linux-2.6.x) Kernel Version                            │ │
      │ │             (None) Libc Version                                     │ │
      │ │             [ ] Default all settings (lose changes)                 │ │
      │ │             [ ] Customize Kernel Settings                           │ │
      │ │             [*] Customize Vendor/User Settings (NEW)                │ │
      │ │             [ ] Update Default Vendor Settings                      │ │
      │ │                                                                     │ │
      │ └─────────────────────────────────────────────────────────────────────┘ │
      ├─────────────────────────────────────────────────────────────────────────┤
      │                    <Select>    < Exit >    < Help >                     │
      └─────────────────────────────────────────────────────────────────────────┘
    
    
  2. Save and exit the main menu
        Do you wish to save your new kernel configuration?
                     < (Yes) >  < No >
    

This step is only required once for any new platform added. The user can refer to the System Settings Configuration Menu Section of the User Guide for more information on the System Settings menu options.

Configure the Linux Kernel

The user have to manually assign the peripheral device drivers for Uart, Ethernet, ROM/flash memory and disable the unused device drivers / unused functions/features.

  1. Within Main Menu, select "Processor type and features --->"
  2. Within "Processor type and features" menu, disable "GIPO driver" and make sure the "Console on UAETLITE" is enabled
      ┌──────────────────────── Processor type and features ────────────────────┐
      │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
      │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
      │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.     │
      │  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable     │
      │ ┌─────────────────────────────────────────────────────────────────────┐ │
      │ │         --- Platform                                                │ │
      │ │         (MyPlatformName) Platform                                   │ │
      │ │         (RAM) Memory model                                          │ │
      │ │         [*] Console on UARTLITE                                     │ │
      │ │         < > GPIO driver                                             │ │
      │ │         < > SystemAce driver                                        │ │
      │ │         [*] Kernel cmdline support (needs new bootloader)           │ │
      │ │         --- Debug Logging                                           │ │
      │ │         [*] Enable debug logging                                    │ │
      │ │                                                                     │ │
      │ │                                                                     │ │
      │ │                                                                     │ │
      │ │                                                                     │ │
      │ │                                                                     │ │
      │ └─────────────────────────────────────────────────────────────────────┘ │
      ├─────────────────────────────────────────────────────────────────────────┤
      │                   <Select>    < Exit >    < Help >                      │
      └─────────────────────────────────────────────────────────────────────────┘
    
  1. Go back to "Main Menu" and select "General Setup --->"
  2. Within "General Setup" menu, make sure "Networking support" is enabled
  3. Go back to "Main Menu" and select "Processor type and features --->"
  4. Within "Memory Technology Devices (MTD)" menu, select "RAM/ROM/Flash chip drivers --->"
      ┌──────────────────── Memory Technology Devices (MTD) ────────────────────┐
      │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
      │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
      │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.     │
      │  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable     │
      │ ┌─────────────────────────────────────────────────────────────────────┐ │
      │ │    <*> Memory Technology Device (MTD) support                       │ │
      │ │    [ ] Debugging                                                    │ │
      │ │    <*>   MTD partitioning support                                   │ │
      │ │    < >   MTD concatenating support                                  │ │
      │ │    < >   RedBoot partition table parsing                            │ │
      │ │    < >   uCbootstrap partition table parsing                        │ │
      │ │    < >   Command line partition table parsing                       │ │
      │ │    --- User Modules And Translation Layers                          │ │
      │ │    <*>   Direct char device access to MTD devices                   │ │
      │ │    <*>   Caching block device access to MTD devices                 │ │
      │ │    < >   FTL (Flash Translation Layer) support                      │ │
      │ │    < >   NFTL (NAND Flash Translation Layer) support                │ │
      │ │    < >   INFTL (Inverse NAND Flash Translation Layer) support       │ │
      │ │    RAM/ROM/Flash chip drivers  --->                                 │ │
      │ │    Mapping drivers for chip access  --->                            │ │
      │ │    Self-contained MTD device drivers  --->                          │ │
      │ │    NAND Flash Device Drivers  --->                                  │ │
      │ └─────────────────────────────────────────────────────────────────────┘ │
      ├─────────────────────────────────────────────────────────────────────────┤
      │                   <Select>    < Exit >    < Help >                      │
      └─────────────────────────────────────────────────────────────────────────┘
    
  1. Within "RAM/ROM/Flash chip drivers" menu, enable "Support for Intel/Sharp flash chips"
      ┌─────────────────────── RAM/ROM/Flash chip drivers ──────────────────────┐
      │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
      │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
      │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.     │
      │  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable     │
      │ ┌─────────────────────────────────────────────────────────────────────┐ │
      │ │<*>   Detect flash chips by Common Flash Interface (CFI) probe       │ │
      │ │<*>   Detect JEDEC JESD21c compatible flash chips                    │ │
      │ │[ ]   Flash chip driver advanced configuration options               │ │
      │ │<*>   Support for Intel/Sharp flash chips                            │ │
      │ │<*>   Support for AMD/Fujitsu flash chips                            │ │
      │ │< >   Support for ST (Advanced Architecture) flash chips             │ │
      │ │<*>   Support for RAM chips in bus mapping                           │ │
      │ │< >   Support for ROM chips in bus mapping                           │ │
      │ │< >   Support for absent chips in bus mapping                        │ │
      │ │[ ]   Older (theoretically obsoleted now) drivers for non-CFI chips  │ │
      │ │                                                                     │ │
      │ │                                                                     │ │
      │ │                                                                     │ │
      │ │                                                                     │ │
      │ └─────────────────────────────────────────────────────────────────────┘ │
      ├─────────────────────────────────────────────────────────────────────────┤
      │                     <Select>    < Exit >    < Help >                    │
      └─────────────────────────────────────────────────────────────────────────┘
    
  1. Go back to "Memory Technology Devices (MTD)" menu and select "Mapping drivers for chip access ---> "
  2. Ensure only "CFI Flash device PetaLinux AutoConfig" and "Generic uClinux RAM/ROM filesystem support" are selected
      ┌──────────────────── Mapping drivers for chip access ────────────────────┐
      │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
      │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
      │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.     │
      │  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable     │
      │ ┌─────────────────────────────────────────────────────────────────────┐ │
      │ │ <*>   CFI Flash device PetaLinux AutoConfig                         │ │
      │ │ < >   CFI Flash device in physical memory map                       │ │
      │ │ < >   CFI Flash device mapped by Arcturus uCbootstrap               │ │
      │ │ < >   CFI Flash device mapped on SnapGear/SecureEdge                │ │
      │ │ < >   CFI Flash device mapped on SnapGear/GEODE boards              │ │
      │ │ < >   CFI Flash device mapped on SnapGear/SecureEdge (uClinux)      │ │
      │ │ < >   CFI Flash device mapped on Microblaze/mbvanilla (uClinux)     │ │
      │ │ < >   CFI Flash device mapped on MicroBlaze auto-config (uClinux)   │ │
      │ │ < >   CFI Flash device mapped on Microblaze/ML40x (uClinux)         │ │
      │ │ < >   CFI Flash device mapped on Microblaze/SUZAKU (uClinux)        │ │
      │ │ < >   CFI Flash device mapped on Key Technology devices             │ │
      │ │ < >   CFI Flash device mapped on SED SIOS III Core                  │ │
      │ │ <*>   Generic uClinux RAM/ROM filesystem support                    │ │
      │ └─────────────────────────────────────────────────────────────────────┘ │
      ├─────────────────────────────────────────────────────────────────────────┤
      │                   <Select>    < Exit >    < Help >                      │
      └─────────────────────────────────────────────────────────────────────────┘
    
  3. Go back to "Main Menu" and select "Netwrok device Support
  4. Enalbe "Network device support" and select "Ethernet (10 or 100Mbit) --->"
      ┌───────────────────────── Network device support ────────────────────────┐
      │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
      │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
      │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.     │
      │  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable     │
      │ ┌─────────────────────────────────────────────────────────────────────┐ │
      │ │        [*] Network device support                                   │ │
      │ │        ARCnet devices  --->                                         │ │
      │ │        < > Dummy net driver support (NEW)                           │ │
      │ │        < > Bonding driver support (NEW)                             │ │
      │ │        < > EQL (serial line load balancing) support (NEW)           │ │
      │ │        --- IMQ needs CONFIG_NETFILTER enabled                       │ │
      │ │        < > Universal TUN/TAP device driver support (NEW)            │ │
      │ │        < > Ethertap network tap (OBSOLETE) (NEW)                    │ │
      │ │        Ethernet (10 or 100Mbit)  --->                               │ │
      │ │        Ethernet (1000 Mbit)  --->                                   │ │
      │ │        [ ] FDDI driver support (NEW)                                │ │
      │ │        [ ] HIPPI driver support (EXPERIMENTAL) (NEW)                │ │
      │ │        < > PLIP (parallel port) support (NEW)                       │ │
      │ │        < > PPP (point-to-point protocol) support (NEW)              │ │
      │ └────────┴(+)─────────────────────────────────────────────────────────┘ │
      ├─────────────────────────────────────────────────────────────────────────┤
      │                     <Select>    < Exit >    < Help >                    │
      └─────────────────────────────────────────────────────────────────────────┘
    
  5. Enable "Ethernet (10 or 100Mbit)" and "Xilinx Ethernet driver"
      ┌──────────────────────── Ethernet (10 or 100Mbit) ───────────────────────┐
      │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
      │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
      │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.     │
      │  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable     │
      │ ┌─────────────────────────────────────────────────────────────────────┐ │
      │ │ [*] Ethernet (10 or 100Mbit) (NEW)                                  │ │
      │ │ <*>   Xilinx Ethernet driver (NEW)                                  │ │
      │ │ < >   Sun LANCE support (NEW)                                       │ │
      │ │ < >   Sun BigMAC 10/100baseT support (EXPERIMENTAL) (NEW)           │ │
      │ │ < >   Sun QuadEthernet support (NEW)                                │ │
      │ │ [ ]   3COM cards (NEW)                                              │ │
      │ │ [ ]   Western Digital/SMC cards (NEW)                               │ │
      │ │ [ ]   Racal-Interlan (Micom) NI cards (NEW)                         │ │
      │ │ [ ]   Pocket and portable adapters (NEW)                            │ │
      │ │ < >   CNXT Emac support (NEW)                                       │ │
      │ │ [ ]   FEC ethernet controller (of ColdFire 5272/5282/5280) (NEW)    │ │
      │ │ < >   CS89x0 support (NEW)                                          │ │
      │ │ [ ]   uCcs8900 support (NEW)                                        │ │
      │ │ < >   AX88796 NE2000 compatible chipset (NEW)                       │ │
      │ └─┴(+)────────────────────────────────────────────────────────────────┘ │
      ├─────────────────────────────────────────────────────────────────────────┤
      │                   <Select>    < Exit >    < Help >                      │
      └─────────────────────────────────────────────────────────────────────────┘
    
  6. Save and exit the configuration.
        Do you wish to save your new kernel configuration?
                     < (Yes) >  < No >
    

Configure the System Settings

PetaLinux provides a System configuration menu that can be set using the 'menuconfig' tool.

  1. Under the Vendor/User Settings menu, select the System Settings submenu.
      ┌──────────────────────────────── Main Menu ────────────────────────────────┐
      │  Arrow keys navigate the menu.  <Enter> selects submenus --->.            │
      │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes,   │
      │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.       │
      │  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable       │
      │ ┌───────────────────────────────────────────────────────────────────────┐ │
      │ │               System Settings  --->                                   │ │
      │ │               Core Applications  --->                                 │ │
      │ │               Library Configuration  --->                             │ │
      │ │               Flash Tools  --->                                       │ │
      │ │               Filesystem Applications  --->                           │ │
      │ │               Network Applications  --->                              │ │
      │ │               Miscellaneous Applications  --->                        │ │
      │ │               BusyBox  --->                                           │ │
      │ │               Tinylogin  --->                                         │ │
      │ │               MicroWindows  --->                                      │ │
      │ │               Games  --->                                             │ │
      │ └───────────────┴(+)────────────────────────────────────────────────────┘ │
      ├───────────────────────────────────────────────────────────────────────────┤
      │                     <Select>    < Exit >    < Help >                      │
      └───────────────────────────────────────────────────────────────────────────┘
    
    
  1. Update the Network Address configuration including the MAC address of the device to reflect your development network and enable the other options as per the below example.
      ┌────────────────────────────── System Settings ───────────────────────────────┐
      │  Arrow keys navigate the menu.  <Enter> selects submenus --->.  Highlighted  │
      │  letters are hotkeys.  Pressing <Y> includes, <N> excludes, <M> modularizes  │
      │  features.  Press <Esc><Esc> to exit, <?> for Help.  Legend: [*] built-in    │
      │  [ ] excluded  <M> module  < > module capable                                │
      │ ┌──────────────────────────────────────────────────────────────────────────┐ │
      │ │                   Network Addresses  --->                                │ │
      │ │                        Default host name: "uclinux"                      │ │
      │ │                        Default root password: "root"                     │ │
      │ │                   (CRAMFS) Root filesystem type                          │ │
      │ │                   [*] Copy final image to tftpboot                       │ │
      │ │                   [*] Build u-boot                                       │ │
      │ │                   Flash Partition Table  --->                            │ │
      │ │                                                                          │ │
      │ │                                                                          │ │
      │ │                                                                          │ │
      │ │                                                                          │ │
      │ │                                                                          │ │
      │ └──────────────────────────────────────────────────────────────────────────┘ │
      ├──────────────────────────────────────────────────────────────────────────────┤
      │                       <Select>    < Exit >    < Help >                       │
      └──────────────────────────────────────────────────────────────────────────────┘
    
    

Refer to the System Settings Configuration Menu Section of the User Guide for more information on the menu options.

  1. Save and exit the configuration.
        Do you wish to save your new kernel configuration?
                     < (Yes) >  < No >
    

Update Default Vendor Settings

Once the configuration is done, the settings need to be saved as the default configuration for this platform. This can be done by selecting the Update Default Vendor Settings option. Save and exit from the configuration session when done.

  ┌─────────────────── Kernel/Library/Defaults Selection ───────────────────
  │  Arrow keys navigate the menu.  <Enter> selects submenus --->.          │
  │  Highlighted letters are hotkeys.  Pressing <Y> includes, <N> excludes, │
  │  <M> modularizes features.  Press <Esc><Esc> to exit, <?> for Help.     │
  │  Legend: [*] built-in  [ ] excluded  <M> module  < > module capable     │
  │ ┌─────────────────────────────────────────────────────────────────────┐ │
  │ │             (linux-2.6.x) Kernel Version                            │ │
  │ │             (None) Libc Version                                     │ │
  │ │             [ ] Default all settings (lose changes)                 │ │
  │ │             [ ] Customize Kernel Settings                           │ │
  │ │             [ ] Customize Vendor/User Settings (NEW)                │ │
  │ │             [*] Update Default Vendor Settings                      │ │
  │ │                                                                     │ │
  │ └─────────────────────────────────────────────────────────────────────┘ │
  ├─────────────────────────────────────────────────────────────────────────┤
  │                    <Select>    < Exit >    < Help >                     │
  └─────────────────────────────────────────────────────────────────────────┘

    Do you wish to save your new kernel configuration?
                 < (Yes) >  < No >

Building the Root Filesystem and Kernel Image

To start the build process for the newly added platform, in the $PETALINUX/software/petalinux-dist directory execute the following commands to build the images.

1. Build the project dependencies

$ yes "" │ make oldconfig dep

2. Build the Images

This step may take a while to complete.

$ make all

3. Check that the build complete successfully.

If the build failed, resolve the problem and repeat step 2.

4. Output images.

The output images will be in the following directories.

$PETALINUX/software/petalinux-dist/images 
  or
/tftpboot

For more information on the various output images refer to the Output Images Section of the PetaLinux User Guide.

Boot your Custom Board

The user can use the images generated in the /tftpboot or $PETALINUX/software/petalinux-dist/images directory to boot up their platform with their normal boot method.

This section describes the steps to boot up your custom board using the 2-phase boot offered by PetaLinux. This section can be skipped if not required.

Starting Kermit (Serial Console Program)

Kermit is used as the default console program to communicate with the target device. User can refer to the Installation Guide Section? of the PetaLinux User Guide for more information on installing Kermit.

Start the kermit console program.

$ kermit -c

Starting FS-Boot

FS-Boot is the first stage bootloader that is used for bootstrapping the full featured U-Boot into system memory. FS-Boot can be booted using your normal bitstream download process or the following instructions.

1. Board Setup.

Set up the your board for configuration bitstream download.

2. Download the hardware bitstreams.

On a different console as the kermit terminal, change into your hardware project directory and type the following command.

$ make -f system.make download 

3. The FS-Boot banner appears.

The following FS-Boot banner or similar should appear on the kermit console when the bitstream download is completed.

=================================================
FS-BOOT First Stage Bootloader (c) 2006 PetaLogix
=================================================
FS-BOOT: System initialisation completed.
FS-BOOT: Booting from FLASH. Press 's' for image download.

Starting U-Boot

4. Start U-Boot SREC image download

Type 's' on the kermit console window to start the serial SREC download of U-Boot binary image. The following FS-BOOT message should appear.

FS-BOOT: Waiting for SREC image....

Note: By default FS-Boot will wait for 3 seconds before it will start the auto boot process. Ensure, that the 's' key is pressed before that.

5. Send the U-Boot SREC image.

On a different console to the kermit window, type the following command to send the file to FS-BOOT.

$ cat /tftpboot/u-boot.srec > /dev/ttyS0

Note: The above example assumes that /dev/ttyS0 is used, substitute the serial device file name as per appropriate.

On the kermit window, you should see the "Spinning wheel" symbol when it is downloading the SREC image.

6. Download completion and booting U-Boot.

FS-Boot will automatically boot the downloaded U-Boot image when download is completed. The following message or similar should appear on the kermit window.

FS-BOOT: Waiting for SREC image....
FS-BOOT: Image download successful.
FS-BOOT: Warning image location differ from default boot location. Image will not boot automatically after POR.
FS-BOOT: Press 'n' to boot old image.
FS-BOOT: Use new image.
FS-BOOT: Booting image...
SDRAM :
        U-Boot Start:0x13fc0000
        Malloc Start:0x13f60000
        Board Info Start:0x13f5ffd0
        Boot Parameters Start:0x13f4ffd0
FLASH:  8 MB
ETHERNET: MAC:<NULL>

*** Warning - bad CRC, using default environment

U-Boot>

Note: The warning messages appear as the U-Boot environment is not configured. These warning messages will not appear once the U-Boot board configuration is done.

Congratulations, at this point of the tutorial the complete development cycle of using PetaLinux is shown.

U-Boot Board Configuration

Note this section will erase the information stored in the on-board Flash device. Do not continue with this section if you don't want information in your Flash device to be erased or over-written. Xilinx provides factory default Flash images for the ML401 board on their website, this can be used to restore the original image on the Flash device if required.

This section will provide the steps to configure the ML401 development board to be an auto-bootable embedded system. With all the required bootloader and kernel images stored into the on-board Flash device. This is often required for most market ready embedded system based product.

The platform configuration procedures are simplified and automated by the U-Boot platform configuration script generated by PetaLinux. This script is automatically generated for any platform that is included into PetaLinux.

The script contains all the necessary system and platform configuration information such as the on-board peripherals OPB address maps, Flash partition table information, ethernet MAC address, IP address and Server IP address and location at which to install the bootloader and kernel images, to allow U-Boot to automatically configure the target platform. In this case the ML401 development board.

Refer to the Customizing U-Boot Section in the User Guide for more information on the U-Boot Configuration.

Below listed is a brief description of the steps taken as part of the configuration process:

  • Setup U-Boot Environment Variables
  • Setup Ethernet Connection
  • Save U-Boot ENV to FLASH

1. Download the Configuration script (ub.config.img) into the ML401 board.

On the kermit window, type the following command.

U-Boot> loadb $(clobstart)
## Ready for binary (kermit) download to 0x24000000 at 115200 bps...

Note: The $(clobstart) is the address in SDRAM that can be used to temporary hold the configuration script image. This value is specific to your hardware SDRAM memory mappings and only needs to change if you are not using the ML401 reference design provided by PetaLinux. If you are not sure what to use, use the "clobstart" value in the ub.config file in the following directory.

$PETALINUX/software/petalinux-dist/u-boot/board/petalogix/microblaze-auto/ub.config

2. Send ub.config.img script via Kermit.

a) On the Kermit window, hold down the "Control" and forward-slash ("\") keys simultaneously, then press "c" to activate the kermit prompt. Note this is different from the common "Control-C" key combination.

Ctrl\c

The following message or similar should appear on your console.

(Back at bennyc.itee.uq.edu.au)
----------------------------------------------------
(/usr/local/petalogix/projects/fs-boot/) C-Kermit>

b) Send the ub.config.img file. Execute the following command exactly.

(/usr/local/petalogix/projects/fs-boot/) C-Kermit> send /bin /tftpboot/ub.config.img

The above command will start transmitting the ub.config.img file. The transmission is comleted when the C-Kermit> prompt returns to the console.

c) Return to the U-Boot prompt.

Type the following command to return to the U-Boot command prompt.

(/usr/local/petalogix/projects/fs-boot/) C-Kermit> connect

The following message or similar should apprear on the terminal window.

(/usr/local/petalogix/projects/fs-boot/) C-Kermit>connect
Connecting to /dev/ttyS0, speed 115200
 Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
## Total Size      = 0x00000512 = 1298 Bytes
## Start Addr      = 0x24000000
U-Boot>

3. Run the ub.config.img script.

To run the script issue the following command on the U-Boot prompt.

U-Boot> autoscr $(fileaddr)

Upon completion the following message or similar shall appear on the terminal window.

U-Boot> autoscr $(fileaddr)
## Executing script at 10000000
PetaLogix MicroBlaze-Auto Board Configuration
---------------------------------------------
Network Configuration:
MTD Configuration:
Clobber DRAM Configuration:
Bootloader Configuration:
Kernel Configuration:
Boot Configuration:
Saving Configurations...
Saving Environment to Flash...
Un-Protected 1 sectors
Erasing Flash...
. done
Erased 1 sectors
Writing to Flash... done
Configuration Completed
U-Boot>

4) Download the U-Boot and Kernel Image into Flash

On the U-Boot prompt issue the following commands exactly as per the example.

Download the U-Boot binary image.

U-Boot> tftp $(clobstart) u-boot-s.bin

Unlock, erase and program the U-Boot image into the boot partition in Flash.

U-Boot> protect off $(bootstart) +$(bootsize)
U-Boot> erase $(bootstart) +$(bootsize)
U-Boot> cp.b $(fileaddr) $(bootstart) $(filesize)

Download the kernel image.

U-Boot> tftp $(clobstart) image.ub

Un-protect, erase and program the Kernel image into the image partition in Flash.

This step will attempt to program the kernel image into the Flash device, depending on the Flash device used this step may take a while to complete. Note that the U-Boot cp command do not provide status information for the copy process.

U-Boot> protect off $(kernstart) +$(kernsize)
U-Boot> erase $(kernstart) +$(kernsize)
U-Boot> cp.b $(fileaddr) $(kernstart) $(filesize)

Note the above steps can also be automated, refer to the U-Boot Manual for more information on generating script files.

Auto-Boot the ML401 Embedded System

At this stage the ML401 board has been fully configured to become a auto-bootable embedded system. This section will describes the steps to initiate an automatic boot up of the ML401 board.

1. Download the hardware bitstreams.

$ make -f system.make download

This should see the ML401 embedded system progress through the booting of all its components to the final Linux kernel image boot. Boot messages will appear on the kermit window.

Further Support

Please refer to the PetaLinux User Guide for more information on the PetaLinux distribution.

User questions can also be found on the microblaze-uclinux mailing list.

For technical support, contact PetaLogix at www.petalogix.com.