Home/Products/Model-Based Development
Model-Based Development

Model it in Simulink. Run it on LeanStack.

LeanStack works seamlessly with MATLAB and Simulink. Design your application logic as models, generate code, and it plugs straight into the basic software that LeanCfg generates, with no glue code to write.

  • MATLAB & Simulink, out of the box
  • Customised classes for LeanStack
  • Wired through BswIf
Simulink model to LeanStack code
Your application, your way

Implement each software component two ways

Mix and match per component. Hand-written and model-generated components sit side by side in the same ECU project.

Option A

C templates

LeanCfg generates a C template for each software component (SWC). Write your logic in the USER CODE sections, and it is preserved every time you regenerate.

  • Generated skeleton with runnables and interfaces in place
  • Your code survives regeneration
  • Ideal for small or performance-critical components
How it works

From block diagram to flashed ECU

1. Decompose

Break the application into SWCs on a block diagram.

2. Map

LeanCfg's component map wires every SWC through BswIf.

3. Implement

Fill in C templates or generate code from Simulink models.

4. Build & flash

Build with the generated BSW and flash with LeanBoot.

Simulink modelApplication logic with customised classes
Generated SWC codeStandard C from your model
BswIfGenerated by LeanCfg, connects SWCs to the BSW
LeanBSWCom, Diagnostics, Memory, OS and MCAL
Real model, real code

Signals speak LeanStack

In this wiper-control example, the model's inputs and outputs use BswIf data types directly. Generate code from the C Code tab and the component is ready to build with the rest of the ECU.

  • No hand-written adapters between the model and the BSW
  • Interfaces stay in sync with the LeanCfg configuration
  • Regenerate either side without breaking the other
Wiper / Runnable / Mode, in Simulink
Simulink model of a wiper mode runnable, with inputs and outputs using BswIf data types
FAQ

Questions about model-based development

Do I have to change how I work in Simulink?

No. LeanStack supplies the customised classes your model uses, and you build, simulate and generate code in Simulink the way you already do.

Can some components be hand-written and others modelled?

Yes. Each SWC can be implemented on its own terms, either in a generated C template or in Simulink, and they all connect through the same BswIf layer.

What happens when I change the configuration in LeanCfg?

Regenerate the BSW and BswIf. Your models and the USER CODE sections in C templates are preserved, so integration stays a build step rather than a rewrite.

Bring your Simulink models to LeanStack

We'll show you a model going from simulation to a running ECU.