Simulating Particle Hardware on Linux and Windows

It would be extremely useful to have a "target" for partiocle firmware that could be executed as an applicaiton under Windows and/or Linux.
I have done this before on other embdded projects and it vastly speeds up debugging. As an example my current project has 3 major hardware components. A temperature sensor, Power monitoring, and a load cell. I already have "simulation code" so that I can run these on devices that do not have hardware connected. Simulating that hardware is trivial. Though under Linix it is pretty easy to "attach" real GPIOs PWMs etc to application software if that is necescary.
What I need is to be able to build against a Particle API library so I can run the same code that I am on the device - but as an App on my local laptop. Again this massively improve productivity. Among other things I means I can continue to do embedded software development on the road, in an airport or hotel room, or anywhere without bringing hardware with me. The vast majority of embedded firmware today is NOT low level hardware programming, but getting the application working. None of this needs hardware.

One method is to use a small subset of Device OS for unit testing of modules. An example of this is the JsonParserGeneratorRK. There is a native library that implements a few common things like String. That example doesn't use a unit testing framework, but you could use the same technique with your chosen framework easily. When testing under Linux you can also run these tests under valgrind which is great for detecting memory leaks, buffer overruns, and other memory-related issues.

The other is to use the gcc platform. This is a complete virtual device that can connect to the cloud. This is difficult to use and undocumented. It is used during the integration testing of Device OS releases, in addition to on-device testing.

I am guessing based on your description that the gcc platform is likely what I am looking for. So how about a starting point ?
If I have "firmware" for a BSOM that I want to build for the GCC platform - how do I go aboput doing that ?
I can guess that in My code - I need conditionals like
But how do I tell particle compile that I am building for PLATFORM_GCC ?

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.