Hello,
I’m trying to develop drivers for the PCI-6025E board using MHDDK.
During the link process I’m getting the following errors :
make -k EXTRA_SUFFIXES=cpp all CCOPTS+=-p
LDOPTS+=-p --file=C:/tmp/PCIProject/PCIProject/QMakefile12512.tmp
QCC -c -DkLittleEndian=1 -I ./ChipObjects -I ./Examples -I . -oPCIProject.o
PCIProject.cpp
QCC -c -DkLittleEndian=1 -I ./ChipObjects -I ./Examples -I . -otESeries.o
…/ChipObjects/tESeries.cpp
QCC -c -DkLittleEndian=1 -I ./ChipObjects -I ./Examples -I . -otSTC.o
…/ChipObjects/tSTC.cpp
QCC -c -DkLittleEndian=1 -I ./ChipObjects -I ./Examples -I . -oosiBus.o
osiBus.cpp
QCC -c -DkLittleEndian=1 -I ./ChipObjects -I ./Examples -I . -oosiUserCode.o
osiUserCode.cpp
QCC PCIProject.o tESeries.o tSTC.o osiBus.o osiUserCode.o -oPCIProject
PCIProject.o: In function `test(iBus *)’:
PCIProject.o(.text+0x43d): undefined reference to `std::terminate(void)’
osiUserCode.o: In function `acquireBoard(char *)’:
osiUserCode.o(.text+0x315): undefined reference to `std::terminate(void)’
cc: C:/QNX630/host/win32/x86/usr/bin/ntox86-ld caught signal 1
make: *** [PCIProject] Error 1
QCC -c -DkLittleEndian=1 -I ./ChipObjects -I ./Examples -I . -olsdaq.o
lsdaq.cpp
QCC lsdaq.o -olsdaq
make: Target `all’ not remade because of errors.
In the acquireBoard() function there is no visible call to the
std::terminate() fucntion neither in test() function.
While looking in the internet I saw that std::terminate() is related to
exceptions. In the acquireBoard() and test() functions there is no
exceptions handler, so I can’t see the source of the problem.
I’m developping on QNX IDE 1.4 on WinXP. I’m programming using C++ and
compiling with GCC 2.95.3.
If someone has an idea to resolve this issue it will be welcomed.
Here is the code for acquireBoard() and test() functions :
void test(iBus *bus)
{
tAddressSpace Bar1;
tESeries *board;
tSTC *theSTC;
unsigned uStatus; //Flag to indicate FIFO not empty
unsigned uValue; //Binary voltage acquired
Bar1 = bus->createAddressSpace(kPCI_BAR1);
board = new tESeries(Bar1);
theSTC = new tSTC(Bar1);
//Configure the board with the channel settings
Configure_Board(theSTC,board);
//Now Program the DAQ-STC
//Configure the timebase options for DAQ-STC
MSC_Clock_Configure(theSTC);
//Clear ADC FIFO
Clear_FIFO(theSTC);
//Stop any activities in progress
AI_Reset_All(theSTC);
//Set DAQ STC for E-series board
AI_Board_Personalize(theSTC);
//Access the first value in the configuration FIFO
AI_Initialize_Configuration_Memory_Output(theSTC);
//Setup for any external multiplexer
AI_Board_Environmentalize(theSTC);
//Set triggering options
AI_Trigger_Signals(theSTC);
//Select the scan start event
AI_Scan_Start(theSTC);
//Select the end of scan event
AI_End_of_Scan(theSTC);
//Clear ADC FIFO
Clear_FIFO(theSTC);
//Start the acquistion
AI_Start_The_Acquisition(theSTC);
//Poll the FIFO not empty flag to determine if
//data is available. If FIFO not empty then
//read the data.
//The Data has to be scaled to get the
//value in voltage. For Example PCI-6024 if used in
//Bipolar mode has range of ±5 Volts, the corresponding
//ADC levels are form -2048 to 2047. Thus a value of 2047
//represents +5 volts.
do
{
uStatus = theSTC->AI_Status_1.readRegister();
if (!( (uStatus & 0x1000) == 0x1000))
uValue = board->AIFifoData.readRegister();
}while(((uStatus & 0x1000) == 0x1000));
printf(“Value %d is %d\n”,1,uValue);
delete theSTC;
delete board;
bus->destroyAddressSpace(Bar1);
}
iBus* acquireBoard(tChar *brdLocation)
{
iBus *bus;
u32 devBAR0, devBAR1;
u32 BAR0sz, BAR1sz;
void *mem0,*mem1;
struct pci_dev_info info;
u32 serverHdl;
void *deviceHdl;
if ( ThreadCtl (_NTO_TCTL_IO, 0) == -1)
{
perror (“ThreadCtl - requesting I/O priviledge”);
return NULL;
}
// connect to the PCI server
if (serverHdl = pci_attach(0) < 0)
{
perror(“pci_attach”);
return NULL;
}
// printf (“device to open: %s\n\n”, brdLocation);
u16 busNumber;
u16 deviceNumber;
sscanf (brdLocation, “PXI%hd::%hd::INSTR”, &busNumber, &deviceNumber);
// printf (“bus number: %d - device number: %d\n”, busNumber, deviceNumber);
info.BusNumber = busNumber;
info.DevFunc = PCI_DEVFUNC (deviceNumber, 0);
deviceHdl = pci_attach_device
(0,PCI_SHARE|PCI_INIT_ALL|PCI_SEARCH_BUSDEV,0,&info);
if (deviceHdl == 0)
{
perror (“pci_attach_device”);
return NULL;
}
//extract physical BARs for card
devBAR0 = PCI_MEM_ADDR (info.CpuBaseAddress[0]);
devBAR1 = PCI_MEM_ADDR (info.CpuBaseAddress[1]);
BAR0sz = info.BaseAddressSize[0];
BAR1sz = info.BaseAddressSize[1];
//memory map the PCI card
mem0 = mmap_device_memory ( NULL,
info.BaseAddressSize[0],
PROT_READ|PROT_WRITE|PROT_NOCACHE,
0,
info.CpuBaseAddress[0]);
if (mem0 == MAP_FAILED)
{
perror (“bar0 map”);
pci_detach_device (deviceHdl);
return NULL;
}
mem1 = mmap_device_memory ( NULL,
info.BaseAddressSize[1],
PROT_READ|PROT_WRITE|PROT_NOCACHE,
0,
info.CpuBaseAddress[1]);
if (mem1 == MAP_FAILED)
{
perror (“bar1 map”);
pci_detach_device (deviceHdl);
return NULL;
}
//create a new iBus
bus = new iBus(0, 0, mem0, mem1);
bus->_physBar[0] = (u32)devBAR0;
bus->_physBar[1] = (u32)devBAR1;
bus->_physBar[2] = (u32)NULL;
bus->_physBar[3] = (u32)NULL;
bus->_physBar[4] = (u32)NULL;
bus->_physBar[5] = (u32)NULL;
tQNXSpecific *specific = new tQNXSpecific;
specific->serverHdl = serverHdl;
specific->deviceHdl = deviceHdl;
specific->bar0Address = mem0;
specific->bar1Address = mem1;
specific->bar0Size = BAR0sz;
specific->bar1Size = BAR1sz;
bus->_osSpecific = (void*)specific;
return bus;
}
Thank you