[zynq] Xilinx SDK设计流程分析 2016.2V

来源:互联网 发布:大数据 可视化 编辑:程序博客网 时间:2024/06/06 08:29
File -> Export -> Export Hardware  ##先从Vivado产生几个硬件描述文件:
design_1_wrapper.bit
design_1_wrapper.mmi
ps7_init.c ps7_init.h ps7_init.tcl
system.hdf

SDK uses theHardware Description file to detect the processor(s) and memory-mapped peripherals present in the hardware.

The FPGA bitstream programs an FPGA device with the hardware created by the hardware designer.

The BMM file is a description of the internal memories used in the hardware description. It fills in the internal block RAM as necessary with a program or data.

  • A Hardware Description file in an XML format
  • An FPGA Bitstream corresponding to the Hardware Description
  • Block RAM Memory Map (BMM) file corresponding to the Bitstream
  • Zynq®-7000 AP SoC Initialization Files
    • ps7_init.tcl file. This is the pre-initialization file that is to be sourced and executed before any application is downloaded onto the target. this tcl contains the clock, pll and ddr initialization code.
    • ps7_init.c/.h files. These files are the C-equivalent files for the ps7_init.tcl file. The ps7_init.c and .h files are used during the FSBL application project creation.
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


File -> Launch SDK  ##打开SDK,发现HDF配置已经做好
新建两个Applicaion Project:用户的C-Application和FSBL(FSBL必须是单独的文件)
File -> New -> Application Project -> my_app -> Hello World
File -> New -> Application Project -> my_fsbl -> Zynq FSBL


SDK在创建Project后,会自动将Temple和Libraries导进来,同时关联上GCC编译器以及标准库。
GNU compiler collection (GCC)  注意GCC不仅仅指GUN C Compiler,同时还有许多其他组件的合集。
• The Vivado GNU tools support both the C and C++ languages
• The MicroBlaze GNU tools include mb-gcc and mb-g++ compilers, mb-as assembler andmb-ld linker.
• The Cortex A9 ARM processor tools include arm-xilinx-eabi-gcc and arm-xilinx-eabi-g++ compilers, 
arm-xilinx-eabi-as assembler, arm-xilinx-eabi-ld linker.
• The toolchains also include the C, Math, GCC, and C++ standard libraries.


SDKautomatically performs the following actions. Configuration options can also be provided for these steps.

  1. SDK builds theboard support package. This is sometimes called a software platform.
  2. SDKcompiles the application software using a platform-specific gcc/g++ compiler.
  3. Theobject files from the application and the Board Support Package arelinked together to form thefinal executable. This step is performed by a linker which takes as input a set of object files and a linker script that specifies where object files should be placed in memory.

Compilation of source files into object files is controlled usingMakefiles. With SDK, there are two possible options for Makefiles:

  • Managed Make: For Managed Make projects, SDK automatically creates Makefiles. Makefiles created by SDK typicallycompile the sources into object files, and finallylink the different object files into anexecutable. In most cases, managed make simply eliminates the job of writing Makefiles. This is the suggested option.
  • Standard Make: If you want ultimate control over the compilation process, use standard make projects. In this case, you must manually write a Makefile with steps to compile and link an application. Using the Standard Make flow hides a number of dependencies from SDK, so you must follow manual steps for other tasks such as debugging or running the application from within SDK. Therefore, the Standard Make flow is not recommended for general use. 

The primary purpose of a linker script is to describe thememory layout of the target machine, and specify whereeach section of the program should be placed in memory.   ##打开lscript.ld可以看到FSBL镜像到OCM低地址 用户程序镜像到DDR首地址

Executable and Linkable Format (ELF) file    my_app.elf和my_fsbl.elf

##Application建立后,
1、SDK自动关联BSP和GCC标准库;
2、自动生成Makfiles文件,即由GCC编译成object文件,然后用Link Script把多个.o文件关联成.elf可执行文件
--------------------------------------------------------------------------------------------------------------------------------------------------------------


在my_app上右击 --> Create Boot Image  ##产生my_app.bif和BOOT.bin文件

The utility is driven by a configuration file known as the Boot Image Format (BIF) file, with a file extension of *.bif. The BIF file lists the input files to the boot image, along with optional attributes for addressing and optional encryption, authentication or checksums.

Select the partition type:
bootloader - This specifies the partition is a boot loader like FSBL. This is the first partition in any boot image.
•init - This specifies that the partition is a register initialization file. This is required to set up some register values to access the hardware.
bootimage - This specifies that partition is an already encrypted or signed partition.
datafile - This specifies that the partition is a normal partition like an application, bit stream, or u-boot.

  • The specified data should be a maximum of 76 bytes (for Zynq) and 40 bytes (Zynq UltraScale+ MPSoC).
  • The specified data will take an offset of 0x4c (for Zynq) and 0x70 (for Zynq UltraScale+ MPSoC) in the bootimage. 

##把几个可执行文件list出来,然后生成二进制BOOT.bin文件 (包含my_app.elf  my_fsbl.elf  design_1_wrapper.bit)

--------------------------------------------------------------------------------------------------------------------------------------------------------------


##把BIN文件放到SD或NOR中,配置启动方式,系统启动过程:
When the processor comes out ofreset in case of Zynq, the control is withBootROM, whichcopies the FSBL from the flash to the on chip memory andhands over the control to it. The FSBL starts executing, which then copies the bitstream from flash andconfigures the PL.Once the PL is configured, the FSBLcopies the next partition, say, an application from the flash to DDR, andhands over the control to the application. The application starts executing. In order to load the Linux, U-boot can be used as one more partition.

--------------------------------------------------------------------------------------------------------------------------------------------------------------

A board support package (BSP) is a collection of libraries and drivers that will form the lowest layer of your application software stack. 

SDK includes the following two board support packages for application development:

  • Standalone - A simple, semi-hosted, and single-threaded environment that provides basic features such as standard input/output and access to processor hardware features
  • Xilkernel - A simple and lightweight kernel that provides POSIX style services such as scheduling, threads, synchronization, message passing, and timers
  • Build (e.g. make).
  • Compile (e.g. gcc).
  • Debug (e.g. gdb).

--------------------------------------------------------------------------------------------------------------------------------------------------------------

Xilinx Software Development Kit (SDK) User Guide 
ug940-vivado-tutorial-embedded-design    //详细的设计调试过程

--------------------------------------------------------------------------------------------------------------------------------------------------------------





0 0
原创粉丝点击