I have tried to compile it for the Arduino Mega 2560 and Ramps 1.4 Board.
I changed the in the Config.h:
#include “grbl.h” // For Arduino IDE compatibility.
// Define CPU pin map and default settings.
// NOTE: OEMs can avoid the need to maintain/update the defaults.h and cpu_map.h files and use only
// one configuration file by placing their specific defaults and pin map at the bottom of this file.
// If doing so, simply comment out these two defines and see instructions below.
#define DEFAULTS_GENERIC
#define CPUMAP2560_INITIAL
// To use with RAMPS 1.4 Board, comment out the above defines and uncomment the next two defines
//#define DEFAULTSRAMPSBOARD
#define CPUMAP2560RAMPSBOARD
Is that correct?
After that , with make in the Terminal:
avr-gcc -Wall -Os -DF_CPU=16000000L -mmcu=atmega2560 -I. -ffunction-sections -flto -MMD -MP -c grbl/main.c -o build/main.o
In file included from grbl/grbl.h:47,
from grbl/main.c:22:
grbl/cpumap.h:160: warning: “STEPDDR” redefined
160 | #define STEPDDR(i) DDR(STEPPORT##i)
|
In file included from grbl/grbl.h:47,
from grbl/main.c:22:
grbl/cpu_map.h:36: note: this is the location of the previous definition
36 | #define STEP_DDR DDRA
|
In file included from grbl/grbl.h:47,
from grbl/main.c:22:
grbl/cpumap.h:162: warning: “STEPPORT” redefined
162 | #define STEPPORT(i) STEP_PORT(i)
|
In file included from grbl/grbl.h:47,
from grbl/main.c:22:
grbl/cpu_map.h:37: note: this is the location of the previous definition
37 | #define STEP_PORT PORTA
|
In file included from grbl/grbl.h:47,
from grbl/main.c:22:
grbl/cpumap.h:163: warning: “STEPPIN” redefined
163 | #define STEPPIN(i) PIN(STEPPORT##i)
|
In file included from grbl/grbl.h:47,
from grbl/main.c:22:
grbl/cpu_map.h:38: note: this is the location of the previous definition
38 | #define STEP_PIN PINA
|
In file included from grbl/grbl.h:47,
from grbl/main.c:22:
grbl/cpumap.h:174: warning: “DIRECTIONDDR” redefined
174 | #define DIRECTIONDDR(i) DDR(DIRECTIONPORT##i)
|
In file included from grbl/grbl.h:47,
from grbl/main.c:22:
grbl/cpu_map.h:45: note: this is the location of the previous definition
45 | #define DIRECTION_DDR DDRC
|
and so on. Any ideas?
评论 (5)
#2 – Technican 于 2022-04-10
Hi Gauthier,
Thanx for the fast answer. The changes from you helps me. I am using macOS 12 , avr-gcc from Homebrew , Version 9.3.0.3.
Only a warning appears during the Compilation, is this a problem?
Great Rewards from Germany ,
Sven
grbl/eeprom.c: In function ‘memcpytoeepromwithchecksum’:
grbl/eeprom.c:133:26: warning: ‘<<' in boolean context, did you mean '' ? [-Wint-in-bool-context]
133 | checksum = (checksum << 1) || (checksum >> 7);
| ~~~~~~~~~~^~~~~
grbl/eeprom.c: In function ‘memcpyfromeepromwithchecksum’:
grbl/eeprom.c:144:26: warning: ‘<<' in boolean context, did you mean '' ? [-Wint-in-bool-context]
144 | checksum = (checksum << 1) || (checksum >> 7);
| ~~~~~~~~~~^~~~~
> Am 10.04.2022 um 18:16 schrieb Gauthier Brière @.*>:
>
>
> Hi @Technican <https://github.com/Technican>,
>
> Your config.h update is not correct. To use an Arduino Mega with RAMPS 1.6, you need to comment the two first definitions and uncomment the two other like this:
>
> // Define CPU pin map and default settings.
> // NOTE: OEMs can avoid the need to maintain/update the defaults.h and cpu_map.h files and use only
> // one configuration file by placing their specific defaults and pin map at the bottom of this file.
> // If doing so, simply comment out these two defines and see instructions below.
> //#define DEFAULTS_GENERIC
> //#define CPUMAP2560_INITIAL
>
> // To use with RAMPS 1.4 Board, comment out the above defines and uncomment the next two defines
> #define DEFAULTSRAMPSBOARD
> #define CPUMAP2560RAMPSBOARD
> Then, if you have other compile error message, please, tell us what is your system, Windows or Linux, which version, which compiler and version, and any other information which can help us to help you…
>
> @++;
> Gauthier.
>
> —
> Reply to this email directly, view it on GitHub <https://github.com/gnea/grbl-Mega/issues/157#issuecomment-1094305819>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AKQMYKT7LS4HLREZT7SWFKTVEL5E5ANCNFSM5TA5GAEQ>.
> You are receiving this because you were mentioned.
>
#3 – fra589 于 2022-04-10
I work under Linux Debian, and the current version in Debian stable is GCC 5.4.0.
Under this version, I don’t have those warning. But GCC version 9 is more finicky and tell many more warning.
Regarding the source code, I don’t think this will be a problem, just a missing cast between integer and boolean and should work fine.
The warning is in the code that saves and restores Grbl settings to EEPROM. If Grbl settings save and return correctly after powering down, it’s working. ![]()
@++;
Gauthier.
#4 – drf5n 于 2022-04-11
> grbl/eeprom.c: In function ‘memcpytoeepromwithchecksum’: grbl/eeprom.c:133:26: warning: ‘<<' in boolean context, did you mean '' ? [-Wint-in-bool-context] 133 | checksum = (checksum << 1) || (checksum >> 7); | ~~~~~~~~~~^~~~~ grbl/eeprom.c: In function ‘memcpyfromeepromwithchecksum’: grbl/eeprom.c:144:26: warning: ‘<<' in boolean context, did you mean '' ? [-Wint-in-bool-context] 144 | checksum = (checksum << 1) || (checksum >> 7); | ~~~~~~~~~~^~~~~
That looks like it was a typo — it squashes the checksum down to a single bit of information, when it looks like it intended to roll it right one bit, so the final checksum ends up either zero or one larger than the last character in the data:
Maybe it was supposed to be
checksum = (checksum << 1) | (checksum >> 7);
That’s what they use in grblHAL:
https://github.com/grblHAL/core/blob/3a84b58d301f04279268b4ef1045fd6bc0961be5/nuts_bolts.c#L267-L278
#5 – fra589 于 2022-04-11
Very old subject… Already discussed in 2017 here :
https://github.com/grbl/grbl/issues/1249#issuecomment-569354273
with the choice not to correct it
@++;
Gauthier.
#1 – fra589 于 2022-04-10
Hi @Technican,
Your config.h update is not correct. To use an Arduino Mega with RAMPS 1.6, you need to comment the two first definitions and uncomment the two other like this:
“
// Define CPU pin map and default settings.
// NOTE: OEMs can avoid the need to maintain/update the defaults.h and cpu_map.h files and use only
// one configuration file by placing their specific defaults and pin map at the bottom of this file.
// If doing so, simply comment out these two defines and see instructions below.
//#define DEFAULTS_GENERIC
//#define CPUMAP2560_INITIAL
// To use with RAMPS 1.4 Board, comment out the above defines and uncomment the next two defines
#define DEFAULTSRAMPSBOARD
#define CPUMAP2560RAMPSBOARD
“
Then, if you have other compile error message, please, tell us what is your system, Windows or Linux, which version, which compiler and version, and any other information which can help us to help you…
@++;
Gauthier.