pub enum DebugSetting {
    Default,
    Disabled,
    Enabled,
    Illegal,
    Authenticate,
}
Expand description

Controls access of debuggers to specific subsystems.

To understand if access is possible:

  • factory + customer setting: Enabled -> yes
  • factor + customer set to Enabled or Authenticate -> need a prepared debug certificate (this is not implemented in this library)
  • any setting Illegal => device may lock up
  • any setting Disabled => access not possible!!

Peculiarities to be aware of:

  • Factory settings (CC_SOCU_PIN, CC_SOCU_DFLT) can be made stricter, but not relaxed, using customer settings (DCFG_CC_SOCU_NS_PIN, DCFG_CC_SOCU_NS_DFLT)
  • As long as the factory page is not sealed, the setting can be changed there.
  • To change settings in the customer page, the ping/pong dance must be done.
  • The enabled bit (“DFLT”) determines which setting is potentially in effect
  • The fixed bit (“PIN”) determines whether a debugger may activate the potentially effective settings (by presenting a Debug Authentication certificate)
  • The non-fixed enabled setting is illegal.
  • All bits are written in the lower half-word, and must be also written in inverted form in the upper half-word.
  • Except, it seems, the default / empty setting, where both PIN and DFLT words are all zero.

In this implementation, we disregard customer settings from configuration files, enforcing that only the firmware changes them.

TODO: We could also model the factory default, where the entire word is zeros. This would need some special handling + research.

Variants

Default

Default state at startup. Will only be accepted when writing to factory settings when all settings are default.

Disabled

Disabled at startup, debugging not possible

Enabled

Debugging enabled at startup (debugger can’t turn off). “Access to the sub-domain is always enabled.”

Illegal

According to UM 11126, 51.7.14, Table 1064: “Illegal setting. Part may lock-up if this setting is selected.”

Authenticate

Debugging disabled at startup, only authenticated debugger can access

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Set to enabled, so that lpc55 factory-settings does not turn off debugging on an otherwise empty key, unless explicitly configured to be turned off.

It might be possible to set the default to Self::Default here, if we research whether its valid for some settings to stay 0 in both bits and also in the “inverted” section.

Deserialize this value from the given Serde deserializer. Read more
Converts to this type from the input type.
Feeds this value into the given Hasher. Read more
Feeds a slice of this type into the given Hasher. Read more
This method returns an Ordering between self and other. Read more
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
Restrict a value to a certain interval. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
This method returns an ordering between self and other values if one exists. Read more
This method tests less than (for self and other) and is used by the < operator. Read more
This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
This method tests greater than (for self and other) and is used by the > operator. Read more
This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.