Skip to content

R_AVR_7_PCREL on ATMEGA 2560 #683

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Emcotek opened this issue May 4, 2020 · 0 comments
Open

R_AVR_7_PCREL on ATMEGA 2560 #683

Emcotek opened this issue May 4, 2020 · 0 comments
Assignees
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project

Comments

@Emcotek
Copy link

Emcotek commented May 4, 2020

Bug Report

Current behavior

arduino-cli compile -b arduino:avr:mega PhMeter

I have been chasing this issue using the GUI IDE off and on for over two months. I have posted on the Arduino Forum seeking help but the problem persists. Most recently I discovered that there is a known bug in the compiler that causes RJMP and RCALL which in certain cases result in the inability to resolve addressing. The solution I found was to change the order of the library linkage.

Here is the suggested compiler invocation string suggested to fix this issue. Note: I am not an expert on command line methods for compilation and beg forgiveness if this is obvious what to do. I am going down the trail of setting up MS VS Code and Arduino-cli vs using the traditional GUI IDE.

/usr/pkg/bin/avr-g++ -mmcu=atmega2560 -I. -DF_CPU=16000000 -DARDUINO=105 -I/home/stix/src/arduino-1.0.5/hardware/arduino/cores/arduino -I/home/stix/src/arduino-1.0.5/libraries/LiquidCrystal -I/home/stix/src/arduino-1.0.5/libraries/Wire -I/home/stix/src/arduino-1.0.5/libraries/utility/twi  -I../libraries/DS1307RTC -I../libraries/OneWire -I../libraries/Time -I/home/stix/src/arduino-1.0.5/libraries/LiquidCrystal/utility/ -I/home/stix/src/arduino-1.0.5/libraries/Wire/utility/ -I/home/stix/src/arduino-1.0.5/libraries/utility/twi/utility/ -I../libraries/DS1307RTC/utility/ -I../libraries/OneWire/utility/ -I../libraries/Time/utility/ -I/home/stix/src/arduino-1.0.5/hardware/arduino/variants/mega -Os -mno-short-calls -o applet/thermo.elf applet/thermo.cpp -L. applet/core.a -nodefaultlibs -Wl,--gc-sections -lm -lgcc -lc -lgcc

Note the -nodefaultlibs and -lm -lgcc -lc -lgcc options. This supposedly will use non-relative jumps and calls and then resolve undefined links with the second pass.

While this is not a bug in arduino-cli Per Se, it is an unresolved Arduino ecosystem issue that needs a fix. I struggled looking for a makefile solution but all required a Linux box and that is a whole other story; short version is I don't have a viable Linux platform.

I have recently installed GNU Make and am attempting to put together a makefile with arduino-cli to execute the aforementioned avr-g++ commands, It has been a long time since I worked on makefiles,

Is there an easier way to get there? If not, how do I fix this error?

thank you.

I apologize if this is not an appropriate use of the issue system to get my issue addressed . Please forgive...I am getting desperate. This is the code that generates the error.

PhMeter 20200504A.zip

Expected behavior

Compile without the error message.

Environment

  • CLI version (output of arduino-cli version): 0.10.0 Commit: ec5c3ed
  • OS and platform:
    Windows 10; Dell M6800 Laptop. Atmega2560 target.
@per1234 per1234 reopened this Mar 30, 2021
@per1234 per1234 self-assigned this Mar 31, 2022
@per1234 per1234 added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

No branches or pull requests

2 participants