# Matlab Deploy Embedded Code

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

- Repository: https://github.com/matlab/matlab-agentic-toolkit (1237 stars)
- Category: Testing
- License: see repository
- Last updated: 2026-10-27
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add matlab/matlab-agentic-toolkit --skill matlab-deploy-embedded-code -g -a claude-code -y`
Codex: `npx skills add matlab/matlab-agentic-toolkit --skill matlab-deploy-embedded-code -g -a codex -y`
Cursor: `npx skills add matlab/matlab-agentic-toolkit --skill matlab-deploy-embedded-code -g -a cursor -y`
Gemini CLI: `npx skills add matlab/matlab-agentic-toolkit --skill matlab-deploy-embedded-code -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add matlab/matlab-agentic-toolkit`

## Description

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.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# 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

```matlab
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`:

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

Without the support package, configure hardware manually:

```matlab
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

```matlab
cfg.EnableDynamicMemoryAllocation = false;
cfg.StackUsageMax = 512;
```

The rest: https://github.com/matlab/matlab-agentic-toolkit/blob/HEAD/skills-catalog/code-generation/matlab-deploy-embedded-code/SKILL.md
