Porting QP Framework to Photon

Hello,

I’d like to use the QP Framework, a state-machine programming model from Quantum Leaps, on Particle Photon, and I know that Quantum leaps supports QP libraries for the ARM Cortex-M3, which is what the Photon is based on. I wonder if there is anyway to deploy these libraries to the Photon over-the-air. As I understand, deploying these libraries to Arm Cortex-m needs ARM compilers like Keil and IAR, which deploy code to the Particle board through JTAG programmer. Is there anyway to get the Particle Web Build IDE to do this?

Thanks,
Mohammed

If the framework generates code, then you will need to:

  1. make sure it generates gcc -compliant code
  2. take that code and make it part of a project that you are building for a photon
  3. use the standard tools to build & deploy that project
  4. profit

The workflow isn’t going to be pretty, but I’m sure you can make it work if you try.

2 Likes

Thank you @AndyW. What if I have a binary code compiled with GCC using Eclipse CDT. Can I just OTA flash it to the Photon using this https://docs.particle.io/reference/api/#flash-a-device-with-a-pre-compiled-binary? Or there are other steps I need to take care of. I am currently working on making this binary file. I have a Makefile for GNU, and I’m trying to use Eclipse CDT environment to produce me a binary file of it.

I will appreciate it if you let me know of any other way to use that Makefile with OTA update.

Thanks,
Mohammed

If you’ve already built a binary within the structure of the Particle firmware tree from github, then it sounds like you have already solved the problem.

If you didn’t build the binary within that structure, it would not work.

I can’t help you with eclipse, I don’t use that.

Thanks @AndyW, I assume this is the firmware tree I should follow https://github.com/spark/firmware/tree/develop
right?

Hi @mohammedmidhat

The “Develop” branch is “bleeding-edge” where all the integration and testing work happens. It is not for stable use.

You want the “Latest” branch which is more stable.

1 Like

Thank you @bko

1 Like

Hi @bko, but the “Latest” branch doesn’t have the “modules” folder I need to build repositories. I will go with the “Develop” branch for this, and I hope it will be okay. Please let me know if there is a better way to do it.

Thanks,
Mohammed

The latest branch does have the modules folder. Please double check you’re on latest and not master.

1 Like

Thanks @mdma, you are right actually. I don’t know why I didn’t see it at the beginning.

Hi @AndyW,

So I was trying to follow the firmware tree on github, and I reached the step of building repositories, using this command line in GitBash:
make clean all PLATFORM=photon -s program-dfu
It gave an error at the beginning, but then I solved it. It was the path of the GCC compiler. The command then ran, and it didn’t give me any response message. I assumed it worked, but when I went to build/target/ directory where the compiled output files are supposed to go, I didn’t find any .hex or .bin file. I wonder what the problem is. In addition, the command line above didn’t work with the Windows cmd. The issue was with the GCC compiler path it seemed, but I was able to fix it in GitBash easier.

I assume after I finish this step successfully, I just OTA flash the .hex or .bin files in that subdirectory using a command line.

Considering Eclipse CDT, is it possible to directly compile a makefile with this firmware tree? This way I will not need to use Eclipse, which doesn’t seem to give me a .bin or .hex file in a straightforward way.

Thanks,
Mohammed

@AndyW. It was my fault with the first question. You can just ignore it, I’m sorry.

The main question now is if I have a makefile for certain project. How do I build it within the structure of Particle? From what I understood, I can change the application.cpp file (in the user/applications/… directory) or put my code there, but this is for source code, and I’m looking for a solution for makefile.

Thanks,

I’m actually not sure about that, I did not create the make hierarchy used building the firmware. I do know that it’s a complex beast that methodically builds the correct set of include paths, libraries etc

Sadly, I don’t know how to locally build anything more complex than a single /application.cpp file, sorry.

I’m hoping others from Particle engineering will step in and offer their guidance; hopefully we’ll both learn something.

Thank you very much @AndyW, I am hoping somebody will give some hints too.