Skills

Matlab Deploy Embedded Code

Deploy MATLAB-generated code to embedded hardware using Embedded Coder.

Install

npx skills add matlab/matlab-agentic-toolkit --skill matlab-deploy-embedded-code -g -a claude-code -y
Category
Testing
Updated
8d ago
License
See repository
Context cost
Mediumabout 2,394 tokens
Runs scripts
No, instructions only

What it does

Deploy MATLAB-generated code to embedded hardware using Embedded Coder. Use when configuring code generation for microcontrollers (STM32, Raspberry Pi, ARM Cortex), setting up PIL/SIL verification, disabling dynamic memory allocation, or configuring hardware-specific code generation settings. Covers ERT-based configurations, processor-in-the-loop testing, memory constraints, and the MEX→SIL→PIL verification progression.

Deploy Embedded Code

Configure MATLAB Coder with Embedded Coder for production-quality code generation targeting embedded hardware, and verify correctness with processor-in-the-loop (PIL) testing.

When to Use

  • Generating C/C++ code for a microcontroller or embedded Linux board
  • Setting up PIL or SIL verification for generated code
  • Configuring code generation with no dynamic memory allocation
  • Configuring Embedded Coder for an AI model entry-point function prepared by matlab-deploy-embedded-ai; for the full AI compression and model-loading workflow, trigger matlab-deploy-embedded-ai first
  • Selecting a hardware target board (STM32, Raspberry Pi)

When NOT to Use

  • Generating MEX or desktop libraries, use standard codegen workflows
  • Simulink-based deployment, use Simulink Coder / Embedded Coder workflows directly
  • GPU code generation (CUDA), use GPU Coder

Workflow

1. Create an ERT-Based Configuration

cfg = coder.config("lib", "ecoder", true);

The "ecoder", true flag creates an ERT-based (Embedded Real-Time) configuration that generates production-quality code with no OS dependencies.

2. Select Target Hardware

With coder.hardware:

cfg.Hardware = coder.hardware("STM32F746G-Discovery");

Without the support package, configure hardware manually:

cfg.HardwareImplementation.ProdHWDeviceType = 'ARM Compatible->ARM Cortex-M';
cfg.HardwareImplementation.ProdBitPerFloat = 32;
cfg.HardwareImplementation.ProdBitPerDouble = 64;

See references/supported-hardware.md for the full list of supported boards and their constraints.

3. Configure Memory for Bare-Metal Targets

cfg.EnableDynamicMemoryAllocation = false;
cfg.StackUsageMax = 512;
Read the whole SKILL.md on GitHub

More in Testing