One MATLAB entry point builds a Simulink model for Raspberry Pi, glues it to Vector XCPlite, extends the stack with XCP programming, deploys the executable, and generates the INCA/CANape artifacts:
<model>.a2l<model>.hex<model>_XCP_Flash_ProF/<model>_XCP_Flash_ProF.zip
The MATLAB workflow implementation is shipped as protected P-code. The C glue templates remain visible because they are compiled into the target application.
XCPlite is not vendored in this repository. On demand, the workflow clones or updates Vector's upstream repository:
https://github.com/vectorgrp/XCPlite.git
By default it resolves XcpliteRef = 'latest-release', currently V2.1.5 on
Vector's GitHub releases page, and checks it out under external/XCPlite.
That folder is ignored by Git.
Run from MATLAB with the Raspberry Pi connection passed as name/value options:
cd("path/to/CM-STACK-Simulink-Compiler")
addpath("workflow")
cfg = xcpWorkflow( ...
'Model', 'xcpMultiRateTest', ...
'PiHost', '192.168.0.101', ...
'PiUser', 'alberto', ...
'PiPassword', '<password>', ...
'PiAppDir', '/home/alberto/xcp_app', ...
'PiHostKey', 'ssh-ed25519 255 SHA256:<fingerprint>', ...
'ModelCores', [2 3], ...
'XcpCores', 1, ...
'Deploy', true);Set 'Deploy', false in the same call to build only: Simulink code generation,
remote compilation, A2L, HEX and ProF are produced, but the target service is
not swapped/restarted.
- Generates Simulink C code with Embedded Coder.
- Fetches Vector XCPlite latest stable release if needed.
- Stages model code, XCPlite, and generated glue sources.
- Patches the staged XCPlite copy for XCP PGM support.
- Builds the executable on the Raspberry Pi and fetches the ELF.
- Generates an INCA-safe A2L and one complete HEX for dataset import and flash.
- Generates an installable INCA ProF flash configuration.
- Optionally deploys and restarts the Raspberry Pi systemd service.
- XCP on Ethernet TCP, default port
5555 - measurement DAQ with one raster per Simulink task
- online calibration via XCPlite calibration pages
- calibration freeze/persistence
- INCA/CANape flashing via XCP PGM to a virtual application sector
- atomic executable swap and rollback backup on the Raspberry Pi
- per-core CPU usage, CPU temperature, cycle count, execution time and overrun diagnostics
- clean INCA display names without generated
<model>_P.,<model>_DW., etc. prefixes
workflow/
xcpWorkflow.p entry point
matlab/*.p protected MATLAB workflow implementation
templates/*.template generated build/systemd config templates
templates/xcp_main.template.c
templates/xcp_flash.c/.h
templates/xcp_pgm_handlers.inc
xcpMultiRateTest.slx multirate example model
testSimulinkRaspberry.slx basic example model
modelParams.m example parameters
More details are in workflow/README.md and INCASetup.md.
- MATLAB/Simulink R2024b tested
- Embedded Coder
- PuTTY tools (
plink.exeandpscp.exe) available on the Windows host - Raspberry Pi 64-bit target with SSH access
- Git available on the Windows host, for automatic XCPlite checkout
- INCA or CANape for measurement/calibration import
See LICENSE.txt.