diff options
Diffstat (limited to 'macros')
26 files changed, 86 insertions, 33 deletions
diff --git a/macros/CCodeGeneration/C_GenerateMakefile.bin b/macros/CCodeGeneration/C_GenerateMakefile.bin Binary files differindex 3ced74fb..4b3546e 100644 --- a/macros/CCodeGeneration/C_GenerateMakefile.bin +++ b/macros/CCodeGeneration/C_GenerateMakefile.bin diff --git a/macros/CCodeGeneration/C_GenerateMakefile.sci b/macros/CCodeGeneration/C_GenerateMakefile.sci index 94b3696..b1c1e71 100644 --- a/macros/CCodeGeneration/C_GenerateMakefile.sci +++ b/macros/CCodeGeneration/C_GenerateMakefile.sci @@ -120,11 +120,12 @@ PrintStringInfo('\t@echo ""Generation of the executable""',FileInfo.MakefileFile PrintStringInfo('\t@echo ""============================""',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('\t$(CC) $(CFLAGS) $(OBJ) *.c $(LDFLAGS) -o $(EXEFILE)',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y'); -PrintStringInfo('\t@echo ""==============""',FileInfo.MakefileFilename,'file','y','y'); -PrintStringInfo('\t@echo ""Executing code""',FileInfo.MakefileFilename,'file','y','y'); -PrintStringInfo('\t@echo ""==============""',FileInfo.MakefileFilename,'file','y','y'); -PrintStringInfo('\t$(EXEFILE)',FileInfo.MakefileFilename,'file','y','y'); - +if(target == "StandAlone") + PrintStringInfo('\t@echo ""==============""',FileInfo.MakefileFilename,'file','y','y'); + PrintStringInfo('\t@echo ""Executing code""',FileInfo.MakefileFilename,'file','y','y'); + PrintStringInfo('\t@echo ""==============""',FileInfo.MakefileFilename,'file','y','y'); + PrintStringInfo('\t$(EXEFILE)',FileInfo.MakefileFilename,'file','y','y'); +end PrintStringInfo('clean:',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('\t@echo "" ""',FileInfo.MakefileFilename,'file','y','y'); PrintStringInfo('\t@echo ""=============================""',FileInfo.MakefileFilename,'file','y','y'); diff --git a/macros/CCodeGeneration/JoinDeclarAndCcode.bin b/macros/CCodeGeneration/JoinDeclarAndCcode.bin Binary files differindex 66286eb..a818143 100644 --- a/macros/CCodeGeneration/JoinDeclarAndCcode.bin +++ b/macros/CCodeGeneration/JoinDeclarAndCcode.bin diff --git a/macros/CCodeGeneration/JoinDeclarAndCcode.sci b/macros/CCodeGeneration/JoinDeclarAndCcode.sci index ebbf002..4328895 100644 --- a/macros/CCodeGeneration/JoinDeclarAndCcode.sci +++ b/macros/CCodeGeneration/JoinDeclarAndCcode.sci @@ -145,6 +145,11 @@ PrintStringInfo('** ---------------',CPass2FileName,'file','y'); PrintStringInfo('** --- C code. ---',CPass2FileName,'file','y'); PrintStringInfo('** ---------------',CPass2FileName,'file','y'); PrintStringInfo('*/',CPass2FileName,'file','y'); + +if(SharedInfo.Target == "RPi") + //Add bcm2835_init() function as it is required + PrintStringInfo('bcm2835_init();',CPass2FileName,'file','y'); +end // --- Copy the remaining part of V1 in V2. --- while (~meof(CPass1V1FileFid)) // #RNU_RES_B diff --git a/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin b/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin Binary files differindex 5bea645..545334a 100644 --- a/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin +++ b/macros/Hardware/RasberryPi/GetRPISupportFunctions.bin diff --git a/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci b/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci index 24c2f55..61bb6c0 100644 --- a/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci +++ b/macros/Hardware/RasberryPi/GetRPISupportFunctions.sci @@ -1,4 +1,4 @@ -function AVRSupportFunctions = GetRPISupportFunctions() +function RPiSupportFunctions = GetRPISupportFunctions() // ----------------------------------------------------------------- // Get list of RPI peripherals supported // @@ -11,7 +11,7 @@ function AVRSupportFunctions = GetRPISupportFunctions() // Author: Siddhesh Wani // ----------------------------------------------------------------- -AVRSupportFunctions = [ +RPiSupportFunctions = [ "RPI_DigitalIn" "RPI_DigitalOut" "RPI_DigitalSetup" diff --git a/macros/Hardware/RasberryPi/RPIDelayMicro.bin b/macros/Hardware/RasberryPi/RPI_DelayMicro.bin Binary files differindex a4d32cb..a4d32cb 100644 --- a/macros/Hardware/RasberryPi/RPIDelayMicro.bin +++ b/macros/Hardware/RasberryPi/RPI_DelayMicro.bin diff --git a/macros/Hardware/RasberryPi/RPIDelayMicro.sci b/macros/Hardware/RasberryPi/RPI_DelayMicro.sci index 730755b..730755b 100644 --- a/macros/Hardware/RasberryPi/RPIDelayMicro.sci +++ b/macros/Hardware/RasberryPi/RPI_DelayMicro.sci diff --git a/macros/Hardware/RasberryPi/RPIDelay.bin b/macros/Hardware/RasberryPi/RPI_DelayMilli.bin Binary files differindex bb8279e..bb8279e 100644 --- a/macros/Hardware/RasberryPi/RPIDelay.bin +++ b/macros/Hardware/RasberryPi/RPI_DelayMilli.bin diff --git a/macros/Hardware/RasberryPi/RPIDelay.sci b/macros/Hardware/RasberryPi/RPI_DelayMilli.sci index c5080dd..c5080dd 100644 --- a/macros/Hardware/RasberryPi/RPIDelay.sci +++ b/macros/Hardware/RasberryPi/RPI_DelayMilli.sci diff --git a/macros/Hardware/RasberryPi/RPI_DigitalIn.bin b/macros/Hardware/RasberryPi/RPI_DigitalIn.bin Binary files differindex a3269a0..ec8fd0d 100644 --- a/macros/Hardware/RasberryPi/RPI_DigitalIn.bin +++ b/macros/Hardware/RasberryPi/RPI_DigitalIn.bin diff --git a/macros/Hardware/RasberryPi/RPI_DigitalIn.sci b/macros/Hardware/RasberryPi/RPI_DigitalIn.sci index 3ea3bf1..8775e4c 100644 --- a/macros/Hardware/RasberryPi/RPI_DigitalIn.sci +++ b/macros/Hardware/RasberryPi/RPI_DigitalIn.sci @@ -20,8 +20,15 @@ function state = RPI_DigitalIn(pin) // Authors // Siddhesh Wani // +// ----------------------------------------------------------------- +//Pins of header P1 which can be used as GPIO +supported_pins = [3,5,7,8,10,11,12,13,15,16,18,19,21,22,23,24,26] + +PinIsGPIO = members(pin, supported_pins); //Check if input pin supports GPIO -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. - +//If given pin does not support GPIO functionality, raise the error +if(PinIsGPIO == 0) + error(9999, 'SCI2CERROR: Given pin number doesnot support GPIO functionality.'); +end +state = 1; endfunction diff --git a/macros/Hardware/RasberryPi/RPI_DigitalSetup.bin b/macros/Hardware/RasberryPi/RPI_DigitalSetup.bin Binary files differindex 46836cd..1de4e22 100644 --- a/macros/Hardware/RasberryPi/RPI_DigitalSetup.bin +++ b/macros/Hardware/RasberryPi/RPI_DigitalSetup.bin diff --git a/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci b/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci index 5ce48f0..aede0b7 100644 --- a/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci +++ b/macros/Hardware/RasberryPi/RPI_DigitalSetup.sci @@ -11,7 +11,7 @@ function RPI_DigitalSetup(pin, direction) // Description // There are few pins available on RPi as Gpio or digital io. These pins can be used as digital output or input. Pin name must be provided from list provided. Please refer '' for complete list of pins. Direction can be 0 or 1 depending upon desired function (Input/output) // Examples -// RPI_DigitalSetup(RPI_GPIO_P1_03,0) //Sets pin 3 of header P1 as input +// RPI_DigitalSetup(3,0) //Sets pin 3 of header P1 as input // // See also // RPI_DigitalIn RPI_DigitalOut @@ -19,9 +19,14 @@ function RPI_DigitalSetup(pin, direction) // // Authors // Siddhesh Wani -// - -// This is curretly dummy function. It provides no functionality but is required -// for providing support for generating C code for RPi. +// ----------------------------------------------------------------- +//Pins of header P1 which can be used as GPIO +supported_pins = [3,5,7,8,10,11,12,13,15,16,18,19,21,22,23,24,26] + +PinIsGPIO = members(pin, supported_pins); //Check if input pin supports GPIO +//If given pin does not support GPIO functionality, raise the error +if(PinIsGPIO == 0) + error(9999, 'SCI2CERROR: Given pin number doesnot support GPIO functionality.'); +end endfunction diff --git a/macros/Hardware/RasberryPi/lib b/macros/Hardware/RasberryPi/lib Binary files differindex 5884511..1031744 100644 --- a/macros/Hardware/RasberryPi/lib +++ b/macros/Hardware/RasberryPi/lib diff --git a/macros/Hardware/RasberryPi/names b/macros/Hardware/RasberryPi/names index 87fe2cd..138ac2a 100644 --- a/macros/Hardware/RasberryPi/names +++ b/macros/Hardware/RasberryPi/names @@ -1,7 +1,7 @@ GetRPISupportFunctions IsRPISupportFunction -RPIDelay -RPIDelayMicro +RPI_DelayMicro +RPI_DelayMilli RPI_DigitalIn RPI_DigitalOut RPI_DigitalSetup diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin Binary files differindex 4cc5184..6da0f76 100644 --- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin +++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci index c67e966..1e0d67a 100644 --- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -4706,14 +4706,13 @@ ClassName = 'AVRPWMSetup'; PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 4',ClassFileName,'file','y');
-PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-//PrintStringInfo('d0d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -4738,7 +4737,6 @@ PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y'); // --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-//PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -4756,14 +4754,13 @@ ClassName = 'RPI_DigitalSetup'; PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
PrintStringInfo('NIN= 2',ClassFileName,'file','y');
-PrintStringInfo('NOUT= 1 ',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
PrintStringInfo('OUT(1).TP= ''u8''',ClassFileName,'file','y');
PrintStringInfo('OUT(1).SZ(1)= ''1''',ClassFileName,'file','y');
PrintStringInfo('OUT(1).SZ(2)= ''1''',ClassFileName,'file','y');
// --- Function List Class. ---
ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
-//PrintStringInfo('d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
PrintStringInfo(''+ArgSeparator+'',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
@@ -5266,6 +5263,41 @@ PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file', INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//------------------------------------
+//---- Class CONVSTR --------------------
+//------------------------------------
+ClassName = 'CONVSTR';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+
+//Arguements specified: initial value, start time, time vector, ode function
+PrintStringInfo('NIN= 1',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(2)',ClassFileName,'file','y');
+
+PrintStringInfo('NIN= 2',ClassFileName,'file','y');
+PrintStringInfo('NOUT= 1',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).TP= IN(1).TP',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(1)= IN(1).SZ(1)',ClassFileName,'file','y');
+PrintStringInfo('OUT(1).SZ(2)= IN(1).SZ(1)',ClassFileName,'file','y');
+
+
+ClassFileName = fullfile(SCI2CLibCFLClsDir,ClassName+ExtensionCFuncListCls);
+PrintStringInfo('g0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('g2'+ArgSeparator+'g2',ClassFileName,'file','y');
+PrintStringInfo('g0g0'+ArgSeparator+'g0',ClassFileName,'file','y');
+PrintStringInfo('g2g0'+ArgSeparator+'g2',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'convstr';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
// ////////////////////////////////////////////
// /////PARTE INTRODOTTA DA ALBERTO MOREA
// /////////////////////////////////////////////
diff --git a/macros/findDeps/getAllHeaders.bin b/macros/findDeps/getAllHeaders.bin Binary files differindex 2d5581b..d44f5f2 100644 --- a/macros/findDeps/getAllHeaders.bin +++ b/macros/findDeps/getAllHeaders.bin diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci index 3fa1d4e..be13035 100644 --- a/macros/findDeps/getAllHeaders.sci +++ b/macros/findDeps/getAllHeaders.sci @@ -145,7 +145,8 @@ function allHeaders = getAllHeaders(Target) "src/c/implicitList/implicitList.h" "src/c/differential_calculus/includes/ode.h" "src/c/differential_calculus/includes/diffc.h" - "src/c/Files/includes/files.h"]; + "src/c/Files/includes/files.h" + "src/c/string/includes/convstr.h"]; //Header files required for "Arduino" output Arduino_headers = [ @@ -155,9 +156,9 @@ function allHeaders = getAllHeaders(Target) "src/c/scilab-arduino/includes/cmd_analog_in.h" "src/c/scilab-arduino/includes/cmd_dcmotor_setup.h" "src/c/scilab-arduino/includes/cmd_dcmotor_run.h" - "src/c/scilab-arduino/includes/cmd_servo_attach.h" - "src/c/scilab-arduino/includes/cmd_servo_detach.h" - "src/c/scilab-arduino/includes/cmd_servo_move.h" + //"src/c/scilab-arduino/includes/cmd_servo_attach.h" + //"src/c/scilab-arduino/includes/cmd_servo_detach.h" + //"src/c/scilab-arduino/includes/cmd_servo_move.h" "src/c/scilab-arduino/includes/sleep.h"]; AVR_headers = [ diff --git a/macros/findDeps/getAllInterfaces.bin b/macros/findDeps/getAllInterfaces.bin Binary files differindex 66ca5ee..6315795 100644 --- a/macros/findDeps/getAllInterfaces.bin +++ b/macros/findDeps/getAllInterfaces.bin diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci index 37d4301..6928831 100644 --- a/macros/findDeps/getAllInterfaces.sci +++ b/macros/findDeps/getAllInterfaces.sci @@ -140,7 +140,8 @@ function allInterfaces = getAllInterfaces(Target) "src/c/implicitList/int_OpColon.h" "src/c/differential_calculus/interfaces/int_ode.h" "src/c/differential_calculus/interfaces/int_diffc.h" - "src/c/Files/interfaces/int_files.h"]; + "src/c/Files/interfaces/int_files.h" + "src/c/string/interfaces/int_convstr.h"]; //Interface files required for "Arduino" output Arduino_interfaces = [ diff --git a/macros/findDeps/getAllSources.bin b/macros/findDeps/getAllSources.bin Binary files differindex 89de1af..2fcad7e 100644 --- a/macros/findDeps/getAllSources.bin +++ b/macros/findDeps/getAllSources.bin diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci index 4ef2f16..050c0d6 100644 --- a/macros/findDeps/getAllSources.sci +++ b/macros/findDeps/getAllSources.sci @@ -974,7 +974,8 @@ function allSources = getAllSources(Target) "src/c/Files/mput/u8mputa.c" "src/c/Files/mput/i8mputa.c" "src/c/Files/mput/u16mputa.c" - "src/c/Files/mput/i16mputa.c"]; + "src/c/Files/mput/i16mputa.c" + "src/c/string/convstr/gconvstrs.c"]; //Files to be inserted only if output format selected is 'Arduino'. Arduino_files = ["src/c/scilab-arduino/cmd_digital_out/u8cmd_digital_outs.c" @@ -983,9 +984,9 @@ function allSources = getAllSources(Target) "src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c" "src/c/scilab-arduino/cmd_dcmotor_setup/u8cmd_dcmotor_setups.c" "src/c/scilab-arduino/cmd_dcmotor_run/u8cmd_dcmotor_runs.c" - "src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp" - "src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detach.cpp" - "src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp" + //"src/c/scilab-arduino/cmd_servo_attach/u8cmd_servo_attach.cpp" + //"src/c/scilab-arduino/cmd_servo_detach/u8cmd_servo_detach.cpp" + //"src/c/scilab-arduino/cmd_servo_move/u8cmd_servo_move.cpp" "src/c/scilab-arduino/sleep/u16sleeps.c"]; //Files to be inserted only if output format selected is 'AVR'. diff --git a/macros/scilab2c.bin b/macros/scilab2c.bin Binary files differindex 91140d1..270d1d5 100644 --- a/macros/scilab2c.bin +++ b/macros/scilab2c.bin diff --git a/macros/scilab2c.sci b/macros/scilab2c.sci index f352d1c..19b1f2b 100644 --- a/macros/scilab2c.sci +++ b/macros/scilab2c.sci @@ -121,7 +121,7 @@ function scilab2c(varargin) return end if varargin(6) <> "StandAlone" & varargin(6) <> "Arduino" & varargin(6) <> "AVR" & varargin(6) <> "RPi" - error(msprintf(gettext("%s: argument #%d must be: ""StandAlone"" or ""Arduino"" or ""AVR"".\n"),"scilab2c",5)); + error(msprintf(gettext("%s: argument #%d must be: ""StandAlone"" or ""Arduino"" or ""AVR"" or ""RPi"".\n"),"scilab2c",5)); return end UserScilabMainFile = varargin(1); @@ -144,7 +144,7 @@ error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), // --- LAUNCH USER SCI CODE TO TEST IT BEFORE TRANSLATING IT!!! --- // If Target choosen is 'Standalone' then only execute the code, otherwise directly start conversion. - if Target == "StandAlone" + if ((Target == "StandAlone") | (Target == "RPi")) runscicode(UserScilabMainFile, UserSciFilesPaths); // --- ASK USER FOR CONTINUATION. --- |