<< return to Pixycam.com

Pixy firmware organization?

How is the pixy device firmware source/project organized? This is really just curiosity and education, looking at this project as an example for Cortex M4 development.

The libraries, libpixy_m0 and libpixy_m4, seem straightforward, just static libraries.
Then is the “video” project the code that runs on the M4 core, and the “m0” project that runs on the M0 core, where these will ultimately be written into the SPI flash to be loaded on startup?
So, then, what does the “pixyflash” code do? Is this providing the DFU mode, or is this used by Keil as an SPI flash writer tool, or something like that?

Hi Andrew,

pixyflash resides in ROM, where it is run when the device enters DFU mode. So when you press down the button and plug it in to USB, the ARM chip enters DFU mode, which runs the pixyflash code from ROM to load firmware code from USB.

You are correct about the other M0 and M4 projects.

Scott

Hi Scott,

“M0” runs on M0 core, but what is in m0_image.c?
I found that M0 starts from the head of SRAM3 where m0_image.c resides in.

Thank you.

Lin

Hi Lin,

The contents in m0_image.c are actually the compiled M0 code, which in our case is the image acquisition code. I know this seems a bit strange, but the way the LPC4330 compiler works is it compiles the M0 code in to a .c source file (m0_image.c), which is then loaded to the M0 side in “main_m4.cpp”:https://github.com/charmedlabs/pixy/blob/master/src/device/video/main_m4.cpp. Let me know if you have any more questions or if I can clear anything up.

Scott

Hi Scott

Oh, so if I compile project M0, it will generate m0.hex in src\device\video\m0 and m0_image.c in src\device\video?
I checked the generate time of these two files and they are the same! So where can I configure the output? Target Options -> Output will only configure m0.hex.

Thank you

Lin

Hi Lin,

I don’t have Keil on this computer to find exactly where the configuration is, but I can at least point you towards the project file we use, “here”:https://github.com/charmedlabs/pixy/blob/master/src/device/video/m0.uvproj. You’ll see within this file there is a setting that specifies the output to be @–output=“m0_image.c”@. Hopefully that gives you a head start in getting your configurations correct.

Scott

Hi Scott,

I found it in Keil:
Target Options -> User -> Run User Programs After Build/Rebuild -> Run #1
command:
fromelf --cadcombined --output=“m0_image.c” “.\m0\m0.axf”

Lin