-
-
Notifications
You must be signed in to change notification settings - Fork 33
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
impossible to debug with platformIO and U8G2 lib #19
Comments
Hi, I was able to reproduce the problem and what solved it was to remove the "static" keyword in the declaration of regs variable in the avr8-stub.c file. If you go to this file (it's in libdeps{avr-debugger folder in your workspace), find this definition: Then the project should build without errors. |
Hi Perfect I just test and now I can debug all my program without using this serial.print .... :) thank you very much. |
Indeed that's strange. Maybe GCC thinks the variable is unused and optimizes it away? Does using |
I just tested it and it doesn't fix it. The error remains the same - linker reports "undefined reference to `regs'", for example in static inline void save_regs1 (void). There is inline assembly code which references the regs variable like this:
The regs variable is used also in C code so the compiler should not think it's unused. |
Weird. Then making the variable global should be the way to fix it for now.. Maybe change the name from |
Yes, the name is not good. I'll put it on my todo list and rename it when I have some time to test it, so that it doesn't break the code. |
Have same problem. Arduino Uno rev.3. PlatformIO, CLion, Windows 10, MinGW. Just adding/removing some call to my method makes error appear and disappear. @jdolinay Thank you very much for a workaround with removing static keyword. Not using any libraries except arduino & yours |
@Deepscorn Thanks for your report. If it happens on Uno too, then it's not related to the flash size of over 64 kB on Mega as I thought. Good to know... |
Hi, I have the same problem. I use this LCD I2C management lib (working well) https://platformio.org/lib/show/576/LiquidCrystal_I2C (check the platformio.ini) and this is making me having the error reported in this issue, specifically here https://gitlab.com/vincentdavy/thermo-lab/-/blob/master/src/lcdmanager/LCDManager.h#L45 When I comment out this line, my project builds properly with the debug option. If the line is enabled, can't build having the error mentionned in this issue.
If any further details or action from my part is required, please fell free to ask. PS : removing the static keyword make the project building ! Thanks |
Hi, thanks for the report. If the project builds OK with the static keyword removed, just remove it and all should be fine. It has no effect on functionality of the program. I'm not sure what fix you mean, removing the static keyword? |
Hi, If you need somebody to test the reworked version, feel free to ask. |
Hi, I think I understand the problem now. The PIO builds the libraries into archive files (.a) and then links these archives with your code. The static variable Another way to get rid of the error would be not to use the breakpoint() call in your program, but that's not comfortable. |
Hello, it does not work for me.
Here is the log in debug mode :
If I comment out the |
Can you check whether using a newer compiler versions makes a difference? Add
to the EDIT: Changed version from >=1.70300.0 to ~1.70300.0 to prevent using a toolchain version without avr-gdb, see #24 . |
GG ! It worked for me project. Here is my project link if you need to check something : https://gitlab.com/vincentdavy/thermo-lab |
I tried with the thermo-lab project and can confirm what @vdavy wrote. Using the newer compiler version solves the problem. No need to use the In my simple test project the |
hey @vdavy, just FYI: I've edited my comment above regarding the |
Hello,
I succeeded to debug with this usefull library on atmega 2560 and platformIO on vscode using integration suggested by platformio but as soon as I add u8g2 lib or more code , linker shows these errors :
Linking .pio\build\megaatmega2560\firmware.elf AppData\Local\Temp\ccPR247p.ltrans1.ltrans.o: In function
breakpoint':Documents\PlatformIO\Projects\TestDbg/.pio\libdeps\megaatmega2560\avr-debugger\avr8-stub/avr8-stub.c:2066: undefined reference to
regs' Documents\PlatformIO\Projects\TestDbg/.pio\libdeps\megaatmega2560\avr-debugger\avr8-stub/avr8-stub.c:2066: undefined reference to
regs'Documents\PlatformIO\Projects\TestDbg/.pio\libdeps\megaatmega2560\avr-debugger\avr8-stub/avr8-stub.c:2066: undefined reference to
regs' Documents\PlatformIO\Projects\TestDbg/.pio\libdeps\megaatmega2560\avr-debugger\avr8-stub/avr8-stub.c:2066: undefined reference to
regs'`I tried multiple manaipulation included following the way you describe how ot integrate but I still have these errors. I have created aspecific github repo for the snippet code that shows the errors. here
Thank you for your help.
The text was updated successfully, but these errors were encountered: