PlatformIO support?

Is there any way to build the Keyboardio firmware with PlatformIO? I’m … really not a fan of the stock Arduino IDE, nor do I like having Java on my system.

(Sorry if this is a dumb or nonsensical question. I’m brand new to Arduino stuff.)

It is not dumb or nonsensical. I am not familiar with PlatformIO, though, so I can’t answer. From a quick glance it seems like it should be possible, but you would be on uncharted waters.

It you do get it working, I would love notes on the process for the wiki, and I wouldn’t be surprised if other folks who know more can point you in the right direction.

Not sure if this is helpful at all, but you can build through Arduino without touching the IDE, i.e. build from the command line. Simple ‘make’ does the trick; under the hood there’s a ‘kaleidoscope-builder’ script that eventually invokes the ‘arduino-builder’ command-line tool. So if your only problem is with the Arduino IDE, you can easily avoid using it.

1 Like

Oh, that actually is helpful. Will make also flash the firmware, or is there an additional command I need to invoke?

Yep, the command you want is ‘make flash’.

See also the instructions in the README for the Model01-Firmware: https://github.com/keyboardio/Model01-Firmware

1 Like

To answer the original question, I’d be thrilled to see a way to build with PlatformIO, but the last time I looked, they wanted us to publish each and every one of our plugins to their global module list and to build a custom hardware definition for thiem. That felt “wrong” to me and isn’t work anyone from Keyboardio (the company) is likely to put effort into doing.

But, yes, commandline builds using the Makefile in the default sketch are something that are 100% supported. We need them internally for our testing and our official binary builds.

It uses the arduino-builder tool from Arduino themselves, but that’s go and not java :wink:

So if I don’t plan on using the Arduino IDE, only the build tools, can I uninstall Java?

On the Mac, is there a different homebrew package to install only the CLI tools?

You can likely uninstall Java, but I haven’t tested that.

I’m not aware of a homebrew package that will get you only the non-gui parts of the IDE package.

1 Like

I get the following error when I run make flash:

avrdude: ser_open(): can’t open device “-b57600”: No such file or directory

I hate to say it, but, have you tried unplugging it and plugging it back in? I’ve seen that fix that error.

That typically means that your serial port’s name doesn’t match our heuristics. What serial port do you see start to show up when you plug in your keyboard?

/dev/cu.usbmodem* on OSX or /dev/ttyACM* on Linux are where to look.

Yep, that fixed it. Funny, since I’d actually just done that before posting.

Super confusingly (at least super confusingly to me), I get that exact error about every second time that I attempt to flash my model01. It always works if I try again one or two more times, without plugging or unplugging or changing anything, but it’s definitely confusing.

1 Like

@andre - What OS are you on? I suspect the issue is that your serial port name is flipping between things that match our patterns and don’t. If you can capture what the ‘bad’ serial port name is, we can probably sort it out.

The other issue might be if you’re on linux and ModemManager is making a play for control of the device.

@jesse vanilla macOS 10.13, connected to a USB hub connected to a Hyperdock USB-3 dock thing on a MacBook Pro 15". I’m happy to try to find the other serial port names, though, if you can give me steps to do it.

ls /dev/tty.usbmodem* should probably tell us. It may change from run to run or boot to boot, due to something specific to OSX.

@jesse cool, here’s what I got while trying once and failing and then trying again and succeeding:

/dev/tty.usbmodemCkbio01
# while flashing
ls: /dev/tty.usbmodem*: No such file or directory
/dev/tty.usbmodemkbio01
/dev/tty.usbmodemCkbio01
# flashing failed, trying again
ls: /dev/tty.usbmodem*: No such file or directory
/dev/tty.usbmodemkbio01
# flashing succeded this time