Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discuss selection of Template engine used by Open-CMSIS-Pack tools #32

Closed
jkrech opened this issue Sep 30, 2021 · 8 comments
Closed

Discuss selection of Template engine used by Open-CMSIS-Pack tools #32

jkrech opened this issue Sep 30, 2021 · 8 comments
Labels
Discussion Done Discussion for this issue has converged

Comments

@jkrech
Copy link
Member

jkrech commented Sep 30, 2021

In the context of #12 the requirement for a template engine was raised.

Identify available open-source template engines which are suitable for generating

  • source modules (C/C++/asm, ...)
  • header files (C/C++, ...)
  • linker scripts
  • other ?

Engines

Create a list of Pros and Cons, discuss and agree and create ADR

@mdortel-stm
Copy link

You can find here a comparison matrix of a log of engines: https://en.wikipedia.org/wiki/Comparison_of_web_template_engines
Even if not strictly true, we can take the first assumption that handlebars is like mustache.

@fred-r
Copy link
Contributor

fred-r commented Oct 5, 2021

Maybe we should clarify what the templating engine will address ?
I guess we are talking here about the equivalent of CMSIS-Zone in term of features ?
Or is it more than this ?

@0xc0170
Copy link

0xc0170 commented Oct 6, 2021

Maybe we should clarify what the templating engine will address ?

As I read the first comment, source files for a project (not project files like cproject or similar) - a tool would generate these files based on project configuration. Looking at the templates in CMSIS-Zone, confirms this, source files generated - basically config files, linker file or any other source file that can be generated based on project configuration.

What languages are OK to be used - no requirement there? Looking at freemaker it's written in Java. Handlebars in javascript.

@fred-r
Copy link
Contributor

fred-r commented Oct 6, 2021

What languages are OK to be used - no requirement there? Looking at freemaker it's written in Java. Handlebars in javascript.

Good point indeed. What is the technology to be used in this project ?

@ReinhardKeil
Copy link
Collaborator

ReinhardKeil commented Oct 12, 2021

"https://en.wikipedia.org/wiki/Comparison_of_web_template_engines - mustache" seems to lack a evaluation language.
When reviewing the existing FreeMarker templates, i.e. https://github.com/ARM-software/CMSIS-Zone/blob/master/Examples/Musca-S1/ftl/tz_sau_nvic.c.ftl it appears that conditions and assignments are a must have.

Freemarker is a third-party tool and requires a JRE (don't think this is an issue). It is called during the build process to generate script/source files based on templates and a data model (*.fzone file). We just need to ensure that it runs. IMHO the language that it is written in is not important, provided that the build environment can execute it.

@Open-CMSIS-Pack Open-CMSIS-Pack deleted a comment from LMESTM Oct 19, 2021
@Open-CMSIS-Pack Open-CMSIS-Pack deleted a comment from ReinhardKeil Oct 19, 2021
@DavidJurajdaNXP
Copy link

Alternative engine might be Jinja, it is typically used with python, but there are also implementations for other languages:
https://github.com/pallets/jinja
https://github.com/jinja2cpp/Jinja2Cpp
https://github.com/HubSpot/jinjava

@fred-r
Copy link
Contributor

fred-r commented Jan 4, 2022

CMSIS-Zone example for STM32L5 reworked with Handlebars:
https://github.com/fred-r/CMSIS-Zone/tree/main/Examples/STM32L5

@ReinhardKeil ReinhardKeil added the Discussion Done Discussion for this issue has converged label Feb 22, 2022
@jkrech
Copy link
Member Author

jkrech commented Mar 8, 2022

I am closing this issue, as we have concluded to focus on using Handlebars for now.

@jkrech jkrech closed this as completed Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion Done Discussion for this issue has converged
Projects
None yet
Development

No branches or pull requests

6 participants