Wrench, Preprocessor and Build Tools for the Electric Imp Platform

Hey guys,

I wanted to let you know about a tool I’ve been creating. I got a bit fed up with not being able to use local libraries since I’ve been working for multiple companies with the Electric Imp platform. Its still pretty early but the tools is pretty useful right now.

Here is the project page:

You’ll have to build it yourself, and I’ll be working on documentation after my current workload dies down.

Here is a list of features that Wrench allows though:
Run Squirrel Files locally - wrench run <file_name> runs any file locally
Library Support - Create a master .nut file from multiple different .nut files.
Basic Build API support - wrench build; wrench upload -r; wrench device log <device_id> does the same thing as the web ide. These may get combined later on to a new command. You can also list devices, models, and assign devices to a model.
Basic Testing Support - wrench test will recursively look for .test.nut files and generate a file and run it locally. More support for testing will be coming. Including later on support for server.sleep and correct nv table emulation.

I’m going to attempt to get more support from electric imp. I’d really love to see good code reuse and tools. Later on I’d like to incorporate a linter, and possibly dynamic #defines that allow you to mutate your code based on EI model, but those will likely be much later on. Currently wrench lets you decompose your projects down and use ides that you are more accustom to.

Development Side:
I’m always willing to look and merge pull requests. Wrench is currently writen in go, and should be very easy later on to run multiple squirrel vms inside. Allowing you to test both agent and device locally, but I’ll need help to get to that point. The best way to contact me right now is probably through email until the community grows and we setup a irc or forum.

I’ll try to get a tutorial/starting project up and going at some point as well.
Sean Sill theblacklabcoat@gmail.com

I have been using wrench for a couple of months now and I have to say it has drastically improved my efficiency as a developer. Thanks Sean :slight_smile:

Hi Sean. Would this be useful for developing/compiling code offline during long transatlantic flights? Often don’t have reliable internet access depending on the carrier.

Hey @blagoni,

Wrench does let you run local squirrel code. I don’t have a lot of the electric imp api mocked yet, but its pretty trivial to do it.
It would be ideal later on to have a simulated agent, and device. It will be possible in the future, I’ve got the basics in the source to do this. I’d really like to have EI’s input though.

Currently working on building this on windows. Will post updates…

Let me know if you have issues. That’s the platform I use it on mostly. Aron’s built it on mac. I think linux is the only one I haven’t built it specifically on. You will need mingw on windows.

Currently running into issues building Squirrel on windows. It seems like the tarball that I need to download is also the one that I need to build Squirrel? I assume I have to build squirrel before running go get, I’m just a bit inexperienced in how to do that.

Have you built any other C linux projects before?

Yeah, I mean I used cygwin make for it, which worked without issues. My question is this:
“squirrel.h” is needed for the installation (using go get). I have a built version of squirrel that I made using the files in the tarball, now what do I do with it?

Unfotunately go get won’t setup much for you. After you go get you’ll need to move the squirrel source to a specific location in the source right now. The go build, expects that the squirrel source is in <$GOPATH>\src\github.com

Then you can go to the top level and use build command in the readme:
go build --ldflags ‘-extldflags “-static”’

Wow, I feel really stupid right now. My error was not checking the directory after running go get. I was so sure it was failing on that “missing <squirrel.h>” error that I didn’t even look for the src folder that was downloaded. I had my folder structure as:


  • squirrel/squirrel3/…
  • src/github.com/nightrune/wrench/…

Either way, it works, I’ll play with it a bit and leave a response with the full steps to get it working for future readers.
Thanks very much for the quick replies.

Also make sure you have gpp, and its in your path. It essential since its doing most of the preprocessing for wrench. I’ve contacted the creator as well, and as I have time I’ll be building it as a library so we can statically build it into wrench as well.

I’ve got a build for it as well, but its not hard to build in mingw.