Author Topic: lock bits  (Read 1534 times)

0 Members and 1 Guest are viewing this topic.

Offline pbyTopic starter

  • Newbie
  • Posts: 2
  • Country: us
lock bits
« on: April 04, 2016, 04:57:44 pm »
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: 5465
  • Country: us
Re: lock bits
« Reply #1 on: April 04, 2016, 05:35:34 pm »
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: 3047
  • Country: nz
  • Professional tightwad.
    • The electronics hobby components I sell.
Re: lock bits
« Reply #2 on: April 04, 2016, 09:05:04 pm »
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