Zynq 7000 starts from scratch and q7000 starts from scratch

Source: Internet
Author: User
Tags vivado

Zynq 7000 starts from scratch and q7000 starts from scratch
This article describes how to use PS gpio, which does not involve fpga. The software involves the creation of the first-level boot program fsbl and the creation of the app. The program runs in ddr.
The mio 50 pin of the z-turn board is connected to the key K1. The function of this experiment is to detect the key and print the corresponding information from the serial port.

1. Build a hardware model with vivado.
On the Re-mimize IP page of block design, click Presets-> Apply Configuration to go to The memtest. tcl hardware Configuration file exported in the previous chapter.
Click MIO configuration-> Expand GPIO, select gpio mio, and export the hardware parameters as gpio. tcl.
After integration, export the hardware parameters and start the SDK from vivado.

2. Edit the software in the SDK

2.1 create a level-1 Bootstrap program fsbl
File-> New-> Application. The parameters are as follows:

Click "Next" and select "buy q fsbl". "Finish". There are two more projects, fsbl and fsbl_bsp. Remember to change the SD card driver of fsbl_bsp to Version 2.2.

2.2 create an app Project
File-> New-> Application. The parameters are as follows:

Note: select the created fsbl_bsp for the Board Support Package. do not create a new one. Click Next-> select Hello World-> Finish.

2.3 modify source code
1>. added the fsbl printing information.
In the src directory of fsbl, modify the fsbl_debug.h file and add # define FSBL_DEBUG_INFO 1.
2>. Modify the helloworld. c file
# Include <stdio. h>
# Include "platform. h"
# Include "xgpiops. h"
# Include "pai_printf.h"

# Define GPIO_DEVICE_ID XPAR_XGPIOPS_0_DEVICE_ID
# Define kmeanpin 50

Int main ()
{
Int Status;
Int cnt = 0;
XGpioPs_Config * ConfigPtr;
XGpioPs Gpio;/* The driver instance for GPIO Device .*/

Init_platform ();

Print ("gpio test \ n \ r ");

/*
* Initialize the GPIO driver.
*/
ConfigPtr = XGpioPs_LookupConfig (GPIO_DEVICE_ID );
Status = XGpioPs_CfgInitialize (& Gpio, ConfigPtr,
ConfigPtr-> BaseAddr );
If (Status! = XST_SUCCESS ){
Print ("cfg init err \ n ");
Return XST_FAILURE;
}

// K1 GPIO Setting
XGpioPs_SetDirectionPin (& Gpio, kmeanpin, 0 );
XGpioPs_SetOutputEnablePin (& Gpio, kmeanpin, 0 );

While (1 ){
Status = XGpioPs_ReadPin (& Gpio, kmeanpin );
If (! Status ){
Pai_printf ("K1 Press % d \ n \ r", cnt ++ );
While (! XGpioPs_ReadPin (& Gpio, kmeanpin ));
}
}

Cleanup_platform ();
Return 0;
}


4. Generate BOOT. bin and download it to the z-turn board.

After compilation, right-click the fsbl Project in Project Explorer-> Create Boot Image.
Add gpio. elf:


When the CPU is powered on, fsbl is run first, and fsbl then copies the gpio code to ddr to run. You can see that the gpio program runs in ddr.

Copy the BOOT. bin in the gpio \ gpio. sdk \ fsbl \ bootimage \ folder to the SD card and insert it to the z-turn board. The following serial port information is displayed:

Xilinx First Stage Boot Loader
Release 2014.4 Jan 22 2015-11:39:25
Devcfg driver initialized
Silicon Version 3.1
Boot mode is SD
SD: rc = 0
SD Init Done
Flash Base Address: 0xE0100000
Reboot status register: 0x60600000
Multiboot Register: 0x0000C000
Image Start Address: 0x00000000
Partition Header Offset: 0x00000C80
Partition Count: 2
Partition Number: 1
Header Dump
Image Word Len: 0x00003003
Data Word Len: 0x00003003
Partition Word Len: 0x00003003
Load Addr: 0x00100000
Exec Addr: 0x00100000
Partition Start: 0x000055D0
Partition Attr: 0x00000010
Partition Checksum Offset: 0x00000000
Section Count: 0x00000001
Checksum: 0xFFDF17C5
Application
Handoff Address: 0x00100000
In FsblHookBeforeHandoff function
SUCCESSFUL_HANDOFF
FSBL Status = 0x1
Gpio test
K1 Press 0
K1 Press 1
K1 Press 2
K1 Press 3
K1 Press 4
K1 Press 5
K1 Press 6

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.