Skip to content
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

cant compile with latest boards from arduino #22

Open
bj97301 opened this issue Sep 18, 2019 · 9 comments
Open

cant compile with latest boards from arduino #22

bj97301 opened this issue Sep 18, 2019 · 9 comments

Comments

@bj97301
Copy link

bj97301 commented Sep 18, 2019

please see screenshots below
Screen Shot 2019-09-18 at Wednesday, September 18, 2019 10 15 AM
Screen Shot 2019-09-18 at Wednesday, September 18, 2019 10 16 AM

@benlye
Copy link
Contributor

benlye commented Sep 20, 2019

The board here is no longer maintained.

Use this one instead, which does not have this issue.
https://github.com/benlye/anet-board

@CpuID
Copy link

CpuID commented Jul 2, 2020

For anyone else who ends up here: https://github.com/benlye/anet-board currently doesn't fix this issue. Same compile issue, tested with Marlin 1.1.9.1 1314b31d97bba8cd74c6625c47176d4692f57790

@benlye
Copy link
Contributor

benlye commented Jul 2, 2020

@CpuID Do you really get the same error as posted above? I just tried to compile the same tag. It failed but I got totally different errors to the TIMERx redefines mentioned above (which are fixed).

That said Marlin 2.0 compiles fine, and I'm pretty sure that's all I ever used the boards package for. I never used Marlin 1.x on my Anet board.

@CpuID
Copy link

CpuID commented Jul 2, 2020

@benlye I apologise, your repo does actually change the error profile. Currently what I get:

In file included from sketch/endstops.cpp:35:0:
sketch/endstop_interrupts.h: In function 'void setup_endstop_interrupts()':
endstop_interrupts.h:121:7: error: non-constant condition for static assertion
       static_assert(digitalPinToPCICR(X_MIN_PIN) != NULL, "X_MIN_PIN is not interrupt-capable");
       ^~~~~~~~~~~~~
In file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:258:0,
                 from sketch/HAL.h:36,
                 from sketch/MarlinConfig.h:39,
                 from sketch/Marlin.h:35,
                 from sketch/endstops.cpp:27:
/Users/nathan/Library/Arduino15/packages/anet/hardware/avr/1.0.2/variants/sanguino/pins_arduino.h:92:66: error: reinterpret_cast from integer to pointer
 #define digitalPinToPCICR(p)    ( (((p) >= 0) && ((p) <= 31)) ? (&PCICR) : ((uint8_t *)0) )
                                                                 ~^~~~~~~
sketch/endstop_interrupts.h:121:21: note: in expansion of macro 'digitalPinToPCICR'
       static_assert(digitalPinToPCICR(X_MIN_PIN) != NULL, "X_MIN_PIN is not interrupt-capable");
                     ^~~~~~~~~~~~~~~~~
In file included from sketch/endstops.cpp:35:0:
endstop_interrupts.h:141:7: error: non-constant condition for static assertion
       static_assert(digitalPinToPCICR(Y_MIN_PIN) != NULL, "Y_MIN_PIN is not interrupt-capable");
       ^~~~~~~~~~~~~
In file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:258:0,
                 from sketch/HAL.h:36,
                 from sketch/MarlinConfig.h:39,
                 from sketch/Marlin.h:35,
                 from sketch/endstops.cpp:27:
/Users/nathan/Library/Arduino15/packages/anet/hardware/avr/1.0.2/variants/sanguino/pins_arduino.h:92:66: error: reinterpret_cast from integer to pointer
 #define digitalPinToPCICR(p)    ( (((p) >= 0) && ((p) <= 31)) ? (&PCICR) : ((uint8_t *)0) )
                                                                 ~^~~~~~~
sketch/endstop_interrupts.h:141:21: note: in expansion of macro 'digitalPinToPCICR'
       static_assert(digitalPinToPCICR(Y_MIN_PIN) != NULL, "Y_MIN_PIN is not interrupt-capable");
                     ^~~~~~~~~~~~~~~~~
In file included from sketch/endstops.cpp:35:0:
endstop_interrupts.h:161:7: error: non-constant condition for static assertion
       static_assert(digitalPinToPCICR(Z_MIN_PIN) != NULL, "Z_MIN_PIN is not interrupt-capable");
       ^~~~~~~~~~~~~
