summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Moore <nick@zoic.org>2019-01-31 10:50:07 +1100
committerNick Moore <nick@zoic.org>2019-04-09 10:54:11 +1000
commitf8e5e2da64fbf2131d77a0834de0b91b102afdee (patch)
tree3f5d33d79e3e0b8170bb6d6222e90dac08b6aec4
parent5015036c06e12c158ca0b36a23fade8da6fbbf07 (diff)
Start on nRF nvm.ByteArray adafruit/circuitpython#1042 (doesn't do anything yet)
-rw-r--r--ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h2
-rw-r--r--ports/nrf/common-hal/microcontroller/__init__.c16
2 files changed, 17 insertions, 1 deletions
diff --git a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h
index eb8be7608..21232d2b3 100644
--- a/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h
+++ b/ports/nrf/boards/feather_nrf52840_express/mpconfigboard.h
@@ -55,7 +55,7 @@
#define CIRCUITPY_AUTORELOAD_DELAY_MS 500
-// TODO #define CIRCUITPY_INTERNAL_NVM_SIZE 8192
+#define CIRCUITPY_INTERNAL_NVM_SIZE (4096)
#define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE)
diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c
index c2e0c5b41..f29b0eb95 100644
--- a/ports/nrf/common-hal/microcontroller/__init__.c
+++ b/ports/nrf/common-hal/microcontroller/__init__.c
@@ -24,9 +24,14 @@
* THE SOFTWARE.
*/
+#include "py/mphal.h"
+#include "py/obj.h"
+#include "py/runtime.h"
+
#include "common-hal/microcontroller/Pin.h"
#include "common-hal/microcontroller/Processor.h"
+#include "shared-bindings/nvm/ByteArray.h"
#include "shared-bindings/microcontroller/__init__.h"
#include "shared-bindings/microcontroller/Pin.h"
#include "shared-bindings/microcontroller/Processor.h"
@@ -63,6 +68,17 @@ const mcu_processor_obj_t common_hal_mcu_processor_obj = {
},
};
+#if CIRCUITPY_INTERNAL_NVM_SIZE > 0
+// The singleton nvm.ByteArray object.
+const nvm_bytearray_obj_t common_hal_mcu_nvm_obj = {
+ .base = {
+ .type = &nvm_bytearray_type,
+ },
+ .len = CIRCUITPY_INTERNAL_NVM_SIZE,
+ .start_address = 0
+};
+#endif
+
STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_P0_00), MP_ROM_PTR(&pin_P0_00) },