Linux Distribution For Xilinx MicroBlaze From ERA PROJECT This page contains the instruction about how to install and use the Linux distribution for Xilinx Microblaze by Evidence Srl (www.evidence.eu.com). Contents 1 General Information 1.1 Definitions and acronyms 1.2 The virtual machine 1.2.1 Accounts 1.2.2 Location of main directories 2 Running Linux on Microblaze: Evelin BSP 2.1 Using precompiled Linux distribution 2.1.1 Getting the Linux distribution 2.1.2 Flashing and running the Linux distribution 2.2 Customized Linux distribution 2.2.1 Configuring the Linux distribution 2.2.1.1 Configuration of the target 2.2.1.2 Busybox configuration 2.2.1.3 Kernel configuration 2.2.1.4 Choosing xparameters.h 2.2.2 Updating the bitstream 2.2.3 Compiling the Linux distribution 2.2.4 Flashing and running the Linux distribution 2.3 Advanced topics 2.3.1 Manual tricking the uboot/Linux configuration 2.3.1.1 Changes of xparameters.h 2.3.1.2 UBoot configuration file 2.3.1.3 Linux kernel configuration file 2.3.2 Boot from Compact Flash 2.3.2.1 Generating SysACE booting file 2.3.2.2 Filling the compact flash 2.3.2.2.1 Troubleshooting 2.3.2.3 Flashing the kernel and the root filesystem 2.3.2.4 First test boot 2.3.2.5 Troubleshooting 2.3.2.6 Booting 3 Compiling applications for MicroBlaze: Evelin SDK 3.1 Writing an application 3.1.1 The source code 3.1.2 Compiling the application 3.1.3 Running the application 3.1.3.1 On the host system 3.1.3.2 On the Microblaze 3.1.4 Debugging the application 3.1.4.1 On the host system 3.2 Using Eclipse 3.2.1 Creating the project 3.2.2 Modifying the sources 3.2.3 Running the application 3.2.3.1 On the host system 3.2.3.2 On the MicroBlaze 3.2.4 Debugging the application
27
Embed
Linux Distribution For Xilinx MicroBlazesoftware.evidence.eu.com/evelin/microblaze/manual-evelin... · Customized Linux distribution Configuring the Linux distribution ... UIMAGE
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Linux Distribution For Xilinx MicroBlazeFrom ERA PROJECT
This page contains the instruction about how to install and use the Linux distribution for Xilinx Microblaze by Evidence Srl(www.evidence.eu.com).
Contents
1 General Information1.1 Definitions and acronyms1.2 The virtual machine
1.2.1 Accounts1.2.2 Location of main directories
2 Running Linux on Microblaze: Evelin BSP2.1 Using precompiled Linux distribution
2.1.1 Getting the Linux distribution2.1.2 Flashing and running the Linux distribution
2.2 Customized Linux distribution2.2.1 Configuring the Linux distribution
2.2.1.1 Configuration of the target2.2.1.2 Busybox configuration2.2.1.3 Kernel configuration2.2.1.4 Choosing xparameters.h
2.2.2 Updating the bitstream2.2.3 Compiling the Linux distribution2.2.4 Flashing and running the Linux distribution
2.3 Advanced topics2.3.1 Manual tricking the uboot/Linux configuration
2.3.1.1 Changes of xparameters.h2.3.1.2 UBoot configuration file2.3.1.3 Linux kernel configuration file
2.3.2 Boot from Compact Flash2.3.2.1 Generating SysACE booting file2.3.2.2 Filling the compact flash
2.3.2.2.1 Troubleshooting2.3.2.3 Flashing the kernel and the root filesystem2.3.2.4 First test boot2.3.2.5 Troubleshooting2.3.2.6 Booting
3 Compiling applications for MicroBlaze: Evelin SDK3.1 Writing an application
3.1.1 The source code3.1.2 Compiling the application3.1.3 Running the application
3.1.3.1 On the host system
3.1.3.2 On the Microblaze3.1.4 Debugging the application
3.1.4.1 On the host system3.2 Using Eclipse
3.2.1 Creating the project3.2.2 Modifying the sources3.2.3 Running the application
3.2.3.1 On the host system3.2.3.2 On the MicroBlaze
3.2.4 Debugging the application3.2.4.1 On the host system
4 Connecting to the Xilinx EDK4.1 User permission troubleshooting
General InformationDefinitions and acronyms
BSP systemBSP stands for "Board Support Package"The BSP system is the system where the BSP is installed i.e., the MicroBlaze
DTCDevice Tree Compiler: to compile the hardware architecture in a form suitable for the Linux kernel
EDKEmbedded Design Kit i.e., the 'EDK and Platform Studio' for Microblaze provided by Xilinx
EDK systemThe machine where the EDK is installed
Evelin BSPThe Linux distribution made by Evidence and running on the MicroBlaze
Evelin SDKSDK stands for "Software Development Kit"Evelin SDK is the development environment made by Evidence to compile the Evelin BSP and to create applications. Itis installed inside the virtual machine.
FDTFlat Device Tree; a compact description of the hardware architecture (used by the Linux kernel to find the resources).
The virtual machine
The Evelin SDK and the sources of Evelin BSP for Xilinx Microblaze are available as a virtual machine provided byEvidence. This virtual machine contains a Ubuntu 10.04 LTS 32bits Linux distribution.
The current version of the virtual machine can be downloaded at the following URL:
Note: the virtual machine can be run using VirtualBox (free) or VMPlayer (free for not commercial use). These two virtualmachine players are available for several systems (Windows, Linux and Mac OS included).
The virtual machine contains:
The development environment on host, called Evelin SDK:A Microblaze gcc crosscompiler (C, C++)Some fundamental libraries (e.g., libc, libstdc++)A Microblaze software debuggerSome additional Microblaze tools (to use with binary files)A DTC compilerThe QEMU emulator for MicroblazeScratchbox2 for MicroblazeEclipse (with wizards to compile/debug Microblaze code)
The embedded Linux distribution for Microblaze, called Evelin BSP:The UBoot bootloaderThe Linux kernel with driversThe root filesystem for the board with some unix daemonsAn integration systemA FPGA reference design
Note: due to license constraints, the virtual machine does not contain the Xilinx tools (which are needed to synthesize theFPGA design and to change the FPGA design).
Note: the software has been tested using Xilinx EDK 12.1 and a Virtex 6 FPGA on a Xilinx ML605 board.
Accounts
The account available on the virtual machine is the following:
system name evelinbspuser name useruser password user
You can get 'root' permissions by using the sudo command.
Location of main directories
The home directory of 'user'/home/user
Evelin SDK/home/user/evedk
Evelin BSP/home/user/evsdk/workspace/evelinbsp
The FPGA reference design/home/user/era_hw_reference_project
A Eclipse example/home/user/evsdk/workspace/microblaze_test_2
Running Linux on Microblaze: Evelin BSPEvelin BSP is the name of the Linux distribution for the MicroBlaze. The distribution (AKA the "firmware") consists ofbootloader UBoot, kernel image uImage and filesystem. The distribution is provided both as sources and as precompiledbinaries. This Section explains both ways of running the Linux distribution.
Keep in mind that the UBoot bootloader and the Linux kernel running on MicroBlaze must be aligned with the hardwaredesign synthetized on the FPGA. Therefore, if you change the hardware design, you will likely have also to configure, buildand flash a new firmware on the platform.
Using precompiled Linux distribution
Getting the Linux distribution
The precompiled binaries of the Linux distribution are available under the /home/user/Desktop/precompiled_binariesdirectory of the virtual machine.
Flashing and running the Linux distribution
Follow the Evelin instructions (http://server.eraproject.org:8080/wiki/images/1/12/Evelinbsprun.txt) :
Instructions about how to flash default images of the Evelin Linux distributionon the Xilinx Virtex6 FPGA.
1. Take the images of the Linux distribution (e.g., those inside the /home/user/Desktop/precompiled_binaries/ directory of the vmware image) and put them on the machine where you have Xilinx tools installed
2. On the machine with the Xilinx tools installed:
2.3 Click on Device Configuration -> Download Bitstream
Wait "Done!"
(If it has problems, disconnect and reconnect the USB cables and try again.)
2.4 Click on Debug -> Launch_XMD to run the gdb console
2.5 On a Linux console, launch "kermit -c" (or minicom, if you prefer)
Note: the serial console must be set to 9600 8N1 - no flow control 2.6 On the gdb console (i.e., xmd) type:
cd <directory containing images>
dow u-boot.bin
dow -data xilinx.dtb 0xb2000000
dow -data uImage 0xb3000000
Only the first time, to flash the filesystem: dow -data rootfs.jffs2 0xb8000000
run
2.7 On the Linux console you will see U-Boot booting. Stop the boot by pressing a key, and type
Only the first time, to flash the filesystem: erase nor0,4 cp.b 0xb8000000 0x9c560000 0x840000
bootm 0xb3000000 - 0xb2000000
2.8 Once the system is booted, only the first time, run
mdev -s
There are not passwords into the system; and there are no users except the root user (with password root).
Customized Linux distribution
Configuring the Linux distribution
Run a shell on the virtual machine, enter the evelibbsp directory and type the command sb2 make menuconfig:
user@evelinbsp:~$ cd ev-sdk/workspace/evelin-bsp/user@evelinbsp:~/ev-sdk/workspace/evelin-bsp$ sb2 make menuconfig
The following screen will appear:
Configuration of the target
Enter the "Vendor/Productselection". The following screen will appear:
Select:
Vendor: MicroblazeProduct: Generic
In the hardware design field, you can insert the absolute path of the directory containing your specific Xilinx design (or leaveit as it is to use the default design).
Busybox configuration
In the main menu, enter the "busybox configuration" menu. The following window will appear:
This menu allows to choose between a default busybox configuration and a custom busybox configuration. In case a customconfiguration is chosen, the busybox menu configuration will be automatically launched when exiting from the menù, and thefollowing menù will appear:
Kernel configuration
In the main menu, enter the "kernel configuration" menu. The following window will appear:
This menu allows to choose between a default kernel configuration or a custom kernel configuration. In case a customconfiguration is chosen, the kernel menù configuration will be automatically launched when exiting from the menù, and thefollowing menù will appear:
Remember however that the 'Platform options' are overriden with values from the hardware design (so, it is useless modifythem).
Note: if you change the resources used by the RS232 uart you must change the linux boot parameters in the same way; thechosen section of the .dts file must contain a line similar to linux,stdoutpath = "/plb@0/serial@84000000"; this line tells thekernel the location of the serial port used by the console. You can use the EDK to make the modification.
Compiling the Linux distribution
To compile the kernel, uboot and to generate the rootfs type the command sb2 make.
At the end of the compilation, the directory ~/evsdk/workspace/evelinbsp/images will contain the following files:
1. uImage: the Linux kernel2. uboot.bin: the uboot boot loader3. rootfs.jffs2: the root filesystem (a JFFS2 filesystem)4. xilinx.dtb: the FDT in a binary form5. xilinx.dts: the FDT in a readable form
UBoot is configured to be loaded at address 0xb1000000; the Linux kernel at address 0xb0000000 (the start of the RAMsynthesized into the hardware design); the rootfs usually resides on the 4th partition of the board flash memory.
Flashing and running the Linux distribution
Follow the Section (http://server.eraproject.org:8080/wiki/index.php/Linux_Distribution_For_Xilinx_MicroBlaze#Flashing_and_running_the_Linux_distribution).
The configuration of uboot and Linux is changed automatically to reflect the change that arevmade in the hardware design.The file xparameters.h is used to make this changes visible for Linux. However, if needed you can manually change theconfiguration.
Note: if you change the hardware design (and generate a new xparameters.h) your manually modification are lost (i.e.overwritten) when you rebuild the system.
After you have modified the configuration file you can rebuild the kernel using:
user@evelinbsp:~/ev-sdk/workspace/evelin-bsp$ rm images/.evelin_done_linuxuser@evelinbsp:~/ev-sdk/workspace/evelin-bsp$ sb2 make linuxMakefile:31: include dot config "linux/linux-2.6.37-microblaze"Start building Linux...if [ ! -f linux/linux-2.6.37-microblaze/.config ]; then \ echo "ERROR: Linux .config file not found"; \ echo "Please run make menuconfig"; \ exit 1; \ fi[ -d /home/user/ev-sdk/workspace/evelin-bsp/images ] || mkdir /home/user/ev-sdk/workspace/evelin-bsp/images........
and for uboot:
user@evelinbsp:~/ev-sdk/workspace/evelin-bsp$ rm images/.evelin_done_ubootuser@evelinbsp:~/ev-sdk/workspace/evelin-bsp$ sb2 make u-boot........
Note: the following pathnames are relative to the BSP installation path (usually /home/user/evsdk/workspace/evelibbsp).
UBoot configuration file
The file boot/uboot/ubootmicroblaze/board/xilinx/microblazegeneric/config.mk contains:
CONFIG_SYS_TEXT_BASEthe address where the uboot must be load (usually 0xB1000000)
Linux kernel configuration file
The file linux/linux2.6.37microblaze/.config contains:
CONFIG_KERNEL_BASE_ADDRthe address where the linux kernel must be load (usually 0XB0000000)
CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTRmust be 1 if the Microblaze cpu has the MSR instruction
CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTRmust be 1 if the Microblaze cpu has the PCMP instuction
CONFIG_XILINX_MICROBLAZE0_USE_BARRELmust be 1 if the barrel can be used
CONFIG_XILINX_MICROBLAZE0_USE_DIVmust be 1 if the DIV instruction can be used
CONFIG_XILINX_MICROBLAZE0_USE_HW_MULis the type of hardware used for the MUL/DIV instructions (see Microblaze documentation)
CONFIG_XILINX_MICROBLAZE0_USE_FPUmust be 1 if is present a FPU
CONFIG_XILINX_MICROBLAZE0_HW_VERthe hardware version (usually, for Virtex6, "8.10.a")
CONFIG_XILINX_MICROBLAZE0_FAMILYthe Microblaze family (usually an empty string)
Boot from Compact Flash
Generating SysACE booting file
We use the SysACE compact flash to load the bitstream and UBoot onto the board. An ACE file must be generated.
The directory ~/evsdk/workspace/evelinbsp/images contains:
booting.ace: the ACE file
Filling the compact flash
The Compact Flash must be partitioned, formatted and filled. The first two operation should be executed only the first time.The last operation should be executed whenever the hardware bitstream or UBoot are changed.
Partitioning: the first partition is the SysACE partition.
michael@panicking:~/evelin-bsp$ sudo fdisk /dev/sdfGNU Fdisk 1.2.4Copyright (C) 1998 - 2006 Free Software Foundation, Inc.This program is free software, covered by the GNU General Public License.
This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See theGNU General Public License for more details.
Using /dev/sdfCommand (m for help): p
Disk /dev/sdf: 512 MB, 512483328 bytes16 heads, 63 sectors/track, 993 cylindersUnits = cylinders of 1008 * 512 = 516096 bytes
Device Boot Start End Blocks Id System /dev/sdf1 * 1 993 500440 6 FAT16Command (m for help): w Information: Don't forget to update /etc/fstab, if necessary.
Writing all changes to /dev/sdf.
Note: this is only an example. Use the correct device and the correct commands.
Formatting: The first partition must be formatted using FAT16 with 0 hidden sectors, 1 reserved sector, 2 FAT, with morethan 1 sector for cluster and without alignment.
Copying the file: never put more than one ACE file into a directory; the ACE file of the root directory in loaded during theboot (unless using a more complex directory layout).
michael@panicking:~/evelin-bsp$ sudo mount -t auto /dev/sdf1 /mntmichael@panicking:~/evelin-bsp$ sudo cp images/booting.ace /mntmichael@panicking:~/evelin-bsp$ sudo umount /mnt
Insert the Compact Flash into your board and switch it on. A green led (labelled 'system ace status led') will blink for a shorttime. The bitstream, that contains the hardware design, has been loaded into the FPGA.
Troubleshooting
When something went wrong, a red led lights.
Check the 'sace mode' dip switch bank: the 'SysAce mode' must be on. Your compact flash must not exceed 2GB. Only thefirst partition is used and there must be a FAT16 filesystem with more than 1 block for cluster.
Flashing the kernel and the root filesystem
The era_hw_reference_project contains RAM memory and Flash memory.
We use the 'xmd' tools to transfer all to the board (from the EDK system). The transfer can take a long time.
michael@panicking:~$ cd evelin-bsp/images/michael@panicking:~/evelin-bsp/images$ xmdXilinx Microprocessor Debugger (XMD) EngineXilinx EDK 12.1 Build EDK_MS1.53dCopyright (c) 1995-2009 Xilinx, Inc. All rights reserved.
XMD% connect mb mdm
JTAG chain configuration--------------------------------------------------Device ID Code IR Length Part Name 1 0a001093 8 System_ACE_CF 2 24250093 10 XC6VLX240T
MicroBlaze Processor Configuration :-------------------------------------Version............................7.30.aOptimization.......................PerformanceInterconnect.......................PLBv46MMU Type...........................Full_MMUNo of PC Breakpoints...............1No of Read Addr/Data Watchpoints...0No of Write Addr/Data Watchpoints..0Instruction Cache Support..........onInstruction Cache Base Address.....0xb0000000Instruction Cache High Address.....0xbfffffffData Cache Support.................onData Cache Base Address............0xb0000000Data Cache High Address............0xbfffffffExceptions Support................onFPU Support.......................offHard Divider Support...............onHard Multiplier Support............on - (Mul64)Barrel Shifter Support.............onMSR clr/set Instruction Support....onCompare Instruction Support........onPVR Supported......................onPVR Configuration Type.............FullData Cache Write-back Support......off
Connected to "mb" target. id = 0Starting GDB server for "mb" target (id = 0) at TCP port no 1234XMD% lsace booting.ace rootfs.jffs2 u-boot.bin uImage xilinx.dtb xilinx.dtsXMD% dow -data xilinx.dtb 0xb2000000Downloading Data File -- xilinx.dtb at 0xb2000000
XMD% dow -data uImage 0xb3000000Downloading Data File -- uImage at 0xb3000000
XMD% dow -data rootfs.jffs2 0xb8000000Downloading Data File -- rootfs.jffs2 at 0xb8000000
XMD% stopXMD% rwr pc 0xb1000000XMD% con
RUNNING> XMD%
UBoot is not dowloaded to the RAM because it is already loaded by the SysACE.
If you have a terminal emulator connected to the board you should see the system running.
You must stop the autoboot pressing a key because the board flash is empty.
michael@panicking:~$ kermit -cConnecting to /dev/ttyUSB0, speed 9600 Escape character: Ctrl-\ (ASCII 28, FS): enabledType the escape character followed by C to get back,or followed by ? to see other options.----------------------------------------------------SDRAM : Icache:ON Dcache:OFF U-Boot Start:0xb1000000FLASH: 32 MiBUsing default environment
Net: Xilinx_EmacliteMAC: 00:e0:0c:00:00:fdU-BOOT for evidence-mb
Hit any key to stop autoboot: 0 evidence-mb>
'evidencemb>' is the prompt of uboot visible from a serial line console. UBoot has been loaded from the SysACE compactflash and now is running. Now we can transfer the system into the flash memory. First of all the flash must be partitioned.
Sometimes the JTAG cable seems to not work ('ERROR: Failed to Open JTAG Cable'). Usually, it is sufficient to plug outand then plug in the USB connector.
Note: the numbers of the cp.b command must be hexadecimal.
Booting
All the components of the system are into the SysACE compact flash or into the board memory flash. There is a little bug thatprevents the board to auto boot. You must use a script to run the uboot from the board:
1. switch on the board2. run the "run_uboot.sh" script (the script is located into the evelinbsp directory)
Note: the script needs to use the JTAG cable so you must not have another program using it and you must run the script fromthe EDK system. You can see all the booting process from the serial console. You have 3 seconds to stop the ubootautomatic boot (if you want or need).
michael@panicking:~/evelin-bsp$ ./run_u-boot.sh michael@panicking:~/evelin-bsp$ kermit -cConnecting to /dev/ttyUSB0, speed 9600 Escape character: Ctrl-\ (ASCII 28, FS): enabledType the escape character followed by C to get back,or followed by ? to see other options.----------------------------------------------------SDRAM : Icache:ON Dcache:OFF U-Boot Start:0xb1000000FLASH: 32 MiBUsing default environment
Net: Xilinx_EmacliteMAC: 00:e0:0c:00:00:fdU-BOOT for evidence-mb
Hit any key to stop autoboot: 0 ## Booting kernel from Legacy Image at 9c160000 ... Image Name: Linux-2.6.37-00717-ga7ace98 Image Type: MicroBlaze Linux Kernel Image (uncompressed) Data Size: 3026948 Bytes = 2.9 MiB Load Address: b0000000 Entry Point: b0000000 Verifying Checksum ... OK## Flattened Device Tree blob at 9c140000 Booting using the fdt blob at 0x9c140000 Loading Kernel Image ... OKOKearly_printk_console is enabled at 0x84000000Ramdisk addr 0x00000003, FDT at 0x9c140000 Linux version 2.6.37-00717-ga7ace98 (user@evelinbsp) (gcc version 4.1.2) #27 Mon May 30 08:51:54 PDT 2011setup_cpuinfo: initialising........................NET: Registered protocol family 1wVFS: Mounted root (jffs2 filesystem) on device 31:4.Freeing unused kernel memory: 96k freedStarting rcS...++ Creating device points++ Mounting filesystem++ Loading system loggers++ Starting networkudhcpc (v1.18.4) startedSending discover...PHY: c000ba40:07 - Link is DownPHY: c000ba40:07 - Link is Up - 100/FullSending discover...Sending select for 192.168.97.187...Lease of 192.168.97.187 obtained, lease time 345600adding dns 192.168.97.1++ Starting telnet daemon++ Starting ftpd daemonrcS Complete/bin/sh: can't access tty; job control turned off/ #
Compiling applications for MicroBlaze: Evelin SDKEvelin SDK is the development environment made by Evidence. It to compile the Evelin BSP Linux distribution, theSupervisor and other applications for the MicroBlaze. This development environment is already installed inside the virtualmachine provided by Evidence.
This section contains two examples showing how to write an application with the integrated development environment(Eclipse) and without.
Writing an application
This example of application computes the Fibonacci's sequence numbers.
The source code
First of all, build the directory structure:
user@evelinbsp:~$ cd ev-sdk/workspace/user@evelinbsp:~/ev-sdk/workspace$ mkdir fibonacciuser@evelinbsp:~/ev-sdk/workspace$ cd fibonacci/user@evelinbsp:~/ev-sdk/workspace/fibonacci$ mkdir src
Then, use an editor (vi, emacs, gedit, etc.) to write the src/fibonacci.c file:
/* * Made using Evelin SDk for Microblaze * Evidence Srl --- <[email protected]> */
First, switch on the board and start the startup script (as described in #Booting). Then, transfer the executable using ftp andstart the application using a telnet client:
user@evelinbsp:~/ev-sdk/workspace/fibonacci$ ftp mbboardConnected to mbboard.priv.mgsi.eu.220 Operation successfulName (mbboard:user): 230 Operation successfulRemote system type is UNIX.Using binary mode to transfer files.ftp> put fibonaccilocal: fibonacci remote: fibonacci200 Operation successful150 Ok to send data226 Operation successful9357 bytes sent in 0.00 secs (19525.0 kB/s)ftp> exit221 Operation successfuluser@evelinbsp:~/ev-sdk/workspace/fibonacci$ telnet mbboardTrying 192.168.97.187...Connected to mbboard.priv.mgsi.eu.Escape character is ']'.
Note: the evelinbsp prompt does not appear, the application is waiting for gdb commands.
Then, use a another terminal to start the debugger:
user@evelinbsp:~/ev-sdk/workspace/first_microblaze_test$ mb-linux-gdbGNU gdb (GDB) 7.2Copyright (C) 2010 Free Software Foundation, Inc.License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>This is free software: you are free to change and redistribute it.There is NO WARRANTY, to the extent permitted by law. Type "show copying"and "show warranty" for details.This GDB was configured as "--host=i686-pc-linux-gnu --target=microblaze-unknown-linux-gnu".For bug reporting instructions, please see:<http://www.gnu.org/software/gdb/bugs/>.(gdb)
Note: the prompt of gdb is '(gdb) ',
Select the target to be run and load the symbols:
(gdb) target remote localhost:1234Remote debugging using localhost:1234[New Remote target][Switching to Remote target]0x10000100 in ?? ()(gdb) file ./mainA program is being debugged already.Are you sure you want to change the file? (y or n) yReading symbols from /home/user/ev-sdk/workspace/first_microblaze_test/main...done.(gdb)
Start debugging your program. For example, you can set a breakpoint at line 16 of the main source file:
(gdb) list3 * by Evidence Srl --- <[email protected]>4 */5 6 #include <stdio.h>7 #include <stdlib.h>8 9 10 int main()11 12 const char* s = "Made using Evelin SDK";(gdb) list13 int n;14 15 n = puts(s);16 fflush(stdout);17 18 printf("Hello world!\n");19 20 return 0;21 22 (gdb) break 16Breakpoint 1 at 0x1000028c: file src/main.c, line 16.(gdb) info breakNum Type Disp Enb Address What1 breakpoint keep y 0x1000028c in main at src/main.c:16(gdb)
You can run the application and see the values of some variables:
Now you can start the debugger by clicking the Debug button. Eclipse will switch to a new perspective (a visual container ofwindows). The application is started and run until the main() function is reached.
To set a breakpoint you must go to the line of the source window and press CTRLALTB. For example we set a breakpoint tothe line 16 and then we continue the execution of the application pressing F8.
Note: In Eclipse you can use keyboard shortcut or the menu system to execute commands.
You can see into the Variables window the values of the two variable of the main() function. To resume the application presskey F8.
The application is terminated. The Console window shows the output of the program.
Connecting to the Xilinx EDKIn some cases you may need to use some tools provided by the Xilinx EDK environment. These tools cannot be distributedinside the virtual machine because they are subject to licensing by Xlinix. Therefore, you have two possible solutions:
1. Install the EDK inside the evelinbsp system using your own license purchased by Xilinx2. Install the EDK on a different Linux system and connect it to the virtual machine.
We will show how to use the second method. The setup needs to be done only once. To use this method you must setup thesystem of the EDK to access the evelinbsp system. In the following example the system containing the EDK is calledpanicking (the user is called michael).
Evelinbsp exports, through the NFS filesystem, the directory /home/user/evsdk/workspace/evelinbsp and/home/user/era_hw_reference_project. You must import them into the EDK system and create a link for the 'user' into yourhome, as shown in the following example:
michael@panicking:~$ mkdir evelinbsp michael@panicking:~$ mkdir era_hw_reference_project michael@panicking:~$sudo su [sudo] password for michael: root@panicking:/home/michael# vi /etc/fstab root@panicking:/home/michael# mount aroot@panicking:/home# cd .. root@panicking:/home# ln s michael user root@panicking:/home# exit michael@panicking:~$These are the lines that must be added to the /etc/fstab file:
If you are in trouble accessing files of evelinbsp from your EDK system you can try to modify the pid and gid of evelinbsp(the BSP system):
1. find the pid and gid of your user into the EDK system (from files /etc/passwd and /etc/group)2. change the gid of the group 'user' into the BSP system to match the gid of the EDK system using sudo groupmod gNEW_GID user
3. change the uid of the user 'user' into the BSP system to match the uid of the EDK system using the comand sudousermod g NEW_GID u NEW_UID
Retrieved from "http://server.eraproject.org:8080/wiki/index.php/Linux_Distribution_For_Xilinx_MicroBlaze"
This page was last modified on 4 July 2013, at 07:38.