mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
misc/linker: Update linker script variables.
* Add start/end to JPEG buffer. This allows board config files to define them using linker script syntax (K, M etc..). * Rename variables more consistently.
This commit is contained in:
parent
307109f1a0
commit
dbe6ae9f18
@ -13,8 +13,8 @@
|
|||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
#include "omv_common.h"
|
#include "omv_common.h"
|
||||||
|
|
||||||
extern char _fballoc;
|
extern char _fb_alloc_end;
|
||||||
static char *pointer = &_fballoc;
|
static char *pointer = &_fb_alloc_end;
|
||||||
|
|
||||||
#if defined(FB_ALLOC_STATS)
|
#if defined(FB_ALLOC_STATS)
|
||||||
static uint32_t alloc_bytes;
|
static uint32_t alloc_bytes;
|
||||||
@ -40,7 +40,7 @@ MP_WEAK NORETURN void fb_alloc_fail() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fb_alloc_init0() {
|
void fb_alloc_init0() {
|
||||||
pointer = &_fballoc;
|
pointer = &_fb_alloc_end;
|
||||||
#if defined(OMV_FB_OVERLAY_MEMORY)
|
#if defined(OMV_FB_OVERLAY_MEMORY)
|
||||||
pointer_overlay = &_fballoc_overlay_end;
|
pointer_overlay = &_fballoc_overlay_end;
|
||||||
#endif
|
#endif
|
||||||
@ -79,7 +79,7 @@ static void int_fb_alloc_free_till_mark(bool free_permanent) {
|
|||||||
// This does not really help you in complex memory allocation operations where you want to be
|
// This does not really help you in complex memory allocation operations where you want to be
|
||||||
// able to unwind things until after a certain point. It also did not handle preventing
|
// able to unwind things until after a certain point. It also did not handle preventing
|
||||||
// fb_alloc_free_till_mark() from running in recursive call situations (see find_blobs()).
|
// fb_alloc_free_till_mark() from running in recursive call situations (see find_blobs()).
|
||||||
while (pointer < &_fballoc) {
|
while (pointer < &_fb_alloc_end) {
|
||||||
uint32_t size = *((uint32_t *) pointer);
|
uint32_t size = *((uint32_t *) pointer);
|
||||||
if ((!free_permanent) && (size & FB_PERMANENT_FLAG)) {
|
if ((!free_permanent) && (size & FB_PERMANENT_FLAG)) {
|
||||||
return;
|
return;
|
||||||
@ -107,7 +107,7 @@ void fb_alloc_free_till_mark() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fb_alloc_mark_permanent() {
|
void fb_alloc_mark_permanent() {
|
||||||
if (pointer < &_fballoc) {
|
if (pointer < &_fb_alloc_end) {
|
||||||
*((uint32_t *) pointer) |= FB_PERMANENT_FLAG;
|
*((uint32_t *) pointer) |= FB_PERMANENT_FLAG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -239,7 +239,7 @@ void *fb_alloc0_all(uint32_t *size, int hints) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fb_free() {
|
void fb_free() {
|
||||||
if (pointer < &_fballoc) {
|
if (pointer < &_fb_alloc_end) {
|
||||||
uint32_t size = *((uint32_t *) pointer);
|
uint32_t size = *((uint32_t *) pointer);
|
||||||
size &= ~FB_PERMANENT_FLAG;
|
size &= ~FB_PERMANENT_FLAG;
|
||||||
#if defined(OMV_FB_OVERLAY_MEMORY)
|
#if defined(OMV_FB_OVERLAY_MEMORY)
|
||||||
@ -257,7 +257,7 @@ void fb_free() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void fb_free_all() {
|
void fb_free_all() {
|
||||||
while (pointer < &_fballoc) {
|
while (pointer < &_fb_alloc_end) {
|
||||||
uint32_t size = *((uint32_t *) pointer);
|
uint32_t size = *((uint32_t *) pointer);
|
||||||
size &= ~FB_PERMANENT_FLAG;
|
size &= ~FB_PERMANENT_FLAG;
|
||||||
#if defined(OMV_FB_OVERLAY_MEMORY)
|
#if defined(OMV_FB_OVERLAY_MEMORY)
|
||||||
|
|||||||
@ -121,7 +121,7 @@
|
|||||||
#define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory.
|
#define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory.
|
||||||
#define OMV_FB_OVERLAY_SIZE (450K) // Fast fb_alloc memory size.
|
#define OMV_FB_OVERLAY_SIZE (450K) // Fast fb_alloc memory size.
|
||||||
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
||||||
#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (1M) // IDE JPEG buffer (header + data).
|
||||||
#define OMV_VOSPI_MEMORY DTCM // VoSPI buffer memory.
|
#define OMV_VOSPI_MEMORY DTCM // VoSPI buffer memory.
|
||||||
#define OMV_VOSPI_SIZE (38K)
|
#define OMV_VOSPI_SIZE (38K)
|
||||||
#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory.
|
#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory.
|
||||||
|
|||||||
@ -55,7 +55,7 @@
|
|||||||
#define OMV_FB_ALLOC_SIZE (16K) // minimum fb alloc size
|
#define OMV_FB_ALLOC_SIZE (16K) // minimum fb alloc size
|
||||||
#define OMV_GC_BLOCK0_MEMORY SRAM // Main GC block.
|
#define OMV_GC_BLOCK0_MEMORY SRAM // Main GC block.
|
||||||
#define OMV_GC_BLOCK0_SIZE (64K)
|
#define OMV_GC_BLOCK0_SIZE (64K)
|
||||||
#define OMV_JPEG_SIZE (16 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (16K) // IDE JPEG buffer (header + data).
|
||||||
|
|
||||||
#define OMV_TEXT_ORIGIN 0x00026000
|
#define OMV_TEXT_ORIGIN 0x00026000
|
||||||
#define OMV_FFS_LENGTH 64K
|
#define OMV_FFS_LENGTH 64K
|
||||||
|
|||||||
@ -54,7 +54,7 @@ extern unsigned char *OMV_BOARD_UID_ADDR; // Unique address.
|
|||||||
#define OMV_FB_ALLOC_SIZE (16K) // minimum fb alloc size
|
#define OMV_FB_ALLOC_SIZE (16K) // minimum fb alloc size
|
||||||
#define OMV_GC_BLOCK0_MEMORY RAM // Main GC block
|
#define OMV_GC_BLOCK0_MEMORY RAM // Main GC block
|
||||||
#define OMV_GC_BLOCK0_SIZE (60 * 1024) // MicroPython's heap
|
#define OMV_GC_BLOCK0_SIZE (60 * 1024) // MicroPython's heap
|
||||||
#define OMV_JPEG_SIZE (20 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (20K) // IDE JPEG buffer (header + data).
|
||||||
|
|
||||||
// GP LED
|
// GP LED
|
||||||
#define OMV_LED_PIN (6)
|
#define OMV_LED_PIN (6)
|
||||||
|
|||||||
@ -110,7 +110,7 @@
|
|||||||
#define OMV_FB_SIZE (400K) // FB memory: header + VGA/GS image
|
#define OMV_FB_SIZE (400K) // FB memory: header + VGA/GS image
|
||||||
#define OMV_FB_ALLOC_SIZE (76K) // minimum fb alloc size
|
#define OMV_FB_ALLOC_SIZE (76K) // minimum fb alloc size
|
||||||
#define OMV_JPEG_MEMORY AXI_SRAM // JPEG buffer memory buffer.
|
#define OMV_JPEG_MEMORY AXI_SRAM // JPEG buffer memory buffer.
|
||||||
#define OMV_JPEG_SIZE (32 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (32K) // IDE JPEG buffer (header + data).
|
||||||
#define OMV_DMA_MEMORY SRAM2 // DMA buffers memory.
|
#define OMV_DMA_MEMORY SRAM2 // DMA buffers memory.
|
||||||
#define OMV_DMA_MEMORY_D1 AXI_SRAM // Domain 1 DMA buffers.
|
#define OMV_DMA_MEMORY_D1 AXI_SRAM // Domain 1 DMA buffers.
|
||||||
#define OMV_DMA_MEMORY_D2 SRAM2 // Domain 2 DMA buffers.
|
#define OMV_DMA_MEMORY_D2 SRAM2 // Domain 2 DMA buffers.
|
||||||
|
|||||||
@ -123,7 +123,7 @@
|
|||||||
#define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory.
|
#define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory.
|
||||||
#define OMV_FB_OVERLAY_SIZE (480K) // Fast fb_alloc memory size.
|
#define OMV_FB_OVERLAY_SIZE (480K) // Fast fb_alloc memory size.
|
||||||
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
||||||
#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (1M) // IDE JPEG buffer (header + data).
|
||||||
#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory.
|
#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory.
|
||||||
#define OMV_VOSPI_SIZE (38K)
|
#define OMV_VOSPI_SIZE (38K)
|
||||||
#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory.
|
#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory.
|
||||||
|
|||||||
@ -74,7 +74,7 @@
|
|||||||
#define OMV_DMA_MEMORY SRAM2 // Misc DMA buffers
|
#define OMV_DMA_MEMORY SRAM2 // Misc DMA buffers
|
||||||
#define OMV_GC_BLOCK0_MEMORY DTCM // Main GC block
|
#define OMV_GC_BLOCK0_MEMORY DTCM // Main GC block
|
||||||
#define OMV_GC_BLOCK0_SIZE (46K)
|
#define OMV_GC_BLOCK0_SIZE (46K)
|
||||||
#define OMV_JPEG_SIZE (8 * 1024) // IDE JPEG buffer size (header + data).
|
#define OMV_JPEG_SIZE (8K) // IDE JPEG buffer size (header + data).
|
||||||
#define OMV_MSC_BUF_SIZE (2K) // USB MSC bot 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_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes)
|
||||||
#define OMV_FFS_BUF_SIZE (16K) // Flash filesystem cache
|
#define OMV_FFS_BUF_SIZE (16K) // Flash filesystem cache
|
||||||
|
|||||||
@ -73,7 +73,7 @@
|
|||||||
#define OMV_DMA_MEMORY DTCM // Misc DMA buffers
|
#define OMV_DMA_MEMORY DTCM // Misc DMA buffers
|
||||||
#define OMV_GC_BLOCK0_MEMORY DTCM // Main GC block
|
#define OMV_GC_BLOCK0_MEMORY DTCM // Main GC block
|
||||||
#define OMV_GC_BLOCK0_SIZE (54K)
|
#define OMV_GC_BLOCK0_SIZE (54K)
|
||||||
#define OMV_JPEG_SIZE (22 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (22K) // IDE JPEG buffer (header + data).
|
||||||
#define OMV_MSC_BUF_SIZE (2K) // USB MSC bot 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_VFS_BUF_SIZE (1K) // VFS struct + FATFS file buffer (624 bytes)
|
||||||
#define OMV_FFS_BUF_SIZE (32K) // Flash filesystem cache
|
#define OMV_FFS_BUF_SIZE (32K) // Flash filesystem cache
|
||||||
|
|||||||
@ -125,7 +125,7 @@
|
|||||||
#define OMV_FB_SIZE (400K) // FB memory: header + VGA/GS image
|
#define OMV_FB_SIZE (400K) // FB memory: header + VGA/GS image
|
||||||
#define OMV_FB_ALLOC_SIZE (80K) // minimum fb alloc size
|
#define OMV_FB_ALLOC_SIZE (80K) // minimum fb alloc size
|
||||||
#define OMV_JPEG_MEMORY AXI_SRAM // JPEG buffer memory.
|
#define OMV_JPEG_MEMORY AXI_SRAM // JPEG buffer memory.
|
||||||
#define OMV_JPEG_SIZE (32 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (32K) // IDE JPEG buffer (header + data).
|
||||||
#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory.
|
#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory.
|
||||||
#define OMV_VOSPI_SIZE (38K)
|
#define OMV_VOSPI_SIZE (38K)
|
||||||
#define OMV_DMA_MEMORY SRAM2 // Misc DMA buffers memory.
|
#define OMV_DMA_MEMORY SRAM2 // Misc DMA buffers memory.
|
||||||
|
|||||||
@ -127,7 +127,7 @@
|
|||||||
#define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory.
|
#define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory.
|
||||||
#define OMV_FB_OVERLAY_SIZE (496K) // Fast fb_alloc memory size.
|
#define OMV_FB_OVERLAY_SIZE (496K) // Fast fb_alloc memory size.
|
||||||
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
||||||
#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (1M) // IDE JPEG buffer (header + data).
|
||||||
#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory.
|
#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory.
|
||||||
#define OMV_VOSPI_SIZE (38K)
|
#define OMV_VOSPI_SIZE (38K)
|
||||||
#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory.
|
#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory.
|
||||||
|
|||||||
@ -137,7 +137,7 @@
|
|||||||
#define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory.
|
#define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory.
|
||||||
#define OMV_FB_OVERLAY_SIZE (496K) // Fast fb_alloc memory size.
|
#define OMV_FB_OVERLAY_SIZE (496K) // Fast fb_alloc memory size.
|
||||||
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
||||||
#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (1M) // IDE JPEG buffer (header + data).
|
||||||
#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory.
|
#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory.
|
||||||
#define OMV_VOSPI_SIZE (38K)
|
#define OMV_VOSPI_SIZE (38K)
|
||||||
#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory.
|
#define OMV_DMA_MEMORY SRAM3 // Misc DMA buffers memory.
|
||||||
|
|||||||
@ -119,7 +119,7 @@
|
|||||||
#define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory.
|
#define OMV_FB_OVERLAY_MEMORY AXI_SRAM // Fast fb_alloc memory.
|
||||||
#define OMV_FB_OVERLAY_SIZE (496K) // Fast fb_alloc memory size.
|
#define OMV_FB_OVERLAY_SIZE (496K) // Fast fb_alloc memory size.
|
||||||
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
||||||
#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (1M) // IDE JPEG buffer (header + data).
|
||||||
#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory.
|
#define OMV_VOSPI_MEMORY SRAM4 // VoSPI buffer memory.
|
||||||
#define OMV_VOSPI_SIZE (38K)
|
#define OMV_VOSPI_SIZE (38K)
|
||||||
#define OMV_DMA_MEMORY SRAM3 // DMA buffers memory.
|
#define OMV_DMA_MEMORY SRAM3 // DMA buffers memory.
|
||||||
|
|||||||
@ -77,7 +77,7 @@
|
|||||||
#define OMV_STACK_MEMORY ITCM1 // stack memory
|
#define OMV_STACK_MEMORY ITCM1 // stack memory
|
||||||
#define OMV_STACK_SIZE (32K)
|
#define OMV_STACK_SIZE (32K)
|
||||||
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
#define OMV_JPEG_MEMORY DRAM // JPEG buffer memory buffer.
|
||||||
#define OMV_JPEG_SIZE (1024 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (1M) // IDE JPEG buffer (header + data).
|
||||||
#define OMV_FB_MEMORY DRAM // Framebuffer, fb_alloc
|
#define OMV_FB_MEMORY DRAM // Framebuffer, fb_alloc
|
||||||
#define OMV_FB_SIZE (13M) // FB memory: header + VGA/GS image
|
#define OMV_FB_SIZE (13M) // FB memory: header + VGA/GS image
|
||||||
#define OMV_FB_ALLOC_SIZE (10M) // minimum fb alloc size
|
#define OMV_FB_ALLOC_SIZE (10M) // minimum fb alloc size
|
||||||
|
|||||||
@ -46,15 +46,15 @@ extern unsigned char *OMV_BOARD_UID_ADDR; // Unique ID address.
|
|||||||
#define OMV_USB1_IRQ_HANDLER (USBD_IRQHandler)
|
#define OMV_USB1_IRQ_HANDLER (USBD_IRQHandler)
|
||||||
|
|
||||||
// Linker script constants (see the linker script template port/x.ld.S).
|
// Linker script constants (see the linker script template port/x.ld.S).
|
||||||
#define OMV_MAIN_MEMORY RAM // Data/BSS memory
|
#define OMV_MAIN_MEMORY RAM // Data/BSS memory
|
||||||
#define OMV_GC_BLOCK0_MEMORY RAM // Main GC block.
|
#define OMV_GC_BLOCK0_MEMORY RAM // Main GC block.
|
||||||
#define OMV_GC_BLOCK0_SIZE (32 * 1024)
|
#define OMV_GC_BLOCK0_SIZE (32 * 1024)
|
||||||
#define OMV_STACK_MEMORY RAM // stack memory
|
#define OMV_STACK_MEMORY RAM // stack memory
|
||||||
#define OMV_STACK_SIZE (8K)
|
#define OMV_STACK_SIZE (8K)
|
||||||
#define OMV_FB_MEMORY RAM // Framebuffer, fb_alloc
|
#define OMV_FB_MEMORY RAM // Framebuffer, fb_alloc
|
||||||
#define OMV_FB_SIZE (151K) // FB memory: header + QVGA/GS image
|
#define OMV_FB_SIZE (151K) // FB memory: header + QVGA/GS image
|
||||||
#define OMV_FB_ALLOC_SIZE (12K) // minimum fb alloc size
|
#define OMV_FB_ALLOC_SIZE (12K) // minimum fb alloc size
|
||||||
#define OMV_JPEG_SIZE (20 * 1024) // IDE JPEG buffer (header + data).
|
#define OMV_JPEG_SIZE (20K) // IDE JPEG buffer (header + data).
|
||||||
|
|
||||||
// GP LED
|
// GP LED
|
||||||
#define OMV_LED_PIN (25)
|
#define OMV_LED_PIN (25)
|
||||||
|
|||||||
@ -104,9 +104,10 @@ PROVIDE(__stack = __StackTop);
|
|||||||
.jpeg_memory (NOLOAD) :
|
.jpeg_memory (NOLOAD) :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_jpeg_buf = .;
|
_jpeg_memory_start = .;
|
||||||
. = . + OMV_JPEG_SIZE;
|
. = . + OMV_JPEG_SIZE;
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
|
_jpeg_memory_end = .;
|
||||||
} >OMV_JPEG_MEMORY
|
} >OMV_JPEG_MEMORY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -160,14 +161,13 @@ PROVIDE(__stack = __StackTop);
|
|||||||
.fb_memory (NOLOAD) :
|
.fb_memory (NOLOAD) :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_fb_base = .;
|
_fb_memory_start = .;
|
||||||
. += OMV_FB_SIZE;
|
. += OMV_FB_SIZE;
|
||||||
|
|
||||||
_fb_end = .;
|
|
||||||
. += OMV_FB_ALLOC_SIZE;
|
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_fballoc = .;
|
_fb_memory_end = .;
|
||||||
|
. += OMV_FB_ALLOC_SIZE;
|
||||||
|
. = ALIGN(4);
|
||||||
|
_fb_alloc_end = .;
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
} >OMV_FB_MEMORY
|
} >OMV_FB_MEMORY
|
||||||
#endif
|
#endif
|
||||||
@ -209,8 +209,9 @@ PROVIDE(__stack = __StackTop);
|
|||||||
|
|
||||||
#if defined(OMV_JPEG_SIZE) && !defined(OMV_JPEG_MEMORY)
|
#if defined(OMV_JPEG_SIZE) && !defined(OMV_JPEG_MEMORY)
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
_jpeg_buf = .; // IDE JPEG buffer
|
_jpeg_memory_start = .;
|
||||||
. = . + OMV_JPEG_SIZE;
|
. = . + OMV_JPEG_SIZE;
|
||||||
|
_jpeg_memory_end = .;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* FFS (internal) filesystem buffer */
|
/* FFS (internal) filesystem buffer */
|
||||||
|
|||||||
@ -13,16 +13,17 @@
|
|||||||
#include "framebuffer.h"
|
#include "framebuffer.h"
|
||||||
#include "omv_boardconfig.h"
|
#include "omv_boardconfig.h"
|
||||||
|
|
||||||
#define FB_ALIGN_SIZE_ROUND_DOWN(x) (((x) / FRAMEBUFFER_ALIGNMENT) * FRAMEBUFFER_ALIGNMENT)
|
#define FB_ALIGN_SIZE_ROUND_DOWN(x) (((x) / FRAMEBUFFER_ALIGNMENT) * FRAMEBUFFER_ALIGNMENT)
|
||||||
#define FB_ALIGN_SIZE_ROUND_UP(x) FB_ALIGN_SIZE_ROUND_DOWN(((x) + FRAMEBUFFER_ALIGNMENT - 1))
|
#define FB_ALIGN_SIZE_ROUND_UP(x) FB_ALIGN_SIZE_ROUND_DOWN(((x) + FRAMEBUFFER_ALIGNMENT - 1))
|
||||||
#define CONSERVATIVE_JPEG_BUF_SIZE (OMV_JPEG_SIZE - 64)
|
#define OMV_JPEG_BUFFER_SIZE_MAX ((&_jpeg_memory_end - &_jpeg_memory_start) - sizeof(jpegbuffer_t))
|
||||||
|
|
||||||
extern char _fb_base;
|
extern char _fb_memory_start;
|
||||||
extern char _fb_end;
|
extern char _fb_memory_end;
|
||||||
framebuffer_t *framebuffer = (framebuffer_t *) &_fb_base;
|
framebuffer_t *framebuffer = (framebuffer_t *) &_fb_memory_start;
|
||||||
|
|
||||||
extern char _jpeg_buf;
|
extern char _jpeg_memory_start;
|
||||||
jpegbuffer_t *jpeg_framebuffer = (jpegbuffer_t *) &_jpeg_buf;
|
extern char _jpeg_memory_end;
|
||||||
|
jpegbuffer_t *jpeg_framebuffer = (jpegbuffer_t *) &_jpeg_memory_start;
|
||||||
|
|
||||||
void fb_set_streaming_enabled(bool enable) {
|
void fb_set_streaming_enabled(bool enable) {
|
||||||
framebuffer->streaming_enabled = enable;
|
framebuffer->streaming_enabled = enable;
|
||||||
@ -136,7 +137,7 @@ void framebuffer_update_jpeg_buffer() {
|
|||||||
bool does_not_fit = false;
|
bool does_not_fit = false;
|
||||||
|
|
||||||
if (mutex_try_lock_alternate(&jpeg_framebuffer->lock, MUTEX_TID_OMV)) {
|
if (mutex_try_lock_alternate(&jpeg_framebuffer->lock, MUTEX_TID_OMV)) {
|
||||||
if (CONSERVATIVE_JPEG_BUF_SIZE < src->size) {
|
if (OMV_JPEG_BUFFER_SIZE_MAX < src->size) {
|
||||||
jpegbuffer_init_from_image(NULL);
|
jpegbuffer_init_from_image(NULL);
|
||||||
does_not_fit = true;
|
does_not_fit = true;
|
||||||
} else {
|
} else {
|
||||||
@ -162,7 +163,7 @@ void framebuffer_update_jpeg_buffer() {
|
|||||||
.w = src->w,
|
.w = src->w,
|
||||||
.h = src->h,
|
.h = src->h,
|
||||||
.pixfmt = PIXFORMAT_JPEG,
|
.pixfmt = PIXFORMAT_JPEG,
|
||||||
.size = CONSERVATIVE_JPEG_BUF_SIZE,
|
.size = OMV_JPEG_BUFFER_SIZE_MAX,
|
||||||
.pixels = jpeg_framebuffer->pixels
|
.pixels = jpeg_framebuffer->pixels
|
||||||
};
|
};
|
||||||
// Note: lower quality saves USB bandwidth and results in a faster IDE FPS.
|
// Note: lower quality saves USB bandwidth and results in a faster IDE FPS.
|
||||||
@ -234,7 +235,7 @@ static uint32_t framebuffer_raw_buffer_size() {
|
|||||||
uint32_t size = (uint32_t) (fb_alloc_stack_pointer() - ((char *) framebuffer->data));
|
uint32_t size = (uint32_t) (fb_alloc_stack_pointer() - ((char *) framebuffer->data));
|
||||||
// We don't want to give all of the frame buffer RAM to the frame buffer. So, we will limit
|
// We don't want to give all of the frame buffer RAM to the frame buffer. So, we will limit
|
||||||
// the maximum amount of RAM we return.
|
// the maximum amount of RAM we return.
|
||||||
uint32_t raw_buf_size = (&_fb_end - &_fb_base);
|
uint32_t raw_buf_size = (&_fb_memory_end - &_fb_memory_start);
|
||||||
return IM_MIN(size, raw_buf_size);
|
return IM_MIN(size, raw_buf_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -187,21 +187,20 @@ SECTIONS
|
|||||||
.fb_memory (NOLOAD) :
|
.fb_memory (NOLOAD) :
|
||||||
{
|
{
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_fb_base = .;
|
_fb_memory_start = .;
|
||||||
. += OMV_FB_SIZE;
|
. += OMV_FB_SIZE;
|
||||||
|
. = ALIGN(4);
|
||||||
|
_fb_memory_end = .;
|
||||||
|
|
||||||
_fb_end = .;
|
|
||||||
. += OMV_FB_ALLOC_SIZE;
|
. += OMV_FB_ALLOC_SIZE;
|
||||||
|
. = ALIGN(4);
|
||||||
|
_fb_alloc_end = .;
|
||||||
|
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
_fballoc = .;
|
_jpeg_memory_start = .;
|
||||||
. = ALIGN(4);
|
|
||||||
|
|
||||||
#if !defined(OMV_JPEG_MEMORY)
|
|
||||||
_jpeg_buf = .; // IDE JPEG buffer
|
|
||||||
. = . + OMV_JPEG_SIZE;
|
. = . + OMV_JPEG_SIZE;
|
||||||
. = ALIGN(4);
|
. = ALIGN(4);
|
||||||
#endif
|
_jpeg_memory_end = .;
|
||||||
} >OMV_FB_MEMORY
|
} >OMV_FB_MEMORY
|
||||||
|
|
||||||
.heap (COPY):
|
.heap (COPY):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user