CMSIS-Zone (Preview)  Version 0.0.1
System Resource Management
 All Files Pages
Generator Data Model

The Generator Data Model defines the view on the Zone Description for code generators. By defining a common data model code generators can be developed independendly from actual CMSIS Zone Projects and vendor tools.

The CMSIS-Zone data (structured according to the Generator Data Model) is combined with file templates using the FreeMarker template engine to generate arbitrary project files, see picture below..

generator.png
FreeMarker Template Engine

Data Model Structure

The class diagram below visualizes the overall structure of the Generator Data Model. The root element visible to the templates is FmZone.

genmodel.png
Generator Data Model Class Diagram

According to FreeMarker Documentation one can access the named attributes like retrieving data from a hash. The reference implementation documented in detail below make use of the default FreeMarker Bean wrapper. This leads to all Java methods named like get<Attribute> or is<Attribute> to be visible just as <Attribute> to the template.

Please take note about the multiplicities stated in the diagram:

  • 0..1 indicates an optional value which might be unavailable, consider using missing value handler operators.
  • 1 indicates a mandatory value which is guaranteed to be valid.
  • 0..* indicates a collection or hash of values which might be empty.
  • 1..* indicates a collection or hash of values which is guaranteed to contain at least one element.

For detailed descriptions of the data model elements please refere to the JavaDoc documentation for

Template Examples

To get an impression of how template files might look like please refere to the simplyfied examples in this section.

HTML table of all assigned memory blocks

This examples demonstrates how to iterate over the collection of memory blocks assigned to the project zone currently evaluated. The result of the template below is a HTML table with three columns listing block name, start address and size, respectively.

<table>
<th>
<td>Name</td>
<td>Start</td>
<td>Size</td>
</th>
<#list blocks as block>
<tr>
<td>${block.name}</td>
<td>${block.start}</td>
<td>${block.size}</td>
</tr>
</#list>
</table>