我正在使用Eclipse Kepler进行AVR开发。
我正在使用C(开源)语言,已经将它调整到可以完美运行。我的目标是ATmega2560,以Arduino Mega2560的形式存在。
使用Arduino板仅是为了硬件方便性;我们正在开发硬件,使其成为带有大多数核心Arduino Mega2560组件的定制板。
我需要在此项目中使用几个只能作为Arduino库使用的库,即来自Seeedstudio的电子纸屏幕库和Nordic的BLE nRF8001库。
如果我使用Eclipse插件创建新的Arduino项目,则可以完美构建和运行Arduino库的测试。
当我试图合并这两个代码库时,似乎无法调用添加的Arduino库中的函数-如果我调用它们,编译器会抛出一个链接错误。
我需要在此项目中使用几个只能作为Arduino库使用的库,即来自Seeedstudio的电子纸屏幕库和Nordic的BLE nRF8001库。
如果我使用Eclipse插件创建新的Arduino项目,则可以完美构建和运行Arduino库的测试。
当我试图合并这两个代码库时,似乎无法调用添加的Arduino库中的函数-如果我调用它们,编译器会抛出一个链接错误。
Building target: Virgin2ManualArdInsert.elf
Invoking: AVR C Linker
avr-gcc -Wl,-Map,Virgin2ManualArdInsert.map -mmcu=atmega2560 -o "Virgin2ManualArdInsert.elf" ./avr/adc.o ./avr/eeprom.o ./avr/lcd_and_input.o ./avr/main.o ./avr/strings.o ./avr/unimplemented.o ./avr/usart.o ./aes.o ./baseconv.o ./bignum256.o ./ecdsa.o ./endian.o ./fft.o ./fix16.o ./hash.o ./hmac_sha512.o ./messages.pb.o ./p2sh_addr_gen.o ./pb_decode.o ./pb_encode.o ./pbkdf2.o ./prandom.o ./ripemd160.o ./sha256.o ./statistics.o ./stream_comm.o ./test_helpers.o ./transaction.o ./wallet.o ./xex.o
./avr/main.o: In function `main':
main.c:(.text.startup.main+0xc): undefined reference to `writeEink'
collect2: error: ld returned 1 exit status
makefile:53: recipe for target 'Virgin2ManualArdInsert.elf' failed
make: *** [Virgin2ManualArdInsert.elf] Error 1
作为一个测试,我只是试图从main.c调用eInk.cpp中的基本“写入显示”调用:
extern "C"{
void writeEink()
{
EPAPER.begin(EPD_SIZE); // setup epaper, size
EPAPER.setDirection(DIRNORMAL); // set display direction
eSD.begin(EPD_SIZE);
GT20L16.begin();
// int timer1 = millis();
EPAPER.drawString("testing", 10, 10);
EPAPER.drawNumber(12345, 60, 40);
EPAPER.drawFloat(-1.25, 2, 80, 65);
EPAPER.display(); // use only once
}
建立自Arduino核心的静态库是否是解决问题的正确方法?我已经尝试过(尽管大多数程序已经过时),但库不想链接/被调用。
在我的C代码中包含C ++ / Arduino调用的正确程序是什么? 我已经尝试在我的.cpp文件和.h文件中使用extern "C" {function()};,但没有用。
感谢任何帮助或指向我可以自行解决问题的地方的指针。