diff options
Diffstat (limited to 'macros')
64 files changed, 462 insertions, 96 deletions
diff --git a/macros/ASTManagement/AST_HandleEndGenFun.bin b/macros/ASTManagement/AST_HandleEndGenFun.bin Binary files differindex 12f738d..8b3ce65 100644 --- a/macros/ASTManagement/AST_HandleEndGenFun.bin +++ b/macros/ASTManagement/AST_HandleEndGenFun.bin diff --git a/macros/ASTManagement/AST_HandleEndGenFun.sci b/macros/ASTManagement/AST_HandleEndGenFun.sci index 69fbb82..f9515cd 100644 --- a/macros/ASTManagement/AST_HandleEndGenFun.sci +++ b/macros/ASTManagement/AST_HandleEndGenFun.sci @@ -40,12 +40,13 @@ SCI2CNInArgCheck(argn(2),3,3); // ----------------------- // --- Initialization. --- // ----------------------- -nxtscifunname = SharedInfo.NextSCIFunName; -nxtscifunnumber = SharedInfo.NextSCIFunNumber; -ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; -Pass1HeaderFileName = FileInfo.Funct(nxtscifunnumber).Pass1HeaderFileName; -FunInfoDatDir = FileInfo.FunctionList.FunInfoDatDir; -CGblDeclarFileName = FileInfo.Funct(nxtscifunnumber).CGblDeclarFileName; +nxtscifunname = SharedInfo.NextSCIFunName; +nxtscifunnumber = SharedInfo.NextSCIFunNumber; +ReportFileName = FileInfo.Funct(nxtscifunnumber).ReportFileName; +Pass1HeaderFileName = FileInfo.Funct(nxtscifunnumber).Pass1HeaderFileName; +FunInfoDatDir = FileInfo.FunctionList.FunInfoDatDir; +CGblDeclarFileName = FileInfo.Funct(nxtscifunnumber).CGblDeclarFileName; +PeripheralInitListFile = FileInfo.PeripheralInitListFile; Flag_FunAlreadyCalled = 0; // #RNU_RES_B @@ -101,6 +102,11 @@ elseif (ASTFunName == 'global') PrintStringInfo(' ',ReportFileName,'both','y'); error(9999, 'SCI2CERROR: Unexpected number of output arguments for global function.'); end +//elseif(IsAVRSupportFunction(ASTFunName)) + //Get the peripheral from function name and input arguements, insert it in + //list of used peripherals. + // PeripheralUsed=GetPeripheral(ASTFunName,InArg); + // InsertPeripheralInList(PeripheralUsed,PeripheralInitListFile); end // #RNU_RES_B diff --git a/macros/ASTManagement/lib b/macros/ASTManagement/lib Binary files differindex ccecc91..4cd697c 100644 --- a/macros/ASTManagement/lib +++ b/macros/ASTManagement/lib diff --git a/macros/ASTManagement/names b/macros/ASTManagement/names index 3e6bfa8..7f6d053 100644 --- a/macros/ASTManagement/names +++ b/macros/ASTManagement/names @@ -1,44 +1,44 @@ -AST_ParseOperStruct -AST_HandleEOL -AST_ReadEqualRhsNames -AST_HandleFor +%comment_string +%cste_string +%equal_string +%for_string +%funcall_string +%ifthenel_string +%operatio_string +%program_p +%program_string %variable_string -AST_GetASTFile -AST_HandleEndFor +%while_string AST2Ccode -AST_GetFuncallPrm -AST_HandleEndGenFun +AST_CheckCommonInOutArgs +AST_CheckLastFunc AST_CheckLineLength -SciFile2ASTFile AST_CheckPrecSpecifier -%operatio_string -AST_HandleIfElse +AST_DisplayStack +AST_ExtractNameAndScope +AST_GetASTFile +AST_GetFuncallPrm +AST_GetPrecAndLhsArg +AST_HandleEOL +AST_HandleEndFor +AST_HandleEndGenFun +AST_HandleEndProgram AST_HandleEndWhile -AST_CheckCommonInOutArgs -AST_HandleWhileStatem +AST_HandleFor AST_HandleForStatem -%ifthenel_string +AST_HandleHeader +AST_HandleIfElse +AST_HandleWhileExpr +AST_HandleWhileStatem AST_ParseEqualStruct -%while_string -AST_GetPrecAndLhsArg -AST_ExtractNameAndScope -objectlist2string -%comment_string +AST_ParseFuncallStruct +AST_ParseIfExprStruct +AST_ParseOperStruct AST_PopASTStack -AST_CheckLastFunc -GenOutArgNames -%equal_string -AST_ReadASTHeader -%cste_string -AST_HandleEndProgram AST_PushASTStack -AST_DisplayStack -%funcall_string -AST_HandleWhileExpr -AST_ParseFuncallStruct +AST_ReadASTHeader +AST_ReadEqualRhsNames +GenOutArgNames Operator2FunName -%program_p -AST_HandleHeader -AST_ParseIfExprStruct -%program_string -%for_string +SciFile2ASTFile +objectlist2string diff --git a/macros/CCodeGeneration/C_FinalizeCode.bin b/macros/CCodeGeneration/C_FinalizeCode.bin Binary files differindex e262750..40a8771 100644 --- a/macros/CCodeGeneration/C_FinalizeCode.bin +++ b/macros/CCodeGeneration/C_FinalizeCode.bin diff --git a/macros/CCodeGeneration/C_Funcall.sci b/macros/CCodeGeneration/C_Funcall.sci index b130a62..166799e 100644 --- a/macros/CCodeGeneration/C_Funcall.sci +++ b/macros/CCodeGeneration/C_Funcall.sci @@ -35,7 +35,7 @@ CDeclarationFileName = FileInfo.Funct(nxtscifunnumber).CDeclarationFileName; CInitVarsFileName = FileInfo.Funct(nxtscifunnumber).CInitVarsFileName; IndentLevel = SharedInfo.NIndent; CCall = ''; - +OutFormat = SharedInfo.OutFormat; // --- Extract Function Info. --- FunctionName = FunInfo.SCIFunctionName; CFunName = FunInfo.CFunctionName; @@ -371,7 +371,7 @@ else if (FlagCall == 0) // Add prototype to the header file - C_InitHeader(CCall+';',HeaderFileName,SharedInfo.Sci2CLibMainHeaderFName); + C_InitHeader(CCall+';',HeaderFileName,SharedInfo.Sci2CLibMainHeaderFName,OutFormat); // Add { at the beginning of the function. PrintStringInfo(' {',ReportFileName,'file','y'); diff --git a/macros/CCodeGeneration/C_GenerateMakefile.bin b/macros/CCodeGeneration/C_GenerateMakefile.bin Binary files differindex eb01ef6..9873469 100644 --- a/macros/CCodeGeneration/C_GenerateMakefile.bin +++ b/macros/CCodeGeneration/C_GenerateMakefile.bin diff --git a/macros/CCodeGeneration/C_InitHeader.bin b/macros/CCodeGeneration/C_InitHeader.bin Binary files differindex 45bb356..72c7943 100644 --- a/macros/CCodeGeneration/C_InitHeader.bin +++ b/macros/CCodeGeneration/C_InitHeader.bin diff --git a/macros/CCodeGeneration/C_InitHeader.sci b/macros/CCodeGeneration/C_InitHeader.sci index 41e13e4..1c2efd6 100644 --- a/macros/CCodeGeneration/C_InitHeader.sci +++ b/macros/CCodeGeneration/C_InitHeader.sci @@ -1,4 +1,4 @@ -function C_InitHeader(C_Prototype,HeaderFileName,Sci2CLibMainHeaderFName) +function C_InitHeader(C_Prototype,HeaderFileName,Sci2CLibMainHeaderFName,OutFormat) // function C_InitHeader(C_Prototype,HeaderFileName,Sci2CLibMainHeaderFName) // ----------------------------------------------------------------- // //NUT: add description here @@ -51,6 +51,12 @@ PrintStringInfo('extern ""C"" {',HeaderFileName,'file','y'); PrintStringInfo('#endif',HeaderFileName,'file','y'); PrintStringInfo('/*',HeaderFileName,'file','y'); PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('** ----- Target ------ ',HeaderFileName,'file','y'); +PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); +PrintStringInfo('*/',HeaderFileName,'file','y'); +PrintStringInfo('# define ' + OutFormat + '1' ,HeaderFileName,'file','y'); +PrintStringInfo('/*',HeaderFileName,'file','y'); +PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); PrintStringInfo('** --- Prototypes. --- ',HeaderFileName,'file','y'); PrintStringInfo('** ------------------- ',HeaderFileName,'file','y'); PrintStringInfo('*/',HeaderFileName,'file','y'); diff --git a/macros/CCodeGeneration/C_Type.bin b/macros/CCodeGeneration/C_Type.bin Binary files differindex 00c1070..c2ff6e6 100644 --- a/macros/CCodeGeneration/C_Type.bin +++ b/macros/CCodeGeneration/C_Type.bin diff --git a/macros/FunctionAnnotation/FA_GetDefaultPrecision.bin b/macros/FunctionAnnotation/FA_GetDefaultPrecision.bin Binary files differindex 026863b..61f446f 100644 --- a/macros/FunctionAnnotation/FA_GetDefaultPrecision.bin +++ b/macros/FunctionAnnotation/FA_GetDefaultPrecision.bin diff --git a/macros/FunctionAnnotation/lib b/macros/FunctionAnnotation/lib Binary files differindex 78fb2f0..50f6251 100644 --- a/macros/FunctionAnnotation/lib +++ b/macros/FunctionAnnotation/lib diff --git a/macros/FunctionAnnotation/names b/macros/FunctionAnnotation/names index e95bff5..d9300d2 100644 --- a/macros/FunctionAnnotation/names +++ b/macros/FunctionAnnotation/names @@ -1,55 +1,55 @@ -FA_SZ_OPRC -FA_SZ_OPLOGEQ -FA_SZ_OPLOGLT +FA_ADD FA_DIV -FA_SZ_OPCC -FA_SZ_OPPLUS -FA_TP_Z -FA_SZ_OPLOGGE -FA_MIN -FA_MUL -FA_SZ_OPLOGOR -FA_SZ_OPSTAR -FA_SZ_OPMINUS -FA_SZ_SEL1 -FA_SZ_OPLOGNE -FA_SZ_OPSLASH -FA_SZ_OPDOTAPEX -FA_SZ_OPBACKSLASH -FA_GetFunAnn -FA_SZ_OPDOTSLASH -FA_SZ_OPPLUSA -FA_MAX FA_GetDefaultPrecision -FA_SZ_OPHAT -FA_TP_C +FA_GetFunAnn +FA_GetOutArgInfo +FA_GetResizeApproach FA_INT -FA_TP_REAL -FA_TP_USER +FA_MAX +FA_MIN +FA_MUL FA_REAL -FA_TP_COMPLEX -FA_ADD -FA_TP_MIN_REAL +FA_SUB FA_SZ_1 -FA_SZ_OPDOTHAT -FA_SZ_OPDOTBACKSLASH -FA_TP_I +FA_SZ_2 FA_SZ_FROM_VAL +FA_SZ_OPAPEX +FA_SZ_OPBACKSLASH +FA_SZ_OPCC +FA_SZ_OPDOTAPEX +FA_SZ_OPDOTBACKSLASH +FA_SZ_OPDOTHAT +FA_SZ_OPDOTSLASH +FA_SZ_OPDOTSTAR +FA_SZ_OPHAT FA_SZ_OPLOGAND -FA_GetOutArgInfo -FA_TP_S -FA_TP_D -FA_TP_MAX -FA_SZ_2 -FA_SZ_SEL2 -FA_GetResizeApproach +FA_SZ_OPLOGEQ +FA_SZ_OPLOGGE FA_SZ_OPLOGGT -FA_SZ_OPDOTSTAR -FA_SUB -FA_SZ_OPLOGNOT FA_SZ_OPLOGLE -FA_SZ_OPAPEX -FA_TP_UINT8 +FA_SZ_OPLOGLT +FA_SZ_OPLOGNE +FA_SZ_OPLOGNOT +FA_SZ_OPLOGOR +FA_SZ_OPMINUS +FA_SZ_OPPLUS +FA_SZ_OPPLUSA +FA_SZ_OPRC +FA_SZ_OPSLASH +FA_SZ_OPSTAR +FA_SZ_SEL1 +FA_SZ_SEL2 +FA_TP_C +FA_TP_COMPLEX +FA_TP_D +FA_TP_I +FA_TP_INT16 FA_TP_INT8 +FA_TP_MAX +FA_TP_MIN_REAL +FA_TP_REAL +FA_TP_S +FA_TP_UINT16 FA_TP_UINT8 -FA_TP_INT16 +FA_TP_USER +FA_TP_Z diff --git a/macros/Hardware/AVR/AVRADCSetup.sci b/macros/Hardware/AVR/AVRADCSetup.sci new file mode 100644 index 0000000..d9897fc --- /dev/null +++ b/macros/Hardware/AVR/AVRADCSetup.sci @@ -0,0 +1,32 @@ +function AVRADCSetup(prescalar,adc_ref) +// Function to initialise ADC of AVR +// +// Calling Sequence +// AVRSetupADC(uint8 prescalar, uint8 adc_ref) +// +// Parameters +// prescalar: prescalar to be used for generating ADC clock (0-7) +// adc_ref : reference voltage to be used for ADC conversion +// 0 -> Voltage on VREF pin +// 1 -> Voltage on AVCC pin +// 2 -> Internal 2.56 reference voltage +// +// Description +// This function initialises ADc of AVR with given parameters. 'prescalar' is +// needed for deciding ADC clock. ADC clock should be between 50KHz and 200KHz +// and it given as (MCU clock/2^prescalar). Select appropriate prescalar depending +// on MCU clock. 'adc_ref' selects one of the available reference voltage sources +// available +// Examples +// AVRADCSetup(128,0) + +// See also +// AVRReadADC +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. +endfunction diff --git a/macros/Hardware/AVR/AVRDigitalOut.bin b/macros/Hardware/AVR/AVRDigitalOut.bin Binary files differnew file mode 100644 index 0000000..7a09b0d --- /dev/null +++ b/macros/Hardware/AVR/AVRDigitalOut.bin diff --git a/macros/Hardware/AVR/AVRDigitalOut.sci b/macros/Hardware/AVR/AVRDigitalOut.sci new file mode 100644 index 0000000..f17c8a0 --- /dev/null +++ b/macros/Hardware/AVR/AVRDigitalOut.sci @@ -0,0 +1,32 @@ +function AVRDigitalOut(port,pin,state) +// Function to change state (high\low) of a digital output pin on AVR +// +// Calling Sequence +// AVRDigitalOut(port,pin,state) +// +// Parameters +// port : port of microcontroller to be used +// pin : pin of port (mentioned above) to be used +// state : state to be outputed on pin (HIGH\LOW) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port as +// digital output. Also, desired output state must be specified as +// 'HIGH' or 'LOW'. +// +// Examples +// AVRDigitalOut('A',0,HIGH) +// +// See also +// AVRDigitalIn +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. +endfunction diff --git a/macros/Hardware/AVR/AVRDigitalSetup.bin b/macros/Hardware/AVR/AVRDigitalSetup.bin Binary files differnew file mode 100644 index 0000000..98a592e --- /dev/null +++ b/macros/Hardware/AVR/AVRDigitalSetup.bin diff --git a/macros/Hardware/AVR/AVRDigitalSetup.sci b/macros/Hardware/AVR/AVRDigitalSetup.sci new file mode 100644 index 0000000..3de56c2 --- /dev/null +++ b/macros/Hardware/AVR/AVRDigitalSetup.sci @@ -0,0 +1,32 @@ +function AVRDigitalSetup(port,pin,direction) +// Function to decide direction of a digital pin on AVR +// +// Calling Sequence +// AVRDigitalSetup(port,pin,direction) +// +// Parameters +// port : port of microcontroller to be used +// pin : pin of port (mentioned above) to be used +// direction : direction to be set for pin (INPUT\OUTPUT) +// +// Description +// Each AVR microcontroller has pins which can be configured as digital +// outputs/inputs. These are normally divided among some 'ports' (group of pins). +// User has to select one of these port and which pin of that port to be +// used as digital output/input. Also, desired direction must be specified as +// 'INPUT' or 'OUTPUT'. +// +// Examples +// AVRDigitalSetup('A',0,OUTPUT) +// +// See also +// AVRDigitalIn AVRDigitalOut +// +// +// Authors +// Siddhesh Wani +// + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. +endfunction diff --git a/macros/Hardware/AVR/AVRReadADC.sci b/macros/Hardware/AVR/AVRReadADC.sci new file mode 100644 index 0000000..f9dfdac --- /dev/null +++ b/macros/Hardware/AVR/AVRReadADC.sci @@ -0,0 +1,31 @@ +function AVRReadADC(channel) +// Function to get voltage on analog pin on AVR +// +// Calling Sequence +// u8AVRReadADCs(channel) +// +// Parameters +// channel : Select which channel is to be read. Values from 0-7 select one +// of the pins ADC0-ADC7. For other possible channel values refer +// datasheet +// Returns-> +// result : Digital value for the voltage present on channel selected +// +// Description +// This function returns digital value for present on adc pins. 'channel' +// selects which of the ADC0-ADC7 is to be used for reading analog value. +// Apart from reading just ADC0-ADC7 other it can also read differential +// voltages between some pins. For channel values for those options, please +// refer datasheet. +// +// Examples +// adc_result = u8AVRReadADC(0) //Read ADC0 +// +// Authors +// Siddhesh Wani +// + + +// This is curretly dummy function. It provides no functionality but is required +// for providing support for generating C code for AVR. +endfunction diff --git a/macros/Hardware/AVR/GetAVRSupportFunctions.bin b/macros/Hardware/AVR/GetAVRSupportFunctions.bin Binary files differnew file mode 100644 index 0000000..eed8be3 --- /dev/null +++ b/macros/Hardware/AVR/GetAVRSupportFunctions.bin diff --git a/macros/Hardware/AVR/GetAVRSupportFunctions.sci b/macros/Hardware/AVR/GetAVRSupportFunctions.sci new file mode 100644 index 0000000..50a913f --- /dev/null +++ b/macros/Hardware/AVR/GetAVRSupportFunctions.sci @@ -0,0 +1,16 @@ +function AVRSupportFunctions = GetAVRSupportFunctions() +// ----------------------------------------------------------------- +// Get list of AVR peripherals supported +// +// Input data: +// None +// +// Output data: +// None +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +AVRSupportFunctions = ["AVRDigitalOut"]; + +endfunction diff --git a/macros/Hardware/AVR/GetPeripheral.bin b/macros/Hardware/AVR/GetPeripheral.bin Binary files differnew file mode 100644 index 0000000..b496bbb --- /dev/null +++ b/macros/Hardware/AVR/GetPeripheral.bin diff --git a/macros/Hardware/AVR/GetPeripheral.sci b/macros/Hardware/AVR/GetPeripheral.sci new file mode 100644 index 0000000..73e9f19 --- /dev/null +++ b/macros/Hardware/AVR/GetPeripheral.sci @@ -0,0 +1,21 @@ +function Peripheral = GetPeripheral(FunName,InArg) +// ----------------------------------------------------------------- +// Get an acronym for peripheral being used to be inserted in list of +// used peripherals +// +// Input data: +// FunName: Name of the function to be checked +// InArg:Input arguements passed to function 'FunName' +// +// Output data: +// Peripheral: Acronym for peripheral to be initialised +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +//select FunName + +//case AVRDigitalOut: +// Peripheral = list('PORT', InArg(1),InArg(2)]; +//end +endfunction diff --git a/macros/Hardware/AVR/InsertPeripheralInList.bin b/macros/Hardware/AVR/InsertPeripheralInList.bin Binary files differnew file mode 100644 index 0000000..c49f4e0 --- /dev/null +++ b/macros/Hardware/AVR/InsertPeripheralInList.bin diff --git a/macros/Hardware/AVR/InsertPeripheralInList.sci b/macros/Hardware/AVR/InsertPeripheralInList.sci new file mode 100644 index 0000000..bafc593 --- /dev/null +++ b/macros/Hardware/AVR/InsertPeripheralInList.sci @@ -0,0 +1,17 @@ +function InsertPeripheralInList(Peripheral,PeripheralListFile) +// ----------------------------------------------------------------- +// Insert input peripheral in peripherals' list +// +// Input data: +// Peripheral: Peripheral of type 'list' to be instertd in list +// PeripheralListFile: Name of file containing list of peripheral used +// +// Output data: +// None +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +load(PeripheralListFile,'PheripheralList'); + +endfunction diff --git a/macros/Hardware/AVR/IsAVRSupportFunction.bin b/macros/Hardware/AVR/IsAVRSupportFunction.bin Binary files differnew file mode 100644 index 0000000..e238230 --- /dev/null +++ b/macros/Hardware/AVR/IsAVRSupportFunction.bin diff --git a/macros/Hardware/AVR/IsAVRSupportFunction.sci b/macros/Hardware/AVR/IsAVRSupportFunction.sci new file mode 100644 index 0000000..a4cbbc8 --- /dev/null +++ b/macros/Hardware/AVR/IsAVRSupportFunction.sci @@ -0,0 +1,22 @@ +function Output = IsAVRSupportFunction(FunName) +// ----------------------------------------------------------------- +// Check whether input function name is an AVR support function or not. +// +// Input data: +// FunName: Name of the function to be checked +// +// Output data: +// Output: True or False depending whether given function is an AVR +// support functions or not +// +// Author: Siddhesh Wani +// ----------------------------------------------------------------- + +//Get list of supported functions for AVR +AVRSupportFunctions = GetAVRSupportFunctions(); + +//Check whether input function is present in above list or not +FunNameInAVRSupport = members(FunName,AVRSupportFunctions); +Output = bool2s(FunNameInAVRSupport~=0); + +endfunction diff --git a/macros/Hardware/AVR/buildmacros.sce b/macros/Hardware/AVR/buildmacros.sce new file mode 100644 index 0000000..60fd284 --- /dev/null +++ b/macros/Hardware/AVR/buildmacros.sce @@ -0,0 +1,15 @@ +// +// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +// Copyright (C) 2009-2009 - DIGITEO - Bruno JOFRET +// +// This file must be used under the terms of the CeCILL. +// This source file is licensed as described in the file COPYING, which +// you should have received as part of this distribution. The terms +// are also available at +// http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt +// +// + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/Hardware/AVR/lib b/macros/Hardware/AVR/lib Binary files differnew file mode 100644 index 0000000..097a89f --- /dev/null +++ b/macros/Hardware/AVR/lib diff --git a/macros/Hardware/AVR/names b/macros/Hardware/AVR/names new file mode 100644 index 0000000..4b941e9 --- /dev/null +++ b/macros/Hardware/AVR/names @@ -0,0 +1,6 @@ +AVRDigitalOut +AVRDigitalSetup +GetAVRSupportFunctions +GetPeripheral +InsertPeripheralInList +IsAVRSupportFunction diff --git a/macros/Hardware/buildmacros.sce b/macros/Hardware/buildmacros.sce new file mode 100644 index 0000000..88f0fb2 --- /dev/null +++ b/macros/Hardware/buildmacros.sce @@ -0,0 +1,19 @@ +// This file is released into the public domain + +Directories = [ "AVR" ]; + + +current_path_buildmacros = get_absolute_file_path("buildmacros.sce"); + +for K=1:size(Directories,"*") + myfile = current_path_buildmacros + filesep() + Directories(K) + filesep() + "buildmacros.sce"; + if isfile(myfile) then + exec(myfile); + end +end + +clear current_path_buildmacros; + +tbx_build_macros(TOOLBOX_NAME, get_absolute_file_path('buildmacros.sce')); + +clear tbx_build_macros; diff --git a/macros/ToolInitialization/INIT_CreateDirs.bin b/macros/ToolInitialization/INIT_CreateDirs.bin Binary files differindex 5c17670..14dfb49 100644 --- a/macros/ToolInitialization/INIT_CreateDirs.bin +++ b/macros/ToolInitialization/INIT_CreateDirs.bin diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.bin Binary files differindex 68968b5..a85721c 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 84c71b4..067a332 100644 --- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci +++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci @@ -3981,6 +3981,62 @@ INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,E INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+//------------------------------------
+//---Functions for AVR ---------------
+//------------------------------------
+
+
+//------------------------------------
+//---- Class AVRDigitalSetup ---------
+//------------------------------------
+ClassName = 'AVRDigitalSetup';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 3',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('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRDigitalSetup';
+PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'file','y');
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
+INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
+
+//------------------------------------
+//---- Class AVRDigitalOut -----------
+//------------------------------------
+ClassName = 'AVRDigitalOut';
+
+// --- Class Annotation. ---
+PrintStringInfo(' Adding Class: '+ClassName+'.',GeneralReport,'file','y');
+ClassFileName = fullfile(SCI2CLibCAnnClsDir,ClassName+ExtensionCAnnCls);
+PrintStringInfo('NIN= 3',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('d0d0d0'+ArgSeparator+'u80',ClassFileName,'file','y');
+PrintStringInfo('d0d0u80'+ArgSeparator+'u80',ClassFileName,'file','y');
+
+// --- Annotation Function And Function List Function. ---
+FunctionName = 'AVRDigitalOut';
+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/ToolInitialization/INIT_GenAnnFLFunctions.bin b/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin Binary files differindex 6220b29..f80837e 100644 --- a/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin +++ b/macros/ToolInitialization/INIT_GenAnnFLFunctions.bin diff --git a/macros/ToolInitialization/INIT_GenFileInfo.bin b/macros/ToolInitialization/INIT_GenFileInfo.bin Binary files differindex dc4c3fe..db8c34b 100644 --- a/macros/ToolInitialization/INIT_GenFileInfo.bin +++ b/macros/ToolInitialization/INIT_GenFileInfo.bin diff --git a/macros/ToolInitialization/INIT_GenFileInfo.sci b/macros/ToolInitialization/INIT_GenFileInfo.sci index 743f647..753509e 100644 --- a/macros/ToolInitialization/INIT_GenFileInfo.sci +++ b/macros/ToolInitialization/INIT_GenFileInfo.sci @@ -108,4 +108,10 @@ FileInfo.GeneralReport = fullfile(FileInfo.WorkingDir,'SCI2CGeneralReport.txt'); FileInfo.CStyleSCI2CMainDir = pathconvert(FileInfo.SCI2CMainDir, %f, %f, 'u');
FileInfo.CStyleOutCCCodeDir = pathconvert(OutCCCodeDir, %f, %f, 'u');
FileInfo.MakefileFilename = fullfile(FileInfo.CStyleOutCCCodeDir,'Makefile');
+
+//-------------------------
+//----Hardware related-----
+//-------------------------
+FileInfo.PeripheralInitListFile = fullfile(FileInfo.WorkingDir,'PeripheralInit.dat');
+
endfunction
diff --git a/macros/ToolInitialization/INIT_GenLibraries.bin b/macros/ToolInitialization/INIT_GenLibraries.bin Binary files differindex 2df9a4f..f6059c9 100644 --- a/macros/ToolInitialization/INIT_GenLibraries.bin +++ b/macros/ToolInitialization/INIT_GenLibraries.bin diff --git a/macros/ToolInitialization/INIT_GenSharedInfo.bin b/macros/ToolInitialization/INIT_GenSharedInfo.bin Binary files differindex ce14906..42b1662 100644 --- a/macros/ToolInitialization/INIT_GenSharedInfo.bin +++ b/macros/ToolInitialization/INIT_GenSharedInfo.bin diff --git a/macros/ToolInitialization/INIT_LoadLibraries.bin b/macros/ToolInitialization/INIT_LoadLibraries.bin Binary files differindex 0a48d06..fbbb641 100644 --- a/macros/ToolInitialization/INIT_LoadLibraries.bin +++ b/macros/ToolInitialization/INIT_LoadLibraries.bin diff --git a/macros/ToolInitialization/INIT_RemoveDirs.bin b/macros/ToolInitialization/INIT_RemoveDirs.bin Binary files differindex fc03695..0740d24 100644 --- a/macros/ToolInitialization/INIT_RemoveDirs.bin +++ b/macros/ToolInitialization/INIT_RemoveDirs.bin diff --git a/macros/ToolInitialization/INIT_SCI2C.bin b/macros/ToolInitialization/INIT_SCI2C.bin Binary files differindex 22ac014..b0b849b 100644 --- a/macros/ToolInitialization/INIT_SCI2C.bin +++ b/macros/ToolInitialization/INIT_SCI2C.bin diff --git a/macros/ToolInitialization/INIT_SCI2C.sci b/macros/ToolInitialization/INIT_SCI2C.sci index 4065d04..0340d6f 100644 --- a/macros/ToolInitialization/INIT_SCI2C.sci +++ b/macros/ToolInitialization/INIT_SCI2C.sci @@ -144,6 +144,12 @@ SharedInfoDatFile = FileInfo.SharedInfoDatFile; global anscounter; //NUT: just to fix problem with ans variables.
anscounter = 0;
+//--------------------------------------------
+//---Hardware related initialisation----------
+//--------------------------------------------
+PeripheralList = list();
+save(FileInfo.PeripheralInitListFile, 'PeripheralList');
+
endfunction
// #RNU_RES_B
//NUT: quando genero il c della funzione utente devo anche generare il corrispondente file delle includes.
diff --git a/macros/ToolInitialization/INIT_SharedInfoEqual.bin b/macros/ToolInitialization/INIT_SharedInfoEqual.bin Binary files differindex 55ef7bb..5aeaa27 100644 --- a/macros/ToolInitialization/INIT_SharedInfoEqual.bin +++ b/macros/ToolInitialization/INIT_SharedInfoEqual.bin diff --git a/macros/ToolInitialization/ManageNextConversion.bin b/macros/ToolInitialization/ManageNextConversion.bin Binary files differindex 6055576..75360d7 100644 --- a/macros/ToolInitialization/ManageNextConversion.bin +++ b/macros/ToolInitialization/ManageNextConversion.bin diff --git a/macros/ToolInitialization/UpdateSCI2CInfo.bin b/macros/ToolInitialization/UpdateSCI2CInfo.bin Binary files differindex 4a06ba2..3acb88a 100644 --- a/macros/ToolInitialization/UpdateSCI2CInfo.bin +++ b/macros/ToolInitialization/UpdateSCI2CInfo.bin diff --git a/macros/ToolInitialization/lib b/macros/ToolInitialization/lib Binary files differindex 3db49c1..6d909b0 100644 --- a/macros/ToolInitialization/lib +++ b/macros/ToolInitialization/lib diff --git a/macros/ToolInitialization/names b/macros/ToolInitialization/names index 0c264f0..71a724d 100644 --- a/macros/ToolInitialization/names +++ b/macros/ToolInitialization/names @@ -1 +1,14 @@ +INIT_CreateDirs INIT_FillSCI2LibCDirs +INIT_GenAnnFLFunctions +INIT_GenFileInfo +INIT_GenLibraries +INIT_GenSharedInfo +INIT_LoadLibraries +INIT_RemoveDirs +INIT_SCI2C +INIT_SharedInfoEqual +ManageNextConversion +UpdateSCI2CInfo +doublecomplex +floatcomplex diff --git a/macros/buildmacros.sce b/macros/buildmacros.sce index 41e3ace..627e638 100644 --- a/macros/buildmacros.sce +++ b/macros/buildmacros.sce @@ -8,7 +8,8 @@ Directories = [ "ASTManagement", ... "FunctionList", ... "GeneralFunctions", ... "SymbolTable", ... - "ToolInitialization" ]; + "ToolInitialization"... + "Hardware" ]; current_path_buildmacros = get_absolute_file_path("buildmacros.sce"); diff --git a/macros/cb_sci2c_gui.bin b/macros/cb_sci2c_gui.bin Binary files differindex a1e9783..00bf368 100644 --- a/macros/cb_sci2c_gui.bin +++ b/macros/cb_sci2c_gui.bin diff --git a/macros/findDeps/getAllHeaders.bin b/macros/findDeps/getAllHeaders.bin Binary files differindex e9992fd..6c4c15f 100644 --- a/macros/findDeps/getAllHeaders.bin +++ b/macros/findDeps/getAllHeaders.bin diff --git a/macros/findDeps/getAllHeaders.sci b/macros/findDeps/getAllHeaders.sci index e152514..f5c74bd 100644 --- a/macros/findDeps/getAllHeaders.sci +++ b/macros/findDeps/getAllHeaders.sci @@ -136,10 +136,17 @@ function allHeaders = getAllHeaders(OutFormat) "src/c/scilab-arduino/includes/cmd_analog_in.h" "src/c/scilab-arduino/includes/sleep.h"]; + AVR_headers = [ + "src/c/hardware/avr/includes/AVRPeripheralGPIO.h" + "src/c/hardware/avr/includes/AVRPeripheralADC.h" + ]; + if OutFormat == "StandAlone" allHeaders = Standalone_headers; elseif OutFormat == "Arduino" allHeaders = cat(1,Standalone_headers, Arduino_headers); + elseif OutFormat == "AVR" + allHeaders = cat(1,Standalone_headers, AVR_headers); end endfunction diff --git a/macros/findDeps/getAllInterfaces.bin b/macros/findDeps/getAllInterfaces.bin Binary files differindex c607ea1..ec75338 100644 --- a/macros/findDeps/getAllInterfaces.bin +++ b/macros/findDeps/getAllInterfaces.bin diff --git a/macros/findDeps/getAllInterfaces.sci b/macros/findDeps/getAllInterfaces.sci index b32bb65..5b52c71 100644 --- a/macros/findDeps/getAllInterfaces.sci +++ b/macros/findDeps/getAllInterfaces.sci @@ -129,10 +129,18 @@ function allInterfaces = getAllInterfaces(OutFormat) "src/c/scilab-arduino/interfaces/int_cmd_analog_in.h" "src/c/scilab-arduino/interfaces/int_sleep.h"]; + //Interface files required for "AVR" output + AVR_interfaces = [ + "src/c/hardware/avr/interfaces/int_AVRPeripheralGPIO.h" + "src/c/hardware/avr/interfaces/int_AVRPeripheralADC.h" + ]; + if OutFormat == "StandAlone" allInterfaces = Standalone_interfaces; elseif OutFormat == "Arduino" allInterfaces = cat(1,Standalone_interfaces, Arduino_interfaces); + elseif OutFormat == "AVR" + allInterfaces = cat(1,Standalone_interfaces, AVR_interfaces); end endfunction diff --git a/macros/findDeps/getAllSources.bin b/macros/findDeps/getAllSources.bin Binary files differindex 1d698a0..6c3f91f 100644 --- a/macros/findDeps/getAllSources.bin +++ b/macros/findDeps/getAllSources.bin diff --git a/macros/findDeps/getAllSources.sci b/macros/findDeps/getAllSources.sci index 356ba38..956f7be 100644 --- a/macros/findDeps/getAllSources.sci +++ b/macros/findDeps/getAllSources.sci @@ -823,10 +823,24 @@ function allSources = getAllSources(OutFormat) "src/c/scilab-arduino/cmd_analog_out/u8cmd_analog_outs.c" "src/c/scilab-arduino/cmd_analog_in/u8cmd_analog_ins.c" "src/c/scilab-arduino/sleep/u16sleeps.c"]; + + //Files to be inserted only if output format selected is 'AVR'. + AVR_files = [ + "src/c/hardware/avr/gpio/u8AVRDigitalSetups.c" + "src/c/hardware/avr/gpio/u8AVRDigitalOuts.c" + "src/c/hardware/avr/gpio/u8AVRDigitalIns.c" + "src/c/hardware/avr/adc/u8AVRADCSetups.c" + "src/c/hardware/avr/adc/u8AVRReadADCs.c" + "src/c/scilab-arduino/sleep/u16sleeps.c" + ]; + + if OutFormat == "StandAlone" allSources = Standalone_files; elseif OutFormat == "Arduino" allSources = cat(1,Standalone_files, Arduino_files); + elseif OutFormat == "AVR" + allSources = cat(1,Standalone_files, AVR_files); end endfunction diff --git a/macros/findDeps/getArduinoFiles.bin b/macros/findDeps/getArduinoFiles.bin Binary files differBinary files differindex 3becbac..c762c30 100644 --- a/macros/findDeps/getArduinoFiles.bin +++ b/macros/findDeps/getArduinoFiles.bin diff --git a/macros/names b/macros/names index b7a7857..a126347 100644 --- a/macros/names +++ b/macros/names @@ -1,6 +1,6 @@ cb_sci2c_gui getScilab2cVersion runsci2c +runscicode sci2c_gui scilab2c -runscicode diff --git a/macros/runsci2c.bin b/macros/runsci2c.bin Binary files differindex 2cc69e9..053c331 100644 --- a/macros/runsci2c.bin +++ b/macros/runsci2c.bin diff --git a/macros/runsci2c.sci b/macros/runsci2c.sci index 880cc9d..ac826a3 100644 --- a/macros/runsci2c.sci +++ b/macros/runsci2c.sci @@ -105,7 +105,7 @@ mkdir(SCI2COutputPath+"/interfaces/"); PrintStepInfo('Copying sources', FileInfo.GeneralReport,'both');
for i = 1:size(allSources, "*")
// DEBUG only
- //disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/");
+ disp("Copying "+allSources(i)+" in "+SCI2COutputPath+"/src/c/");
copyfile(allSources(i), SCI2COutputPath+"/src/c/");
end
@@ -113,7 +113,7 @@ end PrintStepInfo('Copying headers', FileInfo.GeneralReport,'both');
for i = 1:size(allHeaders, "*")
// DEBUG only
- // disp("Copying "+allHeaders(i)+" in "+SCI2COutputPath+"/includes/");
+ disp("Copying "+allHeaders(i)+" in "+SCI2COutputPath+"/includes/");
copyfile(allHeaders(i), SCI2COutputPath+"/includes/");
end
@@ -121,7 +121,7 @@ end PrintStepInfo('Copying interfaces', FileInfo.GeneralReport,'both');
for i = 1:size(allInterfaces, "*")
// DEBUG only
- //disp("Copying "+allInterfaces(i)+" in "+SCI2COutputPath+"/interfaces/");
+ disp("Copying "+allInterfaces(i)+" in "+SCI2COutputPath+"/interfaces/");
copyfile(allInterfaces(i), SCI2COutputPath+"/interfaces/");
end
diff --git a/macros/sci2c_gui.bin b/macros/sci2c_gui.bin Binary files differindex 1c1b69c..9bdf607 100644 --- a/macros/sci2c_gui.bin +++ b/macros/sci2c_gui.bin diff --git a/macros/scilab2c.bin b/macros/scilab2c.bin Binary files differindex 7416eb5..e9fb5fa 100644 --- a/macros/scilab2c.bin +++ b/macros/scilab2c.bin diff --git a/macros/scilab2c.sci b/macros/scilab2c.sci index 1d4675e..64d5753 100644 --- a/macros/scilab2c.sci +++ b/macros/scilab2c.sci @@ -143,9 +143,9 @@ error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), // --- LAUNCH USER SCI CODE TO TEST IT BEFORE TRANSLATING IT!!! --- - if OutFormat == "StandAlone" - runscicode(UserScilabMainFile, UserSciFilesPaths); - end +// if OutFormat == "StandAlone" +// runscicode(UserScilabMainFile, UserSciFilesPaths); +// end // --- ASK USER FOR CONTINUATION. --- // Do not open confirmation box if we are not in STD mode. @@ -156,7 +156,7 @@ error(msprintf(gettext("%s: Wrong number of input argument(s): %d expected.\n"), end if (userchoice == 1) // --- LAUNCH SCI2C --- - runsci2c(UserScilabMainFile, UserSciFilesPaths, CCodeOutputDir, RunMode, BuildTool,OutFormat); + runsci2c(UserScilabMainFile, UserSciFilesPaths, CCodeOutputDir, RunMode, BuildTool,'AVR'); end endfunction |