In file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:258:0,
                 from sketch/HAL.h:36,
                 from sketch/MarlinConfig.h:39,
                 from sketch/Marlin.h:35,
                 from sketch/endstops.cpp:27:
/Users/nathan/Library/Arduino15/packages/anet/hardware/avr/1.0.2/variants/sanguino/pins_arduino.h:92:66: error: reinterpret_cast from integer to pointer
 #define digitalPinToPCICR(p)    ( (((p) >= 0) && ((p) <= 31)) ? (&PCICR) : ((uint8_t *)0) )
                                                                 ~^~~~~~~
sketch/endstop_interrupts.h:161:21: note: in expansion of macro 'digitalPinToPCICR'
       static_assert(digitalPinToPCICR(Z_MIN_PIN) != NULL, "Z_MIN_PIN is not interrupt-capable");
                     ^~~~~~~~~~~~~~~~~
exit status 1
non-constant condition for static assertion

I then tried applying this patch (partial of MarlinFirmware/Marlin#15771 ):

--- ../../Marlin-1.1.9.1.orig/Marlin/endstop_interrupts.h	2020-07-02 20:08:17.000000000 +1000
+++ endstop_interrupts.h	2020-07-02 22:25:07.000000000 +1000
@@ -51,10 +51,13 @@
  * There are more PCI-enabled processor pins on Port J, but they are not connected to Arduino MEGA.
  */
 #if defined(ARDUINO_AVR_MEGA2560) || defined(ARDUINO_AVR_MEGA)
+
+  #undef  digitalPinHasPCICR
+  #define digitalPinHasPCICR(p)   (WITHIN(p, 10, 15) || WITHIN(p, 50, 53) || WITHIN(p, 62, 69))
+
   #undef  digitalPinToPCICR
-  #define digitalPinToPCICR(p)    ( WITHIN(p, 10, 15) || \
-                                    WITHIN(p, 50, 53) || \
-                                    WITHIN(p, 62, 69) ? &PCICR : (uint8_t*)0 )
+  #define digitalPinToPCICR(p)    (digitalPinHasPCICR(p) ? (&PCICR) : nullptr)
+
   #undef  digitalPinToPCICRbit
   #define digitalPinToPCICRbit(p) ( WITHIN(p, 10, 13) || WITHIN(p, 50, 53) ? 0 : \
                                     WITHIN(p, 14, 15) ? 1 : \
