diff --git a/data/nvm.toml b/data/nvm.toml index 6b678f15e378e..8bca037b052a4 160000 --- a/data/nvm.toml +++ b/data/nvm.toml @@ -1 +1 @@ -Subproject commit 6b678f15e378edce820f2ffdef3286b3e55449e7 +Subproject commit 8bca037b052a4a4dc46a56a25a1b802652ee3f47 diff --git a/py/circuitpy_mpconfig.h b/py/circuitpy_mpconfig.h index 701b1b0674cf7..4cf92d58e11ec 100644 --- a/py/circuitpy_mpconfig.h +++ b/py/circuitpy_mpconfig.h @@ -344,6 +344,7 @@ typedef long mp_off_t; #define CIRCUITPY_CONSOLE_UART (1) #ifndef CIRCUITPY_CONSOLE_UART_BAUDRATE #define CIRCUITPY_CONSOLE_UART_BAUDRATE (115200) +#endif #if !defined(CIRCUITPY_CONSOLE_UART_PRINTF) #define CIRCUITPY_CONSOLE_UART_PRINTF(...) mp_printf(&console_uart_print, __VA_ARGS__) #endif @@ -353,7 +354,6 @@ typedef long mp_off_t; #if !defined(CIRCUITPY_CONSOLE_UART_TIMESTAMP) #define CIRCUITPY_CONSOLE_UART_TIMESTAMP (0) #endif -#endif #else #define CIRCUITPY_CONSOLE_UART (0) #define CIRCUITPY_CONSOLE_UART_PRINTF(...) (void)0 diff --git a/supervisor/shared/external_flash/common_commands.h b/supervisor/shared/external_flash/common_commands.h index 539f679d766e4..f2853e6b509b6 100644 --- a/supervisor/shared/external_flash/common_commands.h +++ b/supervisor/shared/external_flash/common_commands.h @@ -23,3 +23,4 @@ #define CMD_ENABLE_RESET 0x66 #define CMD_RESET 0x99 #define CMD_WAKE 0xab +#define CMD_GLOBAL_BLOCK_PROTECTION_UNLOCK 0x98 diff --git a/supervisor/shared/external_flash/device.h b/supervisor/shared/external_flash/device.h index 869f7b7a24439..d35a84d9c325c 100644 --- a/supervisor/shared/external_flash/device.h +++ b/supervisor/shared/external_flash/device.h @@ -24,8 +24,12 @@ typedef struct { // status register. uint8_t quad_enable_bit_mask; + // Device has sector-level write protection bool has_sector_protection : 1; + // Device uses global block protection lock instead of status register bits to enable sector writes + bool use_global_block_protection_lock : 1; + // Supports the 0x0b fast read command with 8 dummy cycles. bool supports_fast_read : 1; diff --git a/supervisor/shared/external_flash/devices.h.jinja b/supervisor/shared/external_flash/devices.h.jinja index 3859559d2b35d..3d24b674fed1e 100644 --- a/supervisor/shared/external_flash/devices.h.jinja +++ b/supervisor/shared/external_flash/devices.h.jinja @@ -17,6 +17,7 @@ .max_clock_speed_mhz = {{ device.max_clock_speed_mhz }}, \ .quad_enable_bit_mask = {{ device.quad_enable_bit_mask }}, \ .has_sector_protection = {{ device.has_sector_protection | lower() }}, \ + .use_global_block_protection_lock = {{ device.use_global_block_protection_lock | lower() }}, \ .supports_fast_read = {{ device.supports_fast_read | lower() }}, \ .supports_qspi = {{ device["6b_quad_read"] | lower() }}, \ .supports_qspi_writes = {{ device["32_qspi_write"] | lower() }}, \ diff --git a/supervisor/shared/external_flash/external_flash.c b/supervisor/shared/external_flash/external_flash.c index b029286fa418e..abf232c0d18c6 100644 --- a/supervisor/shared/external_flash/external_flash.c +++ b/supervisor/shared/external_flash/external_flash.c @@ -268,8 +268,12 @@ void supervisor_flash_init(void) { write_enable(); // Turn off sector protection - uint8_t data[1] = {0x00}; - spi_flash_write_command(CMD_WRITE_STATUS_BYTE1, data, 1); + if (flash_device->use_global_block_protection_lock) { + spi_flash_command(CMD_GLOBAL_BLOCK_PROTECTION_UNLOCK); + } else { + uint8_t data[1] = {0x00}; + spi_flash_write_command(CMD_WRITE_STATUS_BYTE1, data, 1); + } } // Turn off writes in case this is a microcontroller only reset. pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy