Prevent anyone from reading your code on Teensy 3.6

Status
Not open for further replies.

N.Michiels

New member
Hi,

Is it possible to 'lock' the program in the Teensy 3.6, so that the code is prevented from reading by someone else?

Greetings,
 
from : ...\hardware\teensy\avr\cores\teensy3\mk20dx128.c
// Flash Security Setting. On Teensy 3.2, you can lock the MK20 chip to prevent
// anyone from reading your code. You CAN still reprogram your Teensy while
// security is set, but the bootloader will be unable to respond to auto-reboot
// requests from Arduino. Pressing the program button will cause a full chip
// erase to gain access, because the bootloader chip is locked out. Normally,
// erase occurs when uploading begins, so if you press the Program button
// accidentally, simply power cycling will run your program again. When
// security is locked, any Program button press causes immediate full erase.
// Special care must be used with the Program button, because it must be made
// accessible to initiate reprogramming, but it must not be accidentally
// pressed when Teensy Loader is not being used to reprogram. To set lock the
// security change this to 0xDC. Teensy 3.0 and 3.1 do not support security lock.
#define FSEC 0xDE

Forum search on FSEC might have more details - but that comment doesn't address T_3.5/3.6.
 
OK, to understand this better, when you say full chip erase does this mean the bootloader will also be removed or just the sketch?
 
The bootloader is stored in the MKL02 chip, so a full erase of the MK66 chip does not erase the bootloader. The full erase only wipes your sketch/program and any data you've stored in the eeprom memory (aka "flexnvm").
 
Status
Not open for further replies.
Back
Top