I was getting confused trying to get the firmware to build, and I couldn’t find the instructions I used successfully the last time. I tracked down the source of my confusion: there are two/three related-but-different instructions for getting a build running locally. There’s the readme in
Sorry, I’ll clarify:
The wiki was fantastic for when I wanted to use the Arduino GUI and make small changes to existing layouts. Now I want to go all in and build from the command line; that’s where I’m finding confusing/duplicate documentation.
ah, cool. Yes, there is a “setting up a dev environment” set of documentation in the works, but last I checked they were not yet ready for prime time. I’ve been mostly absent for a couple weeks with some family stuff, so I’m not sure what the status of those is. I expect things to settle down so I can give Keyboardio a reasonable time slice in the next week or so.
I created a stub overview page with what I know so far at https://github.com/keyboardio/Kaleidoscope/wiki/Developer-Setup . There are quite a few TODOs in that doc that point to exactly where I lack the necessary info. Respond to this thread and I’ll update the wiki, or feel free to edit the wiki directly.
If you are using the Arduino GUI’s boards manager, stop. How?
You will also have a link from HOME/kaleidoscope/Arduino-Boards to $HOME/Documents/Arduino/hardware/keyboardio/avrWhy?
I believe you can go into the boards manager and click “uninstall” on the keyboardio hardware definitions.
The important thing is that Arduino looks for hardware definitions in two places: One is their boards manager directory. The other is inside the ‘sketchbook’ directory. On OSX, that’s Documents/Arduino/. On linux, that’s just Arduino/
The path inside that is ~hardcoded to hardware/keyboardio/avr
Most people don’t like to have git checkouts over there, preferring instead to keep them encapsulated inside ~/git/ or something.
This is outdated. ‘Model01-Firmware’ is now included inside Arduino-Boards inside libraries/Model01-Firmware
Hm? This doesn’t feel right. Model01-Firmwareis the sketch
Yes, but if you’re going to be making your own changes, it’s better to have an independent clone of Model01-Firmware someplace else, because if you update the Arduino-Boards repository’s submodules, you don’t want the default firmware to check out something other than your own sketch.
@Benji: if you do have a separate firmware sketch (doesn’t have to be a clone of Model01-Firmware, but that’s the easiest way to do it), you can put it anywhere. You can even add third-party plugins as submodules of your own sketch, like this:
git submodule add <plugin-name> <repository-url>
Do that in the sketch directory (e.g. Model01-Firmware/), and the build system will find those plugin libraries.
I believe that if you have check out your own version, either from a different republic or a different branch of that repo, doing a submodule update will not clobber your work. That is a pretty standard part of my workflow
It won’t clobber your work, but if you keep the submodules in sync with Arduino-Boards, when you run git submodule --remote --init, it will check out whatever version of Model01-Firmware is registered in Arduino-Boards/.gitmodules, and whatever branch you had checked out with your own sketch will need to be checked out again before you build.
EDIT: to clarify, it will clobber your work, but only in the sense that after you update the submodules, you will have the “official” branch checked out, not your own (assuming you’re using git and checking in your own changes). If you have un-committed changes, those shouldn’t get overwritten, but I don’t recommend doing that.
I think it ought to be fairly common for people to make changes to their own sketch, and include third-party plugins, but to just use the latest Arduino-Boards and everything under it without changing anything there. That’s the use case I’m thinking of; someone who’s tracking their own changes in git, but doesn’t want to have to restore their branch every time there’s a change to any submodule in Arduino-Boards.
It certainly does make sense; I’m just thinking that it’s not for everyone. There are people who don’t have (or want to have) a GitHub account, or who just store their stuff on some other server (e.g. GitLab), so I think that step should be left out of the instructions, or offered as an additional extra step, which can always be done after the fact.
You can clone the repo(s), make your own branch(es), make lots of changes, then create a GitHub account, fork whichever repositories you want, add those forks as remotes, and push changes to them — all in that order. So I think it’s best to give only the necessary steps first, since it’s not necessary to start over in order to start publishing (or backing up) your changes.
I also see that you’ve got an extra copy of Kaleidoscope in your diagram; it’s included in Arduino-Boards, so you don’t need to have another copy at the same level as Model01-Firmware & Arduino-Boards.
The way I’ve been thinking of it it is that while using version control is a good thing, making git usage a prerequisite for modifying your keyboard firmware sketch is…off-putting at best if you’re new to all of this.
That’s why, for simply modifying your own sketch, we push people toward using the Arduino Boards Manager and the automatic download and install. From there, they can open the Model01-Firmware sketch as an “Example” and Arduino will force them to save it locally.
I believe that to be the “correct” flow for a user who wants to create a custom sketch. If they want to mod the core, that’s when they should need to start touching git.
Well, there are people who don’t want to mess with the core, but are more comfortable using the command line interface, rather than yet another unfamiliar GUI system. And for them, running git clone and git pull is much easier than getting the files some other way.