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


You are viewing a reply to Locate Heap in SDRAM  

Locate Heap in SDRAM

Tunisia

Hello Franz,

you need to specify SDRAM memory in your linker file (here I am using a linker for STM32L476RGTx with 1M FLASH and 96K RAM)

/* Specify the memory areas */
MEMORY
{
FLASH (rx)      : ORIGIN = 0x08000000, LENGTH = 1M
RAM (xrw)       : ORIGIN = 0x20000000, LENGTH = 96K
SDRAM(xrw)    : ORIGIN = 0x????????, LENGTH = 8M
}


And modify >RAM by >SDRAM

/* User_heap_stack section, used to check that there is enough RAM left */
  ._user_heap_stack :
  {
    . = ALIGN(4);
    PROVIDE ( end = . );
    PROVIDE ( _end = . );
    . = . + _Min_Heap_Size;
    . = . + _Min_Stack_Size;
    . = ALIGN(4);
  } >SDRAM


Update:
Do not forget to initialize you SDRAM before your application starts !
It should be done in Reset Handler (in startup file) in assembly.

There are better solutions that writing in assembler
1- Start with the default STACK&HEAP location (RAM), initialize your SDRAM then switch to SDRAM as STACK&HEAP location
2- Separate Heap and stack locations (STACK in RAM and HEAP in SDRAM) in linker file, than initialize SDRAM in your main before any malloc usage

 

Newest Forum Posts

  1. STM32 MCU model shortlisting for Making RC remote by Palvish, 2025-07-07 15:05
  2. SPI on Nucleo_STMH533RE by royjamil, 2025-05-04 20:13
  3. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-25 07:37
  4. SPI on Nucleo_STMH533RE by royjamil, 2025-03-23 11:31
  5. SPI on Nucleo_STMH533RE by higginsa1, 2025-03-23 09:33
  6. Configuring DMA for ADC in SW? by sam.hodgson, 2025-03-04 12:58
  7. Build a project in "release" mode by info@creosrl.it, 2025-02-20 18:12
  8. Build a project in "release" mode by info@creosrl.it, 2025-02-20 17:05
  9. Build a project in "release" mode by tang, 2025-02-20 10:36
  10. Build a project in "release" mode by info@creosrl.it, 2025-02-19 17:35

Last-Modified Blogs