Loading...
 

SW4STM32 and SW4Linux fully supports the STM32MP1 asymmetric multicore Cortex/A7+M4 MPUs

   With System Workbench for Linux, Embedded Linux on the STM32MP1 family of MPUs from ST was never as simple to build and maintain, even for newcomers in the Linux world. And, if you install System Workbench for Linux in System Workbench for STM32 you can seamlessly develop and debug asymmetric applications running partly on Linux, partly on the Cortex-M4.
You can get more information from the ac6-tools website and download (registration required) various documents highlighting:

System Workbench for STM32


You are viewing a reply to Locate Heap in SDRAM  

Locate Heap in SDRAM

Tunisia

We can also do that without big modifcations in linker script biggrin

by defining the heap start/end in linker miscellaneous flags, ie :

-Wl,--defsym=__heap_start=0xD0000000,--defsym=__heap_limit=0xD0800000

Note: you have to change these values with yours

and removing heap informations from linker (not necessary but good for your linker lisibility)

1- remove this line :
_Min_Heap_Size = 0; /* required amount of heap */
2- and replace this

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

with the following

/* User_stack section, used to check that there is enough RAM left */
  ._user_stack :
  {
    . = ALIGN(8);
    PROVIDE ( end = . );
    PROVIDE ( _end = . );
    . = . + _Min_Stack_Size;
    . = ALIGN(8);
  } >RAM



Edit: I forgot syscalls modifications mrgreen

You have to add syscalls.c to project (you can borrow it from another SystemWorkbench project)
then replace _sbrk function by the following

caddr_t _sbrk(int incr)
{
	extern char __heap_start asm("__heap_start"); /* Defined by the linker. */
	extern char __heap_limit asm("__heap_limit"); /* Defined by the linker. */

	static char *heap_end;
    static char *heap_limit = &__heap_limit;

	char *prev_heap_end;

	if (heap_end == 0)
		heap_end = &__heap_start;

	prev_heap_end = heap_end;
	if (heap_end + incr > heap_limit)
	{
		errno = ENOMEM; // not enough memory
		return (caddr_t) -1;
	}

	heap_end += incr;

	return (caddr_t) prev_heap_end;
}