Source Code on MicroSD

Discussion related to "under the hood" OpenMV topics.
User avatar
rommel
Posts: 12
Joined: Tue Jul 11, 2017 5:42 pm

Source Code on MicroSD

Postby rommel » Wed Nov 15, 2017 5:42 pm

Hello,

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?

:geek: :ugeek:
User avatar
kwagyeman
Posts: 4287
Joined: Sun May 24, 2015 2:10 pm

Re: Source Code on MicroSD

Postby kwagyeman » Thu Nov 16, 2017 2:52 am

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.
Nyamekye,
User avatar
rommel
Posts: 12
Joined: Tue Jul 11, 2017 5:42 pm

Re: Source Code on MicroSD

Postby rommel » Mon Nov 20, 2017 12:30 pm

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.

:geek: :ugeek:
User avatar
kwagyeman
Posts: 4287
Joined: Sun May 24, 2015 2:10 pm

Re: Source Code on MicroSD

Postby kwagyeman » Mon Nov 20, 2017 1:09 pm

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.
Nyamekye,
User avatar
rommel
Posts: 12
Joined: Tue Jul 11, 2017 5:42 pm

Re: Source Code on MicroSD

Postby rommel » Wed Nov 22, 2017 2:30 pm

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.

:geek: :ugeek:
User avatar
kwagyeman
Posts: 4287
Joined: Sun May 24, 2015 2:10 pm

Re: Source Code on MicroSD

Postby kwagyeman » Wed Nov 22, 2017 4:45 pm

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.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 3 guests