# Problems compiling Firmware

**URL:** <https://forums.maslowcnc.com/t/problems-compiling-firmware/492>\
**Category:** Software\
**Created:** [August 19, 2017, 11:58pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492 "2017-08-19T23:58:40Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![jamesonhm159](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@jamesonhm159](https://forums.maslowcnc.com/u/jamesonhm159)\
**Post date:** [August 19, 2017, 11:58pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/1 "2017-08-19T23:58:40Z")

</div>

## Have not been able to compile firmware from the beginning. I get the following error;

## In file included from Encoder.cpp:2:0: Encoder.h:41:37: fatal error: utility/direct\_pin\_read.h: No such file or directory #include \<utility/direct\_pin\_read.h\> ^ compilation terminated.

The utility directory is included in the same location as the cnc\_ctrl\_v1.ino file in “sketchbook/libraries/Firmware/cnc\_ctrl\_v1/” . is there an issue with the file path here or is there some other step I need to take with Arduino to find the utility folder? I was able to include the full path to “utility/direct\_pin\_read.h” in “Encoder.h” where these header files are contained, but then encounter multiple other functional issues preventing compiling including attachInterrup being duplicately used as a macro with 2 parameters and a function with 3. Any help you can offer would be appreciated.

---

<div class="post-metadata">

**Author:** ![mooselake](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/mooselake/32/6218_2.png) [@mooselake](https://forums.maslowcnc.com/u/mooselake)\
**Post date:** [August 20, 2017, 12:17am UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/2 "2017-08-20T00:17:32Z")

</div>

OS? Windows, Mac, Linux, BeOS, Plan9, etc?

---

<div class="post-metadata">

**Author:** ![jamesonhm159](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@jamesonhm159](https://forums.maslowcnc.com/u/jamesonhm159)\
**Post date:** [August 20, 2017, 2:34am UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/3 "2017-08-20T02:34:50Z")

</div>

Linux, same error with Ubuntu and raspian

---

<div class="post-metadata">

**Author:** ![blurfl](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/blurfl/32/9_2.png) [@blurfl](https://forums.maslowcnc.com/u/blurfl)\
**Post date:** [August 20, 2017, 2:40am UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/4 "2017-08-20T02:40:22Z")

</div>

What version of Arduino? I think 1.83 is current. Are you running the IDE, or compiling from the command line?

---

<div class="post-metadata">

**Author:** ![jbnimble](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/jbnimble/32/90_2.png) [@jbnimble](https://forums.maslowcnc.com/u/jbnimble)\
**Post date:** [August 20, 2017, 5:42pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/5 "2017-08-20T17:42:25Z")

</div>

The steps [here](https://github.com/MaslowCNC/Firmware/wiki/Firmware-Setup) are what I followed in Linux and everything works fine. I also got Atom setup with PlatformIO based on [these instructions](https://github.com/MaslowCNC/Firmware/blob/master/README.md) and it also works.

Am using Atom 1.13.0 with PlatformIO 2.0.0  
Also Arduino IDE 1.8.1  
On Ubuntu 17.04

So it is definitely possible. For Arduino IDE I did not change anything in the code or structure. For PlatformIO I just modified its platformio.ini file like in the directions.

---

<div class="post-metadata">

**Author:** ![raspnex](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@raspnex](https://forums.maslowcnc.com/u/raspnex)\
**Post date:** [August 20, 2017, 7:33pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/6 "2017-08-20T19:33:37Z")

</div>

I am getting the same error jamesonhm159.  
Presario CQ70  
Ubuntu 16.04 LTS  
Arduino IDE 1.8.3 shows 2:1.0.5+dfsg2-4 in About Arduino

device shows as /dev/ttyACM0

Tried Arduino Web and got a red X in the Select Board. I selected Arduino/Genuino Mega or Mega 2560 at /dev/ttyACM0

I went through the install instructions before and after coffee with the same results. I was on the june shipment and just now got to get started working on it.

---

<div class="post-metadata">

**Author:** ![blurfl](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/blurfl/32/9_2.png) [@blurfl](https://forums.maslowcnc.com/u/blurfl)\
**Post date:** [August 20, 2017, 9:36pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/7 "2017-08-20T21:36:46Z")

</div>

What happens if you move ‘Firmware’ with all its subdirectories up to your home directory? I don’t think Arduino wants to find any part of Firmware in its libraries directory.

---

<div class="post-metadata">

**Author:** ![dlang](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/dlang/32/859_2.png) [@dlang](https://forums.maslowcnc.com/u/dlang)\
**Post date:** [August 20, 2017, 10:16pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/8 "2017-08-20T22:16:03Z")

</div>

the arduino IDE doesn’t really care, you just have to navigate around to that  
directory to open the project

---

<div class="post-metadata">

**Author:** ![blurfl](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/blurfl/32/9_2.png) [@blurfl](https://forums.maslowcnc.com/u/blurfl)\
**Post date:** [August 21, 2017, 4:51am UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/9 "2017-08-21T04:51:05Z")

</div>

Not sure why you’re getting that error. I can see it if I use the Arduino web IDE, though. You could turn on verbose output during compiling to see where it’s looking for the files…  
I find that I can work around it in the web IDE by copying the files from the utility folder into the cnc\_ctrl\_v1 folder and editing Encoder.h to remove the reference to the utility folder in three places:  
Encoder.h:41:#include "utility/direct\_pin\_read.h"  
Encoder.h:46:#include "utility/interrupt\_pins.h"  
Encoder.h:48:#include “utility/interrupt\_config.h”

After that it compiles without complaint.

---

<div class="post-metadata">

**Author:** ![TheRiflesSpiral](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/theriflesspiral/32/20_2.png) [@TheRiflesSpiral](https://forums.maslowcnc.com/u/TheRiflesSpiral)\
**Post date:** [August 21, 2017, 1:39pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/10 "2017-08-21T13:39:43Z")

</div>

What command are you using to compile?

---

<div class="post-metadata">

**Author:** ![jamesonhm159](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@jamesonhm159](https://forums.maslowcnc.com/u/jamesonhm159)\
**Post date:** [August 26, 2017, 3:39pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/11 "2017-08-26T15:39:22Z")

</div>

@blurfl - this worked for those 3 files, the compiler gets past that hangup now. It then had a file not found error with the EEPROM library in Axis.h. I got around that by including it in the cnc\_ctrl\_v1.ino file. I now have the following errors;

Axis.cpp: In constructor ‘Axis::Axis(const int&, const int&, const int&, const int&, const int&, const String&, const int&)’:  
Axis.cpp:34:82: error: invalid conversion from ‘volatile double\*’ to ‘double\*’ [-fpermissive]  
\_pidController.setup(&\_pidInput, &\_pidOutput, &\_pidSetpoint, 0, 0, 0, REVERSE);  
^  
In file included from Axis.h:23:0,  
from Axis.cpp:20:  
PID\_v1.h:21:10: note: initializing argument 1 of ‘void PID::setup(double\*, double\*, double\*, const double&, const double&, const double&, const int&)’  
void setup(double\*, double\*, double\*, // \* constructor. links the PID to the Input, Output, and  
^  
Axis.cpp:34:82: error: invalid conversion from ‘volatile double\*’ to ‘double\*’ [-fpermissive]  
\_pidController.setup(&\_pidInput, &\_pidOutput, &\_pidSetpoint, 0, 0, 0, REVERSE);  
^  
In file included from Axis.h:23:0,  
from Axis.cpp:20:  
PID\_v1.h:21:10: note: initializing argument 2 of ‘void PID::setup(double\*, double\*, double\*, const double&, const double&, const double&, const int&)’  
void setup(double\*, double\*, double\*, // \* constructor. links the PID to the Input, Output, and  
^  
Axis.cpp:34:82: error: invalid conversion from ‘volatile double\*’ to ‘double\*’ [-fpermissive]  
\_pidController.setup(&\_pidInput, &\_pidOutput, &\_pidSetpoint, 0, 0, 0, REVERSE);  
^  
In file included from Axis.h:23:0,  
from Axis.cpp:20:  
PID\_v1.h:21:10: note: initializing argument 3 of ‘void PID::setup(double\*, double\*, double\*, const double&, const double&, const double&, const int&)’  
void setup(double\*, double\*, double\*, // \* constructor. links the PID to the Input, Output, and  
^

It seems there is dome functional issue with the code itself and I do not know enough about c style programming to debug.  
@TheRiflesSpiral - I am compiling with the arduino IDE verify checkmark - version 1.8.4

---

<div class="post-metadata">

**Author:** ![blurfl](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/blurfl/32/9_2.png) [@blurfl](https://forums.maslowcnc.com/u/blurfl)\
**Post date:** [August 26, 2017, 4:11pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/12 "2017-08-26T16:11:06Z")

</div>

Are you sure you’ve chosen the “Board: Arduino/Genuino Mega or Mega2650” target to compile for? It sounds like the compiler is targeting a different platform.  
You could change the setting for verbose output for the compiler, then zip the output and attach it here. That might provide a clue to go on.

---

<div class="post-metadata">

**Author:** ![jamesonhm159](https://avatars.discourse-cdn.com/v4/letter/j/c89c15/32.png) [@jamesonhm159](https://forums.maslowcnc.com/u/jamesonhm159)\
**Post date:** [August 30, 2017, 2:28am UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/13 "2017-08-30T02:28:01Z")

</div>

Thanks for all your responses, successfully compiled and uploaded with Atom/PlatformIO.

---

<div class="post-metadata">

**Author:** ![abetusk](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/abetusk/32/10135_2.png) [@abetusk](https://forums.maslowcnc.com/u/abetusk)\
**Post date:** [November 5, 2017, 8:23am UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/14 "2017-11-05T08:23:59Z")

</div>

I had similar problems in addition to others involving not being able to include EEPROM.h from anything other than the .ino file and then having the EEPROM class not having the ‘update’ method.

I eventually figured out that I was using a very old version 1.0.5 of the Arduino IDE under Ubuntu/Linux (16.04.2). I went to the [Arduino downloads](https://www.arduino.cc/en/Main/Software) page and downloaded the latest Arduino IDE version 1.8.5.

After setting the board and port correctly, it compiled and uploaded without any modification of the source or file locations that was provided by the latest [Maslow firmware (0.96)](https://github.com/MaslowCNC/Firmware/releases).

A quick recap in case others encounter the same problems I did:

- Check to make sure you have an **up-to-date Arduino IDE** (for example 1.8.5)
- Make sure you have the **Arduino 2560 board selected** (_Tools-\>Board-\>Arduino/Genuino Mega or Mega 2560_)
- Make sure you have the proper **Port selected** (_Tools-\>Port-\>…_)
- If you have permissions problems uploading to the Arduino, the following should hopefully work:   
   
 &nbsp; &nbsp; `sudo usermod -a -G dialout <username>`   
   
(taken from the [Arduino IDE Linux installation guide](https://www.arduino.cc/en/Guide/Linux))

---

<div class="post-metadata">

**Author:** ![JustinC](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@JustinC](https://forums.maslowcnc.com/u/JustinC)\
**Post date:** [November 11, 2017, 5:26pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/15 "2017-11-11T17:26:28Z")

</div>

I’m getting this error trying to compile it with the Arduino Create app on my Chromebook. Is this generally a bad idea?

---

<div class="post-metadata">

**Author:** ![bar](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/bar/32/10_2.png) [@bar](https://forums.maslowcnc.com/u/bar)\
**Post date:** [November 21, 2017, 12:48am UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/16 "2017-11-21T00:48:12Z")

</div>

I haven’t tested the Arduino Create app, did it end up working for you or did you have to switch to a different system?

---

<div class="post-metadata">

**Author:** ![JustinC](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@JustinC](https://forums.maslowcnc.com/u/JustinC)\
**Post date:** [November 21, 2017, 9:55pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/17 "2017-11-21T21:55:05Z")

</div>

The Arduino Create App compiled and uploaded the test\_electronics\_firmware sketch to the controller without trouble, but when attempting to compile/verify the cnc\_ctrl\_v1 sketch it seems to have trouble linking dependencies. I had simply imported the sketch into the web app as the zip file after downloading it.

This is the output from the console:

./opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -build-path /tmp/413617047/build -hardware opt/arduino-builder/hardware -hardware ./opt/cores -tools opt/arduino-builder/tools -tools ./opt/tools -built-in-libraries opt/libraries/latest -libraries /tmp/413617047/pinned -libraries /tmp/413617047/custom -fqbn arduino:avr:mega:cpu=atmega2560 -build-cache /tmp -logger humantags -verbose=true /tmp/413617047/cnc\_ctrl\_v1

Using board ‘mega’ from platform in folder: /home/admin/builder/opt/cores/arduino/avr

Using core ‘arduino’ from platform in folder: /home/admin/builder/opt/cores/arduino/avr

Detecting libraries used…

“/home/admin/builder/opt/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF\_CPU=16000000L -DARDUINO=10611 -DARDUINO\_AVR\_MEGA2560 -DARDUINO\_ARCH\_AVR “-I/home/admin/builder/opt/cores/arduino/avr/cores/arduino” “-I/home/admin/builder/opt/cores/arduino/avr/variants/mega” “/tmp/413617047/build/sketch/cnc\_ctrl\_v1.ino.cpp” -o “/dev/null”

“/home/admin/builder/opt/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF\_CPU=16000000L -DARDUINO=10611 -DARDUINO\_AVR\_MEGA2560 -DARDUINO\_ARCH\_AVR “-I/home/admin/builder/opt/cores/arduino/avr/cores/arduino” “-I/home/admin/builder/opt/cores/arduino/avr/variants/mega” “-I/home/admin/builder/opt/cores/arduino/avr/libraries/EEPROM/src” “/tmp/413617047/build/sketch/cnc\_ctrl\_v1.ino.cpp” -o “/dev/null”

“/home/admin/builder/opt/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++” -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega2560 -DF\_CPU=16000000L -DARDUINO=10611 -DARDUINO\_AVR\_MEGA2560 -DARDUINO\_ARCH\_AVR “-I/home/admin/builder/opt/cores/arduino/avr/cores/arduino” “-I/home/admin/builder/opt/cores/arduino/avr/variants/mega” “-I/home/admin/builder/opt/cores/arduino/avr/libraries/EEPROM/src” “/tmp/413617047/build/sketch/cnc\_ctrl\_v1.ino.cpp” -o “/tmp/413617047/build/preproc/ctags\_target\_for\_gcc\_minus\_e.cpp”

Multiple libraries were found for “EEPROM.h”

Used: /home/admin/builder/opt/cores/arduino/avr/libraries/EEPROM

Not used: /home/admin/builder/opt/libraries/latest/arduino-nvm-0-9-1

Using library EEPROM at version 2.0 in folder: /home/admin/builder/opt/cores/arduino/avr/libraries/EEPROM

In file included from /tmp/413617047/build/sketch/MotorGearboxEncoder.h:22:0,

from /tmp/413617047/build/sketch/Axis.h:24,

from /tmp/413617047/build/sketch/CNC\_Functions.h:19,

from /tmp/413617047/cnc\_ctrl\_v1/cnc\_ctrl\_v1.ino:15:

/tmp/413617047/build/sketch/Encoder.h:41:37: fatal error: utility/direct\_pin\_read.h: No such file or directory

#include “utility/direct\_pin\_read.h”

^

compilation terminated.

exit status 1

---

<div class="post-metadata">

**Author:** ![JustinC](https://avatars.discourse-cdn.com/v4/letter/j/da6949/32.png) [@JustinC](https://forums.maslowcnc.com/u/JustinC)\
**Post date:** [November 21, 2017, 9:59pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/18 "2017-11-21T21:59:58Z")

</div>

I should add that I was able to compile/verify/upload cnc\_ctrl\_v1 from the Arduino IDE on my dreaded Windows machine.

Now I’m hoping to install Ubuntu linux on my Chromebook so I can get Ground Control running there hopefully. Failing that, I’ll try the Raspberry Pi solution.

Anything to avoid Windows!

---

<div class="post-metadata">

**Author:** ![abetusk](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/abetusk/32/10135_2.png) [@abetusk](https://forums.maslowcnc.com/u/abetusk)\
**Post date:** [November 21, 2017, 11:36pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/19 "2017-11-21T23:36:40Z")

</div>

@JustinC, what version of the Arduino IDE are you running? Also, have you made sure to select the “Arduino 2560” board in the “Tools-\>Board” dropdown?

---

<div class="post-metadata">

**Author:** ![blurfl](https://yyz1.discourse-cdn.com/flex031/user_avatar/forums.maslowcnc.com/blurfl/32/9_2.png) [@blurfl](https://forums.maslowcnc.com/u/blurfl)\
**Post date:** [November 21, 2017, 11:37pm UTC](https://forums.maslowcnc.com/t/problems-compiling-firmware/492/20 "2017-11-21T23:37:16Z")

</div>

I wonder if the web version can handle the files in the sub folder? The termination with “utility/direct\_pin\_read.h” suggests that’s the problem.

[Next page](https://forums.maslowcnc.com/t/problems-compiling-firmware/492.md?page=2)
