<div dir="auto"><div><br><div class="gmail_extra"><br><div class="gmail_quote">On Jun 12, 2017 3:10 PM, "Hesham Almatary" <<a href="mailto:heshamelmatary@gmail.com">heshamelmatary@gmail.com</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="elided-text"><br><br>On Tue, Jun 13, 2017 at 2:09 AM, Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com" target="_blank">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_<wbr>visitor>,<br>> direction=CHAIN_ITERATOR_<wbr>FORWARD)<br>> at<br>> /home/reprofy/Projects/riscv/<wbr>rtems/development/rtems/<wbr>kernel/rtems-riscv/c/src/../..<wbr>/cpukit/score/src/<wbr>userextiterate.c:155<br>> #1 0x20410ed4 in _User_extensions_Fatal (source=INTERNAL_ERROR_CORE,<br>> error=2) at<br>> ../../cpukit/../../../hifive1/<wbr>lib/include/rtems/score/<wbr>userextimpl.h:307<br>> #2 0x20410ef8 in _Terminate (the_source=INTERNAL_ERROR_<wbr>CORE, the_error=2)<br>> at<br>> /home/reprofy/Projects/riscv/<wbr>rtems/development/rtems/<wbr>kernel/rtems-riscv/c/src/../..<wbr>/cpukit/score/src/interr.c:35<br>> #3 0x20410f40 in _Internal_error<br>> (core_error=INTERNAL_ERROR_<wbr>TOO_LITTLE_WORKSPACE) at<br>> /home/reprofy/Projects/riscv/<wbr>rtems/development/rtems/<wbr>kernel/rtems-riscv/c/src/../..<wbr>/cpukit/score/src/interr.c:44<br>> #4 0x2041e484 in _Workspace_Handler_<wbr>initialization (areas=0x80002f78,<br>> area_count=1, extend=0x0) at<br>> /home/reprofy/Projects/riscv/<wbr>rtems/development/rtems/<wbr>kernel/rtems-riscv/c/src/../..<wbr>/cpukit/score/src/wkspace.c:<wbr>123<br>> #5 0x2040031c in bsp_work_area_initialize_<wbr>default (area_begin=0x80001d58,<br>> area_size=8872) at<br>> ../../../../../.././hifive1/<wbr>lib/include/bsp/bootcard.h:147<br>> #6 0x20400372 in bsp_work_area_initialize () at<br>> /home/reprofy/Projects/riscv/<wbr>rtems/development/rtems/<wbr>kernel/rtems-riscv/c/src/lib/<wbr>libbsp/riscv32/hifive1/../../<wbr>shared/bspgetworkarea.c:61<br>> #7 0x2040f3ce in rtems_initialize_executive () at<br>> /home/reprofy/Projects/riscv/<wbr>rtems/development/rtems/<wbr>kernel/rtems-riscv/c/src/../..<wbr>/cpukit/sapi/src/exinit.c:95<br>> #8 0x204002cc in boot_card (cmdline=0x0) at<br>> /home/reprofy/Projects/riscv/<wbr>rtems/development/rtems/<wbr>kernel/rtems-riscv/c/src/lib/<wbr>libbsp/riscv32/hifive1/../../<wbr>shared/bootcard.c:76<br>> #9 0x20400064 in _end_clear_bss () at<br>> /home/reprofy/Projects/riscv/<wbr>rtems/development/rtems/<wbr>kernel/rtems-riscv/c/src/lib/<wbr>libbsp/riscv32/hifive1/start/<wbr>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></div><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.</div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">This is how the SPARC start up stack is done. If you aren't careful, this may not match the assumption in the default method that carves up the workspace.</div><div dir="auto"><br></div><div dir="auto">You need to be careful that the memory regions don't overlap.</div><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="quoted-text"><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><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.</div></div></blockquote></div></div></div><div dir="auto"><br></div><div dir="auto">Is this a characteristic of this board or the architecture in general? I had the impression that the RISC-V was quite general purpose and could handle plenty of RAM even if some boards don't have much.</div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><font color="#888888"><br><br></font></div><font color="#888888"><div>> --<br>> Regards, Denis Obrezkov<br><br><br><br>-- <br>Hesha</div></font></div>
<br>______________________________<wbr>_________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/devel</a><br></blockquote></div><br></div></div></div>