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 192.168.3.2.
>> z = zynq('linux','192.168.3.2','root','root','/tmp')
z =
LinuxShell with properties:
IPAddress: '192.168.3.2'
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.
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 "init.sh" 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.
Please note that the /mnt directory is mapped to the FAT32 file system which is not a native Linux ext4 or tmpfs file system. To avoid any potential issues between these file systems, you should copy the ELF file to the /tmp directory, and then run the ELF file in the /tmp directory. You can copy and execute the ELF file on startup using this code in the "init.sh" file:\ncp -f /mnt/<appname>.elf /tmp/<appname>.elf
cd /tmp && /tmp/<appname>.elf &
In this code, "<appname>" is the name of the executable.