diff --git a/supervisor/flash.h b/supervisor/flash.h index cd69cbfa9b..289c76c2d0 100644 --- a/supervisor/flash.h +++ b/supervisor/flash.h @@ -31,7 +31,7 @@ #include "py/mpconfig.h" -#ifdef EXTERNAL_FLASH_DEVICE_COUNT +#ifdef EXTERNAL_FLASH_DEVICES #include "supervisor/shared/external_flash/external_flash.h" #else #include "supervisor/shared/internal_flash.h" diff --git a/supervisor/flash_root_pointers.h b/supervisor/flash_root_pointers.h index 634ae58d3f..a426b9c4eb 100644 --- a/supervisor/flash_root_pointers.h +++ b/supervisor/flash_root_pointers.h @@ -26,7 +26,7 @@ #ifndef MICROPY_INCLUDED_SUPERVISOR_FLASH_ROOT_POINTERS_H #define MICROPY_INCLUDED_SUPERVISOR_FLASH_ROOT_POINTERS_H -#ifdef EXTERNAL_FLASH_DEVICE_COUNT +#ifdef EXTERNAL_FLASH_DEVICES #include "supervisor/shared/external_flash/external_flash_root_pointers.h" #else #include "supervisor/internal_flash_root_pointers.h" diff --git a/supervisor/shared/external_flash/external_flash.c b/supervisor/shared/external_flash/external_flash.c index e2d767235e..23727e7e70 100644 --- a/supervisor/shared/external_flash/external_flash.c +++ b/supervisor/shared/external_flash/external_flash.c @@ -45,7 +45,8 @@ // The currently cached sector in the cache, ram or flash based. static uint32_t current_sector; -const external_flash_device possible_devices[EXTERNAL_FLASH_DEVICE_COUNT] = {EXTERNAL_FLASH_DEVICES}; +STATIC const external_flash_device possible_devices[] = {EXTERNAL_FLASH_DEVICES}; +#define EXTERNAL_FLASH_DEVICE_COUNT MP_ARRAY_SIZE(possible_devices) static const external_flash_device* flash_device = NULL; diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk index f94bccd9ac..083e7fb354 100644 --- a/supervisor/supervisor.mk +++ b/supervisor/supervisor.mk @@ -33,10 +33,7 @@ endif # (Right now INTERNAL_FLASH_FILESYSTEM and (Q)SPI_FLASH_FILESYSTEM are mutually exclusive. # But that might not be true in the future.) ifdef EXTERNAL_FLASH_DEVICES - COMMA := , - EXTERNAL_FLASH_DEVICE_COUNT := $(words $(subst $(COMMA), ,$(EXTERNAL_FLASH_DEVICES))) CFLAGS += -DEXTERNAL_FLASH_DEVICES=$(EXTERNAL_FLASH_DEVICES) \ - -DEXTERNAL_FLASH_DEVICE_COUNT=$(EXTERNAL_FLASH_DEVICE_COUNT) SRC_SUPERVISOR += supervisor/shared/external_flash/external_flash.c ifeq ($(SPI_FLASH_FILESYSTEM),1)