Limiting program RAM addresses
Mohammed Khoory
mkhoory at eiast.ae
Mon Dec 9 06:05:00 UTC 2013
I tried using Sebastian's suggestion of declaring the ramdisk as a global
array, and this works, as in it prevents corruption from heap allocations,
but the address is random and not fixed. So I then tried modifying the
linker script to fix the address.
I can't seem to figure out how to fix it at a certain address while
preventing corruption. I tried adding the following to the MEMORY in my
linker script
ramdisk (rw) : ORIGIN = 0x40200000, LENGTH = 6M
And the following to my SECTIONS
.ramdisk 0x40200000 (NOLOAD) :
{
*(.ramdisk)
} > ramdisk
And then modifying ramdisk_buffer so that it's declared in the following
manner:
char ramdisk_buffer[12288][512] __attribute__((section(".ramdisk")));
It's probably very GCC specific, but that's ok as long as it does the job.
While it would seem that the buffer is indeed allocated at 0x40200000, the
heap still allocates memory blocks on top of it which means that corruption
still occurs.
I'm starting to suspect that this is because RTEMS, newlib, and the other
libraries were compiled with the old linker script. Is this the case, or am
I missing something?
Thanks,
>-----Original Message-----
>From: rtems-users-bounces at rtems.org [mailto:rtems-users-
>bounces at rtems.org] On Behalf Of Mohammed Khoory
>Sent: Monday, December 02, 2013 10:30 AM
>To: rtems-users at rtems.org
>Subject: RE: Limiting program RAM addresses
>
>I see, thanks. This makes sense.
>
>I assume in order to make sure that ramdisk_buffer is located in the memory
>region that I need, I would have to modify the linker script. Time to
research
>that I suppose.
>
>>-----Original Message-----
>>From: Sebastian Huber [mailto:sebastian.huber at embedded-brains.de]
>>Sent: Friday, November 29, 2013 6:17 PM
>>To: Mohammed Khoory
>>Cc: rtems-users at rtems.org
>>Subject: Re: Limiting program RAM addresses
>>
>>This doesn't work, but you can use this:
>>
>>static char ramdisk_buffer[12288][512];
>>
>>rtems_ramdisk_config rtems_ramdisk_configuration[] = {
>> {
>> sizeof(ramdisk_buffer[0]),
>> sizeof(ramdisk_buffer) / sizeof(ramdisk_buffer[0]),
>> &ramdisk_buffer[0][0]
>> }
>>};
>>
>
>_______________________________________________
>rtems-users mailing list
>rtems-users at rtems.org
>http://www.rtems.org/mailman/listinfo/rtems-users
More information about the users
mailing list