From 7cbcc2f9ec3708feb91657fd52504fa1bfb19df2 Mon Sep 17 00:00:00 2001 From: Max Holliday Date: Mon, 11 Oct 2021 15:34:58 -0700 Subject: [PATCH] updating pycubed board defs & including --- ports/atmel-samd/boards/pycubed/board.c | 22 ++++--------------- .../atmel-samd/boards/pycubed/mpconfigboard.h | 3 +++ .../boards/pycubed/mpconfigboard.mk | 2 -- ports/atmel-samd/boards/pycubed_mram/board.c | 22 ++++--------------- .../boards/pycubed_mram/mpconfigboard.h | 3 +++ .../boards/pycubed_mram/mpconfigboard.mk | 16 ++++++++++---- .../boards/pycubed_mram_v05/board.c | 3 +++ .../boards/pycubed_mram_v05/mpconfigboard.mk | 2 +- ports/atmel-samd/boards/pycubed_v05/board.c | 3 +++ .../boards/pycubed_v05/mpconfigboard.mk | 2 -- 10 files changed, 33 insertions(+), 45 deletions(-) diff --git a/ports/atmel-samd/boards/pycubed/board.c b/ports/atmel-samd/boards/pycubed/board.c index 2777b9031c..41e4655102 100644 --- a/ports/atmel-samd/boards/pycubed/board.c +++ b/ports/atmel-samd/boards/pycubed/board.c @@ -24,25 +24,12 @@ * THE SOFTWARE. */ - -#include - #include "supervisor/board.h" -#include "py/mpconfig.h" -#include "shared-bindings/nvm/ByteArray.h" +#include "mpconfigboard.h" #include "common-hal/microcontroller/Pin.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/pwmio/PWMOut.h" -nvm_bytearray_obj_t bootcnt = { - .base = { - .type = &nvm_bytearray_type - }, - .len = (uint32_t)8192, - .start_address = (uint8_t *)(0x00080000 - 8192) -}; - - void board_init(void) { pwmio_pwmout_obj_t pwm; common_hal_pwmio_pwmout_construct(&pwm, &pin_PA23, 4096, 2, false); @@ -54,8 +41,7 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - uint8_t value_out = 0; - common_hal_nvm_bytearray_get_bytes(&bootcnt,0,1,&value_out); - ++value_out; - common_hal_nvm_bytearray_set_bytes(&bootcnt,0,&value_out,1); +} + +void board_deinit(void) { } diff --git a/ports/atmel-samd/boards/pycubed/mpconfigboard.h b/ports/atmel-samd/boards/pycubed/mpconfigboard.h index 3df0afd6b5..2d4d489d21 100644 --- a/ports/atmel-samd/boards/pycubed/mpconfigboard.h +++ b/ports/atmel-samd/boards/pycubed/mpconfigboard.h @@ -15,6 +15,9 @@ // External flash W25Q80DV #define EXTERNAL_FLASH_QSPI_DUAL +#define CIRCUITPY_DRIVE_LABEL "PYCUBED" +#define CIRCUITPY_BOOT_COUNTER 1 + #define BOARD_HAS_CRYSTAL 1 #define DEFAULT_I2C_BUS_SCL (&pin_PB13) diff --git a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk index f4be49e769..347462919f 100644 --- a/ports/atmel-samd/boards/pycubed/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed/mpconfigboard.mk @@ -10,8 +10,6 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = W25Q80DV LONGINT_IMPL = MPZ -CIRCUITPY_DRIVE_LABEL = "PYCUBED" - CIRCUITPY_ULAB = 1 CIRCUITPY_BINASCII = 1 CIRCUITPY_SDCARDIO = 1 diff --git a/ports/atmel-samd/boards/pycubed_mram/board.c b/ports/atmel-samd/boards/pycubed_mram/board.c index 2777b9031c..41e4655102 100644 --- a/ports/atmel-samd/boards/pycubed_mram/board.c +++ b/ports/atmel-samd/boards/pycubed_mram/board.c @@ -24,25 +24,12 @@ * THE SOFTWARE. */ - -#include - #include "supervisor/board.h" -#include "py/mpconfig.h" -#include "shared-bindings/nvm/ByteArray.h" +#include "mpconfigboard.h" #include "common-hal/microcontroller/Pin.h" #include "hal/include/hal_gpio.h" #include "shared-bindings/pwmio/PWMOut.h" -nvm_bytearray_obj_t bootcnt = { - .base = { - .type = &nvm_bytearray_type - }, - .len = (uint32_t)8192, - .start_address = (uint8_t *)(0x00080000 - 8192) -}; - - void board_init(void) { pwmio_pwmout_obj_t pwm; common_hal_pwmio_pwmout_construct(&pwm, &pin_PA23, 4096, 2, false); @@ -54,8 +41,7 @@ bool board_requests_safe_mode(void) { } void reset_board(void) { - uint8_t value_out = 0; - common_hal_nvm_bytearray_get_bytes(&bootcnt,0,1,&value_out); - ++value_out; - common_hal_nvm_bytearray_set_bytes(&bootcnt,0,&value_out,1); +} + +void board_deinit(void) { } diff --git a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h index f7dfbae3a2..bd45a814fb 100644 --- a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h +++ b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.h @@ -15,6 +15,9 @@ #define BOARD_FLASH_SIZE (FLASH_SIZE - 0x4000 - CIRCUITPY_INTERNAL_NVM_SIZE) +#define CIRCUITPY_DRIVE_LABEL "PYCUBED" +#define CIRCUITPY_BOOT_COUNTER 1 + #define BOARD_HAS_CRYSTAL 1 #define DEFAULT_I2C_BUS_SCL (&pin_PB13) diff --git a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk index ccf3050d11..ac8af21dcb 100644 --- a/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed_mram/mpconfigboard.mk @@ -10,17 +10,25 @@ QSPI_FLASH_FILESYSTEM = 1 EXTERNAL_FLASH_DEVICES = MR2xH40 LONGINT_IMPL = MPZ -CIRCUITPY_DRIVE_LABEL = "PYCUBED" +CIRCUITPY_ULAB = 1 +CIRCUITPY_BINASCII = 1 +CIRCUITPY_SDCARDIO = 1 +CIRCUITPY_JSON = 1 +CIRCUITPY_MSGPACK = 1 +CIRCUITPY_ALARM = 1 -# Not needed. +# no SAMD51 support... yet ;) +# CIRCUITPY_DUALBANK=1 + +# Not needed CIRCUITPY_AUDIOBUSIO = 0 -CIRCUITPY_BITMAPTOOLS = 0 CIRCUITPY_DISPLAYIO = 0 CIRCUITPY_FRAMEBUFFERIO = 0 CIRCUITPY_KEYPAD = 0 CIRCUITPY_RGBMATRIX = 0 CIRCUITPY_PS2IO = 0 +CIRCUITPY_BLEIO_HCI=0 +CIRCUITPY_BLEIO=0 FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_NeoPixel FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_Register -FROZEN_MPY_DIRS += $(TOP)/frozen/Adafruit_CircuitPython_SD diff --git a/ports/atmel-samd/boards/pycubed_mram_v05/board.c b/ports/atmel-samd/boards/pycubed_mram_v05/board.c index 032ad7b2e7..41e4655102 100644 --- a/ports/atmel-samd/boards/pycubed_mram_v05/board.c +++ b/ports/atmel-samd/boards/pycubed_mram_v05/board.c @@ -42,3 +42,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/atmel-samd/boards/pycubed_mram_v05/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed_mram_v05/mpconfigboard.mk index 2da146ae46..ac8af21dcb 100644 --- a/ports/atmel-samd/boards/pycubed_mram_v05/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed_mram_v05/mpconfigboard.mk @@ -15,9 +15,9 @@ CIRCUITPY_BINASCII = 1 CIRCUITPY_SDCARDIO = 1 CIRCUITPY_JSON = 1 CIRCUITPY_MSGPACK = 1 +CIRCUITPY_ALARM = 1 # no SAMD51 support... yet ;) -# CIRCUITPY_ALARM = 1 # CIRCUITPY_DUALBANK=1 # Not needed diff --git a/ports/atmel-samd/boards/pycubed_v05/board.c b/ports/atmel-samd/boards/pycubed_v05/board.c index 032ad7b2e7..41e4655102 100644 --- a/ports/atmel-samd/boards/pycubed_v05/board.c +++ b/ports/atmel-samd/boards/pycubed_v05/board.c @@ -42,3 +42,6 @@ bool board_requests_safe_mode(void) { void reset_board(void) { } + +void board_deinit(void) { +} diff --git a/ports/atmel-samd/boards/pycubed_v05/mpconfigboard.mk b/ports/atmel-samd/boards/pycubed_v05/mpconfigboard.mk index b5dd957c14..923ab2eaae 100644 --- a/ports/atmel-samd/boards/pycubed_v05/mpconfigboard.mk +++ b/ports/atmel-samd/boards/pycubed_v05/mpconfigboard.mk @@ -11,8 +11,6 @@ EXTERNAL_FLASH_DEVICE_COUNT = 1 EXTERNAL_FLASH_DEVICES = W25Q80DV LONGINT_IMPL = MPZ -CIRCUITPY_DRIVE_LABEL = "PYCUBED" - CIRCUITPY_ULAB = 1 CIRCUITPY_BINASCII = 1 CIRCUITPY_SDCARDIO = 1