Risc-v memory issue

Denis Obrezkov denisobrezkov at gmail.com
Tue Jun 13 08:10:41 UTC 2017


2017-06-12 23:10 GMT+03:00 Hesham Almatary <heshamelmatary at gmail.com>:

>
>
> On Tue, Jun 13, 2017 at 2:09 AM, Denis Obrezkov <denisobrezkov at gmail.com>
> wrote:
> > Hello all,
> >
> > I was able to debug my program on top of HiFive1 board.
> > I found out that I can't use next and until commands from gdb,
> > they just hang gdb.
> > And now I have a problem, this is my backtrace:
> >
> > #0  0x2041d728 in _User_extensions_Iterate (arg=0x80002eb8,
> > visitor=0x2041d64e <_User_extensions_Fatal_visitor>,
> > direction=CHAIN_ITERATOR_FORWARD)
> >     at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/userextiterate.c:155
> > #1  0x20410ed4 in _User_extensions_Fatal (source=INTERNAL_ERROR_CORE,
> > error=2) at
> > ../../cpukit/../../../hifive1/lib/include/rtems/score/userextimpl.h:307
> > #2  0x20410ef8 in _Terminate (the_source=INTERNAL_ERROR_CORE,
> the_error=2)
> > at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:35
> > #3  0x20410f40 in _Internal_error
> > (core_error=INTERNAL_ERROR_TOO_LITTLE_WORKSPACE) at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:44
> > #4  0x2041e484 in _Workspace_Handler_initialization (areas=0x80002f78,
> > area_count=1, extend=0x0) at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/score/src/wkspace.c:123
> > #5  0x2040031c in bsp_work_area_initialize_default
> (area_begin=0x80001d58,
> > area_size=8872) at
> > ../../../../../.././hifive1/lib/include/bsp/bootcard.h:147
> > #6  0x20400372 in bsp_work_area_initialize () at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../
> shared/bspgetworkarea.c:61
> > #7  0x2040f3ce in rtems_initialize_executive () at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/../../cpukit/sapi/src/exinit.c:95
> > #8  0x204002cc in boot_card (cmdline=0x0) at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../
> shared/bootcard.c:76
> > #9  0x20400064 in _end_clear_bss () at
> > /home/reprofy/Projects/riscv/rtems/development/rtems/
> kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/start/start.S:116
> >
> > So, I think I should increase a workspace.
> > Now, I have some questions:
> > I took Hesham's linker file for riscv-generic, and there were no stack
> > space,
> > I allocated 0x1000 for stack. Should I make it zero again, or should I
> > decrease its size?
> > what size for stack should be enough?
>
>>                 /*
>>                  * The stack section will occupy the remaining
>> REGION_STACK region and may
>>                  * contain the task stacks.  Depending on the region
>> distribution this
>>                  * section may be of zero size.
>>                  */
>>
> This means that the stack_end address is starting at your very top address
> space (i.e. 16KiB if you set your linker size to 16KiB). The stack grows
> dynamically downwards, so it might overflow other sections (e.g. work,
> heap, data, etc) if you don't have enough memory size to fit. You can try
> to see how much size each section occupies (riscv32-rtems4.12-objdump -h
> hello.exe), especially work space.
>
>
> > And why there were no space for stack? is it possible to work without
> stack
> > allocated in
> > linkcmd file?
> > Can RTEMS work with a smaller workspace?
> >
> As far as I remember, 4KiB was the smallest I could allocate for workspace
> to work (with Epiphany). As I suggested before, you might want to start
> saving up memory by using the local instruction memory (on HiFive) and
> compressed version of RISC-V ISA.
>
> > --
> > Regards, Denis Obrezkov
>
>
>
> --
> Hesha
>
I think that problem is that my bss section spends 0x1440 byte.
And rtems requires its workspace to be about 15 KiB.
(I have an error in wkspace.c:137 - 'remaining' is 7024 during the error).

And I am not sure is it possible to store bss in ITIM,
details can be found in E31 Coreplex manual, 3.1.
I've tried to push bss to ITIM, but I had errors during clearing it.


Do you think compressed ISA will help? or, how can we reduce the size of
the required space?


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


More information about the devel mailing list