GCC自定义内存区域实现LVGL,FreeRTOS内存,C语言malloc内存区域独立使用。

0 评论
/
35 阅读
/
3439 字
05 2023-12

总体内存配置

  • 总体系统内存: 64MB

LVGL 9 内存配置

  • LVGL 动态内存: 32MB
    • 起始地址: 0x000000
    • 结束地址: 0x02000000
    • LVGL 配置项:
      • #define LV_MEM_CUSTOM 1
      • #define LV_MEM_POOL_DEF_SIZE (32 * 1024 * 1024) (32MB)

FreeRTOS 9 内存配置

  • FreeRTOS 堆内存: 16MB
    • 起始地址: 0x02000000
    • 结束地址: 0x03000000
    • FreeRTOS 配置项:
      • #define configAPPLICATION_ALLOCATED_HEAP 1
      • #define configTOTAL_HEAP_SIZE 0x1000000 (16MB)

C 的 malloc 动态内存配置

  • C 的 malloc 内存: 16MB
    • 起始地址: 0x03000000
    • 结束地址: 0x04000000

LVGL 9 配置

#define LV_MEM_POOL_DEF_SIZE (32 * 1024 * 1024)  // 32MB in bytes

FreeRTOS V9设置


GCC LD文件配置

;/**************************************************************************
; *                                                                         *
; * Copyright (c) 2019 Nuvoton Technology. All rights reserved.             *
; *                                                                         *
; **************************************************************************/

ENTRY(__vector)

MEMORY
{
  LVGL_HEAP   (rwx)   : ORIGIN = 0x000000, LENGTH = 0x02000000 /* 32MB for LVGL dynamic memory */
  FREERTOS_HEAP (rwx) : ORIGIN = 0x02000000, LENGTH = 0x01000000 /* 16MB for FreeRTOS memory */
  CMALLOC_HEAP  (rwx) : ORIGIN = 0x03000000, LENGTH = 0x01000000 /* 16MB for C malloc dynamic memory */
}

SECTIONS
{
  .text :
  {
    PROVIDE(__image_start = .);
    PROVIDE(__text_start = .);
  
    PROVIDE(__vectors_start = .);
    *(.vectors);
    . = ALIGN(4);
    PROVIDE(__vectors_end = .);
    *(.init);
    . = ALIGN(4);
    *(.text);
    . = ALIGN(4);
    *(.rodata);
    . = ALIGN(4);
    *(.rodata*);
    . = ALIGN(4);

    etext = .;
    
    PROVIDE(__text_end = .);
  } > LVGL_HEAP

  . = ALIGN(4);
  _etext = . ;
  PROVIDE (etext = .);
   
  .data : AT (_etext)
  {
    PROVIDE(__data_start__ = .);
    _data = . ;
    *(.data)
    . = ALIGN(4);
    PROVIDE(__data_end__ = .);
  } > LVGL_HEAP

  . = ALIGN(4);
  _edata = . ;
  PROVIDE (edata = .);

  sbss = .;
  .bss :
  {
    PROVIDE (__bss_start__ = .);
    *(.bss)
    *(.bss.**)
    *(COMMON)
    . = ALIGN(4);
    PROVIDE (__bss_end__ = .);
  }>LVGL_HEAP
  ebss = .;
  bss_size = ebss - sbss; 

  .heap :
  {
    . = ALIGN(8);
    end = .;
  } > LVGL_HEAP

  PROVIDE_HIDDEN (__exidx_start = .);
  .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) }
  PROVIDE_HIDDEN (__exidx_end = .);
  
  /* FreeRTOS memory section */
  .freertos_heap :
  {
    /* ... Additional sections for FreeRTOS memory go here ... */
  } > FREERTOS_HEAP

  /* C malloc memory section */
  .cmalloc_heap :
  {
    /* ... Additional sections for C malloc memory go here ... */
  } > CMALLOC_HEAP
} 
标签:
    暂无数据