MCUdude / MightyCore

Arduino hardware package for ATmega1284, ATmega644, ATmega324, ATmega324PB, ATmega164, ATmega32, ATmega16 and ATmega8535
Other
649 stars 182 forks source link

Error compiling for board ATmega1284 #243

Closed brown5500 closed 1 year ago

brown5500 commented 2 years ago

I have an ender 3 with a V1.1.3 board. I downloaded the 1.1.x marlin files, and copied over all the example files from the Ender-3 folder. I followed every instruction that I could find, but I'm getting an error compiling no matter what I try. I got the same results on Arduino IDE 1.8.19 & 1.8.18. I also tried a few different versions of the firmware. I'm pasting the error messages below. Thanks for your help!

Arduino: 1.8.18 (Windows 10), Board: "ATmega1284, Yes (UART0), Standard pinout, EEPROM retained, 1284P, BOD 2.7V, LTO disabled, External 16 MHz"

In file included from C:\Users\corya\Downloads\Marlin-1.1.x\Marlin-1.1.x\Marlin\HAL.h:36:0,

             from C:\Users\corya\Downloads\Marlin-1.1.x\Marlin-1.1.x\Marlin\MarlinConfig.h:39,

             from C:\Users\corya\Downloads\Marlin-1.1.x\Marlin-1.1.x\Marlin\enum.h:26,

             from C:\Users\corya\Downloads\Marlin-1.1.x\Marlin-1.1.x\Marlin\planner.h:36,

             from C:\Users\corya\Downloads\Marlin-1.1.x\Marlin-1.1.x\Marlin\planner.cpp:65:

C:\Users\corya\AppData\Local\Arduino15\packages\MightyCore\hardware\avr\2.1.3\cores\MCUdude_corefiles/Arduino.h:125:22: error: statement-expressions are not allowed outside functions nor in template-argument lists

define sq(x) ({ typeof (x) _x = (x); _x * _x; })

                  ^

C:\Users\corya\Downloads\Marlin-1.1.x\Marlin-1.1.x\Marlin\macros.h:95:32: note: in expansion of macro 'sq'

define CIRCLE_AREA(R) (M_PI * sq(float(R)))

                            ^~

C:\Users\corya\Downloads\Marlin-1.1.x\Marlin-1.1.x\Marlin\planner.cpp:153:44: note: in expansion of macro 'CIRCLE_AREA'

     Planner::volumetric_area_nominal = CIRCLE_AREA(float(DEFAULT_NOMINAL_FILAMENT_DIA) * 0.5f), // Nominal cross-sectional area

                                        ^~~~~~~~~~~

exit status 1

Error compiling for board ATmega1284.

This report would have more information with "Show verbose output during compilation" option enabled in File -> Preferences.

MCUdude commented 2 years ago

What happens if you add the following code all the way on the top of the sketch:

#ifdef sq
  #undef sq
  #define sq(x) ((x)*(x))
#endif
brown5500 commented 2 years ago

Thanks for the suggestion. I got the exact same result with that code added though. Just to make sure that I did it right, there are multiple tabs in the Arduino setup. The first one is Marlin. The top of that one is where I added your code.

On Sun, May 8, 2022 at 1:20 AM Hans @.***> wrote:

What happens if you add the following code all the way on the top of the sketch:

ifdef sq

undef sq

define sq(x) ((x)*(x))

endif

— Reply to this email directly, view it on GitHub https://github.com/MCUdude/MightyCore/issues/243#issuecomment-1120358702, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZCESFMMXIILG3E3NSKS3I3VI5MMNANCNFSM5VLI3DIA . You are receiving this because you authored the thread.Message ID: @.***>

MCUdude commented 1 year ago

The macros have later been replaced with template functions, and the issue should now be resolved.