How can I hide my codes?

Discussion related to "under the hood" OpenMV topics.
laiyingjie
Posts: 10
Joined: Thu Nov 16, 2017 4:57 pm

How can I hide my codes?

Postby laiyingjie » Mon Dec 04, 2017 5:37 pm

When I download my main.py to openmv3,anyothers get it and connect it to PC can see my main.py.
It is dangerous if I put openmv3 into my product.
Any suggestions?
User avatar
kwagyeman
Posts: 3502
Joined: Sun May 24, 2015 2:10 pm

Re: How can I hide my codes?

Postby kwagyeman » Mon Dec 04, 2017 10:34 pm

Hi, we plan to roll out the ability for you to use frozen MicroPython code soon. This will let you compile the code into a byte image that we'll be able to read.

Note that anyone can easily reverse engineer the byte image to get some ugly source code... But, in general folks won't.

What's the ETA on you needing this feature?
Nyamekye,
laiyingjie
Posts: 10
Joined: Thu Nov 16, 2017 4:57 pm

Re: How can I hide my codes?

Postby laiyingjie » Tue Dec 05, 2017 9:41 am

I used to use STM32 MCU and download my codes with .bin or .hex file.
So I think my team will not work hard on it if they know the sourse code will be so easy to be copied.
User avatar
kwagyeman
Posts: 3502
Joined: Sun May 24, 2015 2:10 pm

Re: How can I hide my codes?

Postby kwagyeman » Tue Dec 05, 2017 11:08 am

If you feel like editing the STMCUs C code you can disable the flash file system and hard code your script to be main.py by editing our main.c method. After which you can set disable debug access and your code can't be copied then.

Do you need instructions on how to do this?
Nyamekye,
laiyingjie
Posts: 10
Joined: Thu Nov 16, 2017 4:57 pm

Re: How can I hide my codes?

Postby laiyingjie » Tue Dec 05, 2017 5:14 pm

I need your instruction,thanks!
User avatar
kwagyeman
Posts: 3502
Joined: Sun May 24, 2015 2:10 pm

Re: How can I hide my codes?

Postby kwagyeman » Tue Dec 05, 2017 11:51 pm

Okay, let's do this one step at a time:

1st - Get the firmware build system running: https://github.com/openmv/openmv/wiki. Let me know once you've got the M7 firmware compiling.

2nd - Replace main.py with your script here: https://github.com/openmv/openmv/blob/m ... main.c#L77. The script will now be created on the uPy flash drive on startup and run then.

Once you can get past these two parts when when you program a new firmware image your script runs then we'll just need to disable the USB flash drive code such that it returns all zeros: https://github.com/openmv/micropython/b ... age.c#L334. I.e. make sure these memcpys all write zeros.

...

The above fixes will prevent the user from seeing the clear text code. But, it can still be seen by dumping the flash. The disable that you should write to the STM32 registers than disable flash reading access from debuggers/DFU etc. When you do this then I user must mass erase the chip to read the code off of it. See the programming guide here:

http://www.st.com/resource/en/reference ... 224583.pdf

See chapter 3.5. You can write to any memory address in your script via the STM32 module or just do it in C.
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: MSN [Bot] and 3 guests