Fwd: configuring memory size

Till Straumann strauman at slac.stanford.edu
Tue Dec 6 18:54:12 UTC 2005


D. Peter Siddons wrote:

> Hi Till,
> The bsp is very similar to the uC5282. _M68k_Ramsize is copied from 
> the linker value (_Ramsize) in bsp_start() (part of bspstart.c). I 
> could easily check for the two possibilities here. Is that early enough?

Yes.

The value is used to configure the heap in bsp_pretasking_hook().
The workspace is initialized in rtems_initialize_executive_early(), somewhat
prior to calling the pretasking hook.

Tuning the heap and workspace related parameters from bsp_start() should 
be OK.

Reading the amount of memory from a config register or jumper or probing 
for the
top of memory in bsp_start() should be preferred to hard-coding in the 
linker script.

HTH
T.

> Pete.
>
> Till Straumann wrote:
>
>> Eric Norum wrote:
>>
>>>>
>>>> Looks like what I suggested won't work.   The linker complains if  
>>>> the expressions in the  ORIGIN/LENGTH contain symbols even if 
>>>> those  symbols have been defined before the assignment.
>>>>
>>>> I guess that you'll need to have two separate linkcmds files and  
>>>> use something like
>>>>     -Wl,-TlinkcmdsFor4MFlash
>>>> or
>>>>     -Wl,-TlinkcmdsFor16MFlash
>>>
>>>
>>>
>> A much better solution would be enhancing the BSP so it does
>> auto-detection. This has to be performed early enough,though.
>>
>> If an early detection is too cumbersome, then you can limit
>> the initial size to a minimum, let's say 4M and increase the
>> size later. In order to make the additional ram available to
>> RTEMS (i.e., after the malloc heap/libc have been initialized)
>> you have to implement a trivial 'sbrk()'. The only constraint
>> is that the 'late ram'-portion of the heap to be added by sbrk()
>> must be contiguous to the initial heap.
>>
>> You can look at powerpc/shared/bspstart which uses the
>> two-staged heap approach for different reasons.
>>
>> HTH
>> T.
>>
>>>>
>>>>
>>>>>
>>>>> Eric Norum wrote:
>>>>>
>>>>>>> You need to pass the --defsym option to the linker.
>>>>>>>
>>>>>>> On the compile line, add something like
>>>>>>>     -Wl,--defsym,_RamSize=0x10000000
>>>>>>>
>>>>>>> On Dec 2, 2005, at 10:50 PM, D. Peter Siddons wrote:
>>>>>>>
>>>>>>>> I have two boards which are identical except for the amounts  
>>>>>>>> of  flash and RAM. The linkcmds file has definitions for 
>>>>>>>> these   parameters like:
>>>>>>>> _RamSize = DEFINED(_RamSize) ? _RamSize : 0x7f0000;
>>>>>>>>
>>>>>>>> so my question is, can I invoke a definition somewhere in the   
>>>>>>>> application make process to override the one in linkcmds? If  
>>>>>>>> so,  how and/or where?
>>>>>>>>
>>>>>>>> Pete.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>
>>>> -- 
>>>> Eric Norum <norume at aps.anl.gov>
>>>> Advanced Photon Source
>>>> Argonne National Laboratory
>>>> (630) 252-4793
>>>>
>>>>
>>>
>>
>>




More information about the users mailing list