Risc-v memory issue

Joel Sherrill joel at rtems.org
Mon Jun 12 17:17:19 UTC 2017


On Mon, Jun 12, 2017 at 11: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
>

^^^^^^

Looks like there isn't enough RAM for the amount of workspace needed. This
could indicate
that your address map is wrong or that the calculation in
bsp_work_area_initialize_default()
is doing the right thing and there really isn't enough RAM left after the
BSS.

Look at a symbol table sorted by address (nm -n -g) and look for the
various segment
boundaries. See how that corresponds to the address map of the board.

Also in gdb, you can poke at a program a bit without really loading it on a
target.
This can be done to look at the Configuration Table and other statically
initialized
data structures.

XXX-gdb hello.exe
(gdb) p Configuration


The first step is figuring out if this error is real or a side-effect of a
bad address map.

You probably should lower the minimum stack size for this architecture as
well
as the size of the starting stack. You don't have that much memory.



> #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?
> 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?
>
> --
> Regards, Denis Obrezkov
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20170612/89be8f3e/attachment-0002.html>


More information about the devel mailing list