4DSP Support Forum

Products => Board Support Package (Installation, Licensing, ...) => Topic started by: ec on March 13, 2015, 02:59 PM

Title: compiling example.c in BSP 06.02.2015
Post by: ec on March 13, 2015, 02:59 PM
When trying to compile 4fm.bsp.06.02.2015/lib4FM-1.56.1/example/example.c on Redhat 5, I type 'make', and get the following result:

cc -g -o example example.c -lm -l4FM
In file included from /usr/include/sys/time.h:29,
                 from example.c:23:
/usr/include/bits/time.h:70: error: redefinition of 'struct timeval'
In file included from /usr/include/sys/select.h:44,
                 from /usr/include/sys/time.h:31,
                 from example.c:23:
/usr/include/time.h:122: error: redefinition of 'struct timespec'
In file included from example.c:23:
/usr/include/sys/time.h:96: error: expected identifier before numeric constant
/usr/include/sys/time.h:110: error: redefinition of 'struct itimerval'
make: *** [example] Error 1

How can I fix this issue?

Thanks
Title: Re: compiling example.c in BSP 06.02.2015
Post by: arnaudNL on March 16, 2015, 05:14 AM
Dear Sir,


The software is deprecated (it is for FM482 with QDR memory) so I would not spend too much time on that one. Your best reference is the FMC170App, this is the application prepared for you. There is also the sipmemtest for memory tests.


I hope that helps!


Best Regards,
Arnaud
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 16, 2015, 09:30 AM
Isn't the fmc170app a Windows application? We're running Linux, so I'm looking for an example I can run on Linux.
 
Thanks!
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 16, 2015, 10:15 AM
Sorry, I got the Fmc170App for Linux, but when I try to run it, it says Constellation ID not supported by this software, exiting...
 
The constellation ID is 507 (as reported after 'Start of program')
number of Stars: 8
Software Build: 0x54E44247
Firmware Build: 0x0000000
Firmware version: 0.256
 
Thanks
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 16, 2015, 10:34 AM
I changed FMC170_CONSTELLATION_ID_VP780 to 507 on line 249 of main.cpp, and the program seems to be running. Will it run correctly?
 
Thanks
Title: Re: compiling example.c in BSP 06.02.2015
Post by: tonyku on March 16, 2015, 12:23 PM
Hi Eli,

The Constellation ID for 507 is designed to run on FM780 for FMC170.

Are you running FM780 platform?

It looks like firmware 507 was released on March 12, 2015.   The linux BSP has not been updated to have the latest FMC170 software.

I will post our latest version for FMC170 software on the next post so that you can try it out and build it.   There will be a new Linux BSP release this Friday.


Tony



Title: Re: compiling example.c in BSP 06.02.2015
Post by: tonyku on March 16, 2015, 12:38 PM
Hi Eli,

Attached is a "temp" release for the FMC170 that should be able to connect to your FM780 with FMC170.

The official release for the Linux BSP will be out this Friday.



Tony

Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 16, 2015, 12:42 PM
Yes, we are running FM780 + FMC170.
I'm not really concerned now with the 170 (though my colleague would be, so your help is appreciated), my current goal is to be able to send and receive data to the 780 board from a user application using DMA. The training materials (step 1) seems to be intended to do that, but when I run it, it fails saying could not receive random data. Training materials step 2 fails as well, saying could not find adder address (38).

Edit: I just saw that you posted the temp release, I'll give that a try.

