Generation working and Compilation of MARTe components
This commit is contained in:
143
EC-GN-JA-PCF/target/main/c++/GAMs/JABitSumGAM/JABitSumGAM.cpp
Normal file
143
EC-GN-JA-PCF/target/main/c++/GAMs/JABitSumGAM/JABitSumGAM.cpp
Normal file
@@ -0,0 +1,143 @@
|
||||
/**
|
||||
* @file JABitSumGAM.cpp
|
||||
* @brief Source file for class JABitSumGAM
|
||||
* @date Feb 10, 2020
|
||||
* @author kuchida
|
||||
*
|
||||
* @copyright Copyright 2015 F4E | European Joint Undertaking for ITER and
|
||||
* the Development of Fusion Energy ('Fusion for Energy').
|
||||
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved
|
||||
* by the European Commission - subsequent versions of the EUPL (the "Licence")
|
||||
* You may not use this work except in compliance with the Licence.
|
||||
* You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
|
||||
*
|
||||
* @warning Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the Licence is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the Licence permissions and limitations under the Licence.
|
||||
|
||||
* @details This source file contains the definition of all the methods for
|
||||
* the class JABitSumGAM (public, protected, and private). Be aware that some
|
||||
* methods, such as those inline could be defined on the header file, instead.
|
||||
*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Standard header includes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Project header includes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "JABitSumGAM.h"
|
||||
|
||||
#include "AdvancedErrorManagement.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Static definitions */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Method definitions */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
JABitSumGAM::JABitSumGAM() {
|
||||
//Input signals.
|
||||
input0 = NULL_PTR(MARTe::uint32 *);
|
||||
input1 = NULL_PTR(MARTe::uint32 *);
|
||||
input2 = NULL_PTR(MARTe::uint32 *);
|
||||
input3 = NULL_PTR(MARTe::uint32 *);
|
||||
input4 = NULL_PTR(MARTe::uint32 *);
|
||||
input5 = NULL_PTR(MARTe::uint32 *);
|
||||
input6 = NULL_PTR(MARTe::uint32 *);
|
||||
input7 = NULL_PTR(MARTe::uint32 *);
|
||||
|
||||
//Output signals.
|
||||
output= NULL_PTR(MARTe::uint8 *);
|
||||
}
|
||||
|
||||
JABitSumGAM::~JABitSumGAM() {
|
||||
}
|
||||
|
||||
bool JABitSumGAM::Initialise(MARTe::StructuredDataI & data) {
|
||||
//GAM parameters are initialized.
|
||||
using namespace MARTe;
|
||||
bool ok = GAM::Initialise(data);
|
||||
if (!ok){
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "ParametersError in init.");
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool JABitSumGAM::PrepareNextState(const MARTe::char8 * const currentStateName, const MARTe::char8 * const nextStateName) {
|
||||
//This method changes internal parameter based on next realtime state.
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JABitSumGAM::Setup() {
|
||||
// Setup memory for input/output signals on the GAM.
|
||||
using namespace MARTe;
|
||||
bool ok = (numberOfInputSignals == 8u);
|
||||
if (ok) {
|
||||
ok = (numberOfOutputSignals == 1u);
|
||||
if (!ok) {
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "One output signal shall be defined");
|
||||
}
|
||||
}
|
||||
else {
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Eight input signals shall be defined");
|
||||
}
|
||||
// Do type check for input signals.
|
||||
if (ok) {
|
||||
uint32 c;
|
||||
for (c = 0u; c < numberOfInputSignals; c++) {
|
||||
TypeDescriptor inputType = GetSignalType(InputSignals, c);
|
||||
ok = (inputType == UnsignedInteger32Bit);
|
||||
if (!ok) {
|
||||
StreamString signalName;
|
||||
(void) GetSignalName(InputSignals, c, signalName);
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint32.", signalName.Buffer());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// Do type check for output signals
|
||||
if (ok) {
|
||||
uint32 c;
|
||||
for (c = 0u; c < numberOfOutputSignals; c++) {
|
||||
TypeDescriptor outputType = GetSignalType(OutputSignals, c);
|
||||
ok = (outputType == UnsignedInteger8Bit);
|
||||
if (!ok) {
|
||||
StreamString signalName;
|
||||
(void) GetSignalName(InputSignals, c, signalName);
|
||||
REPORT_ERROR(MARTe::ErrorManagement::ParametersError, "Signal %s shall be defined as uint8.", signalName.Buffer());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Do type cast.
|
||||
if (ok) {
|
||||
input0 = reinterpret_cast<uint32 *>(GetInputSignalMemory(0));
|
||||
input1 = reinterpret_cast<uint32 *>(GetInputSignalMemory(1));
|
||||
input2 = reinterpret_cast<uint32 *>(GetInputSignalMemory(2));
|
||||
input3 = reinterpret_cast<uint32 *>(GetInputSignalMemory(3));
|
||||
input4 = reinterpret_cast<uint32 *>(GetInputSignalMemory(4));
|
||||
input5 = reinterpret_cast<uint32 *>(GetInputSignalMemory(5));
|
||||
input6 = reinterpret_cast<uint32 *>(GetInputSignalMemory(6));
|
||||
input7 = reinterpret_cast<uint32 *>(GetInputSignalMemory(7));
|
||||
|
||||
output = reinterpret_cast<uint8 *>(GetOutputSignalMemory(0));
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool JABitSumGAM::Execute() {
|
||||
// This method is called every realtime state thread cycle.
|
||||
using namespace MARTe;
|
||||
*output = *input0 + *input1*2 + *input2*4 + *input3*8 + *input4*16 +
|
||||
*input5*32 + *input6*64 + *input7*128;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CLASS_REGISTER(JABitSumGAM, "1.0")
|
||||
81
EC-GN-JA-PCF/target/main/c++/GAMs/JABitSumGAM/JABitSumGAM.h
Normal file
81
EC-GN-JA-PCF/target/main/c++/GAMs/JABitSumGAM/JABitSumGAM.h
Normal file
@@ -0,0 +1,81 @@
|
||||
/**
|
||||
* @file JABitSumGAM.h
|
||||
* @brief Header file for class JABitSumGAM
|
||||
* @date Feb 10, 2020
|
||||
* @author kuchida
|
||||
*
|
||||
* @copyright Copyright 2015 F4E | European Joint Undertaking for ITER and
|
||||
* the Development of Fusion Energy ('Fusion for Energy').
|
||||
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved
|
||||
* by the European Commission - subsequent versions of the EUPL (the "Licence")
|
||||
* You may not use this work except in compliance with the Licence.
|
||||
* You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl
|
||||
*
|
||||
* @warning Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the Licence is distributed on an "AS IS"
|
||||
* basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||
* or implied. See the Licence permissions and limitations under the Licence.
|
||||
|
||||
* @details This header file contains the declaration of the class JABitSumGAM
|
||||
* with all of its public, protected and private members. It may also include
|
||||
* definitions for inline methods which need to be visible to the compiler.
|
||||
*/
|
||||
|
||||
#ifndef GAMS_JABitSumGAM_H_
|
||||
#define GAMS_JABitSumGAM_H_
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Standard header includes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Project header includes */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "GAM.h"
|
||||
#include "stdio.h"
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Class declaration */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
class JABitSumGAM : public MARTe::GAM, public MARTe::StatefulI {
|
||||
public:
|
||||
CLASS_REGISTER_DECLARATION()
|
||||
|
||||
JABitSumGAM();
|
||||
|
||||
virtual ~JABitSumGAM();
|
||||
|
||||
virtual bool Initialise(MARTe::StructuredDataI & data);
|
||||
|
||||
virtual bool Setup();
|
||||
|
||||
virtual bool Execute();
|
||||
|
||||
virtual bool PrepareNextState(const MARTe::char8 * const currentStateName,
|
||||
const MARTe::char8 * const nextStateName);
|
||||
|
||||
private:
|
||||
// Input signals
|
||||
MARTe::uint32 *input0;
|
||||
MARTe::uint32 *input1;
|
||||
MARTe::uint32 *input2;
|
||||
MARTe::uint32 *input3;
|
||||
MARTe::uint32 *input4;
|
||||
MARTe::uint32 *input5;
|
||||
MARTe::uint32 *input6;
|
||||
MARTe::uint32 *input7;
|
||||
|
||||
// Output signals
|
||||
MARTe::uint8 *output;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/* Inline method definitions */
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
||||
#endif /* GAMS_JABitSumGAM_H_ */
|
||||
27
EC-GN-JA-PCF/target/main/c++/GAMs/JABitSumGAM/Makefile.gcc
Normal file
27
EC-GN-JA-PCF/target/main/c++/GAMs/JABitSumGAM/Makefile.gcc
Normal file
@@ -0,0 +1,27 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2015 F4E | European Joint Undertaking for ITER
|
||||
# and the Development of Fusion Energy ('Fusion for Energy')
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.gcc 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
|
||||
include Makefile.inc
|
||||
55
EC-GN-JA-PCF/target/main/c++/GAMs/JABitSumGAM/Makefile.inc
Normal file
55
EC-GN-JA-PCF/target/main/c++/GAMs/JABitSumGAM/Makefile.inc
Normal file
@@ -0,0 +1,55 @@
|
||||
#############################################################
|
||||
#
|
||||
# Copyright 2015 F4E | European Joint Undertaking for ITER
|
||||
# and the Development of Fusion Energy ('Fusion for Energy')
|
||||
#
|
||||
# Licensed under the EUPL, Version 1.1 or - as soon they
|
||||
# will be approved by the European Commission - subsequent
|
||||
# versions of the EUPL (the "Licence");
|
||||
# You may not use this work except in compliance with the
|
||||
# Licence.
|
||||
# You may obtain a copy of the Licence at:
|
||||
#
|
||||
# http://ec.europa.eu/idabc/eupl
|
||||
#
|
||||
# Unless required by applicable law or agreed to in
|
||||
# writing, software distributed under the Licence is
|
||||
# distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
|
||||
# express or implied.
|
||||
# See the Licence for the specific language governing
|
||||
# permissions and limitations under the Licence.
|
||||
#
|
||||
# $Id: Makefile.inc 3 2012-01-15 16:26:07Z aneto $
|
||||
#
|
||||
#############################################################
|
||||
OBJSX=JABitSumGAM.x
|
||||
|
||||
PACKAGE=GAMs
|
||||
|
||||
ROOT_DIR=../../../../obj
|
||||
MAKEDEFAULTDIR=$(MARTe2_DIR)/MakeDefaults
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibDefs.$(TARGET)
|
||||
|
||||
INCLUDES += -I.
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L0Types
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L1Portability
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L2Objects
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L3Streams
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Messages
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L4Configuration
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/BareMetal/L5GAMs
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L1Portability
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L3Services
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/Scheduler/L4Messages
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L1Portability
|
||||
INCLUDES += -I$(MARTe2_DIR)/Source/Core/FileSystem/L3Streams
|
||||
|
||||
|
||||
|
||||
all: $(OBJS) $(SUBPROJ) \
|
||||
$(BUILD_DIR)/JABitSumGAM$(LIBEXT) \
|
||||
$(BUILD_DIR)/JABitSumGAM$(DLLEXT)
|
||||
echo $(OBJS)
|
||||
|
||||
include $(MAKEDEFAULTDIR)/MakeStdLibRules.$(TARGET)
|
||||
Reference in New Issue
Block a user