Page 1 of 1

Protect pyboard from reading the code

Posted: Sun Sep 11, 2016 10:27 pm
by kamikaze
Is it possible to protect python code from being read via USB or any other way?

Re: Protect pyboard from reading the code

Posted: Sun Sep 11, 2016 10:40 pm
by markxr
If you ship the python modules already compiled, then people won' t be able to access the source.

A Micropython decompiler is probably feasible.

In general, you should not waste time trying to prevent reverse engineering, although it depends what the exact application is (and hence motivation).

Re: Protect pyboard from reading the code

Posted: Mon Sep 12, 2016 4:07 am
by dhylands
In order to do this you should read up on "read protection" in the datasheet.

If the device is not read-protected, then its trivial to read the entire contents of flash using DFU. With read-protection enabled, you can't.

Disabling read-protection does a complete erase of flash.

Re: Protect pyboard from reading the code

Posted: Mon Sep 12, 2016 3:19 pm
by kamikaze
dhylands wrote:In order to do this you should read up on "read protection" in the datasheet.

If the device is not read-protected, then its trivial to read the entire contents of flash using DFU. With read-protection enabled, you can't.

Disabling read-protection does a complete erase of flash.
Thanks, that's what I'm looking for )

Re: Protect pyboard from reading the code

Posted: Mon Oct 10, 2016 5:23 pm
by kamikaze
in case of someone is interested in such protection: https://github.com/xyb/upy-stm-flash/blob/master/rdp.py

The only question I have - if I will set Level 2 - will micropython and my code work on such system?

Re: Protect pyboard from reading the code

Posted: Mon Oct 10, 2016 6:38 pm
by dhylands
If you choose to use level 2 then DFU and JTAG are both disabled, which means that your code will need to provide a mechanism to reflash should you ever wish to change the onboard firmware for any reason.