Petalinux board bringup
Our design fulfills all these requirements.
Configure software settings and bootloader
After designing the hardware system, it is necessary to configure a PetaLinux BSP for the platform. This is required to automate the PetaLinux board bringup. We will use Xilinx SDK to setup the PetaLinux Board Support Package (BSP) and the First Stage BootLoader (FSBL).
Launching Xilinx SDK
Add PetaLinux SDK repositories
To add PetaLinux SDK repository select from the top menu:
Click the New button and browse to the directory: /opt/PetaLinux/petalinux-v2013.10-final/components/edk_user_repository
Click OK to finish adding local repositories.
Create Zynq FSBL
See part 40 for a decription on how to add the first stage bootloader program.
Create PetaLinux BSP
We will create the BSP and configure it for U-boot and the Linux operating system.
1. Select from the top menu:
File->New->Project and select the Board Support Package wizard.
Click Next. The New Board Support Package Project window appears. Select PetaLinux as BSP OS.
Click Finish and wait for settings window to open.
Select Petalinux from the left sidebar.
Change the settings for:
Click OK to finish the PetaLinux BSP setup. The directories fsbl_0 and petalinux_bsp_0 have been added to our workspace.
Create a new PetaLinux platform
The next step is to create a new PetaLinux SDK software platform, ready for building a Linux system customized to our new hardware platform. The petalinux-create command is used to achieve this:
-> petalinux-create --type project --template <CPU_TYPE> --name <PROJECT_NAME>
CPU_TYPE (zynq or microblaze)
This command will create a new PetaLinux project folder from a default template. Later steps customize these settings to match the hardware project created previously. Here is the result:
Configure the software platform
The final step is to customize the software platform template to precisely match our unique hardware system. This is done by copying and merging the platform configuration files generated during the hardware build phase, into the newly created software platform, as described below:
1. Navigate to appropriate directory before using the petalinux-config command. In general the XSDK BSP directory is for example: "<XSDK workspace directory>/petalinux_bsp_0/"
2. Use the petalinux-config command to import the hardware configuration.
-> cd .../workspace/petalinux_bsp_0
The -p option points to the PetaLinux project that will be updated to match the hardware platform configurations. This step may take a few minutes to complete. This is because it merges the existing platform configuration to Kernel configuration and enables the appropriated drivers in the Kernel configuration.
This tool generates the hardware configuration files, if required and copies the configuration files to the correct location in our project directory. The configuration files are stored in the directory: PetaZed/subsystem/linux/hw-description
3. Change into the PetaLinux project root:
-> cd .../PetaZed
4. Launch the top level system settings configuration menu. Change the boot device to SD card.
5. Launch the Linux kernel configuration menu. No changes made now.
-> petalinux-config -c kernel
5. Launch the rootfs configuration menu. No changes made now.
Build the system image
Run petalinux-build to build the system image:
The compilation log: build.log is stored in the build directory. The result of the build can be found in the images/linux directory.
Generate BOOT.BIN image
Use this command to generate the boot image:
-> petalinux-package --boot --fsbl <FSBL image> --fpga <FPGA bitstream> --uboot
The FSBL image file and the bitstream files can be found here:
Boot system image on the ZedBoard
We will boot from SD card.
1. Copy the files BOOT.BIN and image.ub to the SD card
2. Insert the SD card into the ZedBoard.
3. Set the jumpers to SD boot
4. Connect a terminal
5. Power up the board.
Our Linux image will boot in a few seconds.
Running the LED_Dimmer application
We can not run the bare-metal LED_Dimmer application program inside the PetaLinux OS. We have to rewrite it to use direct memory accesses. Let's find out how to do it. We will start by studying the GPIO documentation. Here is the GPIO register map:
We find the GPIO base address in the PetaZed/hw-description/xparameters.h file
#define XILINX_GPIO_BASEADDR 0x41200000
Using the peek/poke program
Using the poke command we can write to any memory/register location in the Zynq address map. We can use this command to turn on/off the LEDs and set the dimming factor.
Writing Linux device drivers
I wrote a blog entry about this subject a few years ago. It is still valid. Let's study the poke.c source code, found in the directory: /opt/Petalinux/petalinux-v2013.10-final/components/apps to get some ideas.
Userspace access via /dev/mem
is a virtual file representing the memory map of the whole system. To
access the device from user space, we can open "/dev/mem", and then use
mmap() to map the device to memory, and then we can access the device by
using the pointer which points to the mapped memory. Here are some of
OK for prototyping, not recommended for production
Here is a version of LED_Dimmer.c we can run in PetaLinux. To use it:
Top Previous Next
June 7, 2014 03:25 PM PDT
I had exactly the same problem, this fixed it for me:
June 5, 2014 07:21 PM PDT
Hi, when I'm trying to create a BSP for Petalinux under Vivado 2014.1 and Petalinux 2013.10 I just get "Error generating bsp sources : Failed to generate BSP in the log files and as a message.
Any idea about this issue ?
The repository path is correctly set !
|Leave a Comment:|