Loading...
 

Zephyr project on STM32

   Zephyr Workbench, a VSCode extension to manage Zephyr on STM32.
It enables users to easily create, develop, and debug Zephyr applications.
Main features:
  • Install host dependencies.
  • Import toolchain and SDK.
  • Create, configure, build and manage apps.
  • Debug STM32.
You can directly download it from the VSCode marketplace
For more details, visit the Zephyr Workbench

System Workbench for STM32


Section for external SDRAM STM32F746 GCC

Hey guys,

I have a problem with defining a section for the external SDRAM on the STM32F746-Disco. I red many posts in different forums but I didn’t find the way to a working code.

I initialized the SDRAM in the SystemInit() and it’s working because I can use it in the main() function without additional initialisation. Afterwords I took the linker script and added a memory entry like followed:

MEMORY
{
FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 320K
SDRAM (xrw) : ORIGIN = 0xC0000000, LENGTH = 8M
}

and a section entry like this:

...
.sdram_data (NOLOAD) :
{
. = ALIGN(8);
_sdram_data_begin = .;
*(.sdram_data)
*(.sdram_data*)
. = ALIGN(8);
_sdram_data_end = .;
} >SDRAM
...

When I now declare a variable in the main file

const char picture1480*272*3 attribute ((section(“.sdram_data”)));

and want to fill it afterwards with information

picture1[] = {
0x00, 0xFF, 0xFF;
0x00, 0xFF, 0xFF;
0x00, 0xFF, 0xFF;
...
};

I get the error:

../src/main.c:53:1: warning: data definition has no type or storage class
picture1[] = {
^
../src/main.c:53:1: warning: type defaults to ‘int’ in declaration of ‘picture1’ -Wimplicit-int
../src/main.c:53:1: error: conflicting types for ‘picture1’
../src/main.c:52:12: note: previous declaration of ‘picture1’ was here
const char picture1480*272*3 attribute ((section(“.sdram_data”)));

When I declare the variable as followed I don’t get an error but it’s also not working.

attribute ((section(“.sdram_data”)))
const char picture1[] =
{
0x00, 0xFF, 0xFF;
0x00, 0xFF, 0xFF;
0x00, 0xFF, 0xFF;
...
};

I hope anybody of you can help me.

Hello !

First thank you your post helped me in the process.
I did it on an STM32f4x9I eval board.
You may have found your answer but I add my remarks if it can help others.

The problem for me is the way you declare youre picture :

  • picture1480*272*3 ==> ‘*’ cannot be used, use “x”.
  • “const char picture1[]” : why load const data into RAM ?, it stays in Flash. Anyway even if you want to do so your linker may detect const data and let it into flash.




You post have some things to clarify :
= ALIGN(8); why do you align on 8 bytes, 4 is sufficient.
attribute : the gcc linker use the attribute keyword.