Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2015-07-21 15:33:52 +0000
committerJuergen Haug2015-07-31 10:02:07 +0000
commit33c71f0684c7483aa25428d765ebfb089a954a67 (patch)
tree103aa43a654afbe3fee105de51dff0ca19067c38
parenta988c716e9c73a44fc1db44a0ec1d779a60c2599 (diff)
downloadorg.eclipse.etrice-33c71f0684c7483aa25428d765ebfb089a954a67.tar.gz
org.eclipse.etrice-33c71f0684c7483aa25428d765ebfb089a954a67.tar.xz
org.eclipse.etrice-33c71f0684c7483aa25428d765ebfb089a954a67.zip
Bug 472908 - refactor etDatatypes.h
-rw-r--r--examples/org.eclipse.etrice.template.c/.cproject65
-rw-r--r--plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend4
-rw-r--r--plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java4
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zipbin101975 -> 101617 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zipbin210088 -> 209502 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zipbin164272 -> 164224 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zipbin43408 -> 43162 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zipbin172426 -> 172482 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zipbin69494 -> 69310 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zipbin12606 -> 12556 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zipbin28017 -> 27971 bytes
-rw-r--r--plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zipbin47761 -> 47675 bytes
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/gen_modellib_c.launch2
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/model/Types.room2
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/model/etUnit/Tests.room6
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/.cproject1
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h2
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h117
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c44
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h17
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h4
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_32Bit_FreeRTOS_Generic/etDatatypes.h77
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h85
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h84
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etDatatypes.h74
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/util/RandomGenerator.c10
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/util/RandomGenerator.h19
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room2
-rw-r--r--tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room2
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/make.xml27
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c10
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.c94
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.h20
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtUnit.c2
-rw-r--r--tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c11
37 files changed, 447 insertions, 346 deletions
diff --git a/examples/org.eclipse.etrice.template.c/.cproject b/examples/org.eclipse.etrice.template.c/.cproject
index 81e905627..8592a3974 100644
--- a/examples/org.eclipse.etrice.template.c/.cproject
+++ b/examples/org.eclipse.etrice.template.c/.cproject
@@ -96,39 +96,27 @@
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1937396059.1692710118" moduleId="org.eclipse.cdt.core.settings" name="LinuxPosix">
<externalSettings/>
<extensions>
- <extension id="org.eclipse.cdt.core.PE" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.ELF" point="org.eclipse.cdt.core.BinaryParser"/>
<extension id="org.eclipse.cdt.core.GASErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GLDErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
<extension id="org.eclipse.cdt.core.GCCErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="org.eclipse.cdt.core.CWDLocator" point="org.eclipse.cdt.core.ErrorParser"/>
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
<configuration artifactName="${ProjName}" buildArtefactType="org.eclipse.cdt.build.core.buildArtefactType.exe" buildProperties="org.eclipse.cdt.build.core.buildArtefactType=org.eclipse.cdt.build.core.buildArtefactType.exe,org.eclipse.cdt.build.core.buildType=org.eclipse.cdt.build.core.buildType.debug" cleanCommand="rm -rf" description="" id="cdt.managedbuild.config.gnu.mingw.exe.debug.1937396059.1692710118" name="LinuxPosix" parent="cdt.managedbuild.config.gnu.mingw.exe.debug">
<folderInfo id="cdt.managedbuild.config.gnu.mingw.exe.debug.1937396059.1692710118." name="/" resourcePath="">
- <toolChain id="cdt.managedbuild.toolchain.gnu.mingw.exe.debug.640025056" name="MinGW GCC" superClass="cdt.managedbuild.toolchain.gnu.mingw.exe.debug">
- <targetPlatform binaryParser="org.eclipse.cdt.core.ELF;org.eclipse.cdt.core.PE" id="cdt.managedbuild.target.gnu.platform.mingw.exe.debug.1384971214" name="Debug Platform" superClass="cdt.managedbuild.target.gnu.platform.mingw.exe.debug"/>
- <builder buildPath="${workspace_loc:/org.eclipse.etrice.template.c}/Debug" id="cdt.managedbuild.tool.gnu.builder.mingw.base.903440934" keepEnvironmentInBuildfile="false" managedBuildOn="true" name="CDT Internal Builder" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.tool.gnu.builder.mingw.base"/>
- <tool id="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug.337714673" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.mingw.exe.debug">
- <option id="gnu.both.asm.option.include.paths.209403556" name="Include paths (-I)" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c}&quot;"/>
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}&quot;"/>
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}&quot;"/>
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC}&quot;"/>
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.c}&quot;"/>
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.c/src-gen}&quot;"/>
- </option>
- <inputType id="cdt.managedbuild.tool.gnu.assembler.input.2139505179" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
- </tool>
- <tool id="cdt.managedbuild.tool.gnu.archiver.mingw.base.1477927725" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.mingw.base"/>
- <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug.1363495263" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.mingw.exe.debug">
- <option id="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level.329510873" name="Optimization Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
- <option id="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level.551016782" name="Debug Level" superClass="gnu.cpp.compiler.mingw.exe.debug.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
+ <toolChain id="cdt.managedbuild.toolchain.gnu.base.775329099" name="Linux GCC" superClass="cdt.managedbuild.toolchain.gnu.base">
+ <targetPlatform archList="all" binaryParser="org.eclipse.cdt.core.ELF" id="cdt.managedbuild.target.gnu.platform.base.169698942" name="Debug Platform" osList="linux,hpux,aix,qnx" superClass="cdt.managedbuild.target.gnu.platform.base"/>
+ <builder buildPath="${workspace_loc:/org.eclipse.etrice.template.c}/LinuxPosix" id="cdt.managedbuild.target.gnu.builder.base.1150740789" name="Gnu Make Builder.LinuxPosix" parallelBuildOn="true" parallelizationNumber="optimal" superClass="cdt.managedbuild.target.gnu.builder.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.archiver.base.161743578" name="GCC Archiver" superClass="cdt.managedbuild.tool.gnu.archiver.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.compiler.base.162916403" name="GCC C++ Compiler" superClass="cdt.managedbuild.tool.gnu.cpp.compiler.base">
+ <option id="gnu.cpp.compiler.option.optimization.level.726082008" superClass="gnu.cpp.compiler.option.optimization.level" value="gnu.cpp.compiler.optimization.level.none" valueType="enumerated"/>
+ <option id="gnu.cpp.compiler.option.debugging.level.472954999" superClass="gnu.cpp.compiler.option.debugging.level" value="gnu.cpp.compiler.debugging.level.max" valueType="enumerated"/>
</tool>
- <tool id="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug.572999454" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.mingw.exe.debug">
- <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.mingw.exe.debug.option.optimization.level.578666984" name="Optimization Level" superClass="gnu.c.compiler.mingw.exe.debug.option.optimization.level" valueType="enumerated"/>
- <option id="gnu.c.compiler.mingw.exe.debug.option.debugging.level.1824649509" name="Debug Level" superClass="gnu.c.compiler.mingw.exe.debug.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
- <option id="gnu.c.compiler.option.include.paths.1501497700" name="Include paths (-I)" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
+ <tool id="cdt.managedbuild.tool.gnu.c.compiler.base.1762318973" name="GCC C Compiler" superClass="cdt.managedbuild.tool.gnu.c.compiler.base">
+ <option id="gnu.c.compiler.option.include.paths.1719714402" superClass="gnu.c.compiler.option.include.paths" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}&quot;"/>
@@ -137,25 +125,38 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.c/src-gen}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src-gen}&quot;"/>
</option>
- <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1539026479" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
+ <option defaultValue="gnu.c.optimization.level.none" id="gnu.c.compiler.option.optimization.level.1516981381" superClass="gnu.c.compiler.option.optimization.level" valueType="enumerated"/>
+ <option id="gnu.c.compiler.option.debugging.level.1503754647" superClass="gnu.c.compiler.option.debugging.level" value="gnu.c.debugging.level.max" valueType="enumerated"/>
+ <inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.1113300613" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
- <tool id="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug.524816999" name="MinGW C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.mingw.exe.debug">
- <option id="gnu.c.link.option.paths.204614274" name="Library search path (-L)" superClass="gnu.c.link.option.paths" valueType="libPaths">
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/LinuxPosix}&quot;"/>
- <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.c/LinuxPosix}&quot;"/>
- </option>
- <option id="gnu.c.link.option.libs.1899078006" name="Libraries (-l)" superClass="gnu.c.link.option.libs" valueType="libs">
+ <tool id="cdt.managedbuild.tool.gnu.c.linker.base.596868941" name="GCC C Linker" superClass="cdt.managedbuild.tool.gnu.c.linker.base">
+ <option id="gnu.c.link.option.libs.295782194" superClass="gnu.c.link.option.libs" valueType="libs">
<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.modellib.c"/>
<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="org.eclipse.etrice.runtime.c"/>
<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="pthread"/>
<listOptionValue builtIn="false" srcPrefixMapping="" srcRootPath="" value="rt"/>
</option>
- <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.152518061" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
+ <option id="gnu.c.link.option.paths.597534164" superClass="gnu.c.link.option.paths" valueType="libPaths">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/LinuxPosix}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.c/LinuxPosix}&quot;"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.c.linker.input.1668593267" superClass="cdt.managedbuild.tool.gnu.c.linker.input">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinput" paths="$(LIBS)"/>
</inputType>
</tool>
- <tool id="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug.1009623546" name="MinGW C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.mingw.exe.debug"/>
+ <tool id="cdt.managedbuild.tool.gnu.cpp.linker.base.1231219692" name="GCC C++ Linker" superClass="cdt.managedbuild.tool.gnu.cpp.linker.base"/>
+ <tool id="cdt.managedbuild.tool.gnu.assembler.base.473625771" name="GCC Assembler" superClass="cdt.managedbuild.tool.gnu.assembler.base">
+ <option id="gnu.both.asm.option.include.paths.644544330" superClass="gnu.both.asm.option.include.paths" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/src/common}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/src/config}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.c}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/org.eclipse.etrice.modellib.c/src-gen}&quot;"/>
+ </option>
+ <inputType id="cdt.managedbuild.tool.gnu.assembler.input.911025490" superClass="cdt.managedbuild.tool.gnu.assembler.input"/>
+ </tool>
</toolChain>
</folderInfo>
<sourceEntries>
diff --git a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
index da5b3a80d..d2787cffd 100644
--- a/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
+++ b/plugins/org.eclipse.etrice.generator.c/src/org/eclipse/etrice/generator/c/gen/StateMachineGen.xtend
@@ -84,6 +84,10 @@ class StateMachineGen extends GenericStateMachineGenerator {
"etInt16"
}
+ override boolType() {
+ "etBool"
+ }
+
override markVariableUsed(String varname) {
'''
((void)trigger__et); /* avoids unused warning */
diff --git a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java
index 1b1579a34..b718ffd4e 100644
--- a/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java
+++ b/plugins/org.eclipse.etrice.generator.c/xtend-gen/org/eclipse/etrice/generator/c/gen/StateMachineGen.java
@@ -197,6 +197,10 @@ public class StateMachineGen extends GenericStateMachineGenerator {
return "etInt16";
}
+ public String boolType() {
+ return "etBool";
+ }
+
public CharSequence markVariableUsed(final String varname) {
StringConcatenation _builder = new StringConcatenation();
_builder.append("((void)trigger__et);\t/* avoids unused warning */");
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip
index 928017dbd..dfb53679f 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.c.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip
index d367bf2a8..2a32b4a0c 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.examples.java.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip
index 99a19b70e..c46ae6134 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.c.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip
index 633ff66cb..9b9a43924 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.modellib.java.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip
index 8e794be88..4ec4efd92 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.c.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip
index f4a2c66cf..e6ca0baef 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.runtime.java.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip
index a1673224b..b525adf07 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.template.c.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip
index 53d6753bf..c1777643a 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.c.zip
Binary files differ
diff --git a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip
index 1548edd51..e07e40bb8 100644
--- a/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip
+++ b/plugins/org.eclipse.etrice.ui.runtime/contents/org.eclipse.etrice.tutorials.java.zip
Binary files differ
diff --git a/runtime/org.eclipse.etrice.modellib.c/gen_modellib_c.launch b/runtime/org.eclipse.etrice.modellib.c/gen_modellib_c.launch
index a672d883f..da0481584 100644
--- a/runtime/org.eclipse.etrice.modellib.c/gen_modellib_c.launch
+++ b/runtime/org.eclipse.etrice.modellib.c/gen_modellib_c.launch
@@ -5,7 +5,7 @@
<booleanAttribute key="GenInstanceDiagram" value="true"/>
<stringAttribute key="GenModelPath" value=""/>
<booleanAttribute key="Lib" value="true"/>
-<booleanAttribute key="MSC" value="false"/>
+<booleanAttribute key="MSC" value="true"/>
<listAttribute key="ModelFiles">
<listEntry value="${workspace_loc:/org.eclipse.etrice.modellib.c/model/TimingService.room}"/>
<listEntry value="${workspace_loc:/org.eclipse.etrice.modellib.c/model/TcpService.room}"/>
diff --git a/runtime/org.eclipse.etrice.modellib.c/model/Types.room b/runtime/org.eclipse.etrice.modellib.c/model/Types.room
index 11012f488..3d512beb5 100644
--- a/runtime/org.eclipse.etrice.modellib.c/model/Types.room
+++ b/runtime/org.eclipse.etrice.modellib.c/model/Types.room
@@ -1,6 +1,6 @@
RoomModel room.basic.types {
- PrimitiveType boolean: ptBoolean -> boolean default "ET_FALSE"
+ PrimitiveType boolean: ptBoolean -> bool default "false"
PrimitiveType char: ptCharacter -> char default "0"
PrimitiveType int8: ptInteger -> int8 default "0"
PrimitiveType int16: ptInteger -> int16 default "0"
diff --git a/runtime/org.eclipse.etrice.modellib.c/model/etUnit/Tests.room b/runtime/org.eclipse.etrice.modellib.c/model/etUnit/Tests.room
index 1d2062827..02fec2348 100644
--- a/runtime/org.eclipse.etrice.modellib.c/model/etUnit/Tests.room
+++ b/runtime/org.eclipse.etrice.modellib.c/model/etUnit/Tests.room
@@ -42,11 +42,11 @@ RoomModel room.basic.etunit {
"return self->constData->instName;"
}
Operation startTimeout(time: uint32){
- "tcTimeoutIgnore = false;"
+ "tcTimeoutIgnore = ET_FALSE;"
"tcTimer.startTimeout(time);"
}
Operation invalidateTimeout(){
- "tcTimeoutIgnore = true;"
+ "tcTimeoutIgnore = ET_TRUE;"
}
StateMachine {
Transition init: initial -> tpEnter of testing {
@@ -75,7 +75,7 @@ RoomModel room.basic.etunit {
}
State timeout {
entry {
- "EXPECT_FALSE(tcCaseId, \"timeout\", true);"
+ "EXPECT_FALSE(tcCaseId, \"timeout\", ET_TRUE);"
"etUnit_closeTestCase(tcCaseId);"
"tcLifecycle.finishedTestCase(tcCaseId);"
}
diff --git a/runtime/org.eclipse.etrice.runtime.c/.cproject b/runtime/org.eclipse.etrice.runtime.c/.cproject
index 46d4069c4..eab210cb1 100644
--- a/runtime/org.eclipse.etrice.runtime.c/.cproject
+++ b/runtime/org.eclipse.etrice.runtime.c/.cproject
@@ -40,6 +40,7 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/common}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/config}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/platforms/MT_WIN_MinGW}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src/util}&quot;"/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.316560634" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h
index 38d274e5a..2b960e259 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory.h
@@ -19,7 +19,7 @@
* this macro computes the memory aligned value for a given size. It uses the ALIGNMENT
* defined in etDatatypes.h
*/
-#define MEM_CEIL(n) ((n)+((ALIGNMENT-((n)&(ALIGNMENT-1)))&(ALIGNMENT-1)))
+#define MEM_CEIL(n) ((n)+((etALIGNMENT-((n)&(etALIGNMENT-1)))&(etALIGNMENT-1)))
struct etMemory;
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c
index e97b2b1e7..09e2008ab 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/base/etMemory_FreeList.c
@@ -60,7 +60,7 @@ static void* etMemory_getFreeListMem(etFreeListMemory* self, etUInt16 size) {
int asize, slot_offset, slot, slot_size;
ET_MSC_LOGGER_SYNC_ENTRY("etMemory", "getFreeListMem")
- asize = (size / ALIGNMENT);
+ asize = (size / etALIGNMENT);
for (slot_offset = 0; slot_offset < self->nslots; slot_offset++) {
slot = (asize + slot_offset) % self->nslots;
slot_size = self->freelists[slot].objsize;
@@ -87,7 +87,7 @@ static void etMemory_putFreeListMem(etFreeListMemory* self, void* obj, etUInt16
{
int asize, slot_offset, slot, slot_size;
- asize = (size / ALIGNMENT);
+ asize = (size / etALIGNMENT);
for (slot_offset = 0; slot_offset < self->nslots; slot_offset++) {
slot = (asize + slot_offset) % self->nslots;
slot_size = self->freelists[slot].objsize;
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h
new file mode 100644
index 000000000..294068261
--- /dev/null
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etStdDatatypes.h
@@ -0,0 +1,117 @@
+/*******************************************************************************
+ * Copyright (c) 2011 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Juergen Haug (initial contribution)
+ *
+ *******************************************************************************/
+
+/*
+ * Generic version for most platforms based on std.
+ */
+
+#ifndef _ETSTDDATATYPES_H_
+#define _ETSTDDATATYPES_H_
+
+/*
+ Define switches for additional data types:
+ #define ET_INT64
+ #define ET_FLOAT32
+ #define ET_FLOAT64
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdbool.h>
+
+/* --- Data types for room.basic.types */
+
+// bool already defined
+typedef uint8_t uint8;
+typedef uint16_t uint16;
+typedef uint32_t uint32;
+
+typedef int8_t int8;
+typedef int16_t int16;
+typedef int32_t int32;
+
+#ifdef ET_INT64
+typedef uint64_t uint64;
+typedef int64_t int64;
+#endif
+
+#ifdef ET_FLOAT32
+typedef float float32;
+#endif
+#ifdef ET_FLOAT64
+typedef double float64;
+#endif
+
+typedef char* charPtr;
+
+/*-----------------------------------------------------------*/
+
+/*--- Cross language support (e.g. Java,C/C++) */
+
+#define null NULL
+// typedef x boolean
+
+/*-----------------------------------------------------------*/
+
+//--- Required types of runtime
+typedef bool etBool;
+#define ET_TRUE true
+#define ET_FALSE false
+
+typedef uint8 etUInt8;
+typedef uint16 etUInt16;
+typedef uint32 etUInt32;
+
+typedef int8 etInt8;
+typedef int16 etInt16;
+typedef int32 etInt32;
+
+#ifdef ET_INT64
+typedef uint64_t etUInt64;
+typedef int64_t etInt64;
+#endif
+
+#ifdef ET_FLOAT32
+typedef float32 etFloat32;
+#endif
+#ifdef ET_FLOAT64
+typedef float64 etFloat64;
+#endif
+
+typedef charPtr etCharPtr;
+
+typedef etInt16 etAddressId;
+
+/* mandatory:
+ #define etALIGNMENT x // power of 2 and >= sizeof(int) !
+ typedef x etFileHandle;
+ */
+
+/*
+ typedef float32 etFloat32;
+ typedef float64 etFloat64;
+ */
+
+/* types for osal */
+
+/* mandatory:
+ typedef x etOSMutexData;
+ typedef x etOSThreadData;
+ typedef x etOSThreadId;
+ typedef x etOSSemaData;
+ typedef x etOSTimerData;
+ typedef x etOSTimerId;
+ */
+
+/*-----------------------------------------------------------*/
+
+#endif /* _ETSTDDATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
index 544ffaf8f..bc903795e 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
@@ -55,14 +55,28 @@ static OrderInfo* getOrderInfo(etInt16 id) {
return NULL;
}
+/* float measuring */
+#if defined (ET_FLOAT32) || defined (ET_FLOAT64)
+#define ETUNIT_FLOAT
+#ifdef ET_FLOAT64
+typedef etFloat64 etUnitFloat;
+#else
+typedef etFloat32 etUnitFloat;
+#endif
+#endif
+
+
/* forward declarations of private functions */
static void expect_equal_int(etInt16 id, const char* message, etInt32 expected, etInt32 actual, const char* file, int line);
static void expect_range_int(etInt16 id, const char* message, etInt32 min, etInt32 max, etInt32 actual, const char* file, int line);
static void expect_equal_uint(etInt16 id, const char* message, etUInt32 expected, etUInt32 actual, const char* file, int line);
static void expect_range_uint(etInt16 id, const char* message, etUInt32 min, etUInt32 max, etUInt32 actual, const char* file, int line);
-static void expect_equal_float(etInt16 id, const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line);
-static void expect_range_float(etInt16 id, const char* message, etFloat64 min, etFloat64 max, etFloat64 actual, const char* file, int line);
+#ifdef ETUNIT_FLOAT
+static void expect_equal_float(etInt16 id, const char* message, etUnitFloat expected, etUnitFloat actual, etUnitFloat precision, const char* file, int line);
+static void expect_range_float(etInt16 id, const char* message, etUnitFloat min, etUnitFloat max, etUnitFloat actual, const char* file, int line);
+#endif
+
static void etUnit_handleExpect(etInt16 id, etBool result, const char *trace, const char* expected, const char* actual, const char* file, int line);
/* public functions */
@@ -97,8 +111,6 @@ void etUnit_open(const char* testResultPath, const char* testFileName) {
/* prepare time measurement */
getTimeFromTarget(&etUnit_startTime);
- etLogger_logInfoF("Start Time: %ld", etTimeHelpers_convertToMSec(&etUnit_startTime));
-
}
void etUnit_close(void) {
@@ -106,7 +118,10 @@ void etUnit_close(void) {
etLogger_fclose(etUnit_reportfile);
etUnit_reportfile = NULL;
}
- etLogger_logInfoF("End Time: %ld", clock());
+ etTime endTime;
+ getTimeFromTarget(&endTime);
+ etTimeHelpers_subtract(&endTime, &etUnit_startTime);
+ etLogger_logInfoF("Elapsed Time: %ld ms", etTimeHelpers_convertToMSec(&endTime));
if (etUnit_errorCounter == 0)
etLogger_logInfoF("Error Counter: %ld", etUnit_errorCounter);
else
@@ -148,7 +163,6 @@ void etUnit_closeTestCase(etInt16 id) {
OrderInfo* info = getOrderInfo(id);
if(info != NULL){
if (info->currentIndex != info->size) {
- char testresult[ETUNIT_FAILURE_TEXT_LEN];
etUnit_handleExpect(id, ET_FALSE, "EXPECT_ORDER was not completed", NULL, NULL, 0, 0);
}
}
@@ -231,21 +245,25 @@ void expect_equal_void_ptr(etInt16 id, const char* message, const void* expected
}
}
+#ifdef ET_FLOAT32
void expectEqualFloat32(etInt16 id, const char* message, etFloat32 expected, etFloat32 actual, etFloat32 precision, const char* file, int line) {
expect_equal_float(id, message, expected, actual, precision, file, line);
}
-void expectEqualFloat64(etInt16 id, const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line) {
- expect_equal_float(id, message, expected, actual, precision, file, line);
-}
-
void expectRangeFloat32(etInt16 id, const char* message, etFloat32 min, etFloat32 max, etFloat32 actual, const char* file, int line) {
expect_range_float(id, message, min, max, actual, file, line);
}
+#endif
+
+#ifdef ET_FLOAT64
+void expectEqualFloat64(etInt16 id, const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line) {
+ expect_equal_float(id, message, expected, actual, precision, file, line);
+}
void expectRangeFloat64(etInt16 id, const char* message, etFloat64 min, etFloat64 max, etFloat64 actual, const char* file, int line) {
expect_range_float(id, message, min, max, actual, file, line);
}
+#endif
void expectOrderStart(etInt16 id, etInt16* list, etInt16 size, const char* file, int line) {
int i;
@@ -362,7 +380,8 @@ static void expect_range_uint(etInt16 id, const char* message, etUInt32 min, etU
}
}
-static void expect_equal_float(etInt16 id, const char* message, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line) {
+#ifdef ETUNIT_FLOAT
+static void expect_equal_float(etInt16 id, const char* message, etUnitFloat expected, etUnitFloat actual, etUnitFloat precision, const char* file, int line) {
if (expected - actual < -precision || expected - actual > precision) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
char exp[16], act[16];
@@ -375,7 +394,7 @@ static void expect_equal_float(etInt16 id, const char* message, etFloat64 expect
}
}
-static void expect_range_float(etInt16 id, const char* message, etFloat64 min, etFloat64 max, etFloat64 actual, const char* file, int line) {
+static void expect_range_float(etInt16 id, const char* message, etUnitFloat min, etUnitFloat max, etUnitFloat actual, const char* file, int line) {
if (actual < min || actual > max) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
char exp[64], act[16];
@@ -392,6 +411,7 @@ static void expect_range_float(etInt16 id, const char* message, etFloat64 min, e
etUnit_handleExpect(id, ET_TRUE, "", NULL, NULL, file, line);
}
}
+#endif
static void etUnit_handleExpect(etInt16 id, etBool result, const char *resulttext, const char* exp, const char* act, const char* file, int line) {
if (result == ET_TRUE) {
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
index eb2c30bca..99c5bb3e0 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
@@ -130,13 +130,18 @@ void etUnit_closeAll(etInt16 id);
/*
* float values
*/
+#ifdef ET_FLOAT32
/** calls \ref expectEqualFloat32() */
#define EXPECT_EQUAL_FLOAT32(id, msg, expected, actual, precision) expectEqualFloat32(id, msg, expected, actual, precision, __FILE__, __LINE__)
+#define EXPECT_RANGE_FLOAT32(id, msg, min, max, actual) expectRangeFloat32(id, msg, min, max, actual, __FILE__, __LINE__)
+#endif
+
+#ifdef ET_FLOAT64
/** calls \ref expectEqualFloat64() */
#define EXPECT_EQUAL_FLOAT64(id, msg, expected, actual, precision) expectEqualFloat64(id, msg, expected, actual, precision, __FILE__, __LINE__)
-
-#define EXPECT_RANGE_FLOAT32(id, msg, min, max, actual) expectRangeFloat32(id, msg, min, max, actual, __FILE__, __LINE__)
#define EXPECT_RANGE_FLOAT64(id, msg, min, max, actual) expectRangeFloat64(id, msg, min, max, actual, __FILE__, __LINE__)
+#endif
+
/*
* Pointers
@@ -287,7 +292,9 @@ void expectEqualUInt32(etInt16 id, const char* msg, etUInt32 expected, etUInt32
* \param file the file name with the test case
* \param line the line
*/
+#ifdef ET_FLOAT32
void expectEqualFloat32(etInt16 id, const char* msg, etFloat32 expected, etFloat32 actual, etFloat32 precision, const char* file, int line);
+#endif
/**
* reports an error if two floats aren't equal
*
@@ -299,7 +306,9 @@ void expectEqualFloat32(etInt16 id, const char* msg, etFloat32 expected, etFloat
* \param file the file name with the test case
* \param line the line
*/
+#ifdef ET_FLOAT64
void expectEqualFloat64(etInt16 id, const char* msg, etFloat64 expected, etFloat64 actual, etFloat64 precision, const char* file, int line);
+#endif
/**
* reports an error if a value is not inside a range e.g. [-5.1, +3.0]
@@ -312,7 +321,9 @@ void expectEqualFloat64(etInt16 id, const char* msg, etFloat64 expected, etFloat
* \param file the file name with the test case
* \param line the line
*/
+#ifdef ET_FLOAT32
void expectRangeFloat32(etInt16 id, const char* message, etFloat32 min, etFloat32 max, etFloat32 actual, const char* file, int line) ;
+#endif
/**
* reports an error if a value is not inside a range e.g. [-5.1, +3.0]
@@ -325,7 +336,9 @@ void expectRangeFloat32(etInt16 id, const char* message, etFloat32 min, etFloat3
* \param file the file name with the test case
* \param line the line
*/
+#ifdef ET_FLOAT64
void expectRangeFloat64(etInt16 id, const char* message, etFloat64 min, etFloat64 max, etFloat64 actual, const char* file, int line) ;
+#endif
/**
* reports an error if two pointers aren't equal
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
index 708d55c29..7149058f3 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.c
@@ -61,14 +61,14 @@ void etTimeHelpers_convertToEtTime(etTime *result, etInt32 milliSeconds){
result->nSec = milliSeconds%1000 * 1000000;
}
-boolean etTimeHelpers_isGreater(etTime* t1, etTime* t2) {
+etBool etTimeHelpers_isGreater(etTime* t1, etTime* t2) {
if (t1->sec > t2->sec) return ET_TRUE;
if (t1->sec < t2->sec) return ET_FALSE;
if (t1->nSec > t2->nSec) return ET_TRUE;
return ET_FALSE;
}
-boolean etTimeHelpers_isGreaterOrEqual(etTime* t1, etTime* t2) {
+etBool etTimeHelpers_isGreaterOrEqual(etTime* t1, etTime* t2) {
if (t1->sec > t2->sec) return ET_TRUE;
if (t1->sec < t2->sec) return ET_FALSE;
if (t1->nSec >= t2->nSec) return ET_TRUE;
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
index e70f66376..b08839d86 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/helpers/etTimeHelpers.h
@@ -75,7 +75,7 @@ void etTimeHelpers_convertToEtTime(etTime *result, etInt32 milliSeconds);
* \param t1 first time
* \param t2 second time
*/
-boolean etTimeHelpers_isGreater(etTime* t1, etTime* t2);
+etBool etTimeHelpers_isGreater(etTime* t1, etTime* t2);
/**
* check if t1 is greater than or equal as t2
@@ -83,6 +83,6 @@ boolean etTimeHelpers_isGreater(etTime* t1, etTime* t2);
* \param t1 first time
* \param t2 second time
*/
-boolean etTimeHelpers_isGreaterOrEqual(etTime* t1, etTime* t2);
+etBool etTimeHelpers_isGreaterOrEqual(etTime* t1, etTime* t2);
#endif /* _ETTIMEHELPERS_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_32Bit_FreeRTOS_Generic/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_32Bit_FreeRTOS_Generic/etDatatypes.h
index e0b270816..40d3aaaef 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_32Bit_FreeRTOS_Generic/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_32Bit_FreeRTOS_Generic/etDatatypes.h
@@ -14,9 +14,15 @@
#define _ETDATATYPES_H_
/*
- * typedefs for FreeRTOS on a 32Bit environment
- *
- * */
+ * typedefs for platform specific datatypes
+ * FreeRTOS on a 32Bit version
+ */
+
+#define ET_INT64
+#define ET_FLOAT32
+//#define ET_FLOAT64 /* not available on this platform */
+
+#include "etStdDatatypes.h"
#include <stdio.h>
#include <FreeRTOS.h>
@@ -24,75 +30,26 @@
#include <timers.h>
#include <semphr.h>
-/* unsigned integer datatypes */
-typedef unsigned char uint8;
-typedef unsigned short int uint16;
-typedef unsigned int uint32;
-typedef unsigned long long uint64;
-
-/* signed integer datatypes */
-typedef char int8;
-typedef short int int16;
-typedef int int32;
-typedef long long int64;
-
+/*--- Data types for room.basic.types */
-/* float datatypes */
-typedef float float32;
-/* typedef double float64; */ /* not available on this platform */
-
-/* boolean datatypes and values */
-//typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
-//typedef bool boolean;
-typedef char boolean;
-
-#ifndef ET_TRUE
- #define ET_TRUE 1
-#endif
-#ifndef ET_FALSE
- #define ET_FALSE 0
-#endif
-
-/*
- * typedefs for eTrice Runtime and Testing
- *
- * */
+/*-----------------------------------------------------------*/
-typedef int8 etInt8;
-typedef int16 etInt16;
-typedef int32 etInt32;
-
-typedef uint8 etUInt8;
-typedef uint16 etUInt16;
-typedef uint32 etUInt32;
-
-//typedef bool etBool;
-typedef char etBool;
+/*--- Data types for runtime */
#define ALIGNMENT 4 /* power of 2 and >= sizeof(int) ! */
-typedef float32 etFloat32;
-typedef float32 etFloat64;
-
-/* string datatypes */
-typedef char* charPtr;
-
-
typedef FILE* etFileHandle;
-typedef int8 etAddressId;
-
-
-/*
- * typedefs for OS-specific types
- */
+/* types for osal */
typedef xSemaphoreHandle etOSMutexData;
typedef xSemaphoreHandle etOSSemaData;
typedef xTaskHandle etOSThreadData;
-typedef uint16 etOSThreadId;
+typedef etUInt16 etOSThreadId;
typedef xTimerHandle etOSTimerData;
-typedef uint16 etOSTimerId;
+typedef etUInt16 etOSTimerId;
+
+/*-----------------------------------------------------------*/
#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
index 007aa865c..14407a0a1 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_POSIX_GENERIC_GCC/etDatatypes.h
@@ -17,8 +17,13 @@
/*
* typedefs for platform specific datatypes
* POSIX version
- *
- * */
+ */
+
+#define ET_INT64
+#define ET_FLOAT32
+#define ET_FLOAT64
+
+#include "etStdDatatypes.h"
#include <stdio.h>
#include <pthread.h>
@@ -26,79 +31,17 @@
#include <signal.h>
#include <sys/types.h>
-/* unsigned integer datatypes */
-typedef unsigned char uint8;
-typedef unsigned short int uint16;
-typedef unsigned long uint32;
-typedef unsigned long long uint64;
-
-/* signed integer datatypes */
-typedef char int8;
-typedef short int int16;
-typedef long int32;
-typedef long long int64;
-
+/*--- Data types for room.basic.types */
-/* float datatypes */
-typedef float float32;
-typedef double float64;
+/*-----------------------------------------------------------*/
-/* string datatypes */
-typedef char* charPtr;
-
-
-#ifndef NULL
- #define NULL 0
-#endif
-
-/* boolean datatypes and values */
-typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
-typedef bool boolean;
-
-#ifndef ET_TRUE
- #define ET_TRUE 1
-#endif
-#ifndef ET_FALSE
- #define ET_FALSE 0
-#endif
-#ifndef true
- #define true 1
-#endif
-#ifndef false
- #define false 0
-#endif
-
-#define ALIGNMENT 8 /* power of 2 and >= sizeof(int) ! */
-
-/*
- * typedefs for eTrice Runtime and Testing
- *
- * */
-
-typedef int8 etInt8;
-typedef int16 etInt16;
-typedef int32 etInt32;
-
-typedef uint8 etUInt8;
-typedef uint16 etUInt16;
-typedef uint32 etUInt32;
-
-typedef charPtr etCharPtr;
-
-typedef float32 etFloat32;
-typedef float64 etFloat64;
-
-typedef bool etBool;
+/*--- Data types for runtime */
+#define etALIGNMENT 8 /* power of 2 and >= sizeof(int) ! */
typedef FILE* etFileHandle;
-typedef int16 etAddressId;
-
-/*
- * typedefs for OS-specific types
- */
-
+/* types for osal */
typedef pthread_mutex_t etOSMutexData;
typedef pthread_t etOSThreadData;
typedef pthread_t etOSThreadId;
@@ -108,9 +51,9 @@ typedef struct {
timer_t timerid;
sigevent_t te;
etBool signaled;
-}
-etOSTimerData;
+} etOSTimerData;
typedef timer_t etOSTimerId;
+/*-----------------------------------------------------------*/
#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
index a50da01b2..8adfcda08 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/MT_WIN_MinGW/etDatatypes.h
@@ -15,87 +15,31 @@
/*
* typedefs for platform specific datatypes
- * generic Version for most bigger 32 and 64 bit platforms like Linux an Windows
- *
- * */
+ * MinGW version
+ */
+
+#define ET_INT64
+#define ET_FLOAT32
+#define ET_FLOAT64
+
+#include "etStdDatatypes.h"
#include <stdio.h>
#define WINVER 0x0500
#include <windows.h>
-/* unsigned integer datatypes */
-typedef unsigned char uint8;
-typedef unsigned short int uint16;
-typedef unsigned long uint32;
-typedef unsigned long long uint64;
-
-/* signed integer datatypes */
-typedef char int8;
-typedef short int int16;
-typedef long int32;
-typedef long long int64;
-
-
-/* float datatypes */
-typedef float float32;
-typedef double float64;
-
-/* string datatypes */
-typedef char* charPtr;
-
-
-#ifndef NULL
- #define NULL 0
-#endif
-
-/* boolean datatypes and values */
-typedef char bool; /* TODO: bool, Bool, Boolean, and boolean are already defined in some platforms*/
-
-#ifndef ET_TRUE
- #define ET_TRUE 1
-#endif
-#ifndef ET_FALSE
- #define ET_FALSE 0
-#endif
-#ifndef true
- #define true 1
-#endif
-#ifndef false
- #define false 0
-#endif
+/*--- Data types for room.basic.types */
-#define ALIGNMENT 8 /* power of 2 and >= sizeof(int) ! */
+/*-----------------------------------------------------------*/
-/*
- * typedefs for eTrice Runtime and Testing
- *
- * */
-
-typedef int8 etInt8;
-typedef int16 etInt16;
-typedef int32 etInt32;
-
-typedef uint8 etUInt8;
-typedef uint16 etUInt16;
-typedef uint32 etUInt32;
-
-typedef charPtr etCharPtr;
-
-typedef float32 etFloat32;
-typedef float64 etFloat64;
-
-typedef bool etBool;
+/*--- Data types for runtime */
+#define etALIGNMENT 8 /* power of 2 and >= sizeof(int) ! */
typedef FILE* etFileHandle;
-typedef int16 etAddressId;
-
-/*
- * typedefs for OS-specific types
- */
-
+/* types for osal */
typedef CRITICAL_SECTION etOSMutexData;
typedef HANDLE etOSThreadData;
typedef DWORD etOSThreadId;
@@ -103,4 +47,6 @@ typedef HANDLE etOSSemaData;
typedef HANDLE etOSTimerData;
typedef DWORD etOSTimerId;
+/*-----------------------------------------------------------*/
+
#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etDatatypes.h b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etDatatypes.h
index 762d9b50c..f21fb05d4 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etDatatypes.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/platforms/ST_32Bit_Generic/etDatatypes.h
@@ -16,75 +16,35 @@
/*
* typedefs for platform specific datatypes
* Version for 32 Bit Controllers like ARM Cortex M
- *
- * */
-
-#include <stdio.h>
-
-/* unsigned integer datatypes */
-typedef unsigned char uint8;
-typedef unsigned short int uint16;
-typedef unsigned int uint32;
-typedef unsigned long long uint64;
-
-/* signed integer datatypes */
-typedef char int8;
-typedef short int int16;
-typedef int int32;
-typedef long long int64;
+ */
+#define ET_INT64
+#define ET_FLOAT32
+//#define ET_FLOAT64 /* not available on this platform */
-/* float datatypes */
-typedef float float32;
-/* typedef double float64; */ /* not available on this platform */
-/* boolean datatypes and values */
-typedef char boolean;
-#ifndef ET_TRUE
- #define ET_TRUE 1
-#endif
-#ifndef ET_FALSE
- #define ET_FALSE 0
-#endif
+#include "etStdDatatypes.h"
-/*
- * typedefs for eTrice Runtime and Testing
- *
- * */
+#include <stdio.h>
-typedef int8 etInt8;
-typedef int16 etInt16;
-typedef int32 etInt32;
+/*--- Data types for room.basic.types */
-typedef uint8 etUInt8;
-typedef uint16 etUInt16;
-typedef uint32 etUInt32;
+/*-----------------------------------------------------------*/
-//typedef bool etBool;
-typedef char etBool;
+/*--- Data types for runtime */
#define ALIGNMENT 4 /* power of 2 and >= sizeof(int) ! */
-typedef float32 etFloat32;
-typedef float32 etFloat64;
-
-/* string datatypes */
-typedef char* charPtr;
-
-
typedef FILE* etFileHandle;
-typedef int8 etAddressId;
+/* types for osal */
+typedef etUInt32 etOSMutexData;
+typedef etUInt32 etOSSemaData;
+typedef etUInt32 etOSThreadData;
+typedef etUInt32 etOSThreadId;
+typedef etUInt32 etOSTimerData;
+typedef etUInt32 etOSTimerId;
-
-/*
- * typedefs for OS-specific types
- */
-typedef uint32 etOSMutexData;
-typedef uint32 etOSSemaData;
-typedef uint32 etOSThreadData;
-typedef uint32 etOSThreadId;
-typedef uint32 etOSTimerData;
-typedef uint32 etOSTimerId;
+/*-----------------------------------------------------------*/
#endif /* _DATATYPES_H_ */
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/util/RandomGenerator.c b/runtime/org.eclipse.etrice.runtime.c/src/util/RandomGenerator.c
index d849b4edb..b20444b56 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/util/RandomGenerator.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/util/RandomGenerator.c
@@ -12,9 +12,11 @@
#include "RandomGenerator.h"
+#ifdef ET_FLOAT64
+
#include "math.h"
-void RandomGenerator_init(RandomGenerator* self, float64 seed, float64 min, float64 max){
+void RandomGenerator_init(RandomGenerator* self, etFloat64 seed, etFloat64 min, etFloat64 max){
self->seed = seed;
self->min = min;
self->max = max;
@@ -23,12 +25,14 @@ void RandomGenerator_init(RandomGenerator* self, float64 seed, float64 min, floa
}
-float64 RandomGenerator_getNext(RandomGenerator* self){
+etFloat64 RandomGenerator_getNext(RandomGenerator* self){
self->seed = 1000. * fabs(log(self->seed)); /* shift comma 3 times to get nice values */
- int64 resultInt = self->seed; /* get int number left of comma */
+ etInt64 resultInt = self->seed; /* get int number left of comma */
self->seed = self->seed - resultInt; /* cut off everything left of comma */
self->current = self->seed*self->range + self->min; /* stretch to range */
self->seed += 0.1; /** seed must always be bigger than 0 for log in next iteration */
return self->current;
}
+
+#endif
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/util/RandomGenerator.h b/runtime/org.eclipse.etrice.runtime.c/src/util/RandomGenerator.h
index 3cda64a74..25e3d1b28 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/util/RandomGenerator.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/util/RandomGenerator.h
@@ -15,12 +15,14 @@
#include "etDatatypes.h"
+#ifdef ET_FLOAT64
+
typedef struct RandomGenerator {
- float64 seed;
- float64 max;
- float64 min;
- float64 range;
- float64 current;
+ etFloat64 seed;
+ etFloat64 max;
+ etFloat64 min;
+ etFloat64 range;
+ etFloat64 current;
}RandomGenerator;
/**
@@ -35,11 +37,11 @@ typedef struct RandomGenerator {
* (...)
* RandomNumberGenerator rand;
* RandomNumberGenerator_init(&rand, 0.321, -10, 10);
-* float64 result = RandomNumberGenerator_getNext(&rand);
+* etFloat64 result = RandomNumberGenerator_getNext(&rand);
* (...)
* result now holds a random number between -10 and 10;
*/
-void RandomGenerator_init(RandomGenerator* self, float64 seed, float64 min, float64 max);
+void RandomGenerator_init(RandomGenerator* self, etFloat64 seed, etFloat64 min, etFloat64 max);
/**
* initialze once before use.
@@ -48,7 +50,8 @@ void RandomGenerator_init(RandomGenerator* self, float64 seed, float64 min, floa
* @return A random number between min and max
*
*/
-float64 RandomGenerator_getNext(RandomGenerator* self);
+etFloat64 RandomGenerator_getNext(RandomGenerator* self);
+#endif
#endif /* RANDOMGENERATOR_H_ */
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room
index dba8209e0..5adf8788e 100644
--- a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_C.room
@@ -270,7 +270,7 @@ RoomModel StaticConfigTest {
DataClass Data_Super1_dc {
// PrimitiveType
- Attribute bool_r: boolean = "falSe"
+ Attribute bool_r: boolean = "false"
Attribute bool_c: boolean = "false"
Attribute bool_i: boolean = "false"
// Array
diff --git a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room
index 8c879765b..81ef8963e 100644
--- a/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room
+++ b/tests/org.eclipse.etrice.generator.common.tests/models/StaticConfigTest_Java.room
@@ -254,7 +254,7 @@ RoomModel StaticConfigTest {
DataClass Data_Super1_dc {
// PrimitiveType
- Attribute bool_r: boolean = "falSe"
+ Attribute bool_r: boolean = "false"
Attribute bool_c: boolean = "false"
Attribute bool_i: boolean = "false"
Attribute int8_r: int8 = "8"
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/make.xml b/tests/org.eclipse.etrice.runtime.c.tests/make.xml
index c31c499a0..7fe1b251c 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/make.xml
+++ b/tests/org.eclipse.etrice.runtime.c.tests/make.xml
@@ -15,7 +15,7 @@
<property name="runtime.path" value="../../runtime/org.eclipse.etrice.runtime.c"/>
<property name="bin.path" value="./bin"/>
- <property name="xml.output" value="./tmp"/>
+ <property name="xml.output" value="log"/>
<property name="output" value="./output"/>
<property environment="env"/>
@@ -31,43 +31,43 @@
set_tp: get the target.platform property from the environment var ETRICE_TARGET_PLATFORM if not set already
-->
<target name="set_tp" unless="target.platform">
- <echo>using local target platform</echo>
<property name="target.platform" value="${env.ETRICE_TARGET_PLATFORM}"/>
+ <echo>using local target platform (${target.platform})</echo>
</target>
<!--
set_tr: sets the test.result property if not set already
-->
<target name="set_tr" unless="test.results">
- <echo>using local test result folder</echo>
<property name="test.results" value="./results"/>
+ <echo>using local test result folder (${test.results})</echo>
</target>
<!--
set_platform: sets the runtime.platform property if not set already
-->
<target name="set_platform" unless="runtime.platform">
- <echo>using MinGW runtime platform</echo>
<!--
<property name="runtime.platform" value="MT_WIN_MinGW"/>
-->
<property name="runtime.platform" value="MT_POSIX_GENERIC_GCC"/>
+ <echo>using runtime platform ${runtime.platform}</echo>
</target>
<!--
set_rp: sets the runtime.path from the ETRICE_C_RUNTIME environment variable property if not set already
-->
<target name="set_rp" unless="c-runtime.path">
- <echo>using local runtime folder</echo>
<property name="c-runtime.path" value="${env.ETRICE_C_RUNTIME}"/>
+ <echo>using local runtime folder (${c-runtime.path})</echo>
</target>
<!--
set_gcc_path: sets the gcc.path property from the ETRICE_GCC_PATH environment variable property if not set already
-->
<target name="set_gcc_path" unless="gcc.path">
- <echo>using gcc from path</echo>
<property name="gcc.path" value="${env.ETRICE_GCC_PATH}"/>
+ <echo>using gcc from path (${gcc.path})</echo>
</target>
<!--
@@ -78,7 +78,7 @@
<delete dir="${c-runtime.path}/bin"/>
<delete dir="${output}"/>
<delete dir="src-gen"/>
- <delete dir="tmp"/>
+ <delete dir="log"/>
</target>
<!--
@@ -173,6 +173,7 @@
<arg value="../../src/runtime/TestEtMessageService.c"/>
<arg value="../../src/runtime/TestEtQueue.c"/>
<arg value="../../src/runtime/TestEtTimer.c"/>
+ <arg value="../../src/runtime/TestEtDatatypes.c"/>
<arg value="../../src/runtime/TestEtUnit.c"/>
<arg value="../../src/runtime/helpers/TestEtTimeHelpers.c"/>
<arg value="../../src/runtime/util/TestUtil.c"/>
@@ -188,6 +189,7 @@
<arg value="TestEtMessageService.o"/>
<arg value="TestEtQueue.o"/>
<arg value="TestEtTimer.o"/>
+ <arg value="TestEtDatatypes.o"/>
<arg value="TestEtUnit.o"/>
<arg value="TestEtTimeHelpers.o"/>
<arg value="TestUtil.o"/>
@@ -203,7 +205,8 @@
run: runs all executables
-->
<target name="run" depends="build">
- <mkdir dir="tmp/testlog"/>
+ <mkdir dir="log"/>
+ <mkdir dir="log/testlog"/>
<echo>start RuntimeTest</echo>
<exec dir="./" resolveexecutable="true" executable="./bin/test/RuntimeTest.exe" output="${output}/run.txt" />
<echo>end RuntimeTest</echo>
@@ -226,14 +229,14 @@
<java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
<arg value="-suite"/>
<arg value="org.eclipse.etrice.runtime.c.tests.TestEtUnitSpecial"/>
- <arg value="./tmp/testlog/TestEtUnitSpecial.etu"/>
+ <arg value="./log/testlog/TestEtUnitSpecial.etu"/>
<classpath refid="clspath"/>
</java>
<java output="${output}/convert.txt" append="true" classname="org.eclipse.etrice.etunit.converter.EtUnitReportConverter" fork="true" failonerror="true">
<arg value="-suite"/>
<arg value="org.eclipse.etrice.runtime.c.tests.TestCRuntime"/>
- <arg value="./tmp/testlog/TestCRuntime.etu"/>
+ <arg value="./log/testlog/TestCRuntime.etu"/>
<classpath refid="clspath"/>
</java>
</target>
@@ -242,9 +245,9 @@
copy_results: copies the *.xml results to their final destination
-->
<target name="copy_results" depends="set_tr">
- <move file="./tmp/testlog/TestEtUnitSpecial.xml" tofile="./tmp/testlog/CTestEtUnitSpecial.xml"/>
+ <move file="./log/testlog/TestEtUnitSpecial.xml" tofile="./log/testlog/CTestEtUnitSpecial.xml"/>
<copy todir="${test.results}" >
- <fileset dir="./tmp/testlog">
+ <fileset dir="./log/testlog">
<include name="*.xml"/>
</fileset>
</copy>
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c
index 87b09c3f5..0a932fb44 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/RunCRuntimeTestcases.c
@@ -28,6 +28,7 @@
#include "TestEtMemory.h"
#include "TestEtQueue.h"
#include "TestEtTimer.h"
+#include "TestEtDatatypes.h"
#include "helpers/TestEtTimeHelpers.h"
#include "util/TestUtil.h"
@@ -37,9 +38,9 @@
void RunCRuntimeTestcases(void){
etInt16 id;
- etMSCLogger_open("tmp/testlog", "test.log");
- etUnit_open("tmp/testlog","TestCRuntime");
-
+ etMSCLogger_open("log/testlog", "test.log");
+ etUnit_open("log/testlog","TestCRuntime");
+
TestEtQueue_runSuite();
TestEtMemory_runSuite();
TestEtMessage_runSuite();
@@ -47,6 +48,7 @@ void RunCRuntimeTestcases(void){
TestEtMessageService_runSuite();
TestEtUnit_runSuite();
TestEtTimer_runSuite();
+ TestEtDatatypes_runSuite();
TestEtTimeHelpers_runSuite();
TestUtil_runSuite();
@@ -54,7 +56,7 @@ void RunCRuntimeTestcases(void){
/* special situation for testing openAll and closeAll of etUnit
* this has to be done outside of etUnit_open and etUnit_close */
- id = etUnit_openAll("tmp/testlog","TestEtUnitSpecial", "etUnit", "openAll and closeAll");
+ id = etUnit_openAll("log/testlog","TestEtUnitSpecial", "etUnit", "openAll and closeAll");
EXPECT_TRUE(id, "Open and Close", ET_TRUE);
etUnit_closeAll(id);
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.c
new file mode 100644
index 000000000..84cbb0ff9
--- /dev/null
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.c
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2015 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Juergen Haug (initial contribution)
+ *
+ *******************************************************************************/
+
+#include "TestEtDatatypes.h"
+#include "etUnit/etUnit.h"
+
+void TestEtDatatypes_IntegerSize(etInt16 id) {
+ EXPECT_EQUAL_INT32(id, "", 1, sizeof(int8));
+ EXPECT_EQUAL_INT32(id, "", 1, sizeof(uint8));
+ EXPECT_EQUAL_INT32(id, "", 2, sizeof(int16));
+ EXPECT_EQUAL_INT32(id, "", 2, sizeof(uint16));
+ EXPECT_EQUAL_INT32(id, "", 4, sizeof(int32));
+ EXPECT_EQUAL_INT32(id, "", 4, sizeof(uint32));
+
+#ifdef ET_INT64
+ EXPECT_EQUAL_INT32(id, "", 8, sizeof(int64));
+ EXPECT_EQUAL_INT32(id, "", 8, sizeof(uint64));
+#endif
+
+ EXPECT_EQUAL_INT32(id, "", 1, sizeof(etInt8));
+ EXPECT_EQUAL_INT32(id, "", 1, sizeof(etUInt8));
+ EXPECT_EQUAL_INT32(id, "", 2, sizeof(etInt16));
+ EXPECT_EQUAL_INT32(id, "", 2, sizeof(etUInt16));
+ EXPECT_EQUAL_INT32(id, "", 4, sizeof(etInt32));
+ EXPECT_EQUAL_INT32(id, "", 4, sizeof(etUInt32));
+
+#ifdef ET_INT64
+ EXPECT_EQUAL_INT32(id, "", 8, sizeof(etInt64));
+ EXPECT_EQUAL_INT32(id, "", 8, sizeof(etUInt64));
+#endif
+}
+
+void TestEtDatatypes_IntegerSign(etInt16 id) {
+ EXPECT_TRUE(id, "", ((int8 )-1) < 0);
+ EXPECT_TRUE(id, "", ((uint8 )-1) >= 0);
+ EXPECT_TRUE(id, "", ((int16 )-1) < 0);
+ EXPECT_TRUE(id, "", ((uint16 )-1) >= 0);
+ EXPECT_TRUE(id, "", ((int32 )-1) < 0);
+ EXPECT_TRUE(id, "", ((uint32 )-1) >= 0);
+
+#ifdef ET_INT64
+ EXPECT_TRUE(id, "", ((int64 )-1) < 0);
+ EXPECT_TRUE(id, "", ((uint64 )-1) >= 0);
+#endif
+
+ EXPECT_TRUE(id, "", ((etInt8 )-1) < 0);
+ EXPECT_TRUE(id, "", ((etUInt8 )-1) >= 0);
+ EXPECT_TRUE(id, "", ((etInt16 )-1) < 0);
+ EXPECT_TRUE(id, "", ((etUInt16 )-1) >= 0);
+ EXPECT_TRUE(id, "", ((etInt32 )-1) < 0);
+ EXPECT_TRUE(id, "", ((etUInt32 )-1) >= 0);
+
+#ifdef ET_INT64
+ EXPECT_TRUE(id, "", ((etInt64 )-1) < 0);
+ EXPECT_TRUE(id, "", ((etUInt64 )-1) >= 0);
+#endif
+}
+
+void TestEtDatatypes_Boolean(etInt16 id) {
+ EXPECT_TRUE(id, "", (bool)1);
+ EXPECT_FALSE(id, "", (bool)0);
+
+ EXPECT_TRUE(id, "", (etBool )1);
+ EXPECT_FALSE(id, "", (etBool )0);
+}
+
+void TestEtDatatypes_FLOAT(etInt16 id) {
+#ifdef ET_FLOAT32
+ EXPECT_EQUAL_INT32(id, "", 4, sizeof(float32));
+ EXPECT_EQUAL_INT32(id, "", 4, sizeof(etFloat32));
+#endif
+#ifdef ET_FLOAT64
+ EXPECT_EQUAL_INT32(id, "", 8, sizeof(float64));
+ EXPECT_EQUAL_INT32(id, "", 8, sizeof(etFloat64));
+#endif
+}
+
+void TestEtDatatypes_runSuite(void) {
+ etUnit_openTestSuite("TestDatatypes");
+ ADD_TESTCASE(TestEtDatatypes_IntegerSize);
+ ADD_TESTCASE(TestEtDatatypes_IntegerSign);
+ ADD_TESTCASE(TestEtDatatypes_Boolean);
+ ADD_TESTCASE(TestEtDatatypes_FLOAT);
+ etUnit_closeTestSuite();
+}
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.h b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.h
new file mode 100644
index 000000000..abe06201a
--- /dev/null
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtDatatypes.h
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2015 protos software gmbh (http://www.protos.de).
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * CONTRIBUTORS:
+ * Juergen Haug (initial contribution)
+ *
+ *******************************************************************************/
+
+#ifndef _TESTETDATATYPES_H_
+#define _TESTETDATATYPES_H_
+
+#include "etDatatypes.h"
+
+void TestEtDatatypes_runSuite(void);
+
+#endif /* _TESTETDATATYPES_H_ */
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtUnit.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtUnit.c
index 34366ee5e..4bf2c137e 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtUnit.c
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/TestEtUnit.c
@@ -36,8 +36,10 @@ void TestEtUnit_Expect(etInt16 id){
EXPECT_EQUAL_UINT32(id, "EXPECT_EQUAL_INT32", 1234567, 1234567);
/* float values */
+#ifdef ET_FLOAT32
EXPECT_EQUAL_FLOAT32(id, "EXPECT_EQUAL_FLOAT32", (etFloat32) 123.456, (etFloat32) 123.456, (etFloat32) 0.0001);
EXPECT_EQUAL_FLOAT32(id, "EXPECT_EQUAL_FLOAT32", (etFloat32) 123.456, (etFloat32) 123.456, (etFloat32) 0.0001);
+#endif
/* Pointers */
etUInt16 value;
diff --git a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c
index 13d3fa251..da583e1de 100644
--- a/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c
+++ b/tests/org.eclipse.etrice.runtime.c.tests/src/runtime/util/TestUtil.c
@@ -16,6 +16,8 @@
#include "RandomGenerator.h"
+#ifdef ET_FLOAT64
+
static void TestRandomGenerator (etInt16 id) {
RandomGenerator rand;
int i;
@@ -28,7 +30,7 @@ static void TestRandomGenerator (etInt16 id) {
EXPECT_RANGE_FLOAT64(id, "random [-1,+1]", -1., +1., result); /* check for range */
sum += result;
}
- average = sum / (float64)i;
+ average = sum / (etFloat64)i;
EXPECT_RANGE_FLOAT64(id, "average [-1,+1]", -0.1, 0.1, average); /* check for quality */
sum = average = 0;
@@ -38,16 +40,21 @@ static void TestRandomGenerator (etInt16 id) {
EXPECT_RANGE_FLOAT64(id, "random [-500,+1000]", -500., +1000., result); /* check for range */
sum += result;
}
- average = sum / (float64)i;
+ average = sum / (etFloat64)i;
EXPECT_RANGE_FLOAT64(id, "average [-500,+1000]", 230., 270., average); /* check for quality */
}
+#endif
void TestUtil_runSuite(void){
etUnit_openTestSuite("TestUtil");
+
+#ifdef ET_FLOAT64
ADD_TESTCASE(TestRandomGenerator);
+#endif
+
etUnit_closeTestSuite();
}

Back to the top