Skip to content
This repository has been archived by the owner on Feb 17, 2023. It is now read-only.

Creating Standalone Application

danielbennettagility edited this page Feb 19, 2019 · 16 revisions

The process of compiling a Simulink model to run as a standalone application on a flash drive is described in detail in this Simulink documentation page. The procedure is summarized below, along with some workarounds required for our use-case to work with r2017b.

Preparing the USB Drive

  • Follow the procedure in Setting Up Development PC
  • Create a bootable flash drive with FreeDOS using the Rufus tool (use the following settings)
    • MBR partition scheme for BIOS or UEFI
    • Add fixes for old BIOSes
    • FAT32 file system
    • 4096 bytes cluster size
    • Create bootable disk using FreeDOS
    • Copy the files in RealTimeModel to the FreeDOS USB drive. This replaces the AUTOEXEC.BAT file generated by Simulink Real-Time. It will never change from build to build, so make sure you never overwrite it with the generated AUTOEXEC.BAT file when you build a model.

Building and Deploying the Model

  • Select Stand Alone mode for the boot configuration in the Simulink Real-Time Explorer for the CassieV3 target (make sure to save the change)
  • Make sure graphics mode is unchecked and USB support is checked under Target Settings
  • Build the model that will be loaded onto Cassie (for example, model.slx)
  • After the build completes, copy the following 3 files from the model_slrt_emb folder (listed below) to the flash drive (this folder can be found in the directory where the generated code is saved). DO NOT copy autoexec.bat.
    • xpcboot.com
    • slrtkrnl.rtb
    • model.mldatx
  • Set the target computer's BIOS settings to boot first from the flash drive (This has already been done by Agility, and is only required for setting up new targets)
  • Plug the flash drive into the target computer USB port and power on

Notes and Best Practices

We have observed that Simulink Real-Time occasionally produces builds with an incorrect EtherCAT configuration, and one of the symptoms is that the battery status indicator on the radio displays a nonsense value (such as 231%). To avoid this, take the following steps before building a model:

  1. Clear the Cache and Code directories created by the Simulink Real-Time build processes
  2. Press ctrl-D on the Simulink model to update the diagram
  3. Start the build

We recommend using this procedure as a best practice to ensure a proper build.

Clone this wiki locally