cancel
Showing results for 
Search instead for 
Did you mean: 

How can I define an array[512] at RAM_D1(@0x24000000) with STM32 VSCode extension?

prof89
Associate II

I am new user of stm32h750, and I try developing it with STM32 vscode extension, it is great!

For sci_dma, I need a buffer at RAM_D1(@0x24000000) , how can I define the array?

I can only define a pointer at the address and it works: 

uint8_t *p = (uint8_t *)0x24000000;

 

But how about a char_buffer[n]?

 

Please kindly help me, thank you.

1 ACCEPTED SOLUTION

Accepted Solutions

7e382f66-0c9c-4436-8043-a6d926c206b0.png

in STM32H743IITx_FLASH.ld

add

._D1_Area :
{
  . = ALIGN(4);
  . = ALIGN(4);
} >RAM_D1

 and

__attribute__((section("._D1_Area"))) float char_buffer[n] = {0};

 

Sorry, I overlooked something.

View solution in original post

8 REPLIES 8
Hollies
Associate II

try like

__attribute__((section("._DTCM_Area"))) float adcBuf[3] = {0};

__attribute__((section(".RAM_D1"))) float char_buffer[n] = {0};

Thanks a lot.

I will try and report back my result.

Dear Hollies,

I tried your suggestion :

__attribute__((section(".RAM_D1"))) float char_buffer[n] = {0};

 

The define may not be working with STM32 vscode extension. I checked the map file:

.RAM_D1         0x2000006c        0x5 load address 0x0800fb88
 .RAM_D1        0x2000006c        0x5 CMakeFiles/i7H750_test.dir/Core/Src/main.c.obj
                0x2000006c                char_buffer
                0x20000074                        . = ALIGN (0x4)
 
The array is not located at 0x24000000. As stm32h750 defined:
 
Memory Configuration

Name             Origin             Length             Attributes
DTCMRAM          0x20000000         0x00020000         xrw
RAM_D1           0x24000000         0x00080000         xrw
RAM_D2           0x30000000         0x00048000         xrw
RAM_D3           0x38000000         0x00010000         xrw
ITCMRAM          0x00000000         0x00010000         xrw
FLASH            0x08000000         0x00020000         xr
*default*        0x00000000         0xffffffff
 

 

7e382f66-0c9c-4436-8043-a6d926c206b0.png

in STM32H743IITx_FLASH.ld

add

._D1_Area :
{
  . = ALIGN(4);
  . = ALIGN(4);
} >RAM_D1

 and

__attribute__((section("._D1_Area"))) float char_buffer[n] = {0};

 

Sorry, I overlooked something.

Thanks a lot.

I will try your suggestion and report back my result.

 

Dear Hollies,

it works!

thank you very much.

 

May I ask you a favor? Where can I learn relative define method as you given above?


@prof89 wrote:

Dear Hollies,

it works!

thank you very much.

 

May I ask you a favor? Where can I learn relative define method as you given above?


I'm from China.I can search for relevant Chinese articles on bing.

You could find "STM32H743+CubeIDE-将变量定义到指定的内存" in CSDN.

And I found that, ST maybe has offered a pdf.But I never tried.

In STM32CubeIDE:

“Help”->“Read STM32CubeIDE Documentation”->“C/C++ Linker”(ld.pdf)

Thank you for your generous response.

I will read the ld.pdf.