Skip to content
Snippets Groups Projects
Commit 6588d0e8 authored by Javier.Errea-Moreno's avatar Javier.Errea-Moreno Committed by Jakob.Fittler
Browse files

Javier mbed changes

parent e08c00b3
No related branches found
No related tags found
1 merge request!171Mbed
File added
......@@ -169,9 +169,9 @@ public class AVATAR2CMBED {
makeConcurrencyMutex();
makeSynchronousChannels();
//makeSynchronousChannels();
makeAsynchronousChannels();
//makeAsynchronousChannels();
makeTasks();
......@@ -376,9 +376,15 @@ public class AVATAR2CMBED {
cpt++;
}
ret += "\"," + tr + ");" + CR;
<<<<<<< HEAD
ret += traceFunctionCall(_block.getName(), _am.getName(), "my__attr");
} else {
ret += traceFunctionCall(_block.getName(), _am.getName(), null);
=======
//ret += traceFunctionCall(_block.getName(), _am.getName(), "my__attr");
} else {
//ret += traceFunctionCall(_block.getName(), _am.getName(), null);
>>>>>>> Javier mbed changes
}
}
......@@ -462,7 +468,11 @@ public class AVATAR2CMBED {
int nbOfMaxParams = _block.getMaxNbOfParams();
//s+= "request *__req;" + CR;
//Comentamos todos los unused atributes
<<<<<<< HEAD
=======
/*
>>>>>>> Javier mbed changes
for(i=0; i<_block.getMaxNbOfMultipleBranches(); i++) {
s+= UNUSED_ATTR + " request __req" + i + ";" + CR;
s+= UNUSED_ATTR + "int *__params" + i + "[" + nbOfMaxParams + "];" + CR;
......@@ -473,14 +483,22 @@ public class AVATAR2CMBED {
//s+= UNUSED_ATTR + "rtos::ConditionVariable __myCond(&__mainMutex)" + CR;
s+= UNUSED_ATTR + "request *__returnRequest;" + CR;
<<<<<<< HEAD
s+= CR + "char * __myname = \"mainFunc__" + _block.getName() + "\";" + CR;
//s+= "rtos::Thread * __myself = ((owner*)arg)->ownerThread;" + CR;
/*
if (tracing) {
=======
s+= CR + "char * __myname = ((owner*)arg)->ownerName;" + CR;
s+= "rtos::Thread * __myself = ((owner*)arg)->ownerThread;" + CR;
*/
/*if (tracing) {
>>>>>>> Javier mbed changes
s+= CR + "char __value[CHAR_ALLOC_SIZE];" + CR;
}
*/
//s+= CR + "pthread_cond_init(&__myCond, NULL);" + CR;
<<<<<<< HEAD
s += CR + "fillListOfRequests(&__list, __myname, NULL, &__mainCond, &__mainMutex);" + CR;
......@@ -488,13 +506,22 @@ public class AVATAR2CMBED {
s += CR + "/* Main loop on states */" + CR;
s += "while(__currentState != STATE__STOP__STATE) {" + CR;
=======
/*
s+= CR + "fillListOfRequests(&__list, __myname, __myself, &__myCond, &__mainMutex);" + CR;
s+= "//printf(\"my name = %s\\n\", __myname);" + CR;
*/
s+= CR + "/* Main loop on states */" + CR;
s+= "while(__currentState != STATE__STOP__STATE) {" + CR;
>>>>>>> Javier mbed changes
s += "switch(__currentState) {" + CR;
// Making start state
AvatarStateMachine asm = _block.getStateMachine();
s += "case STATE__START__STATE: " + CR;
s += traceStateEntering("__myname", "__StartState");
//s += traceStateEntering("__myname", "__StartState");
s += makeBehaviourFromElement(_block, asm.getStartState(), true);
s += "break;" + CR + CR;
......@@ -503,7 +530,7 @@ public class AVATAR2CMBED {
for (AvatarStateMachineElement asme : asm.getListOfElements()) {
if (asme instanceof AvatarState) {
s += "case STATE__" + asme.getName() + ": " + CR;
s += traceStateEntering("__myname", asme.getName());
//s += traceStateEntering("__myname", asme.getName());
if (includeUserCode) {
tmp = ((AvatarState) asme).getEntryCode();
......@@ -561,8 +588,12 @@ public class AVATAR2CMBED {
}
if (at.hasDelay()) {
<<<<<<< HEAD
ret += "waitFor(" + reworkDelay(at.getMinDelay()) + ", " + reworkDelay(at.getMaxDelay()) + ");" + CR;
//ret += "wait_us(" + reworkDelay(at.getMinDelay()) +");" + CR;
=======
ret+= "wait_us(" + reworkDelay(at.getMaxDelay()) + ");" + CR;
>>>>>>> Javier mbed changes
}
//String act;
......@@ -848,10 +879,17 @@ public class AVATAR2CMBED {
//mainFileMbed.appendToMainCode(CR + "owner __" + taskFileMbed.getName() + ";" + CR);
//mainFileMbed.appendToMainCode("__" + taskFileMbed.getName() + ".ownerName = \"" + taskFileMbed.getName() + "\";" + CR);
//mainFileMbed.appendToMainCode("__" + taskFileMbed.getName() + ".ownerThread = &thread__" + taskFileMbed.getName() + ";" + CR);
<<<<<<< HEAD
//mainFileMbed.appendToMainCode("thread__" + taskFileMbed.getName() + ".start(mainFunc__" + taskFileMbed.getName() + ");" + CR);
mainFileMbed.appendToMainCode("thread__" + taskFileMbed.getName() + ".start(mainFunc__" + taskFileMbed.getName() + ");" + CR);
=======
mainFileMbed.appendToMainCode("thread__" + taskFileMbed.getName() + ".start(mainFunc__" + taskFileMbed.getName() + ");" + CR);
/*
mainFileMbed.appendToMainCode("thread__" + taskFileMbed.getName() + ".start(mainFunc__" + taskFileMbed.getName() + ", (void*)&__" + taskFileMbed.getName() + ");" + CR);
*/
>>>>>>> Javier mbed changes
//mainFileMbed.appendToMainCode("pthread_create(&thread__" + taskFileMbed.getName() + ", NULL, mainFunc__" + taskFileMbed.getName() + ", (void *)\"" + taskFileMbed.getName() + "\");" + CR);
}
......
......@@ -55,12 +55,20 @@ public class MainFileMbed {
private final static String H_END_DEF = "#endif\n";
private final static String INCLUDE_HEADER = "#include <mbed.h>\n#include <rtos.h>\n";//"#include <stdio.h>\n#include <pthread.h>\n#include <unistd.h>\n#include <stdlib.h>\n";
<<<<<<< HEAD
//private final static String LOCAL_INCLUDE_HEADER = "";
//Quitamos las librerias que causan problemas
private final static String LOCAL_INCLUDE_HEADER = "#include \"request.h\"\n#include \"syncchannel.h\"\n#include \"request_manager" +
".h\"\n#include \"debug.h\"\n#include \"random.h\"\n#include \"tracemanager.h\"";
=======
private final static String LOCAL_INCLUDE_HEADER = "";
//Quitamos las librerias que causan problemas
/*private final static String LOCAL_INCLUDE_HEADER = "#include \"request.h\"\n#include \"syncchannel.h\"\n#include \"request_manager" +
".h\"\n#include \"debug.h\"\n#include \"random.h\"\n#include \"tracemanager.h\"";
*/
>>>>>>> Javier mbed changes
private final static String MAIN_DEC = "int main(int argc, char *argv[]) {\n";
private final static String DISABLE_BUFFERING = "/* disable buffering on stdout */\nsetvbuf(stdout, (char*)NULL, _IONBF, 0);\n";
......
......@@ -52,6 +52,7 @@ public class TaskFileMbed {
//1) enlever pthread.h
//2) ajouter : srl.h et mwmr.h
private final static String INCLUDE_HEADER = "#include <mbed.h>\n#include <rtos.h>\n";//"#include <stdio.h>\n#include <pthread.h>\n#include <unistd.h>\n#include <stdlib.h>\n";
<<<<<<< HEAD
//private final static String LOCAL_INCLUDE_HEADER = "#include \"main.h\"";
//Quitamos de nuestros task files las librerias que causan errores.
private final static String LOCAL_INCLUDE_HEADER = "#include \"request.h\"\n#include \"syncchannel.h\"\n#include \"asyncchannel.h\"\n#include " +
......@@ -61,8 +62,18 @@ public class TaskFileMbed {
private final static String INCLUDE_HEADER_SOCLIB = "#include <mbed.h>\n#include <rtos.h>\n";//"#include <stdio.h>\n#include <unistd.h>\n#include <stdlib.h>\n";
//private final static String LOCAL_INCLUDE_HEADER_SOCLIB = "#include \"main.h\"";
=======
private final static String LOCAL_INCLUDE_HEADER = "#include \"main.h\"";
//Quitamos de nuestros task files las librerias que causan errores.
/*private final static String LOCAL_INCLUDE_HEADER = "#include \"request.h\"\n#include \"syncchannel.h\"\n#include \"request_manager" +
".h\"\n#include \"debug.h\"\n#include \"defs.h\"\n#include \"mytimelib.h\"\n#include \"random.h\"\n#include \"tracemanager.h\"\n#include \"main.h\"";
*/
private final static String INCLUDE_HEADER_SOCLIB = "#include <mbed.h>\n#include <rtos.h>\n";//"#include <stdio.h>\n#include <unistd.h>\n#include <stdlib.h>\n";
private final static String LOCAL_INCLUDE_HEADER_SOCLIB = "#include \"main.h\"";
/*
>>>>>>> Javier mbed changes
private final static String LOCAL_INCLUDE_HEADER_SOCLIB = "#include \"request.h\"\n#include \"syncchannel.h\"\n#include \"request_manager.h\"\n#include \"debug.h\"\n#include \"defs.h\"\n#include \"mytimelib.h\"\n#include \"random.h\"\n#include \"tracemanager.h\"\n#include \"main.h\"\n#include \"/Users/ludovicapvrille/Prog/mutekh/libmwmr/include/mwmr/mwmr.h\"\n ";
*/
private final static String CR = "\n";
private String name;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment