Optimization issue in RISC-V BSP

Denis Obrezkov denisobrezkov at gmail.com
Fri Jul 28 12:08:39 UTC 2017


2017-07-28 13:11 GMT+02:00 Gedare Bloom <gedare at rtems.org>:

> On Thu, Jul 27, 2017 at 7:43 PM, Denis Obrezkov <denisobrezkov at gmail.com>
> wrote:
> > I didn't want to enable optimization because I was afraid of new
> mistakes.
> > So, I enabled -Os and now I have:
> > _Terminate (the_source=the_source at entry=INTERNAL_ERROR_CORE,
> > the_error=the_error at entry=3)
> >     at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:44
> > 44        _CPU_Fatal_halt( the_source, the_error );
> > (gdb) i s
> > #0  _Terminate (the_source=the_source at entry=INTERNAL_ERROR_CORE,
> > the_error=the_error at entry=3)
> >     at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:44
> > #1  0x20401672 in _Internal_error
> > (core_error=core_error at entry=INTERNAL_ERROR_WORKSPACE_ALLOCATION)
> >     at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:51
> > #2  0x20404968 in _Workspace_Allocate_or_fatal_error (size=<optimized
> out>)
> > at ../../cpukit/../../../hifive1/lib/include/rtems/score/heapimpl.h:137
> > #3  0x20401f76 in _Objects_Extend_information (information=0x80000ad4
> > <_RTEMS_tasks_Information>)
> >     at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/
> objectextendinformation.c:70
> > #4  0x20402110 in _Objects_Do_initialize_information
> > (information=information at entry=0x80000ad4 <_RTEMS_tasks_Information>,
> > the_api=the_api at entry=OBJECTS_CLASSIC_API,
> >     the_class=<optimized out>, maximum=maximum at entry=124,
> size=<optimized
> > out>, is_string=<optimized out>,
> > maximum_name_length=maximum_name_length at entry=4)
> >     at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/
> objectinitializeinformation.c:118
> > #5  0x20402e3a in _Thread_Initialize_information
> > (information=information at entry=0x80000ad4 <_RTEMS_tasks_Information>,
> > the_api=the_api at entry=OBJECTS_CLASSIC_API,
> >     the_class=the_class at entry=1, maximum=124,
> > is_string=is_string at entry=false,
> > maximum_name_length=maximum_name_length at entry=4)
> >     at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/thread.c:57
> > #6  0x20400ff8 in _RTEMS_tasks_Manager_initialization () at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/rtems/src/tasks.c:72
> > #7  0x2040112e in rtems_initialize_executive () at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/sapi/src/exinit.c:92
> > #8  0x20400496 in boot_card (cmdline=<optimized out>) at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../
> shared/bootcard.c:78
> >
> > Though, the size of executable is much lower (almost two times),
> > but I get this mistake. And as for now I can't understand do I have the
> > error
> > due to optimization or has the optimization revealed another issue?
> >
>
> Most likely it has revealed another issue. It appears that the
> workspace is out of room and the allocate request fails. This could be
> a problem in the application's configuration (CONFIGURE_XXX macros) or
> is another side-effect of the memory constraints on your device. How
> much workspace is there available in your linker script, can you tell?
> Are you using unified heap and workspace?
>
>
> > --
> > Regards, Denis Obrezkov
> >
> > _______________________________________________
> > devel mailing list
> > devel at rtems.org
> > http://lists.rtems.org/mailman/listinfo/devel
>

In my linker scripts all ram is allocated - 16 K:
https://github.com/embeddedden/rtems-riscv/blob/hifive1/c/src/lib/libbsp/riscv32/hifive1/startup/linkcmds

I use:
CONFIGURE_UNIFIED_WORK_AREAS


-- 
Regards, Denis Obrezkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170728/cb9f988b/attachment.html>


More information about the devel mailing list