Skip to main content
January 7, 2021
Question

Place Pictures data in external ram

  • January 7, 2021
  • 4 replies
  • 1490 views

Hello Dear Engineers and Developers,

This one is an advance question for me, perhaps as easy as ABC for you.

I want to put image data on the external ram. Either of Keil or Stm32cubeIDE compilers are acceptable. I know that I should change the linker script, read data from one external memory, and load it into (the external) ram region. I had saved the binary data into SDCARD and have been able to read SDCARD data.

First question: How should I change the linker script in either of the compilers so that the data are put and read from external ram? I have been able to write into external ram from SDCARD.

Second question: For Touchgfx, which Address should I write into so that I can be able to see them as if data was in the internal flash section?

Any help would be appreciated.

    This topic has been closed for replies.

    4 replies

    Tesla DeLorean
    Guru
    January 7, 2021

    You will need to describe to the linker where memories you want it to use are situated.

    ie QSPI is at 0x90000000, SDRAM probably at 0xC0000000 or 0xD0000000, this should be in the Reference Manual or Data Sheet

    With external memories you MUST configure the peripheral, pins and memories themselves properly BEFORE touching them.

    In more normative models you'd do this in SystemInit() prior to the code in startup.s that initializes the statics, copies data, zeros other data, and calls the constructors, etc.

    If you're using Keil, and initialize the memory properly, their code in __main / scatterload will unpack the load regions described in the scatter file (Keil's linker script equivalent)

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    January 7, 2021

    Dear @Community member​ 

    Thank you for your reply.

    I was looking for a handy guide. To tell on how to configure the code and compiler. Any videos or documents. I said I know I should do all of them. I asked HOW should I do them. Any template or anything that can help.

    Tesla DeLorean
    Guru
    January 7, 2021

    >>This one is an advance question for me, perhaps as easy as ABC for you.

    College level Compilers, Assemblers, Linkers and Loaders should provide sufficient context. I took EE not CS

    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
    January 8, 2021

    Dear @MM..1​ 

    Thank you for your follow up. I have read these documentations in advance, but yet there is no example on one compiler, either IAR, Keil, or stm32cubeide. ANY working videos.

    mattias norlander
    ST Employee
    February 22, 2021

    Hi Vahid,

    Have you looked into the User Guide? Find it in Help > Information Center > Technical documentation > User Guide. See specifically chapter 2.5.7.2 - Place code in RAM (might be different number in other version of the UG). Admittedly the example I refer to is how to place CODE in RAM. The example also does not take into account that you rely on EXTERNAL memory. But still the example shows you some linker magic like LMA vs VMA. In terms of code you have to initialize the external memories before copying the data, hence your data copy loops might be part of main() rather than Reset_Handler().