Amp-zynq
Amp-zynq copied to clipboard
Simple AMP Running Linux and Bare-Metal System on Both Zynq SoC Processors
Zynq AMP Mode
Note : This design refers to xapp1078 and xapp1079.
Summery###
Simple AMP
Running Linux and Bare-Metal System on Both Zynq SoC Processors
CPU0 runs linux ; CPU1 runs standalone code to blink a led.
And every CPU can communicate with the other through shared memory.
Lab info
-
Vivado : 2015.2
-
Linux kernel : 2014.4
-
Rootfs : linaro
-
U-boot : 2015.01
-
Board : ZYBO
Work flow##
###Build hardware project###
- Download the zip and extract it
- Open
vivado 2015.2tcl console ,then go into<your path>/hardware_prj - Run
source ./system_pro.tcl - Waitting for bitstream ... then it's ok !
###SDK work###
- Open the implemented design (necessary to export bitfile to SDK)
- Export the design and bitstream to SDK and launch SDK. Once SDK opens, a hardware platform project will have been created automatically
- Select
Xilinx_Tools->Repositories.Beside theLocal Repositories, selectNewBrowseto and select<your path>/src/sdk_repo, select OK - Create the FSBL project
- Select
File->New->Application_Project - Enter the project name
amp_fsbland select Next - Select the template
Zynq FSBLthen select Finish - Verify the FSBL BSP is using standalone from thelocal repository: After FSBL builds, right click on the
fsbl_bspproject and selectBoard Support Package SettingsIn the Overview window, verify the OS Version is5.19.
- Select
- Create the BSP for CPU1
- Select
File->New->Board_Support_Package - Enter the project name
app_cpu1_bsp, change CPU tops7_cortexa9_1. - Select Finish
- In the
Board Support Package SettingsSelectOverview->drivers->ps7_cortexa9_1and change theextra_compiler_flagsvalue to contain-g -DUSE_AMP=1 - Select OK
- Open
app_cpu1_bsp/ps7_cortexa9_1/libsrc/standalone_v5_19/src/xil-crt0.sdelete this commandbl XTime_SetTime
- Select
- Create the Application that will run on CPU1
- Select
File->New->Application_Project - Enter the project name
app_cpu1 - Change Processor to
ps7_cortexa9_1 - Change
Board Support PackagetoUse existingapp_cpu1_bspand select Next - Select the template
Empty Applicationthen select Finish. - Import the C and linkerscript file for
app_cpu1. Right click onapp_cpu1/srcand selectImport,SelectGeneral->File_Systemthen selectFrom directory, browse to and select<your path>/src/cpu1_app/src,select bothapp_cpu1.candlscript.ldthen select Finish. Answer Yes to overwrite lscript.ld
- Select
- Create BOOT.BIN
- From SDK, open a command window by selecting
Xilinx_Tools->Launch_Shell - In the shell, cd to
<your path>/src/bootgen - After all files added (amp_fsbl.elf,*.bit,u-boot.elf,app_cpu1.elf) Run bootgen by executing the batch file
createBoot.bat - Note: You can use
Creat Zynq BootimageGUI to achieve that ,too.
- From SDK, open a command window by selecting
###Linux work###
ZYBO has 512MB of Ram so 384MB was chosen to be used by CPU0 to run Linux and the remaining 128MB was left for CPU1. This means we need to modify the device tree source and u-boot file.
- Devicetree
- Add
mem=384M maxcpus=1in the bootargs - Modify the memory reg to
reg = <0x0 0x18000000> - Compile the devicetree
- Add
- u-boot
- Modify the source of u-boot. Open
u-boot/include/configs/zynq_zybo.h, modifyCONFIG_SYS_SDRAM_SIZEto(384 * 1024 * 1024) - Compile the u-boot
- Modify the source of u-boot. Open
###Working with the design###
- Copy BOOT.bin,uImage,devicetree.dtb and
<your path>/src/tool/devmemto SD card. - Power up the board
- Run
mount /dev/mmcblk0p1 /mnt/when linux is up. - Run
cd /mnt/devmem - Run
./devmem 0xfffffff0 w 0x18000000after this command ,you can see the led is blinking - Run
./devmem 0xFFFF8000 wrepeatedly, you can see the counter is bigger
- Run
Congratulations!
If you get some problems,please contact [email protected]
Best Regards!