In this lab we will learn how to add a new software application to SDK based on examples with Hello World and Memory/Peripheral tests applications.
1. Start of development based on example code
Please launch Xilinx SDK and choose: File -> New -> Application Project. Please enter the project name and use exiting Standalone BSP.
When you press Next you will see a list of available templates. In this lab we will use a Empty Application template. By choosing other template like: Memory or Peripheral Tests we could easily create application to test hardware platform.
In project explorer you will able to see following folders:
- Hello_World - which contains sources of C application,
- standalone_bsp_0 - which contains board support package,
- ZynqHW - which contains ARM embedded hardware.
In Hello_World folder in folder src there is file: lscript.ld which is a default linker script. Now we will add a our own source file by selecting option New -> Source File from menu displayed after right-click on src folder. You could enter following name for source file: hello_zynq.c.
By default SDK will try to build sources automatically. In this case build will fail because there is no main() function in this source file. To fix this we will use a example code which prints "Hello World" message on UART. To do this please open system.mss file and browse down under the "Peripheral Drivers". Please find the "ps7_uart_1" and choose option Import Examples. Please select xuartps_hello_world_example.c and press twice on it. The source code will open in new window. We will be able to copy this example to our source file hello_zynq.c.
When we press save then the application will automatically builds. You could see a report with information about application size. By choosing Hello_World -> src -> lscript.ld you could get information about Available Memory Regions.
There are following memory regions:
- axi_bram_ctrl_0_Mem0 - is is a block RAM located in the programmable logic,
- ps7_ddr_0 - it is a DDR3L memory,
- ps7_qspi_linear_0 - it is a QSPI,
- ps7_ram_0 - it is a 192 KB of on-chip RAM,
- ps7_ram_1 - it is a 64 KB of on-chip RAM.
Second summary contains information about Stack and Heaps sizes.
We could edit the source of linker script by switching to Source tab. Additionally we could generate a completely new linker script by choosing option "Generate Linker Script" from Project Explorer. In wizard we could configure all these parameters.