Skip to main content
ykn
Associate III
March 28, 2024
Solved

How to use DTCMRAM in stm32h743

  • March 28, 2024
  • 12 replies
  • 8434 views

Hi All,

I want to use DTCRAM in stm32cubeide, the controller i used is stm32h743, earlier I

Used RAM_D2. shifting from RAM_D2 to DTCRAM is possible but both i cant use,

please guide me,

 

/DISCARD/ :
 {
 libc.a ( * )
 libm.a ( * )
 libgcc.a ( * )
 }
 .RAMD2buffers(NOLOAD) : {
 . = ALIGN(4);
 *(.buffers*)
 } > DTCMRAM
 
.bssDTCMRAM(NOLOAD) : {
 . = ALIGN(4);
 *(.buffersDT*)
 } > RAM_D2
 
 .ARM.attributes 0 : { *(.ARM.attributes) }

the above code is added to linker file,

//__attribute__ ((section(".buffers"), used))
char rData[BUF_SIZE];// Read data
__attribute__ ((section(".buffers"), used))
uint32_t DMA_ADC1[ADC1_Size];
__attribute__ ((section(".buffers"), used))
uint32_t DMA_ADC2[ADC2_Size];
__attribute__ ((section(".buffers"), used))
uint32_t DMA_ADC3[ADC3_Size];
__attribute__ ((section(".buffersDT")))
uint32_t DMA_ADC3_dummy[ADC3_Size];

 

this code added to main file, 

thanking you

    This topic has been closed for replies.
    Best answer by Tesla DeLorean

    Pick less ambiguous patterns.

    File is processed in-order, variables need to be used or dead-code elimination will discard them 

    12 replies

    Pavel A.
    March 28, 2024

    DTCM (a.k.a. tightly core-coupled) memories are not accessible by peripherals DMA. That's is why they are very fast, and also don't work with DMA. Now you're informed.

     

    ykn
    yknAuthor
    Associate III
    March 28, 2024

    Ok, what if I want to use it for general variable other than DMA, what should be the syantax.i tried the above, but the memory analyzer not showing DTCMRAM.

    mƎALLEm
    ST Technical Moderator
    March 28, 2024

    From your code I understand that you need to access DTCM with a general purpose DMA (DMA1 or DMA2) which is not possible. These masters don't have access to DTCM RAM. You need to use MDMA for this.

     

    To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
    ykn
    yknAuthor
    Associate III
    March 28, 2024

    Can you provide me the syntaxes or link for DTCMRAM for general variable.

    Pavel A.
    March 28, 2024

    Your syntax looks ok. The problem is something else.

     

    AScha.3
    Super User
    March 29, 2024

    Hi,

    no problem, to use all ram areas, just write it in linker file:

     /* Initialized data sections into "RAM_D1" Ram type memory */
     .data : 
     {
     . = ALIGN(4);
     _sdata = .; /* create a global symbol at data start */
     *(.data) /* .data sections */
     *(.data*) /* .data* sections */
    
     . = ALIGN(4);
     _edata = .; /* define a global symbol at data end */
     
     } >DTCMRAM AT> FLASH /* war >RAM_D1 AT> FLASH */
    
     /* Uninitialized data section into "RAM_D1" Ram type memory */
     . = ALIGN(4);
     .bss :
     {
     /* This is used by the startup in order to initialize the .bss section */
     _sbss = .; /* define a global symbol at bss start */
     __bss_start__ = _sbss;
     *(.bss)
     *(.bss*)
     *(COMMON)
    
     . = ALIGN(4);
     _ebss = .; /* define a global symbol at bss end */
     __bss_end__ = _ebss;
     } >DTCMRAM				/* war >RAM_D1 */
    
     /* User_heap_stack section, used to check that there is enough "RAM_D1" Ram type memory left */
     ._user_heap_stack :
     {
     . = ALIGN(8);
     PROVIDE ( end = . );
     PROVIDE ( _end = . );
     . = . + _Min_Heap_Size;
     . = . + _Min_Stack_Size;
     . = ALIGN(8);
     } >DTCMRAM
    
     .RAM_D1_sec :					/* (NOLOAD) <- keine initialisierung */ 
     {
     	. = ALIGN(32);
     *(.RAM_D1_section) 
     . = ALIGN(32);
     } >RAM_D1

    so stack and variables in DTCMRAM .

    Just where we need DMA, this needs to be in "normal" ram area , tell it the compiler/linker in main.c :

    __attribute__((section(".RAM_D1_section"))) uint8_t inbuf[4096*8] __attribute__ ((aligned (32)));			// 32K file input buffer
    __attribute__((section(".RAM_D1_section"))) int32_t out_buf[4096*4], rc, iPitch=40, i, j;					// 16kB -> Radio
    uint16_t peak_val, myfilter=0,source=0;

    -> inbuf+outbuf , i, j : in ram_D1 , peak_val etc. in  DTCMRAM .

     

    If you feel a post has answered your question, please click on " Best Answer ".
    Pavel A.
    March 29, 2024

    but what about bufferDT

    Pattern *(.buffers*)  is before *(.buffersDT*) in the script, so it captures the latter. Move the 2nd section up above the 1st one.

     

    ykn
    yknAuthor
    Associate III
    March 29, 2024

     

     /DISCARD/ :
     {
     libc.a ( * )
     libm.a ( * )
     libgcc.a ( * )
     }
     
     .bssDTCMRAM(NOLOAD) : {
     . = ALIGN(4);
     *(.buffersDT*)
     } > DTCMRAM
     
     .RAMD2buffers(NOLOAD) : {
     . = ALIGN(4);
     *(.buffers*)
     } > RAM_D2

     

    In this way, Now no initialization in DTCMRAM:frowning_face:

    Pavel A.
    March 29, 2024

    Now no initialization in DTCMRAM

    Because in this line only "used" is missing )) This variable likely is not referenced.

    __attribute__ ((section(".buffersDT")))

    Please read the ld documentation, take your time.

    Tesla DeLorean
    Tesla DeLoreanBest answer
    Guru
    March 29, 2024

    Pick less ambiguous patterns.

    File is processed in-order, variables need to be used or dead-code elimination will discard them 

    Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..