Frequently Asked Questions
What does #error in the generated code mean?
When examining the code generated from your model, you might stumble upon function calls or other statements and expressions which contain #error directives.
This text means that the code generator could not determine a value for the element at hand. This might happen for operation calls, but could also happen with other constructs in your model. Usually this means that your Model is not complete, and that the value of the expression isn't available in the model, so the code generator can't do anything about this.
If you have such lines in your generated code, examine the model carefully. The error directive usually contains a hint which gives more information about the error.
For example, if the code generator generated a function call for an operation in your model, make sure that you supplied the method call all required parameters, or that you specified default values for all missing parameters for the operation. To specify a value for a call to an operation, use the Default Value field in the Parameters section of an operation:
Why does Embedded Engineer change my method signature?
When using operations from external libraries and calling these operations from your model (for example in activities or state machines), sometimes a parameter (called me) will be introduced to these calls.
Where does this parameter come from, and how can I suppress the generation of this parameter?
This parameter is introduced to enable functions to access the data in the class, and is introduced if all of the following conditions apply:
- The operation is not marked as static
- The operation is not owned by a static class or interface
- The operation is not owned by a class marked as singleton
In order to suppress the generation of this parameter, it means that you can mark the external library which owns the operations as static by applying the static stereotype, which is basically saying "this library only contains methods which do not need access to a class structure":
Why is my header file not included?
If you are using operations of an imported file and generate code for your model, the include statement might be missing from the generated code, leading to compiler errors. The reason for this is that you have to model such dependencies explicitly in your model. The code generator won't introduce such include statements by itself.
See also
Where is the definition of bool?
Embedded Engineer uses the types defined in stdint.h
and stdbool.h
(C99) to enable MISRA compatibility as well as platform independence.
Unfortunately, not every toolchain includes these datatypes, therefore it's sometimes neccessary to add the appropriate definitions. For bool, you can either include stdbool.h or you can add a Typedefs in your project which defines bool to be int. The code generator will use 1
for true
respectively 0
for false
, so you don't need to supply definitions for true
or false
.
- Since MISRA 2004 Appendix E: Boolean expressions states that:
-
There is a conceptual difference between expressions which return a numeric value and expressions which return a Boolean value.
- And:
-
Boolean values are expected in the following contexts:
- the controlling expression of an if statement
- the controlling expression of an iteration statement
- the first operand of the conditional operator
We changed the default use of 1 and 0 to return a "Boolean-by-construct" value:
- equality operators (
==
and!=
) - logical operators (
!
,&&
and||
) - relational operators (
<
,>
,<=
and>=
)
Therefore the new true
value in Embedded Engineer will be represented as !0
and the new false
value will be !1
Why is there code for elements which I've deleted?
Whenever you delete an element from a diagram using the Del key or by using the context menu and selecting Delete, Enterprise Architect will only delete the Diagram Object for this element. The model element itself will not be removed from your model, so Embedded Engineer will still generate code for these elements.
You can easily locate such elements by using the so called Find Orphans search in Enterprise Architect. Select Edit Search in Model (CTRL + ALT + A). In the first Combobox, select Diagram Searches. In the second, you can now select the function Find Orphans. Execute the search - the listed elements aren't part of any diagrams in your Model.
Info
Orphans are not always a problem, but it's not very common to have elements without them being on a single diagram. Don't just delete the elements without further examination.
To locate these orphans in your project browser, select Find in Project Browser from the context menu in the Find Orphans search. You can also use the Traceability view in Enterprise Architect to further examine the orphans and to decide what to do with them.
The example does not work, what is wrong?
First, please check if an updated version of the example exists. You can find the examples here: Examples
If you still have problems running the example, please check your toolchain for installation / configuration problems.
Info
If the problems persist, please contact us at support@lieberlieber.com
Why are functions in external libraries called with too many arguments?
When generating code for models using external libraries, you may find that the code generator calls the external library function with too many arguments.
FunctionFromExternalLibrary(me, 1, 2);
FunctionFromExternalLibrary(1, 2);
In Embedded Engineer, we generate the me-pointer (this in C++) and consequently pass this pointer when calling methods as described in Classes.
When reverse engineering code in Enterprise Architect, EA does not make a distinction between methods and functions, and the code generator assumes that these operations are methods, not functions.
To resolve this issue, mark the imported Classes/Interfaces as static by applying the static stereotype.
See also
Which standards are you compliant to?
Embedded Engineer generates "ANSI C" (C89) code which is usually MISRA 2004 compliant.
The responsibility of checking the MISRA compliance of the generated code is still up to the customer.
We also opted for a generic language implementation to allow the user to use any language feature and compiler. All new and old language features can be added to the code/model using the Embedded Engineer UML Profile.
How do I generate a define or a typedef?
Typedefs or defines can be generated by extending Attributes with a "define" or "typedef" stereotype.
Also See
How can I find the model Element responsible for an error/warning during generation?
Every line in the Code Generation Progress dialogs, Messages list has a link back to the model element which is responsible for the shown message, warning or error.
To access/find the model element and help you clear any modelling issues you can open the context menu in the Messages list and select the Show relevant element in model.
This will select the element in the Project Browser of Enterprise Architect and also will try to open the Diagram containing the Element.
The same can be done even after the Code Generation Progress dialog is closed simply by opening the System Output: LieberLieber Embedded Engineer tab and double clicking the corresponding line.
Is the code customizable in any way?
Customization of the code can be done via a Custom Documentation or by changing clang styling format in the Model Settings.
Everthing apart from that can only be done by customizing the code generator to your needs, for this please contact us directly.
When changing code in both, the new code editor and the Enterprise Architect Inital Code field, which change will be taken.
This is handled as Enterprise Architect handles such a scenario. The last one to click the "Save" button will "win".
How can the generation language be changed?
Simply by settings the LL Embedded Stereotype and the contained GenerationLanguage Tagged Value on any package leve you like.
Info
You may also mix C and C++ during generation.
What version of Enterprise Architect do I need to use Embedded Engineer?
For this see our System Requirements.
How can I order element or features for generation?
Sometimes we need to have includes, attributes, nested elements or other features in a specific order to compile correctly.
To accomplish this you have the following options:
Elements
Select the element and use the Move element up/down
buttons at the top of the Project Browser.
Features Open the Feature tab and open the context menu selecting the Feature to move. Then use the "Move up/down" entry.
MagicDraw only allows ordering of Attributes and Operations.
This is done directly in the Specification dialog by selecting either Attributes or Operations and then the "Up/Down" buttons at the bottom.
Embedded Engineer contains a ordered Stereotype with a Pos Tagged Value sinde version 3.2.
This Pos Tagged Value can be used to order all other NamedElements.
The current implementation will sort:
- By Pos numerically
- Then by Name alphabetically
- Allow duplicated Pos entries
- Elements without a Pos Tagged Value will by default get default Pos of: 100.000
Why do I get a an 'empty clause' error during generation of Conditinal/LoopNodes
When the generation of a ConditionalNode
or LoopNode
shows one of the following errors:
- Empty test part in loop action.
- Could not determine first executable action in body of loop node: [Name]
- Could not determine first executable action in body of conditional node: [NAME]
- Test part of clause in conditional action '[NAME]' is empty. It should contain an appropriate condition.
Even though Enterprise Architects does not indicate that something is wrong with your StructuredActivity
do the following to fix this issue.
Move the Action(s)
out of the test/body/setup region and then back into its original position. This seems to update something inside of the model and after saving the model again the code should generate as expected.