cancel
Showing results for 
Search instead for 
Did you mean: 

How to use DTCMRAM in stm32h743

ykn
Senior

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

1 ACCEPTED SOLUTION

Accepted Solutions

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
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

12 REPLIES 12
Pavel A.
Evangelist III

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.

 

SofLit
ST Employee

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 on "Accept as Solution" on the reply which solved your issue or answered your question.

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.

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

Pavel A.
Evangelist III

Your syntax looks ok. The problem is something else.

 


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

If you mean by this any variable will be located by default to DTCM you can refer to the linker file provided as template in the CubeH7 package under this link:
https://github.com/STMicroelectronics/STM32CubeH7/blob/master/Projects/NUCLEO-H743ZI/Templates/STM32CubeIDE/STM32H743ZITx_FLASH_DTCMRAM.ld

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.
AScha.3
Chief II

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 "Accept as Solution".

If My syntax is right then what could be the probable reason, 

.RAMD2buffers(NOLOAD) : {
    . = ALIGN(4);
    *(.buffers*)
  } > DTCMRAM
  
.bssDTCMRAM(NOLOAD) : {
    . = ALIGN(4);
    *(.buffersDT*)
  } > RAM_D2

 In above OP,  this works

ykn_0-1711703598424.png

the memory located in DTCRAM for " buffers" only. but what about bufferDT, Tha aRAM_D2 showing noting. If I Invert the DTCMRAM And RAM_D2 as shown in below

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

the Analyzer graph

ykn_1-1711703907469.png

From above. I can say that only first section get into account by compiler and second one discarded.

please guide me.

thanking you

 

Pavel A.
Evangelist III

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.