Boot Loader Lock Bits

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In the latest as well as older versions of the ATmega 8 data sheet under Boot Loader Lock Bits

Quote:
The user can select:
• To protect the entire Flash from a software update by the MCU.
• To protect only the Boot Loader Flash section from a software update by the MCU.
• To protect only the Application Flash section from a software update by the MCU.
• Allow software update in the entire Flash.

But then it goes on to say (emphasis mine)
Quote:
The general Write Lock (Lock bit mode 2) does not control the programming
of the Flash memory by SPM instruction. Similarly, the general Read/Write Lock
(Lock bit mode 3) does not control reading nor writing by LPM/SPM, if it is attempted.

This is followed by a couple of tables which define lock bit modes (4 total)
.
Quote:
Mode 2 SPM is not allowed to write to the Application section.
Mode 3 SPM is not allowed to write to the Application section, and LPM
executing from the Boot Loader section is not allowed to read
from the Application section.

There appears to be a contridiction here. What am I missing? :?:

Laurence Boyd II

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No contradiction. Just remember that there are separate sets of Modes for ISP/HV programming, and for both of the Bootloader Lock Bit sets.

There are two sets of lock bits: General lock bits, and Bootloader lock bits.
The general lock bits (LB2:1) define what you're allowed to do with ISP/HV programming. They do not have any effect on what you can and can't do with the LPM/SPM op-codes,

The Bootloader lock bits are further subdivided into two subcategories:
The Application Section Bootloader lock bits (BLB02:BLB01) define whether you're allowed to use the SPM instruction to write data whose destination lies in the Application section, and whether the LPM instruction (executed from the Bootloader section) is allowed to read data whose source lies in the Application section.

The Bootloader Section Bootloader lock bits (BLB12:BLB11) define whether you're allowed to use the SPM instruction to write data whose destination lies in the Bootloader section, and the LPM instruction (executed from the Application section) is allowed to read data whose source lies in the Bootloader section.

None of the Bootloader Lock Bits have any effect on what you can or can't do with ISP/HV programmers.

(SPM must always be executed from the Bootloader section. The SPM restrictions in the BLB bits simply define where the "target" of SPM is allowed to be.)

(LPM executed from the Application section is always allowed to read data whose source lies in the Application section. Similarly, LPM executed from the Bootloader section is always allowed to read data whose source lies in the Bootloader section.)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, I had overlooked LB1 & LB2 which control serial and parallel programing but do not affect LPM & SPM

Laurence Boyd II