@@ -78,9 +81,11 @@
 
 // Install Pin change interrupt for a pin. Can be called multiple times.
 void pciSetup(const int8_t pin) {
-  SBI(*digitalPinToPCMSK(pin), digitalPinToPCMSKbit(pin));  // enable pin
-  SBI(PCIFR, digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
-  SBI(PCICR, digitalPinToPCICRbit(pin)); // enable interrupt for the group
+  if (digitalPinToPCMSK(pin) != nullptr) {
+    SBI(*digitalPinToPCMSK(pin), digitalPinToPCMSKbit(pin));  // enable pin
+    SBI(PCIFR, digitalPinToPCICRbit(pin)); // clear any outstanding interrupt
+    SBI(PCICR, digitalPinToPCICRbit(pin)); // enable interrupt for the group
+  }
 }

And ended up with the same error (I think?):

In file included from sketch/endstops.cpp:35:0:
sketch/endstop_interrupts.h: In function 'void setup_endstop_interrupts()':
endstop_interrupts.h:126:7: error: non-constant condition for static assertion
       static_assert(digitalPinToPCICR(X_MIN_PIN) != NULL, "X_MIN_PIN is not interrupt-capable");
       ^~~~~~~~~~~~~
In file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:258:0,
                 from sketch/HAL.h:36,
                 from sketch/MarlinConfig.h:39,
                 from sketch/Marlin.h:35,
                 from sketch/endstops.cpp:27:
/Users/nathan/Library/Arduino15/packages/anet/hardware/avr/1.0.2/variants/sanguino/pins_arduino.h:92:66: error: reinterpret_cast from integer to pointer
 #define digitalPinToPCICR(p)    ( (((p) >= 0) && ((p) <= 31)) ? (&PCICR) : ((uint8_t *)0) )
                                                                 ~^~~~~~~
sketch/endstop_interrupts.h:126:21: note: in expansion of macro 'digitalPinToPCICR'
       static_assert(digitalPinToPCICR(X_MIN_PIN) != NULL, "X_MIN_PIN is not interrupt-capable");
                     ^~~~~~~~~~~~~~~~~
In file included from sketch/endstops.cpp:35:0:
endstop_interrupts.h:146:7: error: non-constant condition for static assertion
       static_assert(digitalPinToPCICR(Y_MIN_PIN) != NULL, "Y_MIN_PIN is not interrupt-capable");
       ^~~~~~~~~~~~~
In file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:258:0,
                 from sketch/HAL.h:36,
                 from sketch/MarlinConfig.h:39,
                 from sketch/Marlin.h:35,
                 from sketch/endstops.cpp:27:
/Users/nathan/Library/Arduino15/packages/anet/hardware/avr/1.0.2/variants/sanguino/pins_arduino.h:92:66: error: reinterpret_cast from integer to pointer
 #define digitalPinToPCICR(p)    ( (((p) >= 0) && ((p) <= 31)) ? (&PCICR) : ((uint8_t *)0) )
                                                                 ~^~~~~~~
sketch/endstop_interrupts.h:146:21: note: in expansion of macro 'digitalPinToPCICR'
       static_assert(digitalPinToPCICR(Y_MIN_PIN) != NULL, "Y_MIN_PIN is not interrupt-capable");
                     ^~~~~~~~~~~~~~~~~
In file included from sketch/endstops.cpp:35:0:
endstop_interrupts.h:166:7: error: non-constant condition for static assertion
       static_assert(digitalPinToPCICR(Z_MIN_PIN) != NULL, "Z_MIN_PIN is not interrupt-capable");
       ^~~~~~~~~~~~~
In file included from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/Arduino.h:258:0,
                 from sketch/HAL.h:36,
                 from sketch/MarlinConfig.h:39,
                 from sketch/Marlin.h:35,
                 from sketch/endstops.cpp:27:
/Users/nathan/Library/Arduino15/packages/anet/hardware/avr/1.0.2/variants/sanguino/pins_arduino.h:92:66: error: reinterpret_cast from integer to pointer
 #define digitalPinToPCICR(p)    ( (((p) >= 0) && ((p) <= 31)) ? (&PCICR) : ((uint8_t *)0) )
                                                                 ~^~~~~~~
sketch/endstop_interrupts.h:166:21: note: in expansion of macro 'digitalPinToPCICR'
       static_assert(digitalPinToPCICR(Z_MIN_PIN) != NULL, "Z_MIN_PIN is not interrupt-capable");
                     ^~~~~~~~~~~~~~~~~
exit status 1
non-constant condition for static assertion

I was considering if I need to make the leap to 2.0, was trying to put it off (for a trivial Configuration.h change), but I might need to bite the bullet... :( I'll read over these errors a little closer first and see if there's a simple answer. MarlinFirmware/Marlin#15770 also seems to have a bunch of comments in there and suggestions etc I haven't completely exhausted.

@CpuID
Copy link

CpuID commented Jul 2, 2020

My next test, was trying to drop the version of Arduino AVR Boards in Board Manager from 1.8.3 -> 1.6.23 (as suggested in https://www.reddit.com/r/AnetA8/comments/dct3eo/issue_marlin_119_doesnt_compile/ ). But then I hit this (I believe due to MacOS Catalina no longer running 32bit binaries, FML):

fork/exec /Users/nathan/Library/Arduino15/packages/arduino/tools/avr-gcc/5.4.0-atmel3.6.1-arduino2/bin/avr-g++: bad CPU type in executable
Error compiling for board Anet V1.0.

@CpuID
Copy link

CpuID commented Jul 2, 2020

Original error in #22 (comment) when using Arduino AVR Boards 1.8.2 and 1.8.1.

Idea: Copy the ~/Library/Arduino15/packages/arduino/tools/avr-gcc from Arduino AVR Boards 1.8.1 over to 1.6.23 (doesn't seem included with 1.8.2 or 1.8.3?). Leads to the same error/s as Arduino AVR Boards 1.8.x.

@CpuID
Copy link

CpuID commented Jul 2, 2020

Short of other suggestions here, I think I'm going to spend my time getting Marlin 2.0 installed instead. Probably better to just embrace the future rather than hanging onto the past with this one... (more active development etc)

@yaboo007
Copy link

I am able to use the latest arduino, but need to downgrade the arduino avr to 1.6.20, complies and was able to install marlin 1.1.9-bugfix for me

@herve843
Copy link

herve843 commented Aug 27, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants