File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 109109
110110#ifdef CIRCUITPY_BOOT_COUNTER
111111#include "shared-bindings/nvm/ByteArray.h"
112+ uint8_t value_out = 0 ;
112113#endif
113114
114115#if MICROPY_ENABLE_PYSTACK
@@ -308,15 +309,6 @@ STATIC void print_code_py_status_message(safe_mode_t safe_mode) {
308309 }
309310}
310311
311- #ifdef CIRCUITPY_BOOT_COUNTER
312- nvm_bytearray_obj_t bootcnt = {
313- .base = {.type = & nvm_bytearray_type },
314- .len = ( uint32_t ) 1 ,
315- .start_address = (uint8_t * ) (0x00080000 - CIRCUITPY_INTERNAL_NVM_SIZE )
316- };
317- uint8_t value_out = 0 ;
318- #endif
319-
320312STATIC bool run_code_py (safe_mode_t safe_mode ) {
321313 bool serial_connected_at_start = serial_connected ();
322314 bool printed_safe_mode_message = false;
@@ -330,9 +322,9 @@ STATIC bool run_code_py(safe_mode_t safe_mode) {
330322 #endif
331323
332324 #ifdef CIRCUITPY_BOOT_COUNTER
333- common_hal_nvm_bytearray_get_bytes (& bootcnt ,0 ,1 ,& value_out );
325+ common_hal_nvm_bytearray_get_bytes (& common_hal_mcu_nvm_obj ,0 ,1 ,& value_out );
334326 ++ value_out ;
335- common_hal_nvm_bytearray_set_bytes (& bootcnt ,0 ,& value_out ,1 );
327+ common_hal_nvm_bytearray_set_bytes (& common_hal_mcu_nvm_obj ,0 ,& value_out ,1 );
336328 #endif
337329
338330 pyexec_result_t result ;
Original file line number Diff line number Diff line change 3131
3232extern const mp_obj_type_t nvm_bytearray_type ;
3333
34- uint32_t common_hal_nvm_bytearray_get_length (nvm_bytearray_obj_t * self );
34+ uint32_t common_hal_nvm_bytearray_get_length (const nvm_bytearray_obj_t * self );
3535
36- bool common_hal_nvm_bytearray_set_bytes (nvm_bytearray_obj_t * self ,
36+ bool common_hal_nvm_bytearray_set_bytes (const nvm_bytearray_obj_t * self ,
3737 uint32_t start_index , uint8_t * values , uint32_t len );
3838// len and values are intentionally swapped to signify values is an output and
3939// also leverage the compiler to validate uses are expected.
40- void common_hal_nvm_bytearray_get_bytes (nvm_bytearray_obj_t * self ,
40+ void common_hal_nvm_bytearray_get_bytes (const nvm_bytearray_obj_t * self ,
4141 uint32_t start_index , uint32_t len , uint8_t * values );
4242
4343#endif // MICROPY_INCLUDED_SHARED_BINDINGS_NVM_BYTEARRAY_H
You can’t perform that action at this time.
0 commit comments