Quicker lib development cycle

I’m developing some native nodes, and repeatedly go through the cycle:

  • Edit my lib’s .xodp and .cpp
  • reload the project in XOD-desktop (two steps)
  • upload (no hotkey)
  • get gcc errors, or check the arduino serial-console
  • if gcc error, get the code (“show code for arduino”), and hunt for the line, and try to guess what gcc means :slight_smile:

That’s tedious and slow.

I should be able to test my native-node libs by pushing one button, or using a command-line (command line preferred), and get the results without having to open panes/windows/modals (preferable via the terminal and file-system), so the edit/test cycle is faster/immediate. I have to setup a project that uses my native-node lib.

  • push one button, or using a command-line (command line preferred)
  • it does the equivalent of “reload”, using this project, but with the updated /lib
  • and compiles
  • and outputs the validation/gcc error (console preferred)
  • keep the generated code around (equivalent of “show arduino code”) as a file
  • enabling the various debug features (trace, and other suggested features like possibly #33, #780)
  • uploads to arduino (if it gets this far)
  • auto magically opening the equivalent of the serial-monitor (this would be real nice, but could be “later”)
  • integration with the command line is pretty important (makefiles, git, vi/emacs, etc.)

How to implement

Via the command line would be preferred (allows integration with editors, etc.)

Via a hot-key should also be supported.

nkrkv noted:

different possible solutions (upload with CLI, embedded C++ editor, manual project reload, hot reload, re-deploy menu item)

Other ideas on how to make this a more convenient cycle?

Thanks for starting the discussion.

XOD has a command line interface for some tasks. Did you note it? There is a command to transpile a patch equivalent to “Deploy → Show Code for Arduino”:

$ xodc transpile ~/xod/project-name @/patch-name

I use a xodc from my development sandbox and to make it available system-wide I’ve created an alias. xodc is actually:

node /path/to/the/devrepo/packages/xod-cli/bin/xodc

The command above outputs C++ code to the stdout. You can send it to a file and open that file in the Arduino IDE:

$ xodc transpile ~/xod/project-name @/patch-name --output=sketch.ino && arduino sketch.ino

Given that, you’d have a much shorter test cycle:

  1. Make a change in *.cpp
  2. Run a command to open the generated code in Arduino IDE
  3. Click “Upload” to observe results (tweak code in IDE if required)

Also, you can not simply open Arduino IDE but rather try to upload right away:

$ arduino --verbose --upload --board arduino:avr:uno --port /dev/ttyACM0 sketch.ino

Or you could even use Platform IO CLI tools to do that.


All that are “pro” hacks that allow making things done. Ideally, we should provide a cleaner and more straightforward ways. Of all potential solutions mentioned the easiest to implement are:

  1. Make something like xodc upload /path/to/your/patch for advanced users like you
  2. Provide a UI right within XOD IDE to edit C++ implementations on fly for regular users who are familiar with Arduino but are not comfortable with CLI (most Windows arduiners)

Will it suffice, what do you think?

Nope. Didn’t know that. It’s not installed by the linux .deb (desktop). I’ll have to try building it.

The xodc | uploadarduino pipeline would be best for me. Can you include xodc in the installations?

Editing the c++ code in XOD would be convenient as well. I strongly feel that a tool should give access to the lower levels like this.

All distributives (and .deb as well) are build by a beast called electron-builder. Its main purpose is to pack GUI applications. It is configurable but only to some degree. I guess including xodc for Linux along with the IDE in the same distro should not be a big deal. Will try it soon.