Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - Error: Invalid Reference to 'EEPROM_read(unsigned int)

(you are viewing a thread; or go back to list of threads)

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.
Tue Jun 22 2021, 20:21:56
(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é
Wed Jun 23 2021, 03:35:30
(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
Wed Jun 23 2021, 08:49:07
(no subject) (by José)
Copying files is required but not enough ; Romlib.c must be included in the Arduino project to be compiled and linked with the main program.

It seems that you can do it via "Sketch->Add file" in Arduino but I don't really know...
Wed Jun 23 2021, 13:37:31
(no subject) (by OnosTech)
I have seen this error in Arduino IDE too. Copy the "RomLib.h" file from the ARDUINO library folder instead of the AVR library folder. There are some differences in the code.

If for no other reason configuring LDmicro in C mode following the below video link has proven to be more efficient for me.

https://youtu.be/1ooMWbz8Zzs
Fri Jun 25 2021, 10:36:54
(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?
Tue Jun 29 2021, 06:04:45
(no subject) (by OnosTech)
Hi Carey,

I don't have any experience with that.
Tue Jun 29 2021, 17:42:41
(no subject) (by hassan)
Using Arduino Mega FuseS
L=0XFF
H=0XD8
E=0XFD
The program works correctly, but it does not save
Wed Dec 8 2021, 16:39:49
(no subject) (by hassan)
Sorry, posted in error
Wed Dec 8 2021, 16:41:28
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):