Flashing: SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set

Hi,

I want to see if I can upgrade my custom firmware to the latest version. So as a first step I just wanted to flash the latest firmware, before I try to merge in my changes.

I get this error:

SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!

Here is some environment info - I tried to reclone everything as described in the README.md file

lasse@luke ~/D/A/Model01-Factory> pwd
/Users/lasse/Documents/Arduino/Model01-Factory
lasse@luke ~/D/A/Model01-Factory> ls -la ..
total 16
drwxr-xr-x   10 lasse  staff   320 Oct  8 17:04 .
drwx------+ 154 lasse  staff  4928 Oct  8 18:46 ..
-rw-r--r--@   1 lasse  staff  6148 Mar 27  2018 .DS_Store
drwxr-xr-x    8 lasse  staff   256 Oct  8 16:53 Model01-Factory
drwxr-xr-x   15 lasse  staff   480 May  9 21:59 Model01-Firmware
drwxr-xr-x   14 lasse  staff   448 Nov 15  2018 Model01-Macware
drwxr-xr-x@   4 lasse  staff   128 Jan 24  2018 attiny_flasher
drwxr-xr-x    4 lasse  staff   128 Mar 27  2018 attiny_flasher_org
drwxr-xr-x    3 lasse  staff    96 Oct  8 17:04 hardware
drwxr-xr-x    3 lasse  staff    96 Mar 11  2018 hw
lasse@luke ~/D/A/Model01-Factory> ls -la
total 144
drwxr-xr-x   8 lasse  staff    256 Oct  8 16:53 .
drwxr-xr-x  10 lasse  staff    320 Oct  8 17:04 ..
-rw-r--r--   1 lasse  staff  35141 Oct  8 16:52 LICENSE
-rw-r--r--   1 lasse  staff   2661 Oct  8 16:52 Makefile
-rw-r--r--   1 lasse  staff  21929 Oct  8 16:52 Model01-Firmware.ino
-rw-r--r--   1 lasse  staff   3908 Oct  8 16:52 README.md
-rw-r--r--   1 lasse  staff    275 Oct  8 16:52 library.properties
drwxr-xr-x   3 lasse  staff     96 Oct  8 16:52 src
lasse@luke ~/D/A/Model01-Factory> make flash
BOARD_HARDWARE_PATH="/Users/lasse/Documents/Arduino/hardware" /Users/lasse/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/bin//kaleidoscope-builder flash
SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!
SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!
SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!
ls: /.ino: No such file or directory
SKETCH, LIBRARY, SOURCEDIR, and ROOT need to be set before including this file!
make: *** [flash] Error 1
lasse@luke ~/D/A/Model01-Factory>

Try copying the .kaleidoscope-builder.conf file from the official repo. The problem here is that you’re in a directory called Model01-Factory, and the build system expects the sketch name to be the same as the directory name. The default builder config explicitly sets the sketch name to Model01-Firmware, so no matter how you named the directory, it will build.

This is what you need in .kaleidoscope-builder.conf:

DEFAULT_SKETCH=Model01-Firmware
1 Like

Thank you. That helped, but I got one more error.

fork/exec /Applications/Arduino.app/Contents/Java/hardware/tools/avr/bin/avr-g++: bad CPU type in executable

It turns out this is because macOS 10.15 (just out) no longer allows 32 bit binaries.
So I have to wait for a new Arduino version for this to be fixed:

Just so you know … I will update when/if I find a solution.

1 Like

Just tested with Arduino 1.9.0-BETA and that version works with the macOS 10.15

Actually … one more issue. Maybe this is also macOS 10.15 catalina related?
When actually flashing (hitting the prog key) I get this error:

avrdude: ser_open(): can't open device "/dev/cu.usbmodemkbio011": No such file or directory

What to do? Can you override the device path in .kaleidoscope-builder.conf?

My device is called:

lasse@luke ~/d/svu> ls -la /dev/cu.usb*
crw-rw-rw-  1 root  wheel   18,  19 Oct 10 14:56 /dev/cu.usbmodemCDkbio011

Huh. We ought to be probing that from: https://github.com/keyboardio/Kaleidoscope/blob/master/bin/find-device-port-macos

If you try that tool standalone, does it work?

(This may indeed be Catalina breakage.)

I just upgraded a machine to Catalina, but I haven’t had time to try to build or flash Kaleidoscope on it yet. It may be a few days before I get around to it, but if the device port scanner still isn’t fixed by then, I expect to be able to sort it out.

Hmm the tool seems to work standalone, but it tries a different /dev when flashing

Full log:

lasse@luke ~/D/A/Model01-Factory> chmod +x ../hardware/keyboardio/avr/libraries/Kaleidoscope/bin/find-device-port-macos
lasse@luke ~/D/A/Model01-Factory> ../hardware/keyboardio/avr/libraries/Kaleidoscope/bin/find-device-port-macos
2019-10-11 11:04:44.208 system_profiler[53030:839727] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2019-10-11 11:04:44.209 system_profiler[53030:839727] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
/dev/cu.usbmodemCDkbio011

but make flash picks /dev/cu.usbmodemkbio011

lasse@luke ~/D/A/Model01-Factory> make flash
BOARD_HARDWARE_PATH="/Users/lasse/Documents/Arduino/hardware" /Users/lasse/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope/bin//kaleidoscope-builder flash
Building ./Model01-Firmware 0.0.0 into /var/folders/bh/blvc1l9n4dv2m9h0pg_hzdf80000gn/T//kaleidoscope-lasse/sketch/8852701481-Model01-Firmware.ino/output...
- Size: firmware/Model01-Firmware/Model01-Firmware-0.0.0.elf
  - Program:   25010 bytes (87.2% Full)
  - Data:       1338 bytes (52.3% Full)

To update your keyboard's firmware, hold down the 'Prog' key on your keyboard,
and then press 'Enter'.

When the 'Prog' key glows red, you can release it.

^[^[^[^[^[^[^[^[^[^[^[^[^[
2019-10-11 11:05:15.278 system_profiler[53336:840482] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2019-10-11 11:05:15.279 system_profiler[53336:840482] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2019-10-11 11:05:18.533 system_profiler[53347:840575] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
2019-10-11 11:05:18.534 system_profiler[53347:840575] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
Connecting to programmer: .avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding

avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: ser_drain(): read error: Device not configured
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
Found programmer: Id = ""; type =
    Software Version = .; Hardware Version = .
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: buffered memory access not supported. Maybe it isn't
a butterfly/AVR109 but a AVR910 device?
avrdude: initialization failed, rc=-1
         Double check connections and try again, or use -F to override
         this check.

avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: leave prog mode
avrdude: ser_send(): write error: Device not configured
avrdude: ser_recv(): read error: Device not configured
avrdude: butterfly_recv(): programmer is not responding
avrdude: error: programmer did not respond to command: exit bootloader
avrdude: ser_close(): can't reset attributes for device: Device not configured
avrdude: ser_open(): can't open device "/dev/cu.usbmodemkbio011": No such file or directory
make: *** [flash] Error 1
lasse@luke ~/D/A/Model01-Factory>

I am stuck. Don’t know what to try next.
Any suggestions?
Is there anything I can do to try help debug this?

We’ve found the root cause. Catalina broke flashing of the Model 01, along with every Arduino based on the ATMega32U4. It sounds like Apple will be pushing a fix in a point release in the near future.

Now I am on macOS 10.15.1 (19B88)
I can report that I still get the same error …

As I understand it, 10.15.1 was already locked down before this bug got discovered inside apple.