sudar / Arduino-Makefile

Makefile for Arduino sketches. It defines the workflows for compiling code, flashing it to Arduino and even communicating through Serial.
http://hardwarefun.com/tutorials/compiling-arduino-sketches-using-makefile
GNU Lesser General Public License v2.1
2.02k stars 448 forks source link

'make upload' throws 'input in flex scanner failed' error #637

Closed kzembower closed 4 years ago

kzembower commented 4 years ago

Hello, I'm new to Arduino-Makefile; in fact, this is my first project, so this error may be entirely my own. However, searching for a solution didn't find anything.

My KitchenTimer project compiles successfully, but when trying to upload, throws this error:

kevin@kevin-asrock:~/Arduino/KitchenTimer$ make upload
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED]       CURRENT_OS = LINUX 
- [USER]               ARDUINO_DIR = /home/kevin/Arduino/arduino-1.8.12 
- [USER]               ARDMK_DIR = /home/kevin/Arduino/Arduino-Makefile-master 
- [AUTODETECTED]       ARDUINO_VERSION = 1812 
- [DEFAULT]            ARCHITECTURE = avr 
- [DEFAULT]            ARDMK_VENDOR = arduino 
- [AUTODETECTED]       ARDUINO_PREFERENCES_PATH = /home/kevin/.arduino15/preferences.txt 
- [AUTODETECTED]       ARDUINO_SKETCHBOOK = /home/kevin/Arduino (from arduino preferences file)
- [COMPUTED]           ARDUINO_VAR_PATH = /home/kevin/Arduino/arduino-1.8.12/hardware/arduino/avr/variants (from ARDUINO_DIR)
- [COMPUTED]           BOARDS_TXT = /home/kevin/Arduino/arduino-1.8.12/hardware/arduino/avr/boards.txt (from ARDUINO_DIR)
- [USER]               AVR_TOOLS_DIR = /usr 
- [COMPUTED]           ARDUINO_LIB_PATH = /home/kevin/Arduino/arduino-1.8.12/libraries (from ARDUINO_DIR)
- [COMPUTED]           ARDUINO_PLATFORM_LIB_PATH = /home/kevin/Arduino/arduino-1.8.12/hardware/arduino/avr/libraries (from ARDUINO_DIR)
- [DEFAULT]            USER_LIB_PATH = /home/kevin/Arduino/libraries (in user sketchbook)
- [DEFAULT]            PRE_BUILD_HOOK = pre-build-hook.sh 
- [USER]               BOARD_SUB = 16MHzatmega328 
- [USER]               BOARD_TAG = pro 
- [COMPUTED]           CORE = arduino (from build.core)
- [COMPUTED]           VARIANT = eightanaloginputs (from build.variant)
- [COMPUTED]           OBJDIR = build-pro-16MHzatmega328 (from BOARD_TAG)
- [COMPUTED]           ARDUINO_CORE_PATH = /home/kevin/Arduino/arduino-1.8.12/hardware/arduino/avr/cores/arduino (from ARDUINO_DIR, BOARD_TAG and boards.txt)
- [ASSUMED]            MONITOR_BAUDRATE = 9600 
- [DEFAULT]            OPTIMIZATION_LEVEL = s 
- [DEFAULT]            MCU_FLAG_NAME = mmcu 
- [DEFAULT]            CFLAGS_STD = -std=gnu11 
- [DEFAULT]            CXXFLAGS_STD = -std=gnu++11 
- [COMPUTED]           DEVICE_PATH = /dev/ttyUSB1 (from MONITOR_PORT)
- [DEFAULT]            FORCE_MONITOR_PORT =  
- [AUTODETECTED]       Size utility: AVR-aware for enhanced output
-
-                      ARDUINO_LIBS =
- [SYSTEM]               LiquidCrystal
- [COMPUTED]           BOOTLOADER_PARENT = /home/kevin/Arduino/arduino-1.8.12/hardware/arduino/avr/bootloaders (from ARDUINO_DIR)
- [COMPUTED]           ARDMK_VERSION = 1.6 
- [COMPUTED]           CC_VERSION = 5.4.0 (avr-gcc)
-------------------------
mkdir -p build-pro-16MHzatmega328
make reset
make[1]: Entering directory '/home/kevin/Arduino/KitchenTimer'
/usr/bin/ard-reset-arduino  /dev/ttyUSB1
make[1]: Leaving directory '/home/kevin/Arduino/KitchenTimer'
make do_upload
make[1]: Entering directory '/home/kevin/Arduino/KitchenTimer'
/usr/bin/avrdude -q -V -p atmega328p -C /etc -D -c arduino -b 57600 -P /dev/ttyUSB1 \
        -U flash:w:build-pro-16MHzatmega328/KitchenTimer.hex:i
input in flex scanner failed
/home/kevin/Arduino/Arduino-Makefile-master/Arduino.mk:1707: recipe for target 'do_upload' failed
make[1]: *** [do_upload] Error 2
make[1]: Leaving directory '/home/kevin/Arduino/KitchenTimer'
/home/kevin/Arduino/Arduino-Makefile-master/Arduino.mk:1694: recipe for target 'upload' failed
make: *** [upload] Error 2
kevin@kevin-asrock:~/Arduino/KitchenTimer$ 

I don't know what a 'flex scanner' is, or how to fix it. This is on a Ubuntu 18.04.4 system. Please let me know what other information would help you diagnose this problem.

Thanks for your help and advice.

-Kevin

kzembower commented 4 years ago

Nevermind. User error. This is the error I got when I used: AVRDUDE_CONF = /etc instead of: AVRDUDE_CONF = /etc/avrdude.conf

Sorry for the noise.

-Kevin