RTEMS 4.0.0 bug? LIBC_HEAP_SIZE

Joel Sherrill joel.sherrill at OARcorp.com
Thu Nov 16 13:58:54 UTC 2000


When tinkering with the call to bsp_libc_init(), I would highly
recommend looking at the way the m68k BSPs do it now.  They
all use the same code (libbsp/m68k/m68kpretaskinghook.c).  The
linkcmds for each BSP define a few symbols that can be overridden
at link time.   

"Alexander D. Tarkhov" wrote:
> 
> Hello, rtems users,
> 
> I found a strange call to bsp_libc_init() in
> bsp_start() function for my bsp.
> We use bsp "p4000", target "mips64orion".
> So the code is located in
> tools/rtems-4.0.0/c/src/lib/libbsp/mips64orion/p4000/startup/bspstart.c
> 
> It goes as follows:
>   BSP_Configuration.work_space_start =
>        (void *)((unsigned64)((&end) + LIBC_HEAP_SIZE + 0x2000) & ~0x7);
> 
> Seems to me that it may cause an error, if LIBC_HEAP_SIZE is the
> required size of the heap in bytes. How does the compiler treat such
> expressions,
> as pointer arythmetics, or as normal integer?
> 
> In any case I am going to test the following:
>   BSP_Configuration.work_space_start =
>        (void *)((unsigned64)(((int)(&end)) + LIBC_HEAP_SIZE + 0x2000) &
> ~0x7);
> 
> Does that seem reasonable?

Your change is reasonable.

> And what is a strange constant 0x2000?

Probably a reserved stack for initialization in the linker script.
Look at any m68k BSP (gen68360 or mvme16[27] being at the top of the
list) for a cleaner way.

> I understand that few people (if any) are interested in such errors,
> and that BSP is my own problem. Still let it just lay in the archives :)

These problems need to be fixed.  The BSPs in the distribution -- if not
used directly -- are copied as the starting point for custom BSPs. 
Mistakes
and hacks propagate.

if you can get this to the clearner m68k way, then please submit it.
It will allow you MUCH more control over things in a safer fashion.

> Thank you for your comments.
> 
> Best regards,
> Alexander Tarkhov

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
   Support Available             (256) 722-9985



More information about the users mailing list