Jump to content

Chaka

Members
  • Content count

    2
  • Joined

  • Last visited

  1. Thank you very much. I will test your propositions and keep you in touch. Chaka
  2. Hello all, i really your help. I'm getting an segmentation fault (Erreur de segmentation (core dumped) ) and i do not understand how to fix it. when i do the gdb i git thie one as error. i understand that the error occurred on sc_start and the the problem is with libsystemc-2.3.1.so. i need your help to fix it. Thanks in advance, bellow, tou have my source code. #include <iostream> #include <string> #include <vector> #include "math.h" #define SC_INCLUDE_DYNAMIC_PROCESSES #include "systemc.h" #include "tlm.h" #include "tlm_utils/simple_initiator_socket.h" #include "tlm_utils/simple_target_socket.h" #include "pthread.h" #include "timer_counter_sc.cpp" #include <inttypes.h> #include "genMcu.h" #include "sensors.h" #include "genRadio.h" #include "genbattery.h" #include "alldef.h" using namespace sc_core; using namespace sc_dt; using namespace std; GenMcu* o_genericMcu[numberOfSensorNode]= {NULL}; GenSensor* o_genericSensor[numberOfSensorNode]= {NULL}; Transceiver_hc05* o_genericRadio[numberOfSensorNode]= {NULL}; GenBattery* o_genericBattery[numberOfSensorNode]= {NULL}; SCTimerCounter* o_genericTimer[numberOfSensorNode]= {NULL}; SCTimerCounter* o_genericTimer_rf[numberOfSensorNode]= {NULL}; sc_signal<unsigned int,SC_MANY_WRITERS> sizeDataInRam[numberOfSensorNode]; sc_signal< bool ,SC_MANY_WRITERS> radioINT[numberOfSensorNode]; sc_signal< bool,SC_MANY_WRITERS > sig_radioCS[numberOfSensorNode]; sc_signal< bool ,SC_MANY_WRITERS> mcuInt[numberOfSensorNode]; sc_signal< bool,SC_MANY_WRITERS > sig_allPacketsTransmitted[numberOfSensorNode]; sc_signal<float,SC_MANY_WRITERS> sigMcuHC05[numberOfSensorNode]; sc_core::sc_signal<int,SC_MANY_WRITERS> identSensor_io[numberOfSensorNode]; sc_core::sc_signal<bool,SC_MANY_WRITERS> syncSensorsMcu[numberOfSensorNode]; sc_signal<bool,SC_MANY_WRITERS> paquetToTransmit_io[numberOfSensorNode]; sc_signal< bool,SC_MANY_WRITERS > init_simul_i[numberOfSensorNode]; sc_signal< bool,SC_MANY_WRITERS> commandMode_CMD[numberOfSensorNode]; sc_signal< double,SC_MANY_WRITERS> timeElapsed_mcu[numberOfSensorNode]; sc_signal< double,SC_MANY_WRITERS> timeElapsed_radio[numberOfSensorNode]; sc_signal< char,SC_MANY_WRITERS > batt_mcuState[numberOfSensorNode]; sc_signal<char,SC_MANY_WRITERS> batt_radioState[numberOfSensorNode]; sc_core::sc_signal<float,SC_MANY_WRITERS> sensorData[numberOfSensorNode][fsampling]; std::string s; sc_event ev_activeNode_1; const int indexNode =0; SC_MODULE (emotica) { //sc_in<int> indexNode{"indexNode_emoticaM"}; SC_CTOR(emotica) { int HC05 = HC; int mcuType = MCU_t; int radioType = HC05; int selectSensor[3] = {1,2,4}; sc_time period_clk(period_mcu, SC_SEC); //0.125=1/8 @freq_mcu= 8 sc_clock clk("clk", period_clk, 0.5, SC_ZERO_TIME, true); sc_time period_clk_hc05(period_radio, SC_SEC); // @freq_hc05= 1 megabit/s sc_clock clk_hc05("clk_hc05", period_clk_hc05, 0.5, SC_ZERO_TIME, true); std::stringstream stream; stream << indexNode; stream >> s; paquetToTransmit_io[indexNode] = false; commandMode_CMD[indexNode]= false; o_genericMcu[indexNode] = new GenMcu (("mcu"+s).c_str()); o_genericSensor[indexNode] = new GenSensor (("sensor"+s).c_str(),selectSensor[indexNode]); o_genericRadio[indexNode] = new Transceiver_hc05 (("radio"+s).c_str()); o_genericBattery[indexNode] = new GenBattery (("battery"+s).c_str(), mcuType,radioType,freq_mcu,SUPPLY_VOLTAGE_V); o_genericTimer[indexNode] = new SCTimerCounter (("timer"+s).c_str()); o_genericTimer_rf[indexNode] = new SCTimerCounter (("timer_rf"+s).c_str()); o_genericTimer[indexNode]->ClockTC(clk); o_genericTimer_rf[indexNode]->ClockTC(clk_hc05); o_genericMcu[indexNode]->clk(clk); o_genericMcu[indexNode]->allPacketsTransmitted(sig_allPacketsTransmitted[indexNode]); o_genericMcu[indexNode]->identSensor(identSensor_io[indexNode]); init_simul_i[indexNode].write(true); o_genericMcu[indexNode]->init_simul(init_simul_i[indexNode]); o_genericMcu[indexNode]->tc_reg_access.bind(o_genericTimer[indexNode]->reg_access_socket); o_genericMcu[indexNode]->tc_irq_socket.bind(o_genericTimer[indexNode]->irq); o_genericMcu[indexNode]->timeElapsed_mcu(timeElapsed_mcu[indexNode]); o_genericBattery[indexNode]->timeElapsed_mcu(timeElapsed_mcu[indexNode]); o_genericBattery[indexNode]->timeElapsed_radio(timeElapsed_radio[indexNode]); o_genericMcu[indexNode]->readSensorData(syncSensorsMcu[indexNode]); o_genericSensor[indexNode]->readSensorData(syncSensorsMcu[indexNode]); o_genericSensor[indexNode]->identSensor(identSensor_io[indexNode]); identSensor_io[indexNode]=0; for (int i=0; i< nbSensors; i++) { for (int j=0;j<fsampling;j++) { o_genericMcu[indexNode]->analogInput[i][j](sensorData[indexNode][j]); o_genericSensor[indexNode]->sensorAnalogOut[i][j](sensorData[indexNode][j]); } } o_genericMcu[indexNode]->paquetToTransmit(paquetToTransmit_io[indexNode]); o_genericMcu[indexNode]->batt_mcuState(batt_mcuState[indexNode]); o_genericBattery[indexNode]->batt_mcuState(batt_mcuState[indexNode]); o_genericBattery[indexNode]->batt_radioState(batt_radioState[indexNode]); o_genericMcu[indexNode]->radioINT(radioINT[indexNode]); o_genericMcu[indexNode]->sizeDataInRam(sizeDataInRam[indexNode]); o_genericMcu[indexNode]->radioCS(sig_radioCS[indexNode]); o_genericMcu[indexNode]->mcuInt(mcuInt[indexNode]); o_genericRadio[indexNode]->clk(clk_hc05); o_genericRadio[indexNode]->radioINT(radioINT[indexNode]); o_genericRadio[indexNode]->sizeDataInRam(sizeDataInRam[indexNode]); o_genericRadio[indexNode]->radioCS(sig_radioCS[indexNode]); o_genericRadio[indexNode]->mcuInt(mcuInt[indexNode]); o_genericRadio[indexNode]->sigFifoIn(sigMcuHC05[indexNode]); o_genericRadio[indexNode]->batt_radioState(batt_radioState[indexNode]); o_genericRadio[indexNode]->timeElapsed_radio(timeElapsed_radio[indexNode]); o_genericRadio[indexNode]->tc_reg_access.bind(o_genericTimer_rf[indexNode]->reg_access_socket); o_genericRadio[indexNode]->tc_irq_socket.bind(o_genericTimer_rf[indexNode]->irq); o_genericMcu[indexNode]->commandMode_CMD(commandMode_CMD[indexNode]); o_genericRadio[indexNode]->commandMode_CMD(commandMode_CMD[indexNode]); } ~emotica() { delete o_genericMcu[indexNode]; delete o_genericSensor[indexNode]; delete o_genericRadio[indexNode]; delete o_genericBattery[indexNode]; } }; SC_MODULE (signal_bind) { //sc_signal<int> indexNode; emotica *archEmotica_1 = NULL; SC_CTOR(signal_bind) { archEmotica_1 = new emotica("archEmotica_1"); //indexNode.write(1); //archEmotica_1->indexNode (indexNode); } ~signal_bind() { delete archEmotica_1; } }; int sc_main(int argc, char *argv[]) { signal_bind archEmotica("SIGNAL_BIND"); sc_start(); return 0; }
×