powertrain-build/docs/target_link/custom_code_block.md
Henrik Wahlqvist 35d3b16bb6 Improve TargetLink documentation
Change-Id: I97db0801183f5fa420e700f44b0a3c52e670a856
2024-10-04 15:36:30 +02:00

1.1 KiB

TargetLink Custom Code Blocks


[TOC]

The Custom Code Block

The custom code block makes it possible to easily insert custom written snippets of C code in the generated code.

Make sure to use proper code review, as it is easy to cause underflow and overflow errors. The usage of Polyspace Code Prover is advised.

It could also be an idea to run Polyspace bugfinder.

Sharing the C Code

By deploying generated C code from custom code blocks to a common folder, it can be shared between simulink models (similarily to shared TargetLink functions).

Read the Manual

There are some docs in the TargetLink documentation dSPACE docs under "Custom Code Blocks". Also, there is a demo model in the MATLAB Command Window, enter tl_demos custom_blocks.

Header Files

Include statements in custom code blocks should not be used, but replaced by "AddFile" blocks.

This complies to MISRA rule 19.1. Include directives which says that only preprocessor directives or comments may be placed before include directives.