diff --git a/src/omv/alloc/fb_alloc.c b/src/omv/alloc/fb_alloc.c index 3e3ee8777..a6ab91be4 100644 --- a/src/omv/alloc/fb_alloc.c +++ b/src/omv/alloc/fb_alloc.c @@ -28,8 +28,8 @@ static uint32_t alloc_bytes_peak; #if defined(OMV_FB_OVERLAY_MEMORY) #define FB_OVERLAY_MEMORY_FLAG 0x1 -extern char _fballoc_overlay; -static char *pointer_overlay = &_fballoc_overlay; +extern char _fballoc_overlay_end, _fballoc_overlay_start; +static char *pointer_overlay = &_fballoc_overlay_end; #endif // fb_alloc_free_till_mark() will not free past this. @@ -57,7 +57,7 @@ void fb_alloc_init0() { pointer = &_fballoc; #if defined(OMV_FB_OVERLAY_MEMORY) - pointer_overlay = &_fballoc_overlay; + pointer_overlay = &_fballoc_overlay_end; #endif } @@ -167,7 +167,7 @@ void *fb_alloc(uint32_t size, int hints) #if defined(OMV_FB_OVERLAY_MEMORY) if ((!(hints & FB_ALLOC_PREFER_SIZE)) - && (((uint32_t) (pointer_overlay - OMV_FB_OVERLAY_MEMORY_ORIGIN)) >= size)) { + && (((uint32_t) (pointer_overlay - &_fballoc_overlay_start)) >= size)) { // Return overlay memory instead. pointer_overlay -= size; result = pointer_overlay; @@ -204,7 +204,7 @@ void *fb_alloc_all(uint32_t *size, int hints) #if defined(OMV_FB_OVERLAY_MEMORY) if (!(hints & FB_ALLOC_PREFER_SIZE)) { - *size = (uint32_t) (pointer_overlay - OMV_FB_OVERLAY_MEMORY_ORIGIN); + *size = (uint32_t) (pointer_overlay - &_fballoc_overlay_start); temp = IM_MIN(temp, *size); } #endif diff --git a/src/omv/boards/OPENMV4P/omv_boardconfig.h b/src/omv/boards/OPENMV4P/omv_boardconfig.h index 72cf30548..b3ee6703e 100644 --- a/src/omv/boards/OPENMV4P/omv_boardconfig.h +++ b/src/omv/boards/OPENMV4P/omv_boardconfig.h @@ -179,7 +179,6 @@ #define OMV_AXI_SRAM_LENGTH 512K #define OMV_DRAM_ORIGIN 0xC0000000 #define OMV_DRAM_LENGTH 32M -#define OMV_FB_OVERLAY_MEMORY_ORIGIN OMV_AXI_SRAM_ORIGIN // Domain 1 DMA buffers region. #define OMV_DMA_MEMORY_D1 AXI_SRAM diff --git a/src/omv/boards/OPENMVPT/omv_boardconfig.h b/src/omv/boards/OPENMVPT/omv_boardconfig.h index ec252e795..01a4c06fb 100644 --- a/src/omv/boards/OPENMVPT/omv_boardconfig.h +++ b/src/omv/boards/OPENMVPT/omv_boardconfig.h @@ -176,7 +176,6 @@ #define OMV_AXI_SRAM_LENGTH 512K #define OMV_DRAM_ORIGIN 0xC0000000 #define OMV_DRAM_LENGTH 64M -#define OMV_FB_OVERLAY_MEMORY_ORIGIN OMV_AXI_SRAM_ORIGIN // Domain 1 DMA buffers region. #define OMV_DMA_MEMORY_D1 AXI_SRAM diff --git a/src/omv/boards/PORTENTA/omv_boardconfig.h b/src/omv/boards/PORTENTA/omv_boardconfig.h index f6781ba64..903643a66 100644 --- a/src/omv/boards/PORTENTA/omv_boardconfig.h +++ b/src/omv/boards/PORTENTA/omv_boardconfig.h @@ -179,7 +179,6 @@ #define OMV_DRAM_LENGTH 8M #define OMV_FLASH_EXT_ORIGIN 0x90000000 #define OMV_FLASH_EXT_LENGTH 16M -#define OMV_FB_OVERLAY_MEMORY_ORIGIN OMV_AXI_SRAM_ORIGIN // Domain 1 DMA buffers region. #define OMV_DMA_MEMORY_D1 AXI_SRAM diff --git a/src/omv/ports/stm32/stm32fxxx.ld.S b/src/omv/ports/stm32/stm32fxxx.ld.S index 2191d19cd..34309985b 100755 --- a/src/omv/ports/stm32/stm32fxxx.ld.S +++ b/src/omv/ports/stm32/stm32fxxx.ld.S @@ -126,7 +126,6 @@ SECTIONS . = ALIGN(4); _fballoc_overlay_start = .; . = . + OMV_FB_OVERLAY_MEMORY_OFFSET; - _fballoc_overlay = .; _fballoc_overlay_end = .; } >OMV_FB_OVERLAY_MEMORY #endif diff --git a/src/uvc/stm32fxxx.ld.S b/src/uvc/stm32fxxx.ld.S index d095254f6..e3f6f3d9e 100755 --- a/src/uvc/stm32fxxx.ld.S +++ b/src/uvc/stm32fxxx.ld.S @@ -107,7 +107,6 @@ SECTIONS . = ALIGN(4); _fballoc_overlay_start = .; . = . + OMV_FB_OVERLAY_MEMORY_OFFSET; - _fballoc_overlay = .; _fballoc_overlay_end = .; } >OMV_FB_OVERLAY_MEMORY #endif