Source Code on MicroSD


I wanted to ask if there was a way of hiding or encrypting the python source code we place on the SD card (and the OpenMV camera can still read it)?

We require the use of the microsd and the .py file is located on the microsd card. Our plan is to be able to update our source code by swapping microsd.

Also, is it possible to update the openmv firmware through microsd?

:nerd: :ugeek:

There’s no way to do this right now. It’s possible however since the STM32 CPU has OTP bits in it for securing the device. That said, we haven’t built out support for this feature.

As for updating the firmware through the SD card… mmm, that might be possible but we don’t implement that either. There’s space I believe in the boot loader code to do something like that though. It could mount the SD card and read a file. Then program the firmware with that file.

Anyway, unless I get help writing code for this it won’t happen soon. Sorry. If you want to tackle coding the firmware update yourself… it’s not technically that hard if you are a competent embedded systems C programmer. I can provide tips.

Alright, that sounds good.

I guess if it’s possible to add that support for the future, that would be great. For the camera to be able to run a .hex file or something similar, instead of needing the .py source.

:nerd: :ugeek:

Micropython supports a frozen bytcode feature. Would you consider that secure? We can get that feature working very easily. We don’t compile it in but it would be not a lot of a work to add.

With frozen bytecode MP runs a compiled byte code program. So, the python source is not visible. That said, it’s not really secure. Just hard to easily view what the source previous was.

I assume that the frozen bytecode simply translates python source to a lower level language? If that will make the python source not visible, then that’ll work as well. The goal is simply to hide the source code from customers.

:nerd: :ugeek:

Okay, I’ll build this feature into coming releases of OpenMV IDE (not the next one). It will be presented as another option when you click the save script to OpenMV Cam button. I’ll just compile in to OpenMV IDE the MP frozen bytcode and then it can be run.