cancel
Showing results for 
Search instead for 
Did you mean: 

SDRAM and a global struct.

Hector_R
Associate II

Hi.

I am using TouchGFX and it works fine,

My MCU is STM32H743

 

But when I use the SDRAM for other things the code does not work.

My question is:

Can I use struct in the  SDRAM.?

 

I have this one in my c file.

 

 

SD_CARD SdCard __attribute__((section("\"SDCardSection\""))) __attribute__((aligned(4)));

 

 

In my h file as follows:

 

 

 

typedef struct { char Name[256]; char Path[1000]; char File[2000]; uint8_t LogicalDrive; }SD_CARD; extern SD_CARD SdCard __attribute__((section("\"SDCardSection\""))) __attribute__((aligned(4)));

 

 

 My Linker file is as follows:

 

 

/* Entry Point */ ENTRY(Reset_Handler) /* Highest address of the user mode stack */ _estack = ORIGIN(RAM_D1) + LENGTH(RAM_D1); /* end of RAM */ /* Generate a link error if heap and stack don't fit into RAM */ _Min_Heap_Size = 0x400; /* required amount of heap */ _Min_Stack_Size = 0x800; /* required amount of stack */ /* Specify the memory areas */ MEMORY { FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K DTCMRAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K RAM_D1 (xrw) : ORIGIN = 0x24000000, LENGTH = 512K RAM_D2 (xrw) : ORIGIN = 0x30000000, LENGTH = 288K RAM_D3 (xrw) : ORIGIN = 0x38000000, LENGTH = 64K ITCMRAM (xrw) : ORIGIN = 0x00000000, LENGTH = 64K QUADSPI (r) : ORIGIN = 0x90000000, LENGTH = 16M SDRAM (xrw) : ORIGIN = 0xC0000000, LENGTH = 32M } etc etc etc .ARM.attributes 0 : { *(.ARM.attributes) } BufferSection (NOLOAD) : { *(Video_RGB_Buffer Video_RGB_Buffer.*) *(.gnu.linkonce.r.*) . = ALIGN(0x4); *(TouchGFX_Framebuffer TouchGFX_Framebuffer.*) *(.gnu.linkonce.r.*) . = ALIGN(0x4); } >SDRAM SDCardSection (NOLOAD) : { *(SDCardSection SDCardSection .*) *(.gnu.linkonce.r.*) . = ALIGN(0x4); } >SDRAM
View more

 

 

 

 Best Regards.

10 REPLIES 10
Hector_R
Associate II

Hi there.

The problem was that TouchGFX uses Unicode.

I was using char buffer and pointers to update the buffer of a scrollWheel.

But TouchGFX describes that we should use the Unicode library.

So,  I updated my buffers to datatype uint16_t, and then used the Unicode library.

void CustomContainer2_1::UpdateText(uint16_t value) { Unicode::snprintf(textArea1Buffer, TEXTAREA1_SIZE, "%s", &SdCard.File); ... ... ... ... textArea1.invalidate(); }