We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Showing results for 
Search instead for 
Did you mean: 

Adam Taylor’s MicroZed Chronicles Part 102: SDSoC AES FreeRTOS Example

Xilinx Employee
Xilinx Employee
0 0 46.4K


By Adam Taylor



Well this was supposed to be the easy one. I should have known better.


Sitting down to create the FreeRTOS project I read the SDSoC User Guide 1027, which states that FreeRTOS is supported for the ZC702 and ZC706 boards only. However, if you are a regular follower of this blog then you will know we have previously run FreeRTOS on the MicroZed.


Indeed while this blog is going to show you how the AES encryption behaves when running FreeRTOS, it is also going to show you how to get FreeRTOS running on the MicroZed using SDSoC.


The first thing we need to do is create an SDSoC Project targeting the MicroZed and using the FreeRTOS operating system:







This will create a blank project, within which we can create our application running as a FreeRTOS task. The libraries for FreeRTOS are included under the arm-xilinx-eabi, mapped when you create the project.








However before we can build the project we must also update some files contained within the Xilinx SDSoC Platforms MicroZed directory to ensure that SDSoC can build the application for the MicroZed. We must do the following:



  1. Update the microzed_sw.pfm file to include information on FreeRTOS below:






  1. Within the same file (microzed_sw.pfm), include the location of the bif file for creating the FreeRTOS boot files.







  1. Within the platforms directory, copy the FreeRTOS directory to the microzed directory from the ZC702 directory—this contains the linker script for the build with the location of the FreeRTOS vectors.



  1. Within the platforms/microzed/boot directory, copy the standalone.bif, paste and rename as freertos.bif



With the above stages completed, we should be able to build our application once we have written it.


FreeRTOS employs tasks so we will be writing the example code as one task and then starting the scheduler. To do so, we must modify the previously software written for the AES example slightly so that it can run as a task. We must also run a special function that configures the hardware correctly for use with SDSoC and FreeRTOS. This function updates the interrupt vector table for use with FreeRTOS. Failure to include this function will result in the task being created but the scheduler not starting correctly.


With this all created, I converted the main() program from the previous example and renamed it as a function called protect(). This function can be called as a task by FreeRTOS.


I created a task and started the scheduler within the new main function. The task executes the AES encryption function. To prevent the task from running continually, I pause the scheduler after it has executed once.


Once all this has been completed, I built the application and ran it on the MicroZed to again establish a performance baseline for comparison against the accelerated performance and against the Linux and Standalone examples.


The performance from software-only PS execution on the Zynq SoC is very similar to that from the Linux:








I achieved the following result when I accelerated the AES code with the same settings as before:






This result is very similar to the bare-metal implementation performance we’ve seen previously, which is not so surprising because FreeRTOS is a much simpler operating system than Linux. With only one task running, results should be very similar to bare-metal operation.


These performance numbers allow me to create a table of the three operating systems and the performance in the Zynq SoC’s PS and PL:



Operating System

PS Only

PS with PL acceleration
















Next week I am going to start looking at how we could add another different operating system to SDSoC.


The files as always are on the github repository.



If you want E book or hardback versions of previous MicroZed chronicle blogs, you can get them below.




  • First Year E Book here
  • First Year Hardback here.



 MicroZed Chronicles hardcopy.jpg




  • Second Year E Book here
  • Second Year Hardback here



 MicroZed Chronicles Second Year.jpg




You also can find links to all the previous MicroZed Chronicles blogs on my own Web site, here.