[SLG ROS] Code cleanup, Erika switch
diff --git a/load_generator/docu/SLG_ROS_guide.docx b/load_generator/docu/SLG_ROS_guide.docx index 48bef3a..41e6dbf 100644 --- a/load_generator/docu/SLG_ROS_guide.docx +++ b/load_generator/docu/SLG_ROS_guide.docx Binary files differ
diff --git a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosChannelSendUtilsGenerator.xtend b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosChannelSendUtilsGenerator.xtend index 7a04981..3d1ed4d 100644 --- a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosChannelSendUtilsGenerator.xtend +++ b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosChannelSendUtilsGenerator.xtend
@@ -15,6 +15,7 @@ import org.eclipse.app4mc.amalthea.model.ChannelSend import org.eclipse.app4mc.amalthea.model.Tag +import org.eclipse.app4mc.slg.ros2.transformers.utils.Code import org.eclipse.app4mc.slg.ros2.transformers.utils.RosModelUtils class MicroRosChannelSendUtilsGenerator { @@ -36,10 +37,7 @@ // // void «rosNodeName»_publish_to_«param»(rcl_publisher_t * «rosNodeName»Node_«param»_publisher, std_msgs__msg__String * «rosNodeName»Node_«param»_msg){ // // ''' -// #ifdef __cplusplus -// extern "C" -// { -// #endif +// «Code.IFDEF_EXTERN_C_BEGIN» // extern rcl_publisher_t «rosNodeName»Node_«param»_publisher; // // void «rosNodeName»_publish_to_«param»(std_msgs__msg__String «rosNodeName»Node_«param»_msg){ @@ -47,11 +45,7 @@ // snprintf(«tag.getName()»Node_«param»_msg.data.data, «rosNodeName»Node_«param»_msg.data.capacity, "AAAAAAAAAAAAAAAAAAA"); // «rosNodeName»Node_«param»_msg.data.size = strlen(«rosNodeName»Node_«param»_msg.data.data); // } -// -// #ifdef __cplusplus -// } -// #endif -// +// «Code.IFDEF_EXTERN_C_END» // ''' // } @@ -60,13 +54,10 @@ val String rosNodeName = RosModelUtils.getROSNodeName(tag) ''' - #ifdef __cplusplus - extern "C" - { - #endif + «Code.IFDEF_EXTERN_C_BEGIN» extern rcl_publisher_t «rosNodeName.toLowerCase»Node_«param»_publisher; - void «tag.name»_publish_to_«param»(std_msgs__msg__String «rosNodeName»Node_«param»_msg){ + void «rosNodeName»_publish_to_«param»(std_msgs__msg__String «rosNodeName»Node_«param»_msg){ rcl_ret_t rc; snprintf(«rosNodeName»Node_«param»_msg.data.data, «rosNodeName»Node_«param»_msg.data.capacity, "AAAAAAAAAAAAAAAAAAA"); «rosNodeName»Node_«param»_msg.data.size = strlen(«rosNodeName»Node_«param»_msg.data.data); @@ -76,10 +67,7 @@ debug_printf(" Published message on '«param»' topic\n"); debug_printf(" Published message '%s'\n", «rosNodeName»Node_«param»_msg.data.data); } - - #ifdef __cplusplus - } - #endif + «Code.IFDEF_EXTERN_C_END» ''' } @@ -99,16 +87,9 @@ // void «rosNodeName»_publish_to_«param»(rcl_publisher_t * «rosNodeName»Node_«param»_publisher, std_msgs__msg__String * «rosNodeName»Node_«param»_msg); ''' - #ifdef __cplusplus - extern "C" - { - #endif - + «Code.IFDEF_EXTERN_C_BEGIN» void «rosNodeName»_publish_to_«param»(std_msgs__msg__String «rosNodeName»Node_«param»_msg); - - #ifdef __cplusplus - } - #endif + «Code.IFDEF_EXTERN_C_END» ''' }
diff --git a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosNodeGenerator.xtend b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosNodeGenerator.xtend index 9f6d08b..b2d703a 100644 --- a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosNodeGenerator.xtend +++ b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosNodeGenerator.xtend
@@ -36,16 +36,11 @@ val nodeName = RosModelUtils.getROSNodeName(tag).toLowerCase val subscriberChannelNames = RosModelUtils.getSubscribers(tag).map[name.toLowerCase] val publisherChannelNames = RosModelUtils.getPublishers(tag).map[name.toLowerCase] + + val isErika = RosModelUtils.getROSTypeName(tag).startsWith("Erika") ''' - «IF Code.ERIKA» - #ifdef __cplusplus - extern "C" - { - #endif - - «ENDIF» - + «Code.IFDEF_EXTERN_C_BEGIN» #include <stdio.h> #include <std_msgs/msg/string.h> #include <rclc/executor.h> @@ -54,15 +49,15 @@ «header» «ENDFOR» - «IF Code.ERIKA» + «IF isErika» /* ERIKA include */ #include "ee.h" #include "erika_board_cfg.h" - + /* Console output */ #include "output_console.h" - - «ENDIF» + «ENDIF» + /****************************************************************************** * PERIODIC Tasks *****************************************************************************/ @@ -224,9 +219,11 @@ int uros_init_done = 0; /* uROS Initialization task (one-shot) */ - DeclareTask(uROSInitTask); - TASK(uROSInitTask) - { + «IF isErika» + DeclareTask(uROSInitTask); + TASK(uROSInitTask) + { + «ENDIF» printf("Activate MicroROS Init Task\n"); /* Setup microros transport functions */ uros_communication_setup(); @@ -236,50 +233,53 @@ if (ret == 0) { uros_init_done = 1; } - - TerminateTask(); - } + + «IF isErika» + TerminateTask(); + } + «ENDIF» /* uROS Ping Pong task (periodic = 10000usec) */ - DeclareTask(uROSPeriodicTask); - TASK(uROSPeriodicTask) - { + «IF isErika» + DeclareTask(uROSPeriodicTask); + TASK(uROSPeriodicTask) + { + «ENDIF» if(uros_init_done == 1) { rclc_executor_spin_some(&executor, RCL_MS_TO_NS(10)); } - } + «IF isErika» + } + «ENDIF» /****************************************************************************** * MAIN *****************************************************************************/ - void idle_hook(void); - void idle_hook(void) - { - printf("Starting communication over UART\n"); - - /* Activate task performing MicroROS app */ - ActivateTask(uROSInitTask); - - /* endless loop*/ - while (1) { - asm volatile("wfi": : : "memory"); - } - } + void idle_hook(void); + void idle_hook(void) + { + printf("Starting communication over UART\n"); + «IF isErika» + «""» /* Activate task performing MicroROS app */ + ActivateTask(uROSInitTask); + «ENDIF» + /* endless loop*/ + while (1) { + asm volatile("wfi": : : "memory"); + } + } int main(void) { + «IF isErika» erika_console_init(); printf("Starting «nodeName.toUpperCase» (MicroROS node)\n"); StartOS(OSDEFAULTAPPMODE); return 0; - } - - «IF Code.ERIKA» - #ifdef __cplusplus - } - #endif «ENDIF» + } + «Code.IFDEF_EXTERN_C_END» ''' }
diff --git a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosTicksUtilsGenerator.xtend b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosTicksUtilsGenerator.xtend index 906c955..80465a1 100644 --- a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosTicksUtilsGenerator.xtend +++ b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/generators/MicroRosTicksUtilsGenerator.xtend
@@ -35,13 +35,13 @@ # «LIB_NAME» ################################################################ #### add_library(«LIB_NAME» STATIC - «FOR srcFile : srcFiles» - ${CMAKE_CURRENT_LIST_DIR}/_src/«srcFile» + «FOR srcFile : srcFiles» + ${CMAKE_CURRENT_LIST_DIR}/_src/«srcFile» «ENDFOR» ) target_include_directories(«LIB_NAME» - PUBLIC ${CMAKE_CURRENT_LIST_DIR}/_inc/ + PUBLIC ${CMAKE_CURRENT_LIST_DIR}/_inc/ ) ''' @@ -135,23 +135,23 @@ // default implementation of tick burning int numLoops = ticks / 400; # if defined (__x86_64__) - for (int i = 0; i < numLoops; i++) { - «FOR i : 1..400» - __asm volatile("nop"); - «ENDFOR» - } - # elif defined (__x86_32__) - for (int i = 0; i < numLoops; i++) { - «FOR i : 1..400» - __asm volatile("mov r0, r0"); - «ENDFOR» - } + for (int i = 0; i < numLoops; i++) { + «FOR i : 1..400» + __asm volatile("nop"); + «ENDFOR» + } + # elif defined (__x86_32__) + for (int i = 0; i < numLoops; i++) { + «FOR i : 1..400» + __asm volatile("mov r0, r0"); + «ENDFOR» + } # elif defined (__aarch64__) - for (int i = 0; i < numLoops; i++) { - «FOR i : 1..400» - __asm volatile("mov x0, x0"); - «ENDFOR» - } + for (int i = 0; i < numLoops; i++) { + «FOR i : 1..400» + __asm volatile("mov x0, x0"); + «ENDFOR» + } # endif '''
diff --git a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/transformers/MicroRosChannelSendUtilsTransformer.java b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/transformers/MicroRosChannelSendUtilsTransformer.java index 3cec60c..7b3dcdd 100644 --- a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/transformers/MicroRosChannelSendUtilsTransformer.java +++ b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/transformers/MicroRosChannelSendUtilsTransformer.java
@@ -36,8 +36,6 @@ public static final String LIB_NAME = "CHANNELSEND_UTIL"; public static final String BASE_PATH = "synthetic_gen"; public static final String MODULE_NAME = "channelSendUtils"; -// public static final String MODULE_PATH = BASE_PATH + "/" + MODULE_NAME; -// public static final String MAKEFILE_PATH = MODULE_PATH + "/CMakeLists.txt"; private List<String> topicList = new ArrayList<>();
diff --git a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/transformers/MicroRosLabelTransformer.java b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/transformers/MicroRosLabelTransformer.java index 1e58b41..3e821d3 100644 --- a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/transformers/MicroRosLabelTransformer.java +++ b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/microros/transformers/MicroRosLabelTransformer.java
@@ -90,7 +90,9 @@ } protected void genFiles(SLGTranslationUnit tu, Label label) { - incAppend(tu, "#pragma once \n\n"); + if (isIncFileEmpty(tu)) { + incAppend(tu, "#pragma once \n\n"); + } incAppend(tu, MicroRosLabelGenerator.toH(label)); if (isSrcFileEmpty(tu)) {
diff --git a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/ros2/transformers/common/RosNodeTransformer.java b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/ros2/transformers/common/RosNodeTransformer.java index 1fc3733..0ee43cd 100644 --- a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/ros2/transformers/common/RosNodeTransformer.java +++ b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/ros2/transformers/common/RosNodeTransformer.java
@@ -119,7 +119,6 @@ String rosTypeName = RosModelUtils.getROSTypeName(tag); boolean isMicroRos = MICRO_ROS_TYPES.contains(rosTypeName); - boolean isErika = rosTypeName.startsWith("Erika"); HashSet<String> codehookHeaders = new HashSet<>();
diff --git a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/ros2/transformers/utils/Code.java b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/ros2/transformers/utils/Code.java index 66d2323..b8d59b3 100644 --- a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/ros2/transformers/utils/Code.java +++ b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/src/org/eclipse/app4mc/slg/ros2/transformers/utils/Code.java
@@ -20,8 +20,8 @@ throw new IllegalStateException("Utility class"); } - public static final String IFDEF_EXTERN_C_BEGIN = "\n#ifdef __cplusplus \n extern \"C\" \n {\n#endif\n"; - public static final String IFDEF_EXTERN_C_END = "#ifdef __cplusplus \n }\n#endif\n\n"; + public static final String IFDEF_EXTERN_C_BEGIN = "\n#ifdef __cplusplus \n extern \"C\" \n {\n#endif\n\n"; + public static final String IFDEF_EXTERN_C_END = "\n#ifdef __cplusplus \n }\n#endif\n\n"; public static final boolean ERIKA = true; // temporary: just an attempt to mark the ERIKA parts of the code
diff --git a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosChannelSendUtilsGenerator.java b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosChannelSendUtilsGenerator.java index d7d128e..cce7981 100644 --- a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosChannelSendUtilsGenerator.java +++ b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosChannelSendUtilsGenerator.java
@@ -15,6 +15,7 @@ import org.eclipse.app4mc.amalthea.model.Channel; import org.eclipse.app4mc.amalthea.model.ChannelSend; import org.eclipse.app4mc.amalthea.model.Tag; +import org.eclipse.app4mc.slg.ros2.transformers.utils.Code; import org.eclipse.app4mc.slg.ros2.transformers.utils.RosModelUtils; import org.eclipse.xtend2.lib.StringConcatenation; @@ -44,14 +45,8 @@ final String param = _name; final String rosNodeName = RosModelUtils.getROSNodeName(tag); StringConcatenation _builder = new StringConcatenation(); - _builder.append("#ifdef __cplusplus"); - _builder.newLine(); - _builder.append("extern \"C\""); - _builder.newLine(); - _builder.append("{"); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); + _builder.append(Code.IFDEF_EXTERN_C_BEGIN); + _builder.newLineIfNotEmpty(); _builder.append("extern rcl_publisher_t "); String _lowerCase = rosNodeName.toLowerCase(); _builder.append(_lowerCase); @@ -61,8 +56,7 @@ _builder.newLineIfNotEmpty(); _builder.newLine(); _builder.append("void "); - String _name_1 = tag.getName(); - _builder.append(_name_1); + _builder.append(rosNodeName); _builder.append("_publish_to_"); _builder.append(param); _builder.append("(std_msgs__msg__String "); @@ -123,13 +117,8 @@ _builder.newLineIfNotEmpty(); _builder.append("}"); _builder.newLine(); - _builder.newLine(); - _builder.append("#ifdef __cplusplus"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); + _builder.append(Code.IFDEF_EXTERN_C_END); + _builder.newLineIfNotEmpty(); _xblockexpression = _builder.toString(); } return _xblockexpression; @@ -160,15 +149,8 @@ final String param = _name; final String rosNodeName = RosModelUtils.getROSNodeName(tag); StringConcatenation _builder = new StringConcatenation(); - _builder.append("#ifdef __cplusplus"); - _builder.newLine(); - _builder.append("extern \"C\""); - _builder.newLine(); - _builder.append("{"); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); - _builder.newLine(); + _builder.append(Code.IFDEF_EXTERN_C_BEGIN); + _builder.newLineIfNotEmpty(); _builder.append("void "); _builder.append(rosNodeName); _builder.append("_publish_to_"); @@ -179,13 +161,8 @@ _builder.append(param); _builder.append("_msg);"); _builder.newLineIfNotEmpty(); - _builder.newLine(); - _builder.append("#ifdef __cplusplus"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); - _builder.append("#endif\t\t"); - _builder.newLine(); + _builder.append(Code.IFDEF_EXTERN_C_END); + _builder.newLineIfNotEmpty(); _xblockexpression = _builder.toString(); } return _xblockexpression;
diff --git a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosNodeGenerator.java b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosNodeGenerator.java index 9335b66..863170a 100644 --- a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosNodeGenerator.java +++ b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosNodeGenerator.java
@@ -43,21 +43,10 @@ return it.getName().toLowerCase(); }; final Iterable<String> publisherChannelNames = IterableExtensions.<Channel, String>map(RosModelUtils.getPublishers(tag), _function_1); + final boolean isErika = RosModelUtils.getROSTypeName(tag).startsWith("Erika"); StringConcatenation _builder = new StringConcatenation(); - { - if (Code.ERIKA) { - _builder.append("#ifdef __cplusplus"); - _builder.newLine(); - _builder.append("extern \"C\""); - _builder.newLine(); - _builder.append("{"); - _builder.newLine(); - _builder.append("#endif"); - _builder.newLine(); - _builder.newLine(); - } - } - _builder.newLine(); + _builder.append(Code.IFDEF_EXTERN_C_BEGIN); + _builder.newLineIfNotEmpty(); _builder.append("#include <stdio.h>"); _builder.newLine(); _builder.append("#include <std_msgs/msg/string.h>"); @@ -74,7 +63,7 @@ } _builder.newLine(); { - if (Code.ERIKA) { + if (isErika) { _builder.append("/* ERIKA include */"); _builder.newLine(); _builder.append("#include \"ee.h\""); @@ -86,9 +75,9 @@ _builder.newLine(); _builder.append("#include \"output_console.h\""); _builder.newLine(); - _builder.newLine(); } } + _builder.newLine(); _builder.append("/******************************************************************************"); _builder.newLine(); _builder.append(" "); @@ -545,12 +534,16 @@ _builder.newLine(); _builder.append("/* uROS Initialization task (one-shot) */"); _builder.newLine(); - _builder.append("DeclareTask(uROSInitTask);"); - _builder.newLine(); - _builder.append("TASK(uROSInitTask)"); - _builder.newLine(); - _builder.append("{"); - _builder.newLine(); + { + if (isErika) { + _builder.append("DeclareTask(uROSInitTask);"); + _builder.newLine(); + _builder.append("TASK(uROSInitTask)"); + _builder.newLine(); + _builder.append("{"); + _builder.newLine(); + } + } _builder.append(" "); _builder.append("printf(\"Activate MicroROS Init Task\\n\");"); _builder.newLine(); @@ -579,20 +572,28 @@ _builder.append("}"); _builder.newLine(); _builder.newLine(); - _builder.append(" "); - _builder.append("TerminateTask();"); - _builder.newLine(); - _builder.append("}"); - _builder.newLine(); + { + if (isErika) { + _builder.append(" "); + _builder.append("TerminateTask();"); + _builder.newLine(); + _builder.append("}"); + _builder.newLine(); + } + } _builder.newLine(); _builder.append("/* uROS Ping Pong task (periodic = 10000usec) */"); _builder.newLine(); - _builder.append("DeclareTask(uROSPeriodicTask);"); - _builder.newLine(); - _builder.append("TASK(uROSPeriodicTask)"); - _builder.newLine(); - _builder.append("{"); - _builder.newLine(); + { + if (isErika) { + _builder.append("DeclareTask(uROSPeriodicTask);"); + _builder.newLine(); + _builder.append("TASK(uROSPeriodicTask)"); + _builder.newLine(); + _builder.append("{"); + _builder.newLine(); + } + } _builder.append("\t"); _builder.append("if(uros_init_done == 1) {"); _builder.newLine(); @@ -602,8 +603,12 @@ _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append("}"); - _builder.newLine(); + { + if (isErika) { + _builder.append("}"); + _builder.newLine(); + } + } _builder.newLine(); _builder.newLine(); _builder.append("/******************************************************************************"); @@ -614,41 +619,36 @@ _builder.append(" "); _builder.append("*****************************************************************************/"); _builder.newLine(); - _builder.append(" "); _builder.append("void idle_hook(void);"); _builder.newLine(); - _builder.append(" "); _builder.append("void idle_hook(void)"); _builder.newLine(); - _builder.append(" "); _builder.append("{"); _builder.newLine(); - _builder.append(" "); + _builder.append("\t"); _builder.append("printf(\"Starting communication over UART\\n\");"); _builder.newLine(); - _builder.append(" "); - _builder.newLine(); - _builder.append(" "); - _builder.append("/* Activate task performing MicroROS app */"); - _builder.newLine(); - _builder.append(" "); - _builder.append("ActivateTask(uROSInitTask);"); - _builder.newLine(); - _builder.append(" "); - _builder.newLine(); - _builder.append(" "); + { + if (isErika) { + _builder.append("\t/* Activate task performing MicroROS app */"); + _builder.newLineIfNotEmpty(); + _builder.append("\t"); + _builder.append("ActivateTask(uROSInitTask);"); + _builder.newLine(); + } + } + _builder.append("\t"); _builder.append("/* endless loop*/"); _builder.newLine(); - _builder.append(" "); + _builder.append("\t"); _builder.append("while (1) {"); _builder.newLine(); - _builder.append(" "); + _builder.append("\t\t"); _builder.append("asm volatile(\"wfi\": : : \"memory\");"); _builder.newLine(); - _builder.append(" "); + _builder.append("\t"); _builder.append("}"); _builder.newLine(); - _builder.append(" "); _builder.append("}"); _builder.newLine(); _builder.append(" "); @@ -659,35 +659,26 @@ _builder.append(" "); _builder.append("{"); _builder.newLine(); - _builder.append(" "); - _builder.append("erika_console_init();"); - _builder.newLine(); - _builder.append(" "); - _builder.append("printf(\"Starting "); - String _upperCase = nodeName.toUpperCase(); - _builder.append(_upperCase, " "); - _builder.append(" (MicroROS node)\\n\");"); - _builder.newLineIfNotEmpty(); - _builder.append(" "); - _builder.append("StartOS(OSDEFAULTAPPMODE);"); - _builder.newLine(); - _builder.append(" "); - _builder.append("return 0;"); - _builder.newLine(); - _builder.append(" "); - _builder.append("}"); - _builder.newLine(); - _builder.newLine(); { - if (Code.ERIKA) { - _builder.append("#ifdef __cplusplus"); + if (isErika) { + _builder.append("erika_console_init();"); _builder.newLine(); - _builder.append("}"); + _builder.append("printf(\"Starting "); + String _upperCase = nodeName.toUpperCase(); + _builder.append(_upperCase); + _builder.append(" (MicroROS node)\\n\");"); + _builder.newLineIfNotEmpty(); + _builder.append("StartOS(OSDEFAULTAPPMODE);"); _builder.newLine(); - _builder.append("#endif"); + _builder.append("return 0;"); _builder.newLine(); } } + _builder.append(" "); + _builder.append("}"); + _builder.newLine(); + _builder.append(Code.IFDEF_EXTERN_C_END); + _builder.newLineIfNotEmpty(); _xblockexpression = _builder.toString(); } return _xblockexpression;
diff --git a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosTicksUtilsGenerator.java b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosTicksUtilsGenerator.java index d94f23e..8bf5e8a 100644 --- a/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosTicksUtilsGenerator.java +++ b/load_generator/plugins/org.eclipse.app4mc.slg.ros2/xtend-gen/org/eclipse/app4mc/slg/microros/generators/MicroRosTicksUtilsGenerator.java
@@ -46,8 +46,9 @@ _builder.newLineIfNotEmpty(); { for(final String srcFile : srcFiles) { + _builder.append("\t"); _builder.append("${CMAKE_CURRENT_LIST_DIR}/_src/"); - _builder.append(srcFile); + _builder.append(srcFile, "\t"); _builder.newLineIfNotEmpty(); } } @@ -58,7 +59,7 @@ _builder.append("target_include_directories("); _builder.append(MicroRosTicksUtilsGenerator.LIB_NAME, "\t"); _builder.newLineIfNotEmpty(); - _builder.append("\t "); + _builder.append("\t\t"); _builder.append("PUBLIC ${CMAKE_CURRENT_LIST_DIR}/_inc/"); _builder.newLine(); _builder.append("\t"); @@ -243,50 +244,50 @@ _builder.newLine(); _builder.append("#\tif defined (__x86_64__)"); _builder.newLine(); - _builder.append(" \t"); + _builder.append("\t\t"); _builder.append("for (int i = 0; i < numLoops; i++) {"); _builder.newLine(); { IntegerRange _upTo = new IntegerRange(1, 400); for(final Integer i : _upTo) { - _builder.append(" \t\t"); + _builder.append("\t\t\t"); _builder.append("__asm volatile(\"nop\");"); _builder.newLine(); } } - _builder.append(" \t\t"); + _builder.append("\t\t"); _builder.append("}"); _builder.newLine(); - _builder.append("#\telif defined (__x86_32__) \t\t"); + _builder.append("#\telif defined (__x86_32__)"); _builder.newLine(); - _builder.append(" \t\t"); + _builder.append("\t\t"); _builder.append("for (int i = 0; i < numLoops; i++) {"); _builder.newLine(); { IntegerRange _upTo_1 = new IntegerRange(1, 400); for(final Integer i_1 : _upTo_1) { - _builder.append(" \t\t\t \t"); + _builder.append("\t\t\t"); _builder.append("__asm volatile(\"mov r0, r0\");"); _builder.newLine(); } } - _builder.append(" \t\t\t\t"); + _builder.append("\t\t"); _builder.append("}"); _builder.newLine(); _builder.append("#\telif defined (__aarch64__) \t\t"); _builder.newLine(); - _builder.append(" \t"); + _builder.append("\t\t"); _builder.append("for (int i = 0; i < numLoops; i++) {"); _builder.newLine(); { IntegerRange _upTo_2 = new IntegerRange(1, 400); for(final Integer i_2 : _upTo_2) { - _builder.append(" \t"); + _builder.append("\t\t\t"); _builder.append("__asm volatile(\"mov x0, x0\");"); _builder.newLine(); } } - _builder.append("\t"); + _builder.append("\t\t"); _builder.append("}"); _builder.newLine(); _builder.append("#\tendif");