2024-03-28 06:39 AM
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
Solved! Go to Solution.
2024-03-29 02:59 PM
Pick less ambiguous patterns.
File is processed in-order, variables need to be used or dead-code elimination will discard them
2024-03-28 06:47 AM - edited 2024-03-28 06:50 AM
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.
2024-03-28 06:47 AM
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.
2024-03-28 10:46 AM
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.
2024-03-28 10:48 AM
Can you provide me the syntaxes or link for DTCMRAM for general variable.
2024-03-28 02:16 PM
Your syntax looks ok. The problem is something else.
2024-03-29 12:08 AM
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
2024-03-29 02:08 AM
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 .
2024-03-29 02:20 AM
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
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
From above. I can say that only first section get into account by compiler and second one discarded.
please guide me.
thanking you
.
2024-03-29 02:32 AM - edited 2024-03-29 02:33 AM
> 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.