Thanks,
Eli
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 16, 2015, 02:31 PM
I tried the new FMC170TestApp, this time it reported the constellation ID as 393 (I haven't uploaded any different firmware), and said constellation ID not supported by this software, exiting...
 
Thanks,
Eli
Title: Re: compiling example.c in BSP 06.02.2015
Post by: tonyku on March 16, 2015, 03:45 PM


Hi Eli,

The burn in (flash memory) firmware would be the memory firmware.  When the card boots up, by default, that's what it will load (hence #393 for the CID).   So if you just power on the system, by default the memory firmware will be loaded by the flash.

If you want to test the memory (which also does DMA reads and writes) - you can run the sipmemtest with that firmware.   The mem test is availbale inside the BSP distribution.

if you want to load FMC170, then you'll have to program the FM780 via JTAG with the firmware you want through Impact or whatever Xilinx tool you are using, then do a "soft reboot".



Tony


Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 16, 2015, 05:40 PM
Thanks
 
With the same configuration, I ran 'memtestip FM780 0 100 2 1' and got the following result:
 
LOOP0000000 | Bank index 0, GM780_DDR3_V1 | Could not send data
LOOP0000000 | Bank index 1, GM780_DDR3_V1 | Could not send data
LOOP0000000 | Bank index 2, GM780_DDR3_V1 | Could not send data
LOOP0000000 | Bank index 3, GM780_DDR3_V1 | Could not send data
 
Test efficiency (READ/WRITE) (including printfs, etc..) : 0.0[MB/s]
Test efficiency (DMA Read)    : nan[MB/s]
Test efficiency (DMA Write)    :0.0[MB/s]
 
Thanks
Title: Re: compiling example.c in BSP 06.02.2015
Post by: tonyku on March 16, 2015, 05:52 PM
Um,   GM780_DDR3_V1 is not a valid type (nor is it in any code inside the memory test).    Have you guys modified the source code?

Also, the frequency should be 200 MHZ.







Thanks
 
With the same configuration, I ran 'memtestip FM780 0 100 2 1' and got the following result:
 
LOOP0000000 | Bank index 0, GM780_DDR3_V1 | Could not send data
LOOP0000000 | Bank index 1, GM780_DDR3_V1 | Could not send data
LOOP0000000 | Bank index 2, GM780_DDR3_V1 | Could not send data
LOOP0000000 | Bank index 3, GM780_DDR3_V1 | Could not send data
 
Test efficiency (READ/WRITE) (including printfs, etc..) : 0.0[MB/s]
Test efficiency (DMA Read)    : nan[MB/s]
Test efficiency (DMA Write)    :0.0[MB/s]
 
Thanks

Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 17, 2015, 09:33 AM
Sorry, we have not modified the source, the GM780 was just a typo, the actual error said FM780_DDR3_V1.
 
I tried again with frequency 200 and got the same error.
 
Thanks
Title: Re: compiling example.c in BSP 06.02.2015
Post by: tonyku on March 17, 2015, 11:12 AM
Can you attach the entire log from beginning of the run?
Title: Re: compiling example.c in BSP 06.02.2015
Post by: tonyku on March 17, 2015, 11:13 AM

Also, please attach the log after doing this:

sudo lspci -vvv


Thanks.

Tony
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 17, 2015, 12:24 PM
After a shutdown and reboot, I am running as root, the following is the output of memtestsip:

./memtestsip FM780 0 200 2 1
4DSP Memory Test Application (DDR2, DDR3 and QDR2)
--------------------------------------------------
Initalizing (synthesizer frequency = 200MHz), please wait... Done : FM780:0


Configuring memory FIFOs:
 - configured FM780_DDR3_V1   FIFOs

Starting test (1 loops)
LOOP00000001 | Bank index 0, FM780_DDR3_V1   |Could not send data
LOOP00000001 | Bank index 1, FM780_DDR3_V1   |Could not send data
LOOP00000001 | Bank index 2, FM780_DDR3_V1   |Could not send data
LOOP00000001 | Bank index 3, FM780_DDR3_V1   |Could not send data
Test succeeded!

Test efficiency (READ/WRITE) (including printfs, etc..) : 0.0[MB/s]
Test efficiency (DMA Read)                              : nan[MB/s]
Test efficiency (DMA Write)                             : 0.0[MB/s]


The output of lspci -vvv is attached.


The output of '4fm_get_information FM780 0' is as follows:
Successfully read information from device 0
Information:
        Library Version       : 1.56 build 001
        FPGA A PCI Revision   : 5.0
        FPGA A Revision       : 3.0
        FPGA A Customer Nr.   : 0
        FPGA A Firmware Type  : 380
        FPGA A Has Ext. Infos : 0
        CPLD Revision         : 1.4
        Board Serial Number   : 10
        User ROM Value        : 4294967295
        FPGA B Device Type    : XC6VX980T-1FFG1930C
        FPGA B Revision       : 1.3.0
        FPGA B Firmware Type  : 393


===================================================

A related question: When I run TrainMaterialStep1, it runs until it says "Could not receive random data from the hardware device...". Does that mean it sent data correctly (which it fails to do in memtestsip)?

I notice the training materials use functions _4FM_SendData and _4FM_ReceiveData (which are documented in the programmer's guide), while memtestsip uses sipif_writedata and sipif_readdata (which I cannot find in the documentation). Is one of these up to date and one deprecated? Is there documentation for the up to date functions?

Thanks a lot for your help
Title: Re: compiling example.c in BSP 06.02.2015
Post by: tonyku on March 17, 2015, 01:28 PM
Hi Eli,


Yeah the lspci is not needed if you are able to retrieve the information from the PCIe.  It is just to make sure the board is detected by the driver.


Are you able to run this board with a Windows drive?  (i.e. using the standard 4FM GUI with the memory test module).     The board is verified with Windows 4FM setup.


Is the BSP 06.02.2015 the first time you install the BSP or has there been a previous version?    If there was a previous version we need to make sure the libraries, etc. are all properly recompiled and re-installed.

If you run "dmesg" as root, do you see any error message relating to 4FM? 


Tony





Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 17, 2015, 02:19 PM
output of dmesg includes:

 Start loading IDM driver
 **************************************************************
Register PCI device driver
**********************************************************
******************************************************
/root/4fm.bsp.06.02.2015/4fm-driver-0.1.1.6/4fm.c: Out of memory
/root/4fm.bsp.06.02.2015/4fm-driver-0.1.1.6/4fm.c: Out of memory
/root/4fm.bsp.06.02.2015/4fm-driver-0.1.1.6/4fm.c: Out of memory
/root/4fm.bsp.06.02.2015/4fm-driver-0.1.1.6/4fm.c: Out of memory


There was a previous version (19.12.2014) installed as a user, but this is the only version that I installed as root, after the previous one was already installed.
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 17, 2015, 04:52 PM
after rmmod and insmod again, dmesg included:
PCI: Setting latency timer of device 0000:03:00.0 to 64
/root/4fm.bsp.06.02.2015/4fm-driver-0.1.1.6/4fm.c: found 1 devices
 
then after running memtestsip as before, it had:
/root/4fm.bsp.06.02.2015/4fm-driver-0.1.1.6/4fm.c: Out of memory
root/4fm.bsp.06.02.2015/4fm-driver-0.1.1.6/4fm.c: Out of memory
root/4fm.bsp.06.02.2015/4fm-driver-0.1.1.6/4fm.c: Out of memory
root/4fm.bsp.06.02.2015/4fm-driver-0.1.1.6/4fm.c: Out of memory
Title: <compiling example.c in BSP 06.02.2015
Post by: arnaudNL on March 18, 2015, 11:12 AM
What kind of host computer are you using? The driver could not allocate memory for the scatter and gather table, the kernel refused the allocation.
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 18, 2015, 11:35 AM
I'm using a desktop with Intel Xeon processors. Using a network file system (though root is local). Running Redhat 5. Output from uname -a is:

Linux adgeda12.md.hnsnet 2.6.18-274.el5 #1 SMP Fri Jul 8 17:36:59 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
Title: Re: compiling example.c in BSP 06.02.2015
Post by: arnaudNL on March 18, 2015, 03:21 PM
And how much memory do you have on there, it is quite strange the driver is not having enough memory. As if the kernel memory space is scarce on this system.
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 18, 2015, 05:00 PM
cat /proc/meminfo
MemTotal:      6044292 kB
MemFree:       4593900 kB
Buffers:        125196 kB
Cached:         942408 kB
SwapCached:          0 kB
Active:         566828 kB
Inactive:       700756 kB
HighTotal:           0 kB
HighFree:            0 kB
LowTotal:      6044292 kB
LowFree:       4593900 kB
SwapTotal:    12586916 kB
SwapFree:     12586916 kB
Dirty:              16 kB
Writeback:           0 kB
AnonPages:      199940 kB
Mapped:          70480 kB
Slab:           107416 kB
PageTables:      24944 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
CommitLimit:  15609060 kB
Committed_AS:   557712 kB
VmallocTotal: 34359738367 kB
VmallocUsed:    303120 kB
VmallocChunk: 34359434227 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
Hugepagesize:     2048 kB

Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 19, 2015, 05:05 PM
Where do the dbg() messages go to, and how can I turn it on (if necessary)?

Thanks
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 19, 2015, 06:09 PM
using err() messages, I've located where the allocation is failing. It's line 864 of 4fm.c, and it attempts to allocate 262144 bytes (pages_mapped * sizeof *sg), is that correct?

Thanks
Title: Re: compiling example.c in BSP 06.02.2015
Post by: arnaudNL on March 20, 2015, 05:00 AM
That's correct, and we never seen that failing over 7 years. I am not able to tell why is it failing on your system, it is like if you don't have much kernel/pci space available.
Title: Re: compiling example.c in BSP 06.02.2015
Post by: arnaudNL on March 24, 2015, 05:13 AM
Dear Sir,


Have you been able to move forward?


Best Regards,
Arnaud
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 24, 2015, 09:51 AM
I have not been able to move forward yet. I've never dealt with device drivers before, and my colleague has been out the past week, so it's been slow progress.

I do know that I read in Linux Device Drivers (3rd ed.) that kmalloc is not reliable on all systems for allocating greater than 128K, and that there's a better way if I need more than a few K. I know the book is old though, so I'm not sure what to make of that. And if you haven't seen your driver fail, it's probably pretty reliable.

My colleague should be back today, so I will contact you if I cannot get help from within the company.

Thanks
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on March 25, 2015, 10:14 AM
I ran the training materials, and it seems that it allocates a much smaller amount of memory, so it passed the sending data, but failed to receive data.
Title: Re: compiling example.c in BSP 06.02.2015
Post by: arnaudNL on March 25, 2015, 10:31 AM
Maybe mem= boot parameters can help here. I understand you believe that there is an issue in our scheme but today I took a very simple machine with 4GB RAM on, installed a default x64 debian linux and could run the sipmemtest application without issue. Your machine has a little less than 6GB so I assume you have enough memory. It is more as if your specific kernel configuration is not having much kernel memory available.


Can you also confirm that you are using a 64 bit linux?


best Regards,
Arnaud
Title: Re: compiling example.c in BSP 06.02.2015
Post by: arnaudNL on April 08, 2015, 08:48 AM
Dear Sir,


Do you still need this topic open? You are the only customer left on the forum, everyone has already moved towards our ticketing system on support.4dsp.com


Best Regards,
Arnaud
Title: Re: compiling example.c in BSP 06.02.2015
Post by: ec on April 08, 2015, 09:32 AM
no, I've moved on from this and actually started a new topic on support.4dsp.com. you can close this
Title: Re: compiling example.c in BSP 06.02.2015
Post by: arnaudNL on April 08, 2015, 09:34 AM
This topic is being closed because the issue is considered as resolved by 4DSP. Feel free to create a new topic for any further inquiries.