From be03021258eab12cb558c0069ed64ace7ef2b774 Mon Sep 17 00:00:00 2001 From: iabdalkader Date: Sat, 29 Jun 2024 22:15:47 +0200 Subject: [PATCH] boards/All: Update memory configs. * DMA buffers regions are automatically rounded up to the next power of 2 via the linker script. This ensures that these buffers, when rounded up, can actually fit into their respective memories. It also ensures that when/if the MPU is used to configure these regions, it will not round up the regions sizes, which may cause the MPU to configure a region bigger than the DMA buffer. * GC blocks can be rearranged in any order, including the main heap/first block. This is very important for boards with limited RAM to avoid fragmenting the contiguous large heap early before it's actually needed. * Moved VOSPI memory to its own section. The offset is no longer required, and the linker script can detect overlaps. * Renamed GC heap memory to allow more than one heap to exist, and added support for it in the common linker script. This change allows adding a second heap for malloc/libc easily if needed. * For STM32 boards, the domain-specific DMA buffers can now be located anywhere within their memory regions, as their MPU regions' base addresses and sizes are all set via linker script variables. Previously, this was defined in headers, and sections could have easily overlapped without warning. --- src/omv/boards/ARDUINO_GIGA/omv_boardconfig.h | 43 ++++++------------- .../omv_boardconfig.h | 8 ++-- .../omv_boardconfig.h | 6 +-- .../ARDUINO_NICLA_VISION/omv_boardconfig.h | 38 +++++----------- .../ARDUINO_PORTENTA_H7/omv_boardconfig.h | 34 +++++---------- src/omv/boards/OPENMV2/omv_boardconfig.h | 14 +++--- src/omv/boards/OPENMV3/omv_boardconfig.h | 8 ++-- src/omv/boards/OPENMV4/omv_boardconfig.h | 42 ++++++------------ src/omv/boards/OPENMV4P/omv_boardconfig.h | 34 +++++---------- src/omv/boards/OPENMV4_PRO/omv_boardconfig.h | 31 ++++--------- src/omv/boards/OPENMVPT/omv_boardconfig.h | 34 +++++---------- .../boards/OPENMV_RT1060/omv_boardconfig.h | 19 ++++---- src/omv/boards/PICO/omv_boardconfig.h | 6 +-- 13 files changed, 107 insertions(+), 210 deletions(-) diff --git a/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.h b/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.h index 8f772e06a..348fde213 100644 --- a/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.h +++ b/src/omv/boards/ARDUINO_GIGA/omv_boardconfig.h @@ -108,26 +108,29 @@ // Note: fb_alloc is a stack-based, dynamically allocated memory on FB. // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). #define OMV_MAIN_MEMORY SRAM1 // Data, BSS memory. -#define OMV_HEAP_MEMORY SRAM1 // Heap memory. -#define OMV_HEAP_SIZE (198K) #define OMV_STACK_MEMORY DTCM // stack memory #define OMV_STACK_SIZE (64K) #define OMV_FB_MEMORY DRAM // Framebuffer, fb_alloc #define OMV_FB_SIZE (3M) // FB memory: header + VGA/GS image #define OMV_FB_ALLOC_SIZE (2M) // minimum fb alloc size -#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer. -#define OMV_JPEG_BUF_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). -#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory. -#define OMV_VOSPI_MEMORY_OFFSET (20K) // SRAM4 reserves 16K for CM4 + 4K D3 DMA buffers. #define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory. #define OMV_FB_OVERLAY_SIZE (480K) // Fast fb_alloc memory size. -#define OMV_GC_BLOCK0_MEMORY DRAM // Extra GC block 0. -#define OMV_GC_BLOCK0_SIZE (2M) -#define OMV_DMA_MEMORY SRAM3 // DMA buffers memory. +#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer. +#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). +#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory. +#define OMV_VOSPI_SIZE (38K) +#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory. +#define OMV_DMA_MEMORY_D1 AXI_SRAM // Domain 1 DMA buffers. +#define OMV_DMA_MEMORY_D2 SRAM3 // Domain 2 DMA buffers. +#define OMV_DMA_MEMORY_D3 SRAM4 // Domain 3 DMA buffers. +#define OMV_GC_BLOCK0_MEMORY SRAM1 // Main GC block. +#define OMV_GC_BLOCK0_SIZE (198K) +#define OMV_GC_BLOCK1_MEMORY DRAM // Extra GC block 1. +#define OMV_GC_BLOCK1_SIZE (2M) #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data #define OMV_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes) -#define OMV_SDRAM_SIZE (8 * 1024 * 1024) // This needs to be here for UVC firmware. -#define OMV_LINE_BUF_SIZE (11 * 1024) // Image line buffer round(2592 * 2BPP * 2 buffers). +#define OMV_SDRAM_SIZE (8 * 1024 * 1024) // This needs to be here for UVC firmware. +#define OMV_LINE_BUF_SIZE (11 * 1024) // Image line buffer round(2592 * 2BPP * 2 buffers). // Memory map. #define OMV_FLASH_ORIGIN 0x08000000 @@ -157,24 +160,6 @@ #define OMV_CM4_FLASH_ORIGIN 0x08020000 #define OMV_CM4_FLASH_LENGTH 128K -// Domain 1 DMA buffers region. -#define OMV_DMA_MEMORY_D1 AXI_SRAM -#define OMV_DMA_MEMORY_D1_SIZE (8 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D1_BASE (OMV_AXI_SRAM_ORIGIN + OMV_FB_OVERLAY_SIZE) -#define OMV_DMA_REGION_D1_SIZE MPU_REGION_SIZE_32KB - -// Domain 2 DMA buffers region. -#define OMV_DMA_MEMORY_D2 SRAM3 -#define OMV_DMA_MEMORY_D2_SIZE (4 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D2_BASE (OMV_SRAM3_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D2_SIZE MPU_REGION_SIZE_32KB - -// Domain 3 DMA buffers region. -#define OMV_DMA_MEMORY_D3 SRAM4 -#define OMV_DMA_MEMORY_D3_SIZE (4 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D3_BASE (OMV_SRAM4_ORIGIN + (16 * 1024)) -#define OMV_DMA_REGION_D3_SIZE MPU_REGION_SIZE_4KB - // MDMA configuration #define OMV_MDMA_CHANNEL_DCMI_0 (0) #define OMV_MDMA_CHANNEL_DCMI_1 (1) diff --git a/src/omv/boards/ARDUINO_NANO_33_BLE_SENSE/omv_boardconfig.h b/src/omv/boards/ARDUINO_NANO_33_BLE_SENSE/omv_boardconfig.h index 5c4814bf7..46eef3e35 100644 --- a/src/omv/boards/ARDUINO_NANO_33_BLE_SENSE/omv_boardconfig.h +++ b/src/omv/boards/ARDUINO_NANO_33_BLE_SENSE/omv_boardconfig.h @@ -48,14 +48,14 @@ // Linker script constants (see the linker script template port/x.ld.S). #define OMV_MAIN_MEMORY SRAM // Data, BSS memory -#define OMV_HEAP_MEMORY SRAM // Heap memory -#define OMV_HEAP_SIZE (64K) #define OMV_STACK_MEMORY SRAM // stack memory #define OMV_STACK_SIZE (8K) #define OMV_FB_MEMORY SRAM // Framebuffer, fb_alloc #define OMV_FB_SIZE (128K) // FB memory: header + QVGA/GS image -#define OMV_FB_ALLOC_SIZE (16K) // minimum fb alloc size -#define OMV_JPEG_BUF_SIZE (16 * 1024) // IDE JPEG buffer (header + data). +#define OMV_FB_ALLOC_SIZE (16K) // minimum fb alloc size +#define OMV_GC_BLOCK0_MEMORY SRAM // Main GC block. +#define OMV_GC_BLOCK0_SIZE (64K) +#define OMV_JPEG_SIZE (16 * 1024) // IDE JPEG buffer (header + data). #define OMV_TEXT_ORIGIN 0x00026000 #define OMV_FFS_LENGTH 64K diff --git a/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/omv_boardconfig.h b/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/omv_boardconfig.h index 53b4ec689..87d42674d 100644 --- a/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/omv_boardconfig.h +++ b/src/omv/boards/ARDUINO_NANO_RP2040_CONNECT/omv_boardconfig.h @@ -47,14 +47,14 @@ extern unsigned char *OMV_BOARD_UID_ADDR; // Unique address. // Linker script constants (see the linker script template port/x.ld.S). #define OMV_MAIN_MEMORY RAM // Data/BSS memory -#define OMV_HEAP_MEMORY RAM // Heap memory -#define OMV_HEAP_SIZE (60 * 1024) // MicroPython's heap #define OMV_STACK_MEMORY RAM // stack memory #define OMV_STACK_SIZE (16K) #define OMV_FB_MEMORY RAM // Framebuffer, fb_alloc #define OMV_FB_SIZE (100K) // FB memory #define OMV_FB_ALLOC_SIZE (16K) // minimum fb alloc size -#define OMV_JPEG_BUF_SIZE (20 * 1024) // IDE JPEG buffer (header + data). +#define OMV_GC_BLOCK0_MEMORY RAM // Main GC block +#define OMV_GC_BLOCK0_SIZE (60 * 1024) // MicroPython's heap +#define OMV_JPEG_SIZE (20 * 1024) // IDE JPEG buffer (header + data). // GP LED #define OMV_LED_PIN (6) diff --git a/src/omv/boards/ARDUINO_NICLA_VISION/omv_boardconfig.h b/src/omv/boards/ARDUINO_NICLA_VISION/omv_boardconfig.h index 9abcd2003..26c7d7b0d 100644 --- a/src/omv/boards/ARDUINO_NICLA_VISION/omv_boardconfig.h +++ b/src/omv/boards/ARDUINO_NICLA_VISION/omv_boardconfig.h @@ -101,20 +101,22 @@ // Note: fb_alloc is a stack-based, dynamically allocated memory on FB. // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). #define OMV_MAIN_MEMORY DTCM // Data/BSS memory. -#define OMV_HEAP_MEMORY ITCM // Heap memory -#define OMV_HEAP_SIZE (64K) #define OMV_STACK_MEMORY DTCM // stack memory #define OMV_STACK_SIZE (32K) #define OMV_FB_MEMORY AXI_SRAM // Framebuffer, fb_alloc #define OMV_FB_SIZE (400K) // FB memory: header + VGA/GS image -#define OMV_FB_ALLOC_SIZE (100K) // minimum fb alloc size -#define OMV_JPEG_MEMORY SRAM4 // JPEG buffer memory buffer. -#define OMV_JPEG_BUF_SIZE (32 * 1024) // IDE JPEG buffer (header + data). -#define OMV_GC_BLOCK0_MEMORY SRAM1 // Extra GC block 0. -#define OMV_GC_BLOCK0_SIZE (276K) -#define OMV_GC_BLOCK1_MEMORY SRAM4 // Extra GC block 0. -#define OMV_GC_BLOCK1_SIZE (32K) +#define OMV_FB_ALLOC_SIZE (76K) // minimum fb alloc size +#define OMV_JPEG_MEMORY AXI_SRAM // JPEG buffer memory buffer. +#define OMV_JPEG_SIZE (32 * 1024) // IDE JPEG buffer (header + data). #define OMV_DMA_MEMORY SRAM2 // DMA buffers memory. +#define OMV_DMA_MEMORY_D1 AXI_SRAM // Domain 1 DMA buffers. +#define OMV_DMA_MEMORY_D2 SRAM2 // Domain 2 DMA buffers. +#define OMV_GC_BLOCK0_MEMORY DTCM // Main GC block 0. +#define OMV_GC_BLOCK0_SIZE (32K) +#define OMV_GC_BLOCK1_MEMORY SRAM4 // Extra GC block 1. +#define OMV_GC_BLOCK1_SIZE (64K) +#define OMV_GC_BLOCK2_MEMORY SRAM1 // Extra GC block 2. +#define OMV_GC_BLOCK2_SIZE (276K) #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data #define OMV_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes) #define OMV_LINE_BUF_SIZE (3 * 1024) // Image line buffer round(640 * 2BPP * 2 buffers). @@ -147,24 +149,6 @@ #define OMV_CM4_FLASH_ORIGIN 0x08020000 #define OMV_CM4_FLASH_LENGTH 128K -// Domain 1 DMA buffers region. -#define OMV_DMA_MEMORY_D1 AXI_SRAM -#define OMV_DMA_MEMORY_D1_SIZE (8 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D1_BASE (OMV_AXI_SRAM_ORIGIN + (500 * 1024)) -#define OMV_DMA_REGION_D1_SIZE MPU_REGION_SIZE_8KB - -// Domain 2 DMA buffers region. -#define OMV_DMA_MEMORY_D2 SRAM2 -#define OMV_DMA_MEMORY_D2_SIZE (1 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D2_BASE (OMV_SRAM2_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D2_SIZE MPU_REGION_SIZE_16KB - -// Domain 3 DMA buffers region. -// #define OMV_DMA_MEMORY_D3 SRAM4 -// #define OMV_DMA_MEMORY_D3_SIZE (4 * 1024) // Reserved memory for DMA buffers -// #define OMV_DMA_REGION_D3_BASE (OMV_SRAM4_ORIGIN + (60 * 1024)) -// #define OMV_DMA_REGION_D3_SIZE MPU_REGION_SIZE_4KB - // MDMA configuration #define OMV_MDMA_CHANNEL_DCMI_0 (0) #define OMV_MDMA_CHANNEL_DCMI_1 (1) diff --git a/src/omv/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h b/src/omv/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h index 4cc98b73e..6c73dd477 100644 --- a/src/omv/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h +++ b/src/omv/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h @@ -109,8 +109,6 @@ // Note: fb_alloc is a stack-based, dynamically allocated memory on FB. // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). #define OMV_MAIN_MEMORY SRAM1 // Data/BSS memory -#define OMV_HEAP_MEMORY SRAM1 // Heap memory -#define OMV_HEAP_SIZE (160K) #define OMV_STACK_MEMORY DTCM // stack memory #define OMV_STACK_SIZE (64K) #define OMV_FB_MEMORY DRAM // Framebuffer, fb_alloc @@ -119,11 +117,17 @@ #define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory. #define OMV_FB_OVERLAY_SIZE (480K) // Fast fb_alloc memory size. #define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer. -#define OMV_JPEG_BUF_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). -#define OMV_GC_BLOCK0_MEMORY DRAM // Extra GC block 0. -#define OMV_GC_BLOCK0_SIZE (2M) +#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). #define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory. -#define OMV_DMA_MEMORY SRAM3 // DMA buffers memory. +#define OMV_VOSPI_SIZE (38K) +#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory. +#define OMV_DMA_MEMORY_D1 AXI_SRAM // Domain 1 DMA buffers. +#define OMV_DMA_MEMORY_D2 SRAM3 // Domain 2 DMA buffers. +#define OMV_DMA_MEMORY_D3 SRAM4 // Domain 3 DMA buffers. +#define OMV_GC_BLOCK0_MEMORY SRAM1 // Main GC block. +#define OMV_GC_BLOCK0_SIZE (160K) +#define OMV_GC_BLOCK1_MEMORY DRAM // Extra GC block 0. +#define OMV_GC_BLOCK1_SIZE (2M) #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data #define OMV_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes) #define OMV_SDRAM_SIZE (8 * 1024 * 1024) // This needs to be here for UVC firmware. @@ -157,24 +161,6 @@ #define OMV_FLASH_EXT_ORIGIN 0x90000000 #define OMV_FLASH_EXT_LENGTH 16M -// Domain 1 DMA buffers region. -#define OMV_DMA_MEMORY_D1 AXI_SRAM -#define OMV_DMA_MEMORY_D1_SIZE (16 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D1_BASE (OMV_AXI_SRAM_ORIGIN + OMV_FB_OVERLAY_SIZE) -#define OMV_DMA_REGION_D1_SIZE MPU_REGION_SIZE_32KB - -// Domain 2 DMA buffers region. -#define OMV_DMA_MEMORY_D2 SRAM3 -#define OMV_DMA_MEMORY_D2_SIZE (1 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D2_BASE (OMV_SRAM3_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D2_SIZE MPU_REGION_SIZE_16KB - -// Domain 3 DMA buffers region. -#define OMV_DMA_MEMORY_D3 SRAM4 -#define OMV_DMA_MEMORY_D3_SIZE (32 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D3_BASE (OMV_SRAM4_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D3_SIZE MPU_REGION_SIZE_64KB - // MDMA configuration #define OMV_MDMA_CHANNEL_DCMI_0 (0) #define OMV_MDMA_CHANNEL_DCMI_1 (1) diff --git a/src/omv/boards/OPENMV2/omv_boardconfig.h b/src/omv/boards/OPENMV2/omv_boardconfig.h index 7ea6f8a5b..2a9fdca79 100644 --- a/src/omv/boards/OPENMV2/omv_boardconfig.h +++ b/src/omv/boards/OPENMV2/omv_boardconfig.h @@ -63,15 +63,15 @@ // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). // Note: fb_alloc overwrites the line buffer which is only used during readout. #define OMV_MAIN_MEMORY DTCM // Data/BSS memory -#define OMV_HEAP_MEMORY DTCM // Heap memory -#define OMV_HEAP_SIZE (46K) #define OMV_STACK_MEMORY DTCM // stack memory #define OMV_STACK_SIZE (8K) #define OMV_FB_MEMORY SRAM1 // Framebuffer, fb_alloc -#define OMV_FB_SIZE (152K) // FB memory: header + QVGA/GS image +#define OMV_FB_SIZE (150K) // FB memory: header + QVGA/GS image #define OMV_FB_ALLOC_SIZE (10K) // minimum fb alloc size -#define OMV_JPEG_BUF_SIZE (8 * 1024) // IDE JPEG buffer size (header + data). #define OMV_DMA_MEMORY SRAM2 // Misc DMA buffers +#define OMV_GC_BLOCK0_MEMORY DTCM // Main GC block +#define OMV_GC_BLOCK0_SIZE (46K) +#define OMV_JPEG_SIZE (8 * 1024) // IDE JPEG buffer size (header + data). #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data #define OMV_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes) #define OMV_FFS_BUF_SIZE (16K) // Flash filesystem cache @@ -83,9 +83,9 @@ #define OMV_DTCM_ORIGIN 0x10000000 #define OMV_DTCM_LENGTH 64K #define OMV_SRAM1_ORIGIN 0x20000000 -#define OMV_SRAM1_LENGTH 162K -#define OMV_SRAM2_ORIGIN 0x20028800 -#define OMV_SRAM2_LENGTH 30K +#define OMV_SRAM1_LENGTH 160K +#define OMV_SRAM2_ORIGIN 0x20028000 +#define OMV_SRAM2_LENGTH 32K // Flash configuration. #define OMV_FLASH_FFS_ORIGIN 0x08004000 diff --git a/src/omv/boards/OPENMV3/omv_boardconfig.h b/src/omv/boards/OPENMV3/omv_boardconfig.h index 8d212714e..6952a04ab 100644 --- a/src/omv/boards/OPENMV3/omv_boardconfig.h +++ b/src/omv/boards/OPENMV3/omv_boardconfig.h @@ -62,15 +62,15 @@ // Note: fb_alloc is a stack-based, dynamically allocated memory on FB. // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). #define OMV_MAIN_MEMORY DTCM // Data/BSS memory -#define OMV_HEAP_MEMORY DTCM // Heap memory -#define OMV_HEAP_SIZE (55K) #define OMV_STACK_MEMORY ITCM // stack memory #define OMV_STACK_SIZE (16K) -#define OMV_DMA_MEMORY DTCM // Misc DMA buffers #define OMV_FB_MEMORY SRAM1 // Framebuffer, fb_alloc #define OMV_FB_SIZE (300K) // FB memory: header + VGA/GS image #define OMV_FB_ALLOC_SIZE (84K) // minimum fb alloc size -#define OMV_JPEG_BUF_SIZE (22 * 1024) // IDE JPEG buffer (header + data). +#define OMV_DMA_MEMORY DTCM // Misc DMA buffers +#define OMV_GC_BLOCK0_MEMORY DTCM // Main GC block +#define OMV_GC_BLOCK0_SIZE (54K) +#define OMV_JPEG_SIZE (22 * 1024) // IDE JPEG buffer (header + data). #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data #define OMV_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes) #define OMV_FFS_BUF_SIZE (32K) // Flash filesystem cache diff --git a/src/omv/boards/OPENMV4/omv_boardconfig.h b/src/omv/boards/OPENMV4/omv_boardconfig.h index 94ddfb329..73d8d2018 100644 --- a/src/omv/boards/OPENMV4/omv_boardconfig.h +++ b/src/omv/boards/OPENMV4/omv_boardconfig.h @@ -115,20 +115,21 @@ // Note: fb_alloc is a stack-based, dynamically allocated memory on FB. // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). #define OMV_MAIN_MEMORY SRAM1 // Data/BSS memory -#define OMV_HEAP_MEMORY SRAM1 // Heap memory -#define OMV_HEAP_SIZE (230K) +#define OMV_FFS_MEMORY DTCM // Flash filesystem cache memory #define OMV_STACK_MEMORY ITCM // stack memory #define OMV_STACK_SIZE (64K) #define OMV_FB_MEMORY AXI_SRAM // Framebuffer, fb_alloc #define OMV_FB_SIZE (400K) // FB memory: header + VGA/GS image -#define OMV_FB_ALLOC_SIZE (50K) // minimum fb alloc size -#define OMV_JPEG_MEMORY SRAM3 // JPEG buffer memory. -#define OMV_JPEG_BUF_SIZE (32 * 1024) // IDE JPEG buffer (header + data). -#define OMV_GC_BLOCK0_MEMORY AXI_SRAM // Extra GC block 0. -#define OMV_GC_BLOCK0_SIZE (50K) +#define OMV_FB_ALLOC_SIZE (80K) // minimum fb alloc size +#define OMV_JPEG_MEMORY AXI_SRAM // JPEG buffer memory. +#define OMV_JPEG_SIZE (32 * 1024) // IDE JPEG buffer (header + data). #define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory. -#define OMV_DMA_MEMORY SRAM2 // DMA buffers memory. -#define OMV_FFS_MEMORY DTCM // Flash filesystem cache memory +#define OMV_VOSPI_SIZE (38K) +#define OMV_DMA_MEMORY SRAM2 // Misc DMA buffers memory. +#define OMV_GC_BLOCK0_MEMORY SRAM4 // Main GC block. +#define OMV_GC_BLOCK0_SIZE (26K) +#define OMV_GC_BLOCK1_MEMORY SRAM1 // Extra GC block 0. +#define OMV_GC_BLOCK1_SIZE (267K) #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data #define OMV_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes) #define OMV_LINE_BUF_SIZE (3 * 1024) // Image line buffer round(640 * 2BPP * 2 buffers). @@ -141,11 +142,9 @@ #define OMV_ITCM_ORIGIN 0x00000000 #define OMV_ITCM_LENGTH 64K #define OMV_SRAM1_ORIGIN 0x30000000 -#define OMV_SRAM1_LENGTH 248K -#define OMV_SRAM2_ORIGIN 0x3003E000 // 16KB of SRAM1 +#define OMV_SRAM1_LENGTH 280K +#define OMV_SRAM2_ORIGIN 0x30046000 #define OMV_SRAM2_LENGTH 8K -#define OMV_SRAM3_ORIGIN 0x30040000 -#define OMV_SRAM3_LENGTH 32K #define OMV_SRAM4_ORIGIN 0x38000000 #define OMV_SRAM4_LENGTH 64K #define OMV_AXI_SRAM_ORIGIN 0x24000000 @@ -157,23 +156,6 @@ #define OMV_FLASH_TXT_ORIGIN 0x08040000 #define OMV_FLASH_TXT_LENGTH 1792K -// Domain 1 DMA buffers region. -#define OMV_DMA_MEMORY_D1 AXI_SRAM -#define OMV_DMA_MEMORY_D1_SIZE (8 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D1_BASE (OMV_AXI_SRAM_ORIGIN + (500 * 1024)) -#define OMV_DMA_REGION_D1_SIZE MPU_REGION_SIZE_8KB - -// Domain 2 DMA buffers region. -#define OMV_DMA_MEMORY_D2 SRAM2 -#define OMV_DMA_MEMORY_D2_SIZE (1 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D2_BASE (OMV_SRAM2_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D2_SIZE MPU_REGION_SIZE_8KB - -// Domain 3 DMA buffers region. -//#define OMV_DMA_MEMORY_D3 SRAM4 -//#define OMV_DMA_REGION_D3_BASE (OMV_SRAM4_ORIGIN+(0*1024)) -//#define OMV_DMA_REGION_D3_SIZE MPU_REGION_SIZE_64KB - // MDMA configuration #define OMV_MDMA_CHANNEL_DCMI_0 (0) #define OMV_MDMA_CHANNEL_DCMI_1 (1) diff --git a/src/omv/boards/OPENMV4P/omv_boardconfig.h b/src/omv/boards/OPENMV4P/omv_boardconfig.h index 31c25ccca..ffc6722e9 100644 --- a/src/omv/boards/OPENMV4P/omv_boardconfig.h +++ b/src/omv/boards/OPENMV4P/omv_boardconfig.h @@ -116,8 +116,6 @@ // Note: fb_alloc is a stack-based, dynamically allocated memory on FB. // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). #define OMV_MAIN_MEMORY SRAM1 // Data/BSS memory -#define OMV_HEAP_MEMORY SRAM1 // Heap memory -#define OMV_HEAP_SIZE (239K) #define OMV_STACK_MEMORY ITCM // stack memory #define OMV_STACK_SIZE (64K) #define OMV_FB_MEMORY DRAM // Framebuffer, fb_alloc @@ -126,11 +124,17 @@ #define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory. #define OMV_FB_OVERLAY_SIZE (496K) // Fast fb_alloc memory size. #define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer. -#define OMV_JPEG_BUF_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). -#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory. +#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). #define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory. -#define OMV_GC_BLOCK0_MEMORY DRAM // Extra GC block 0. -#define OMV_GC_BLOCK0_SIZE (4M) +#define OMV_VOSPI_SIZE (38K) +#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory. +#define OMV_DMA_MEMORY_D1 AXI_SRAM // Domain 1 DMA buffers. +#define OMV_DMA_MEMORY_D2 SRAM3 // Domain 2 DMA buffers. +#define OMV_DMA_MEMORY_D3 SRAM4 // Domain 3 DMA buffers. +#define OMV_GC_BLOCK0_MEMORY SRAM1 // Main GC block +#define OMV_GC_BLOCK0_SIZE (239K) +#define OMV_GC_BLOCK1_MEMORY DRAM // Extra GC block 0. +#define OMV_GC_BLOCK1_SIZE (4M) #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data #define OMV_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes) #define OMV_SDRAM_SIZE (32 * 1024 * 1024) // This needs to be here for UVC firmware. @@ -160,24 +164,6 @@ #define OMV_FLASH_TXT_ORIGIN 0x08040000 #define OMV_FLASH_TXT_LENGTH 1792K -// Domain 1 DMA buffers region. -#define OMV_DMA_MEMORY_D1 AXI_SRAM -#define OMV_DMA_MEMORY_D1_SIZE (16 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D1_BASE (OMV_AXI_SRAM_ORIGIN + OMV_FB_OVERLAY_SIZE) -#define OMV_DMA_REGION_D1_SIZE MPU_REGION_SIZE_16KB - -// Domain 2 DMA buffers region. -#define OMV_DMA_MEMORY_D2 SRAM3 -#define OMV_DMA_MEMORY_D2_SIZE (16 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D2_BASE (OMV_SRAM3_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D2_SIZE MPU_REGION_SIZE_32KB - -// Domain 3 DMA buffers region. -#define OMV_DMA_MEMORY_D3 SRAM4 -#define OMV_DMA_MEMORY_D3_SIZE (64 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D3_BASE (OMV_SRAM4_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D3_SIZE MPU_REGION_SIZE_64KB - // MDMA configuration #define OMV_MDMA_CHANNEL_DCMI_0 (0) #define OMV_MDMA_CHANNEL_DCMI_1 (1) diff --git a/src/omv/boards/OPENMV4_PRO/omv_boardconfig.h b/src/omv/boards/OPENMV4_PRO/omv_boardconfig.h index b68b61e67..99fd44eb6 100644 --- a/src/omv/boards/OPENMV4_PRO/omv_boardconfig.h +++ b/src/omv/boards/OPENMV4_PRO/omv_boardconfig.h @@ -126,8 +126,6 @@ // Note: fb_alloc is a stack-based, dynamically allocated memory on FB. // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). #define OMV_MAIN_MEMORY SRAM1 // Data/BSS memory -#define OMV_HEAP_MEMORY SRAM1 // Heap memory -#define OMV_HEAP_SIZE (196K) #define OMV_STACK_MEMORY ITCM // stack memory #define OMV_STACK_SIZE (64K) #define OMV_FB_MEMORY DRAM // Framebuffer, fb_alloc @@ -136,12 +134,17 @@ #define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory. #define OMV_FB_OVERLAY_SIZE (496K) // Fast fb_alloc memory size. #define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer. -#define OMV_JPEG_BUF_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). -#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory. +#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). #define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory. -#define OMV_VOSPI_MEMORY_OFFSET (4K) // First 4K reserved for D3 DMA buffers. +#define OMV_VOSPI_SIZE (38K) +#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory. +#define OMV_DMA_MEMORY_D1 AXI_SRAM // Domain 1 DMA buffers. +#define OMV_DMA_MEMORY_D2 SRAM3 // Domain 2 DMA buffers. +#define OMV_DMA_MEMORY_D3 SRAM4 // Domain 3 DMA buffers. #define OMV_CYW43_MEMORY FLASH_EXT // CYW43 firmware in external flash mmap'd flash. #define OMV_CYW43_MEMORY_OFFSET (0x90F00000)// Last Mbyte. +#define OMV_GC_BLOCK0_MEMORY SRAM1 // Main GC block. +#define OMV_GC_BLOCK0_SIZE (196K) #define OMV_SDRAM_SIZE (32 * 1024 * 1024) // This needs to be here for UVC firmware. #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data #define OMV_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes) @@ -174,24 +177,6 @@ #define OMV_FLASH_EXT_ORIGIN 0x90000000 #define OMV_FLASH_EXT_LENGTH 32M -// Domain 1 DMA buffers region. -#define OMV_DMA_MEMORY_D1 AXI_SRAM -#define OMV_DMA_MEMORY_D1_SIZE (8 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D1_BASE (OMV_AXI_SRAM_ORIGIN + OMV_FB_OVERLAY_SIZE) -#define OMV_DMA_REGION_D1_SIZE MPU_REGION_SIZE_8KB - -// Domain 2 DMA buffers region. -#define OMV_DMA_MEMORY_D2 SRAM3 -#define OMV_DMA_MEMORY_D2_SIZE (8 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D2_BASE (OMV_SRAM3_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D2_SIZE MPU_REGION_SIZE_32KB - -// Domain 3 DMA buffers region. -#define OMV_DMA_MEMORY_D3 SRAM4 -#define OMV_DMA_MEMORY_D3_SIZE (4 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D3_BASE (OMV_SRAM4_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D3_SIZE MPU_REGION_SIZE_4KB - // MDMA configuration #define OMV_MDMA_CHANNEL_DCMI_0 (0) #define OMV_MDMA_CHANNEL_DCMI_1 (1) diff --git a/src/omv/boards/OPENMVPT/omv_boardconfig.h b/src/omv/boards/OPENMVPT/omv_boardconfig.h index cb4b44e63..09e258f84 100644 --- a/src/omv/boards/OPENMVPT/omv_boardconfig.h +++ b/src/omv/boards/OPENMVPT/omv_boardconfig.h @@ -108,8 +108,6 @@ // Note: fb_alloc is a stack-based, dynamically allocated memory on FB. // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). #define OMV_MAIN_MEMORY SRAM1 // Data/BSS memory -#define OMV_HEAP_MEMORY SRAM1 // Heap memory -#define OMV_HEAP_SIZE (250K) #define OMV_STACK_MEMORY ITCM // stack memory #define OMV_STACK_SIZE (64K) #define OMV_FB_MEMORY DRAM // Framebuffer, fb_alloc @@ -118,11 +116,17 @@ #define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory. #define OMV_FB_OVERLAY_SIZE (496K) // Fast fb_alloc memory size. #define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer. -#define OMV_JPEG_BUF_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). -#define OMV_GC_BLOCK0_MEMORY DRAM // Extra GC block 0. -#define OMV_GC_BLOCK0_SIZE (8M) -#define OMV_DMA_MEMORY SRAM3 // DMA buffers memory. +#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). #define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory. +#define OMV_VOSPI_SIZE (38K) +#define OMV_DMA_MEMORY SRAM3 // DMA buffers memory. +#define OMV_DMA_MEMORY_D1 AXI_SRAM // Domain 1 DMA buffers. +#define OMV_DMA_MEMORY_D2 SRAM3 // Domain 2 DMA buffers. +#define OMV_DMA_MEMORY_D3 SRAM4 // Domain 3 DMA buffers. +#define OMV_GC_BLOCK0_MEMORY SRAM1 // Main GC block. +#define OMV_GC_BLOCK0_SIZE (250K) +#define OMV_GC_BLOCK1_MEMORY DRAM // Extra GC block 0. +#define OMV_GC_BLOCK1_SIZE (8M) #define OMV_SDRAM_SIZE (64 * 1024 * 1024) // This needs to be here for UVC firmware. #define OMV_MSC_BUF_SIZE (2K) // USB MSC bot data #define OMV_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes) @@ -152,24 +156,6 @@ #define OMV_FLASH_TXT_ORIGIN 0x08040000 #define OMV_FLASH_TXT_LENGTH 1792K -// Domain 1 DMA buffers region. -#define OMV_DMA_MEMORY_D1 AXI_SRAM -#define OMV_DMA_MEMORY_D1_SIZE (16 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D1_BASE (OMV_AXI_SRAM_ORIGIN + OMV_FB_OVERLAY_SIZE) -#define OMV_DMA_REGION_D1_SIZE MPU_REGION_SIZE_16KB - -// Domain 2 DMA buffers region. -#define OMV_DMA_MEMORY_D2 SRAM3 -#define OMV_DMA_MEMORY_D2_SIZE (1 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D2_BASE (OMV_SRAM3_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D2_SIZE MPU_REGION_SIZE_16KB - -// Domain 3 DMA buffers region. -#define OMV_DMA_MEMORY_D3 SRAM4 -#define OMV_DMA_MEMORY_D3_SIZE (64 * 1024) // Reserved memory for DMA buffers -#define OMV_DMA_REGION_D3_BASE (OMV_SRAM4_ORIGIN + (0 * 1024)) -#define OMV_DMA_REGION_D3_SIZE MPU_REGION_SIZE_64KB - // MDMA configuration #define OMV_MDMA_CHANNEL_DCMI_0 (0) #define OMV_MDMA_CHANNEL_DCMI_1 (1) diff --git a/src/omv/boards/OPENMV_RT1060/omv_boardconfig.h b/src/omv/boards/OPENMV_RT1060/omv_boardconfig.h index 9b5019737..dac5e4970 100644 --- a/src/omv/boards/OPENMV_RT1060/omv_boardconfig.h +++ b/src/omv/boards/OPENMV_RT1060/omv_boardconfig.h @@ -74,21 +74,24 @@ // Note: fb_alloc is a stack-based, dynamically allocated memory on FB. // The maximum available fb_alloc memory = FB_ALLOC_SIZE + FB_SIZE - (w*h*bpp). #define OMV_MAIN_MEMORY DTCM // Data/BSS memory -#define OMV_HEAP_MEMORY DTCM // Heap memory -#define OMV_HEAP_SIZE (284K) #define OMV_STACK_MEMORY ITCM1 // stack memory #define OMV_STACK_SIZE (32K) #define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer. -#define OMV_JPEG_BUF_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). +#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data). #define OMV_FB_MEMORY DRAM // Framebuffer, fb_alloc -#define OMV_FB_SIZE (16M) // FB memory: header + VGA/GS image -#define OMV_FB_ALLOC_SIZE (11M) // minimum fb alloc size +#define OMV_FB_SIZE (13M) // FB memory: header + VGA/GS image +#define OMV_FB_ALLOC_SIZE (10M) // minimum fb alloc size #define OMV_FB_OVERLAY_MEMORY OCRM1 // Fast fb_alloc memory. #define OMV_FB_OVERLAY_SIZE (512K) -#define OMV_GC_BLOCK0_MEMORY DRAM // Extra GC block 0. -#define OMV_GC_BLOCK0_SIZE (4M) -#define OMV_DMA_MEMORY DTCM // DMA buffers memory. #define OMV_VOSPI_MEMORY OCRM2 // VoSPI buffer memory. +#define OMV_VOSPI_SIZE (38K) +#define OMV_DMA_MEMORY DTCM // Misc DMA buffers memory. +#define OMV_GC_BLOCK0_MEMORY OCRM2 // Extra GC block 0. +#define OMV_GC_BLOCK0_SIZE (26K) +#define OMV_GC_BLOCK1_MEMORY DTCM // Main GC block +#define OMV_GC_BLOCK1_SIZE (293K) +#define OMV_GC_BLOCK2_MEMORY DRAM // Extra GC block 1. +#define OMV_GC_BLOCK2_SIZE (8M) #define OMV_RAMFUNC_MEMORY ITCM2 // RAM code memory. #define OMV_LINE_BUF_SIZE (11 * 1024) // Image line buffer. diff --git a/src/omv/boards/PICO/omv_boardconfig.h b/src/omv/boards/PICO/omv_boardconfig.h index e48b5bbfd..20d86b1e6 100644 --- a/src/omv/boards/PICO/omv_boardconfig.h +++ b/src/omv/boards/PICO/omv_boardconfig.h @@ -47,14 +47,14 @@ extern unsigned char *OMV_BOARD_UID_ADDR; // Unique ID address. // Linker script constants (see the linker script template port/x.ld.S). #define OMV_MAIN_MEMORY RAM // Data/BSS memory -#define OMV_HEAP_MEMORY RAM // Heap memory -#define OMV_HEAP_SIZE (32 * 1024) // MicroPython's heap +#define OMV_GC_BLOCK0_MEMORY RAM // Main GC block. +#define OMV_GC_BLOCK0_SIZE (32 * 1024) #define OMV_STACK_MEMORY RAM // stack memory #define OMV_STACK_SIZE (8K) #define OMV_FB_MEMORY RAM // Framebuffer, fb_alloc #define OMV_FB_SIZE (151K) // FB memory: header + QVGA/GS image #define OMV_FB_ALLOC_SIZE (12K) // minimum fb alloc size -#define OMV_JPEG_BUF_SIZE (20 * 1024) // IDE JPEG buffer (header + data). +#define OMV_JPEG_SIZE (20 * 1024) // IDE JPEG buffer (header + data). // GP LED #define OMV_LED_PIN (25)