cancel
Showing results for 
Search instead for 
Did you mean: 

Screen Buffer Storage Issue

DHOUT19
Associate

I am currently using the STM32N657 to drive an 800x480 pixel display with 24-bit color. The problem that I am running into is the buffer that I need uses 1.1MB (800*480*3 = 1.152MB). Using just FSBL, I am limited to 511KB of SRAM. I know that this chip has 4.2MB of SRAM on it, so how do I access that SRAM for my buffer?

1 ACCEPTED SOLUTION

Accepted Solutions
Saket_Om
ST Employee

Hello @DHOUT19 

You need to check the Reference Manual or Memory Map section of the STM32N657 datasheet to find the base address and size of the full SRAM region.

Please follow these steps below:

  1. Check the full SRAM memory address and size in the STM32N657 datasheet or reference manual.

  2. Modify your linker script to increase the SRAM region size to 4.2MB and optionally create a dedicated section for your framebuffer.

    MEMORY
    {
      /* Adjust these addresses and sizes based on your device's memory map */
      SRAM (rw) : ORIGIN = 0x30000000, LENGTH = 0x00420000  /* 4.2MB SRAM */
      /* Other memory regions */
    }
    
    SECTIONS
    {
      /* Place your framebuffer buffer in SRAM */
      .framebuffer (NOLOAD) :
      {
        . = ALIGN(4);
        _framebuffer_start = .;
        KEEP(*(.framebuffer))
        . = ALIGN(4);
        _framebuffer_end = .;
      } > SRAM
    }
  3. Declare your framebuffer in code with a section attribute to place it in the large SRAM region.

    #define FRAMEBUFFER_SIZE (800 * 480 * 3)
    
    __attribute__((section(".framebuffer"))) 
    uint8_t framebuffer[FRAMEBUFFER_SIZE];
To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om

View solution in original post

2 REPLIES 2
Saket_Om
ST Employee

Hello @DHOUT19 

You need to check the Reference Manual or Memory Map section of the STM32N657 datasheet to find the base address and size of the full SRAM region.

Please follow these steps below:

  1. Check the full SRAM memory address and size in the STM32N657 datasheet or reference manual.

  2. Modify your linker script to increase the SRAM region size to 4.2MB and optionally create a dedicated section for your framebuffer.

    MEMORY
    {
      /* Adjust these addresses and sizes based on your device's memory map */
      SRAM (rw) : ORIGIN = 0x30000000, LENGTH = 0x00420000  /* 4.2MB SRAM */
      /* Other memory regions */
    }
    
    SECTIONS
    {
      /* Place your framebuffer buffer in SRAM */
      .framebuffer (NOLOAD) :
      {
        . = ALIGN(4);
        _framebuffer_start = .;
        KEEP(*(.framebuffer))
        . = ALIGN(4);
        _framebuffer_end = .;
      } > SRAM
    }
  3. Declare your framebuffer in code with a section attribute to place it in the large SRAM region.

    #define FRAMEBUFFER_SIZE (800 * 480 * 3)
    
    __attribute__((section(".framebuffer"))) 
    uint8_t framebuffer[FRAMEBUFFER_SIZE];
To give better visibility on the answered topics, please click on "Accept as Solution" on the reply which solved your issue or answered your question.
Saket_Om
DHOUT19
Associate

This pointed me in the right direction. Thanks.