Getting Started with Embedded Coder Support Package for ARM Cortex-M Processors
This example shows you how to use the Embedded Coder® Support Package for ARM Cortex-M™ Processors to run a Simulink model on an ARM Cortex-M3 emulator provided by QEMU.
The Embedded Coder Support Package for ARM Cortex-M Processors enables you to create and run a Simulink model on the QEMU emulator. You can verify the generated code on an emulated ARM Cortex-M3 processor without physical hardware. You can also collect execution profiling measurements running PIL simulations to optimize the execution time of your algorithm.
Task 1 - Configure the model for code generation
In this task, you will create a simple model that will run on the ARM Cortex-M3 (QEMU) emulated target.
1. In MATLAB, select HOME > New > Simulink Model.
2. To configure the model for the ARM Cortex-M3 (QEMU) target, follow the steps shown in the figure below:
3. Open the Simulink browser. Click on the Simulink > Commonly Used Blocks tab. Drag and drop a Constant block, a Gain block and an Out1 block into your model. Connect these three blocks as shown in the figure below and generate code by first saving the model and then clicking on Build model button:
4. You will see in the Diagnostic Viewer window that code is generated for the model.
.. ..... ...... ### Created: ../untitled1.elf ### Invoking postbuild tool Binary Converter ... arm-none-eabi-objcopy -O binary ../untitled1.elf ../untitled1.bin ### Done invoking postbuild tool. ### Invoking postbuild tool Hex Converter ... arm-none-eabi-objcopy -O ihex ../untitled1.elf ../untitled1.hex ### Done invoking postbuild tool. ### Invoking postbuild tool Executable Size ... arm-none-eabi-size ../untitled1.elf text data bss dec hex filename 2328 20 2136 4484 1184 ../untitled1.elf ### Done invoking postbuild tool. ### Successfully generated all binary outputs.
The generated executable will start running on the QEMU emulator.
5. Terminate the emulator session by executing the following command:
6. To interact with the code running on the QEMU emulator, see the Code Verification and Validation with PIL and External Mode example.
This example introduced the workflow for configuring and running a Simulink model on the ARM Cortex-M3 QEMU emulator.