Error: Invalid Reference to 'EEPROM_read(unsigned int) (by Carey)
Hi I'm trying to get a stepper motor example to compile that makes the following reference:
if(!Read_Ib_scratch()) {
if(!Read_Ib_once_1_isIniPERSIST_Lenght()) {
Write_Ib_once_1_isIniPERSIST_Lenght(1);
Ui_Lenght = EEPROM_read(0);
Ui_Lenght |= (uint16_t)EEPROM_read(1) << 8;
its code that generated by the LDmicro compiler. I've added this reference in my .ino file:
#include "RomLib.h" which has the following declaration:
unsigned char EEPROM_read(uint16_t address);
When I compile this in the Arduino IDE (1.8.14) I get this error: "Invalid Reference to 'EEPROM_read(unsigned int)"
I made sure that the Rom and Uart .h files are in the project folder
Here's the error log:
Arduino: 1.8.15 (Windows 10), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"
C:\Users\Carey\AppData\Local\Temp\cc1VwUZZ.ltrans0.ltrans.o: In function `PlcCycle':
C:\Users\Carey\Desktop\LDMicro\build5411\DriverStepMotorMerge\ARDUINO\DriverStepMotorMerge/DriverStepMotorMerge.cpp:377: undefined reference to `EEPROM_read(unsigned int)'
C:\Users\Carey\Desktop\LDMicro\build5411\DriverStepMotorMerge\ARDUINO\DriverStepMotorMerge/DriverStepMotorMerge.cpp:378: undefined reference to `EEPROM_read(unsigned int)'
C:\Users\Carey\Desktop\LDMicro\build5411\DriverStepMotorMerge\ARDUINO\DriverStepMotorMerge/DriverStepMotorMerge.cpp:397: undefined reference to `EEPROM_write(unsigned int, unsigned char)'
C:\Users\Carey\Desktop\LDMicro\build5411\DriverStepMotorMerge\ARDUINO\DriverStepMotorMerge/DriverStepMotorMerge.cpp:1498: undefined reference to `UART_Transmit_Ready()'
C:\Users\Carey\Desktop\LDMicro\build5411\DriverStepMotorMerge\ARDUINO\DriverStepMotorMerge/DriverStepMotorMerge.cpp:380: undefined reference to `EEPROM_read(unsigned int)'
C:\Users\Carey\Desktop\LDMicro\build5411\DriverStepMotorMerge\ARDUINO\DriverStepMotorMerge/DriverStepMotorMerge.cpp:381: undefined reference to `EEPROM_read(unsigned int)'
C:\Users\Carey\Desktop\LDMicro\build5411\DriverStepMotorMerge\ARDUINO\DriverStepMotorMerge/DriverStepMotorMerge.cpp:1653: undefined reference to `UART_Transmit(unsigned char)'
C:\Users\Carey\Desktop\LDMicro\build5411\DriverStepMotorMerge\ARDUINO\DriverStepMotorMerge/DriverStepMotorMerge.cpp:1692: undefined reference to `UART_Transmit_Ready()'
C:\Users\Carey\Desktop\LDMicro\build5411\DriverStepMotorMerge\ARDUINO\DriverStepMotorMerge/DriverStepMotorMerge.cpp:1772: undefined reference to `UART_Transmit(unsigned char)'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Mega or Mega 2560.
How do I go about troubleshooting this error? I've added RomLib.h to my sketch folder just in case the compiler was having trouble referencing it. I appreciate any assistance. Thanks in advance.
(no subject) (by José)
Hi Carey
EEprom use requires external libraries Romlib.h + Romlib.c that are in LIBRARIES_FOR\AVR
Romlib.h must be included in your main program and Romlib.c must be added to your project.
It has been developped to be used with AVR compiling in Ldmicro but it should be possible to use it with Arduino if you put the files at the right place (I don't know exactly how ; I don't really use Arduino)...
Do the same with UartLib.h + UartLib.c if you get errors with UART as above. You may also need UsrLib.h + UsrLib.c.
José
(no subject) (by Carey Kiernan)
Hi Jose, Thanks for getting back to me on this. I've added a reference to the main .ccp file "#include Romlib.h" and copied both Romlib.h and .c to my project folder that's under the Ardunio folder in the LDmicro tree. I'm still getting the same error. Can you think of anything else that I might try to resolve this issue?
Thanks, - Carey
(no subject) (by Carey)
OnoTech, Thank you for sharing this tutorial on how to compile LDmicro code directly to c for arduino. This is an excellent video.
I'm looking to set this up as a portable build on a mem-stick so I can send it to someone and teach them how to do this via distance learning. Do have any suggestions on how to manage the environment variable configuration when using a removable usb device?
(no subject) (by OnosTech)
Hi Carey,
I don't have any experience with that.