Skip to main content
Associate III
January 24, 2023
Solved

I'm using STML4R9ZI MCU and TouchFGX framework to implement my UI application. I have used 4' display, therefore required framebuffer size is 480 * 272. So question is how we can use the RAM3 section to hold framebuffer?

This MCU is having 3 RAM sections:

RAM : 640KB,

RAM2: 64KB,

RAM3: 384KB

I have modified my linker script(attached here) but don't know why the framebuffer is stored in RAM as well RAM3 section as per below snap?

0693W00000Y91nmQAB.png 

Linker script: STM32L4R9AIIX_FLASH.zip

Following is the part of touchfgx generated code to store the framebuffer at the TouchGFX_Framebuffer location.

namespace

{

  // Use the section "TouchGFX_Framebuffer" in the linker script to specify the placement of the buffer

  LOCATION_PRAGMA_NOLOAD("TouchGFX_Framebuffer")

  uint32_t frameBuf[(480 * 272 * 3 + 3) / 4] LOCATION_ATTRIBUTE_NOLOAD("TouchGFX_Framebuffer");

  static volatile bool refreshRequested = false;

  static uint16_t lcd_int_active_line;

  static uint16_t lcd_int_porch_line;

}

Please help me to store the frame buffer in section RAM3 only as I want to use RAM/RAM2 for other operations.

    This topic has been closed for replies.
    MM..1
    MM..1Best answer
    Super User
    January 24, 2023

    Simple because RAM3 overlaps RAM.

    4 replies

    MM..1
    MM..1Best answer
    Super User
    January 24, 2023

    Simple because RAM3 overlaps RAM.

    Associate III
    January 25, 2023

    Thank you @MM..1​ for taking my attention towards the memory map of this MCU.

    This MCU has a total of 640KB(RAM1:192, RAM2: 64, and RAM:384).

    TDJ
    Senior III
    October 7, 2023

    @Ashvin Ramani @MM..1 What are LOCATION_PRAGMA_NOLOAD and LOCATION_ATTRIBUTE_NOLOAD macros? Where do I find them? 

    TDJ
    Senior III
    October 8, 2023

    @Ashvin Ramani, @MM..1 Never mind, I have figured this out.
    LOCATION_PRAGMA_NOLOAD and LOCATION_ATTRIBUTE_NOLOAD macros are TGFX defined like this:

     

    #define STR(X) STR_I(X)
    #define STR_I(X) #X
    #define LOCATION_PRAGMA(name)
    #define LOCATION_ATTRIBUTE(name) __attribute__((section(STR(name)))) __attribute__((aligned(4)))

     

    The rest is well described in post How to solve this ( region `RAM' overflowed by 1168976 bytes ) error by @Martin KJELDSEN. Some more background can be found in post GNU Linker, can you NOT Initialize my Variable?