<div dir="ltr"><br><br>On Tue, Jun 13, 2017 at 2:09 AM, Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com">denisobrezkov@gmail.com</a>> wrote:<br>> Hello all,<br>><br>> I was able to debug my program on top of HiFive1 board.<br>> I found out that I can't use next and until commands from gdb,<br>> they just hang gdb.<br>> And now I have a problem, this is my backtrace:<br>><br>> #0  0x2041d728 in _User_extensions_Iterate (arg=0x80002eb8,<br>> visitor=0x2041d64e <_User_extensions_Fatal_visitor>,<br>> direction=CHAIN_ITERATOR_FORWARD)<br>>     at<br>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/userextiterate.c:155<br>> #1  0x20410ed4 in _User_extensions_Fatal (source=INTERNAL_ERROR_CORE,<br>> error=2) at<br>> ../../cpukit/../../../hifive1/lib/include/rtems/score/userextimpl.h:307<br>> #2  0x20410ef8 in _Terminate (the_source=INTERNAL_ERROR_CORE, the_error=2)<br>> at<br>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:35<br>> #3  0x20410f40 in _Internal_error<br>> (core_error=INTERNAL_ERROR_TOO_LITTLE_WORKSPACE) at<br>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:44<br>> #4  0x2041e484 in _Workspace_Handler_initialization (areas=0x80002f78,<br>> area_count=1, extend=0x0) at<br>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/wkspace.c:123<br>> #5  0x2040031c in bsp_work_area_initialize_default (area_begin=0x80001d58,<br>> area_size=8872) at<br>> ../../../../../.././hifive1/lib/include/bsp/bootcard.h:147<br>> #6  0x20400372 in bsp_work_area_initialize () at<br>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../shared/bspgetworkarea.c:61<br>> #7  0x2040f3ce in rtems_initialize_executive () at<br>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/sapi/src/exinit.c:95<br>> #8  0x204002cc in boot_card (cmdline=0x0) at<br>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/../../shared/bootcard.c:76<br>> #9  0x20400064 in _end_clear_bss () at<br>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/lib/libbsp/riscv32/hifive1/start/start.S:116<br>><br>> So, I think I should increase a workspace.<br>> Now, I have some questions:<br>> I took Hesham's linker file for riscv-generic, and there were no stack<br>> space,<br>> I allocated 0x1000 for stack. Should I make it zero again, or should I<br>> decrease its size?<br>> what size for stack should be enough?<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">                /*<br>                 * The stack section will occupy the remaining REGION_STACK region and may<br>                 * contain the task stacks.  Depending on the region distribution this<br>                 * section may be of zero size.<br>                 */<br></blockquote>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.<br><br><div><br>> And why there were no space for stack? is it possible to work without stack<br>> allocated in<br>> linkcmd file?<br>> Can RTEMS work with a smaller workspace?<br>><br></div><div>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.<br><br></div><div>> --<br>> Regards, Denis Obrezkov<br><br><br><br>-- <br>Hesha</div></div>