Skip to content

freemarker usage #11

Description

@highvoltagecontrol

Hi, I am trying to generate c or h or scatter file from ftl templates for STM32L5 example. I have installed freemarker-cli under ubuntu and trying to use STML5.rzone or .azone xml files for the generation

~/firewall/CMSIS-Zone/Examples/STM32L5/Zone$ freemarker-cli -t ftl/mem_layout.h.ftl and getting an error

java.lang.RuntimeException: Failed to render FreeMarker Template: ftl/mem_layout.h.ftl
at com.github.sgoeschl.freemarker.cli.FreeMarkerTask.call(FreeMarkerTask.java:79)
at com.github.sgoeschl.freemarker.cli.FreeMarkerTask.call(FreeMarkerTask.java:61)
at com.github.sgoeschl.freemarker.cli.Main.callOnce(Main.java:151)
at com.github.sgoeschl.freemarker.cli.Main.lambda$call$0(Main.java:141)
at java.base/java.util.stream.IntPipeline$4$1.accept(IntPipeline.java:246)
at java.base/java.util.stream.Streams$RangeIntSpliterator.forEachRemaining(Streams.java:104)
at java.base/java.util.Spliterator$OfInt.forEachRemaining(Spliterator.java:712)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:520)
at java.base/java.util.stream.IntPipeline.max(IntPipeline.java:483)
at com.github.sgoeschl.freemarker.cli.Main.call(Main.java:141)
at com.github.sgoeschl.freemarker.cli.Main.call(Main.java:47)
at picocli.CommandLine.executeUserObject(CommandLine.java:1783)
at picocli.CommandLine.access$900(CommandLine.java:145)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2141)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2108)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1975)
at picocli.CommandLine.execute(CommandLine.java:1904)
at com.github.sgoeschl.freemarker.cli.Main.execute(Main.java:124)
at com.github.sgoeschl.freemarker.cli.Main.main(Main.java:116)
Caused by: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing:
==> zone [in template "ftl/mem_layout.h.ftl" at line 4, column 8]


Tip: If the failing expression is known to legally refer to something that's sometimes null or missing, either specify a default value like myOptionalVar!myDefault, or use <#if myOptionalVar??>when-present<#else>when-missing</#if>. (These only cover the last step of the expression; to cover the whole expression, use parenthesis: (myOptionalVar.foo)!myDefault, (myOptionalVar.foo)??


FTL stack trace ("~" means nesting-related):
- Failed at: #list zone as z [in template "ftl/mem_layout.h.ftl" at line 4, column 1]

    at freemarker.core.InvalidReferenceException.getInstance(InvalidReferenceException.java:134)
    at freemarker.core.Expression.assertNonNull(Expression.java:251)
    at freemarker.core.IteratorBlock.acceptWithResult(IteratorBlock.java:104)
    at freemarker.core.IteratorBlock.accept(IteratorBlock.java:94)
    at freemarker.core.Environment.visit(Environment.java:367)
    at freemarker.core.Environment.visitAndTransform(Environment.java:496)
    at freemarker.core.CompressedBlock.accept(CompressedBlock.java:42)
    at freemarker.core.Environment.visit(Environment.java:331)
    at freemarker.core.Environment.visit(Environment.java:337)
    at freemarker.core.Environment.process(Environment.java:310)
    at freemarker.template.Template.process(Template.java:383)
    at com.github.sgoeschl.freemarker.cli.FreeMarkerTask.call(FreeMarkerTask.java:74)
    ... 22 more

Propably, I dont know how to inform free-marker for the inputing .rzone or .azone files to model generator.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions