Author Topic: lock bits  (Read 640 times)

0 Members and 1 Guest are viewing this topic.

Offline pby

  • Newbie
  • Posts: 2
  • Country: us
lock bits
« on: April 05, 2016, 02:57:44 am »
Hi all,

I'm currently working with an ATTiny85. I've order a bunch to be pre-programmed but the programming house came back to me asking about lock bits as I've only supplied the hex file.

Anyhow, I was wondering if there are any reasons not to set the lock bits on the uC (I assume it is there to prevent someone else from reverse engineering the software).

Thanks
 

Offline CatalinaWOW

  • Super Contributor
  • ***
  • Posts: 2422
  • Country: us
Re: lock bits
« Reply #1 on: April 05, 2016, 03:35:34 am »
You've got the primary reason for setting them, although they can also protect against liability in the case where someone modifies the code.

Reasons you might not want to set them.

1.  You aren't absolutely sure the code won't change before installation or delivery.
2.  You may want to do a field upgrade/bug fix.
3.  You are sensitive to the cost of the parts, and you aren't sure of the quantity you will need with this program.
 

Offline sleemanj

  • Super Contributor
  • ***
  • Posts: 2091
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: lock bits
« Reply #2 on: April 05, 2016, 07:05:04 am »
The lock bits (avr) prevent reading the flash, and on some, writing the flash (or part of it) including from within the code running on the avr itself (self programming).

If you had a bootloader then write locking the non-boot section would not be helpful because your bootloader couldn't write the new code to flash when you tried to upload to it.

Note that the lockbits can be cleared (only) by erasing the chip, which is why the read lock works, you can't unlock without clearing the data.  This also means the lockbits do not prevent you from updating firmware, you just unlock (erase) and burn fresh firmware.

IMHO there is no good reason to read lock, write locking ostensibly could prevent a bug trashing firmware.
~~~
EEVBlog Members - get yourself 10% discount off all my electronic components for sale just use the Buy Direct links and use Coupon Code "eevblog" during checkout.  Shipping from New Zealand, international orders welcome :-)
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf