How do I deploy an ARM software executable from a Simulink model to my Zynq board to run in standalone mode? And how can this exectuable be auto-run on startup?

26 views (last 30 days)
I would like to deploy the ARM software executable generated from a Simulink model to my Zynq board (e.g. Zedboard, ZC702, ZC706, ZCU102...), so that it can be run without any connection to Simulink on my host machine.
However, each time I restart my Zynq board, the software application no longer runs. How do I permanently deploy the executable to my Zynq board so that it can always be run?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 30 Mar 2021
Edited: MathWorks Support Team on 30 Mar 2021
An ARM application deployed using Simulink is lost after reboot because Simulink places the executable in the  "/tmp" folder of the Zynq board's file system. This folder is cleared after power-cycling the board.
The following steps demonstrate how to generate and deploy a software executable in standalone mode, so that it can be run without any connection to Simulink on your host machine.
NOTE: This guide refers to the generated standalone executable as the “.elf file”. In R2018a and prior, the executable will not have a file extension. The steps below will be the same, but the executable file will be called “modelName” instead of “modelName.elf” 
1. In the Model Configuration Parameters, set the “Build action” to “Build”. This will generate the executable (.elf file) without automatically downloading it to the board and running it. 
2. Build the .elf file using the shortcut CTRL+B in Simulink, or in MATLAB using the "slbuild" command:
>> modelName = 'zynqRadioADSB_interface';
>> slbuild(modelName)
 When the build process completes, the "modelname.elf" file will be placed in your current directory.
3. Copy the .elf file to the board using the "zynq" object interface shipped with the "Embedded Coder Support Package for Xilinx Zynq Platform". Make sure to use the actual IP address of your board if it is different than 
>> z = zynq('linux','','root','root','/tmp')
z =
LinuxShell with properties:
IPAddress: ''
  Username: 'root'
  Port: 22
>> z.putFile('zynqRadioADSB_interface.elf','/mnt')
 The second argument to putFile is the destination directory on the target. Here, "/mnt" is the mounted SD card directory in Linux. It is the only persistent directory in this Embedded Linux file system, so placing the .elf file somewhere other than /mnt will cause that file to disappear when the board is rebooted. 
4. Run the .elf file from an SSH terminal session on the target. 
>> z.openShell('ssh')
5. When you are done running the application, exit with Ctrl+C. 
6. If you would like the standalone software to run automatically when the board is powered on, add a line to the "" file on the SD card. This file is a shell script that is called by Linux on startup. 
Editing this file is shown below using the "vi" editor on the board, but you can also do this using your preferred text editor on your host machine, and copy this file to the SD card.
Here, the "&" character means to run the process in the background. 

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!