summaryrefslogtreecommitdiff
path: root/supervisor
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2021-03-04 13:12:24 -0800
committerScott Shawcroft <scott@tannewt.org>2021-03-18 16:55:42 -0700
commit5d2b60cbf69c99abd6984c298d4f052514221177 (patch)
tree381adffaf4aa37a641418bcb2a8e6940ce956258 /supervisor
parent25895153422da1bd3d05f50e4c35ea408f9e4d28 (diff)
Redo RP2040 flash settings
This switches stage2 to C and uses Jinja to change the C code based on flash settings from https://github.com/adafruit/nvm.toml. It produces the fastest settings for the given set of external flashes. Flash size is no longer hard coded so switching flashes with similar capabilities but different sizes should *just work*. This PR also places "ITCM" code in RAM to save the XIP cache for code execution. Further optimization is possible. A blink code.py still requires a number of flash fetches every blink. Fixes #4041
Diffstat (limited to 'supervisor')
-rw-r--r--supervisor/flash.h6
-rw-r--r--supervisor/linker.h2
-rw-r--r--supervisor/shared/memory.c2
-rw-r--r--supervisor/supervisor.mk14
4 files changed, 12 insertions, 12 deletions
diff --git a/supervisor/flash.h b/supervisor/flash.h
index 289c76c2d..21d76c998 100644
--- a/supervisor/flash.h
+++ b/supervisor/flash.h
@@ -31,10 +31,10 @@
#include "py/mpconfig.h"
-#ifdef EXTERNAL_FLASH_DEVICES
-#include "supervisor/shared/external_flash/external_flash.h"
-#else
+#if INTERNAL_FLASH_FILESYSTEM
#include "supervisor/shared/internal_flash.h"
+#else
+#include "supervisor/shared/external_flash/external_flash.h"
#endif
void supervisor_flash_init(void);
diff --git a/supervisor/linker.h b/supervisor/linker.h
index 43050b907..58068c1a4 100644
--- a/supervisor/linker.h
+++ b/supervisor/linker.h
@@ -29,7 +29,7 @@
#ifndef MICROPY_INCLUDED_SUPERVISOR_LINKER_H
#define MICROPY_INCLUDED_SUPERVISOR_LINKER_H
-#if defined(IMXRT10XX) || defined(FOMU) || defined(STM32H7)
+#if defined(IMXRT10XX) || defined(FOMU) || defined(STM32H7) || defined(RASPBERRYPI)
#define PLACE_IN_DTCM_DATA(name) name __attribute__((section(".dtcm_data." #name)))
#define PLACE_IN_DTCM_BSS(name) name __attribute__((section(".dtcm_bss." #name)))
#define PLACE_IN_ITCM(name) __attribute__((section(".itcm." #name))) name
diff --git a/supervisor/shared/memory.c b/supervisor/shared/memory.c
index 83c9d6323..30482ea7b 100644
--- a/supervisor/shared/memory.c
+++ b/supervisor/shared/memory.c
@@ -36,7 +36,7 @@ enum {
CIRCUITPY_SUPERVISOR_IMMOVABLE_ALLOC_COUNT =
// stack + heap
2
- #ifdef EXTERNAL_FLASH_DEVICES
+ #if INTERNAL_FLASH_FILESYSTEM == 0
+ 1
#endif
#if CIRCUITPY_USB_MIDI
diff --git a/supervisor/supervisor.mk b/supervisor/supervisor.mk
index 083e7fb35..946b4b0bf 100644
--- a/supervisor/supervisor.mk
+++ b/supervisor/supervisor.mk
@@ -32,7 +32,13 @@ endif
# Choose which flash filesystem impl to use.
# (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
+ifeq ($(INTERNAL_FLASH_FILESYSTEM),1)
+ ifeq ($(DISABLE_FILESYSTEM),1)
+ SRC_SUPERVISOR += supervisor/stub/internal_flash.c
+ else
+ SRC_SUPERVISOR += supervisor/internal_flash.c
+ endif
+else
CFLAGS += -DEXTERNAL_FLASH_DEVICES=$(EXTERNAL_FLASH_DEVICES) \
SRC_SUPERVISOR += supervisor/shared/external_flash/external_flash.c
@@ -42,12 +48,6 @@ ifdef EXTERNAL_FLASH_DEVICES
ifeq ($(QSPI_FLASH_FILESYSTEM),1)
SRC_SUPERVISOR += supervisor/qspi_flash.c supervisor/shared/external_flash/qspi_flash.c
endif
-else
- ifeq ($(DISABLE_FILESYSTEM),1)
- SRC_SUPERVISOR += supervisor/stub/internal_flash.c
- else
- SRC_SUPERVISOR += supervisor/internal_flash.c
- endif
endif
ifeq ($(USB),FALSE)