[PATCH 0/5] Optimize workspace/malloc initialization
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Nov 30 11:59:24 UTC 2021
Hello Karel,
On 30/11/2021 12:04, Karel Gardas wrote:
> just a question. Do you plan to preserve functionality of _Heap_Extend()
> in the future?
this feature is still available. However, there was a significant change
in the handling of BSP-provided memory areas between RTEMS 5 and 6.
> Asking since I'm using it for amd64/uefi bsp. During the
> bsp start I get efi services pointers and use that to traverse memory
> map. Based on available free blocks I try to allocate memory using EFI
> API and if successful I'm calling _Heap_Extend with it to pass ram to
> RTEMS. That's the way I found out by searching in the tree in lpc24xx
> and lpc176x bsps. Pity I've not found altera-cyclone-v at that time
> since this looks even more similar to what I need to achieve here. Will
> need to analyze it better (weekend task).
>
> As I'm still trying to understand better memory allocation in RTEMS, I'm
> of course open to any idea how to implement this in the most clean way
> acceptable for RTEMS and not using _Heap_Extend() -- if it would not be
> allowed or right thing to do or scheduled for future removal.
In RTEMS 6, the BSP has to provide a _Memory_Get() function which
returns the memory areas which may be used by RTEMS at runtime. Most
BSPs just return a single memory area. A BSP can also return multiple
memory areas:
static Memory_Area _Memory_Areas[ 123 ];
static const Memory_Information _Memory_Information =
MEMORY_INFORMATION_INITIALIZER( _Memory_Areas );
static void bsp_memory_initialize( void )
{
size_t i;
for ( i = 0; i < RTEMS_ARRAY_SIZE( _Memory_Areas ); ++i ) {
_Memory_Initialize( &_Memory_Areas[ i ], begin( i ), end( i ) );
}
}
RTEMS_SYSINIT_ITEM(
bsp_memory_initialize,
RTEMS_SYSINIT_MEMORY,
RTEMS_SYSINIT_ORDER_MIDDLE
);
const Memory_Information *_Memory_Get( void )
{
return &_Memory_Information;
}
What the patch set changed is that the BSP provides specialized
implementations to initialize the RTEMS Workspace and the separate C
Program Heap according to the _Memory_Get() implementation.
--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax: +49-89-18 94 741 - 08
Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
More information about the devel
mailing list