mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-22 06:42:32 +00:00
minimum build code for new APPROTECT is chip type-specific
This commit is contained in:
parent
a31ae52d1a
commit
dd62bb16e5
@ -7,6 +7,7 @@ pub const FORCE_COPY_BUFFER_SIZE: usize = 256;
|
||||
pub const FLASH_SIZE: usize = 192 * 1024;
|
||||
|
||||
pub const RESET_PIN: u32 = 21;
|
||||
pub const APPROTECT_MIN_BUILD_CODE: u8 = b'B';
|
||||
|
||||
embassy_hal_internal::peripherals! {
|
||||
// RTC
|
||||
|
@ -7,6 +7,7 @@ pub const FORCE_COPY_BUFFER_SIZE: usize = 256;
|
||||
pub const FLASH_SIZE: usize = 192 * 1024;
|
||||
|
||||
pub const RESET_PIN: u32 = 21;
|
||||
pub const APPROTECT_MIN_BUILD_CODE: u8 = b'E';
|
||||
|
||||
embassy_hal_internal::peripherals! {
|
||||
// RTC
|
||||
|
@ -7,6 +7,7 @@ pub const FORCE_COPY_BUFFER_SIZE: usize = 256;
|
||||
pub const FLASH_SIZE: usize = 192 * 1024;
|
||||
|
||||
pub const RESET_PIN: u32 = 21;
|
||||
pub const APPROTECT_MIN_BUILD_CODE: u8 = b'B';
|
||||
|
||||
embassy_hal_internal::peripherals! {
|
||||
// RTC
|
||||
|
@ -7,6 +7,7 @@ pub const FORCE_COPY_BUFFER_SIZE: usize = 512;
|
||||
pub const FLASH_SIZE: usize = 256 * 1024;
|
||||
|
||||
pub const RESET_PIN: u32 = 18;
|
||||
pub const APPROTECT_MIN_BUILD_CODE: u8 = b'D';
|
||||
|
||||
embassy_hal_internal::peripherals! {
|
||||
// USB
|
||||
|
@ -11,6 +11,7 @@ pub const FORCE_COPY_BUFFER_SIZE: usize = 255;
|
||||
pub const FLASH_SIZE: usize = 512 * 1024;
|
||||
|
||||
pub const RESET_PIN: u32 = 21;
|
||||
pub const APPROTECT_MIN_BUILD_CODE: u8 = b'G';
|
||||
|
||||
embassy_hal_internal::peripherals! {
|
||||
// RTC
|
||||
|
@ -7,6 +7,7 @@ pub const FORCE_COPY_BUFFER_SIZE: usize = 512;
|
||||
pub const FLASH_SIZE: usize = 512 * 1024;
|
||||
|
||||
pub const RESET_PIN: u32 = 18;
|
||||
pub const APPROTECT_MIN_BUILD_CODE: u8 = b'B';
|
||||
|
||||
embassy_hal_internal::peripherals! {
|
||||
// USB
|
||||
|
@ -7,6 +7,7 @@ pub const FORCE_COPY_BUFFER_SIZE: usize = 512;
|
||||
pub const FLASH_SIZE: usize = 1024 * 1024;
|
||||
|
||||
pub const RESET_PIN: u32 = 18;
|
||||
pub const APPROTECT_MIN_BUILD_CODE: u8 = b'F';
|
||||
|
||||
embassy_hal_internal::peripherals! {
|
||||
// USB
|
||||
|
@ -349,10 +349,11 @@ pub fn init(config: config::Config) -> Peripherals {
|
||||
// Get the letter for the build code (b'A' .. b'F')
|
||||
let build_code = (variant >> 8) as u8;
|
||||
|
||||
if build_code >= b'F' {
|
||||
// Chips with build code F and higher (revision 3 and higher) have an
|
||||
if build_code >= chip::APPROTECT_MIN_BUILD_CODE {
|
||||
// Chips with a certain chip type-specific build code or higher have an
|
||||
// improved APPROTECT ("hardware and software controlled access port protection")
|
||||
// which needs explicit action by the firmware to keep it unlocked
|
||||
// See https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/working-with-the-nrf52-series-improved-approtect
|
||||
|
||||
// UICR.APPROTECT = SwDisabled
|
||||
let res = uicr_write(consts::UICR_APPROTECT, consts::APPROTECT_DISABLED);
|
||||
|
Loading…
Reference in New Issue
Block a user