Table of Contents
Mainline Linux 2.6 kernel for Microblaze, Linux on Microblaze
I would like to thanks PetaLogix for lending Xilinx s3e1600E board and Xilinx for providing ML505 and s3adsp1800 boards.
If you want something to know please send email to microblaze mailing list with CC to me. (archive, archive-gmane)
Latest code is available at GIT server. http://git.monstr.eu/git/gitweb.cgi
Known BUGs
TODO
What is different?
- Code is based on the latest code from PetaLogix
- Kernel is compatible with latest Linux code
- The all code is cleaned according to Linux coding style
- There are no driver in pure Linux kernel (only some) but it is compatible with PetaLogix distribution and drivers and it is possible to join it together
- Completely redesign initialization part of kernel
- Completely redesign memory part of kernel
- The code has the same performance as common Microblaze code with static constant - that's amazing
Patch submission
Before sending your patches please do:
- Check for-linus, fixes-for-linus and next branch for latest rc changes
- Check it with checkpatch.pl script which is in linux kernel and run sparse (make C=1) for checking too. I will reject all patches which break coding style.
- Sending only in-line patches (git-send-email is recommended) do not attach them - it is better for reviewing.
- Send the smallest patches as possible and fix only one issue separately.
- Look at Documentation/SubmittingPatches for proper line.
Toolchain
- Toolchain patches (requires login)
How to boot Microblaze FDT kernel?
Vocabulary
- EDK → Xilinx Embedded Development Kit - development environment where you can create/build your FPGA SoC
- Microblaze → Xilinx soft core CPU
- BSP
- board support package → means full package for specific board (currently this means is not used)
- EDK BSP → scripts which add functionality to EDK in software part.
- DTS file → text file which contains detailed information about SoC. Currently this file is automatically generated by Device tree BSP.
- DTB file → compiled DTS file.
- DTC → device tree compiler which create DTB file from DTS.
- FDT → flat device tree
- OF → open firmware
- BRAM → block ram memory → you can stored program there with bitstream
BSP
For working with FDT kernel you need to have DTS file which describes your Microblaze SoC.
- Download FDT BSP pack fdt-bsp.tar.gz
- Use latest device-tree BSP device-tree_latest.tar.gz
- Copy fdt-bsp.tar.gz to ~/microblaze-fdt/hardware/edk_user_repository/
- Currently you have all BSP which you need for working with FDT Microblaze linux kernel.
BSP updates
This chapter is only for user which wants to update BSP.
Prepared pack contains three BSP
Cloning BSP from GIT server
- Please look at BSP structure and replace *.tcl *.mld file.
Device tree compiler
For creating DTB which is passing to Linux kernel you need DTC
- For proper usage you have to move dtc to your PATH
Hardware design
- For example if you want to add/copy your design (ml505) to this folder. Create new folder (ml505) and add them hw files.
Hardware requirements
- FDT kernel should be able to boot on any HW.
- Please do not use Microblaze version 7.00a without tactical patch.
- Please do not enable FULL PVR with MMU on Microblaze version 7.00.a/b.
- Please check that your FLASH memory baseaddr is on higher address than your Main memory due to U-BOOT bootloader (U-BOOT BSP check it).
- I recommend you enable FULL PVR setting - Linux kernel check that your kernel and DTS file is correct for your CPU
Please check your system.xmp (or *.xmp which you use) that ModuleSearchPath is set correctly
Please choose TOP BSP and set values there.
For example fragment from *.mss file for ml505
For example fragment from *.mss file for s3e1600
Bootloader options
Before you start to build hardware you should choose our booting strategy. I would like to give you some options what you can choose.
- Create your own bootloader
- Use common bootloader
- Use small bootloader - FS-BOOT
- Use advanced bootloader - U-BOOT
Description | Own | FS-Boot | U-BOOT |
---|---|---|---|
Memory consumption | Depends on your features | 8k BRAM | >128k |
Functions | Depends on what you want to develop | Copy SREC to memory, Boot kernel from Flash - reading | Full Flash, System ACE, Network-emaclite,emac,ll_temac, gpio, booting all kernel and a lot of others |
Time of developing | Depends on your features but it is huge in compare to standard solution | - | Only adding features which are not there |
Source code maintaining | Customer must care about | PetaLogix | me |
Stability | uknown | ~99.9% stable | ~99% stable - Depends on setting |
You can use our own bootloader in all variants but be sure you have time and developer who will do it. Keep in your mind that if you want to use it after some years again someone take care about. Please counted how much money this option cost. You will not have any support of it.
- System has no non-volatile memory (without FLASH, SPI flash, SystemACE)
- Use FS-BOOT which waits for SREC through serial line
- copy advanced bootloader to ram and start it - recommended way
- + add more functionality
- - you want to boot any kernel - you must have any different way how to get kernel to memory
- loading around 30s (baudrate 115200)
- copy directly linux kernel to memory and boot it
- + simply
- - time wasting
- System has FLASH memory - NOR
- Use FS-BOOT and place it to BRAM
- Only start kernel stored in FLASH (Kernel is stored to FLASH via JTAG)
- Start U-BOOT and use U-BOOT for advanced booting - recommended way
- Use any simple bootloader which only jump to flash memory and boots whatever
- System has FLASH memory - NAND, Spansion FLASH
- Use U-BOOT which can work with NAND flashes
- System has System.ACE
- Create own bootloader which will read file from CF and loads it to memory and boots - it is possible load U-BOOT too
- Use .ACE file with FS-BOOT and boots kernel or U-BOOT stored in flash
- Use .ACE file with U-BOOT - recommended way
- System has SPI flash
- Currently I don't know about any standard solution. Recommended way is stored U-BOOT there and create simple bootloader which copy it to main memory and jump to start.
Hw build
- If you want to use any bootloader in BRAM you should add it to EDK project.
U-BOOT bootloader
mkimage executable files
- Load U-BOOT code to board
Linux Microblaze FDT kernel
- export your cross_compile
- Generate U-BOOT executable file
-
- for MMU kernel. Address correspond with CONFIG_KERNEL_BASE_ADDR in .config file
Creating DTB file
- There is xilinx.dts file
FDT Kernel booting
Memory layout
Kernel can be place to almost every position. There are some limitation like. The last instruction of kernel cannot exceed limit which is placed approximately 16 kB from the end of memory. You have to calculate with the size of file system too.
U-BOOT
For noMMU kernel -> here is separated Rootfs and kernel
Booting from others bootloaders
- Register R5: command line
- Register R6: physical address to ramdisk. (Build in fs == 0)
- Register R7: physical address to DTB file
Command line priorities
From the lowest to the highest priority
- Passing command line through r5
- CONFIG_CMDLINE in menuconfig
- dts command line
- CONFIG_CMDLINE with CONFIG_CMDLINE_FORCE in menuconfig
NFS rootfs
Command line options summaru
Rootfs on SystemACE | root=/dev/xsa2 |
NFS rootfs | root=/dev/nfs rw nfsroot=192.168.0.102:/tftpboot/rootnfs |
Console on uart16550 or old uartlite | console=ttyS0,115200 |
Console on uarlite | console=ttyUL0,115200 |
Turn off console | silent=off |
Single user mode | single |
tmpfs as root | devfs=mount rw rootfstype=tmpfs root=/dev/ram |
setup ipaddr by dhcp | ip=dhcp |
setup static ipaddr | ip=<client-ip>:<server-ip>:<gw-ip>:<netmask>:<hostname>:<device>:<autoconf> |
ip=192.168.10.2:192.168.10.1:192.168.10.1:255.255.255.0:test:eth0:on |
Serial console
Extract compiled in .config
Showing linux kernel buffer
Via U-BOOT
Via XMD
There is second way how to read Linux kernel log buffer via XMD. This features is not available for free users. Here is the log to show you how this options works. There are new built-in features in xmd called log. The script find-out log buffer from latest Linux kernel code and you can just type log command to show whole log buffer.
HeartBeat function
Saving value in Microblaze ASM
Store byte
ori r10, r0, 0x12345678 addik r11, r0, r0_ram + 0x300 addik r12, r0, r0_ram + 0x304 sb r10,r0,r11 sbr r10,r0,r12 XMD% mrd 0xd02b602c 10 D02B602C: 00000078 D02B6030: 78000000 D02B6034: 00000000
Half word
ori r10, r0, 0x12345678 addik r11, r0, r0_ram + 0x300 addik r12, r0, r0_ram + 0x304 sh r10,r0,r11 shr r10,r0,r12 XMD% mrd 0xd02b602c 10 D02B602C: 00005678 D02B6030: 78560000 D02B6034: 00000000
Word
ori r10, r0, 0x12345678 addik r11, r0, r0_ram + 0x300 addik r12, r0, r0_ram + 0x304 sw r10,r0,r11 swr r10,r0,r12 XMD% mrd 0xd02b602c 10 D02B602C: 12345678 D02B6030: 78563412 D02B6034: 00000000