Having Trouble Building SPI Test Program

Hello,

I am trying to port MPC8349 SPI driver to MPC8360E. I have created the SPI test application. The thing is the build complained about anything to do with spi_xyz, e.g. “undefined reference to `spi_open(char const*), spi_read, spi_close, spi_xchange, …”

I have included the spi header to the c file:

#include <…/…/BSP/prebuilt/usr/include/hw/spi-master.h>

I think I need to link with a static library. But where can I get the SPI library?

Thanks,
Jew-Dong

This may sound like simple, but it does not build in my environment. My SPI test program does the following:

main()
{
spi_open()
spi_xchange()
spi_close()
}

I am using QNX 6.41:

  1. To be sure, I specifically copied the PowerPC libspi-master.a and libspi-masterS.a to both of C:/QNX641/target/qnx6/ppcbe/ and C:/QNX641/target/qnx6/ppcbe/usr/lib directories, which are supposed to the default directories.

  2. I then specified extra libraries llibspi-master.a under Properties/QNX C/C++ Project/Linker tab.

The build failed.

ntoppc-ld: cannot find -lllibspi-master.a

What could be wrong? I have attached the detailed build log below.

Thanks,
Jew-Dong

C:\QNX641\host\win32\x86\usr\bin\make -k all --file=C:/DOCUME~1/CONFER~1/LOCALS~1/Temp/QMakefile125072704337535293.tmp
C:/QNX641/host/win32/x86/usr/bin/make -j 1 -Cppc -fMakefile all
make[1]: Entering directory C:/Multibeam/Gen4/Firmware/SPITest/ppc' C:/QNX641/host/win32/x86/usr/bin/make -j 1 -Co-be -fMakefile all make[2]: Entering directory C:/Multibeam/Gen4/Firmware/SPITest/ppc/o-be’
C:/QNX641/host/win32/x86/usr/bin/rm -f C:/Multibeam/Gen4/Firmware/SPITest/ppc/o-be/SPITest
C:/QNX641/host/win32/x86/usr/bin/qcc -Vgcc_ntoppc -Wl,–no-keep-memory -lang-c++ -lang-c++ -oC:/Multibeam/Gen4/Firmware/SPITest/ppc/o-be/SPITest SPITest.o -L . -L C:/QNX641/target/qnx6/ppcbe/lib -L C:/QNX641/target/qnx6/ppcbe/usr/lib -Wl,–rpath-link . -Wl,–rpath-link C:/QNX641/target/qnx6/ppcbe/lib -Wl,–rpath-link C:/QNX641/target/qnx6/ppcbe/usr/lib -Bstatic -lllibspi-master.a -Bdynamic -EB
C:\QNX641\host\win32\x86\usr\bin\ntoppc-ld: cannot find -lllibspi-master.a
make[2]: Leaving directory `C:/Multibeam/Gen4/Firmware/SPITest/ppc/o-be’

The problem is resolved. This is due to name mangling in C++. The library is done in C.

Thanks,
Jew-Dong

I have the same problem!

How you resolved this problem?

I have the same problem!

How you resolved this problem?