Local library development

Hi,

For library development I installed locally the complete firmware software stack (https://github.com/spark/firmware).
Under “core-firmware” there’s a directory 'libraries" is it best to create my library “template” (https://github.com/spark/uber-library-example/) in this directory?

Thanks.

Hi @gdillen! At present, the online IDE libraries and the local compile libraries aren’t the same and use a different structure.

When you work locally, create a subdirectory in libraries and put your files directly there. You can use the Serial2 example that’s already there as a template.

Unifying the local and online libraries is planned at some point, but we’re not there yet!

1 Like

Hi @mdma thanks. I suppose I need also adapt the makefile accordingly to integrate my library?
Thanks.

No makefile changes needed if your library is headers only, just drop in the headers into your directory.

If you have cpp files as well, then you’ll need to add these to application/build.mk.

Is there a reason you need this to be a library? It might be simpler to put the files in with your application and then separate out when full local library support is available.

Is there a reason you need this to be a library? It might be simpler to put the files in with your application and then separate out when full local library support is available.

I would like a library since I want to port an existing library to Spark Core and want this to be available for all my Spark Core projects.

Thanks for the info! Is using the online IDE an option for you?

If you prefer to develop this locally, you could first develop locally as a regular app, iron out any wrinkles, then deploy to github as an online IDE library. Then when we have support for libraries locally you’ll be all set.

Thanks.

if you prefer to develop this locally, you could first develop locally as a regular app,

Do you know of any IDE I can use (or even better may I know which IDE the Spark Core team uses) that supports the same toolchain as for the Spark Core “GNU Arm Embedded” https://launchpad.net/gcc-arm-embedded?

When doing everything in the Spark Core online IDE gives a lot of impracticalities: e.g.
a lot of tabs with all the different source code files,
when needing additional files doing the same iteration over and over again: add file locally -> push to GitHub -> import in online IDE …

Thanks.

I use netbeans, and others use eclipse. Once you have the local make working, just be sure to have the tools in your path. There are details here:

Hope that helps! :smile:

And FWIW, I use vim and the terminal, without any IDE, just calling make from the build directory.

Sometimes when working on a user app I just use the Spark CLI, calling:

spark compile my-source-folder
spark flash --usb my-firmware.bin

Happy hacking!

1 Like

@mdma where is this applications/build.mk file you speak of located? The only .mk file I can really find is the tools.mk in core-firmware/build

Hi, I must have remembered the wrong file path. To add files to your local app, you can just drop them in the src folder and they’ll automatically be picked up.