<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 13, 2017 at 10:20 PM, Joel Sherrill <span dir="ltr"><<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div><div class="gmail-h5"><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" target="_blank">heshamelmatary@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail-m_-5102351179215020596quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail-m_-5102351179215020596elided-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_visito<wbr>r>,<br>> direction=CHAIN_ITERATOR_FORWA<wbr>RD)<br>>     at<br>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/score/src/userextiterat<wbr>e.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/userex<wbr>timpl.h:307<br>> #2  0x20410ef8 in _Terminate (the_source=INTERNAL_ERROR_COR<wbr>E, the_error=2)<br>> at<br>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/score/src/interr.c:35<br>> #3  0x20410f40 in _Internal_error<br>> (core_error=INTERNAL_ERROR_TOO<wbr>_LITTLE_WORKSPACE) at<br>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/score/src/interr.c:44<br>> #4  0x2041e484 in _Workspace_Handler_initializat<wbr>ion (areas=0x80002f78,<br>> area_count=1, extend=0x0) at<br>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/score/src/wkspace.c:123<br>> #5  0x2040031c in bsp_work_area_initialize_defau<wbr>lt (area_begin=0x80001d58,<br>> area_size=8872) at<br>> ../../../../../.././hifive1/li<wbr>b/include/bsp/bootcard.h:147<br>> #6  0x20400372 in bsp_work_area_initialize () at<br>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/lib/libbsp/<wbr>riscv32/hifive1/../../shared/<wbr>bspgetworkarea.c:61<br>> #7  0x2040f3ce in rtems_initialize_executive () at<br>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>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/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/lib/libbsp/<wbr>riscv32/hifive1/../../shared/<wbr>bootcard.c:76<br>> #9  0x20400064 in _end_clear_bss () at<br>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/lib/libbsp/<wbr>riscv32/hifive1/start/start.S:<wbr>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></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><span class="gmail-"><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail-m_-5102351179215020596quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail-m_-5102351179215020596quoted-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></span><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="gmail-m_-5102351179215020596quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-"><div dir="ltr"><div><font color="#888888"><br></font></div></div></span></blockquote></div></div></div></div></blockquote><div>RISC-V itself doesn't put such restrictions on the size of memory (e.g. Linux, seL4, RTEMS can run on FPGA and/or simulators). There's a compressed extension for RISC-V (like thumb) for platforms that have small memories same as HiFive. Having such small memory is only HiFive related, not RISC-V.<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto"><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail-m_-5102351179215020596quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-"><div dir="ltr"><div><font color="#888888"><br></font></div><font color="#888888"><div>> --<br>> Regards, Denis Obrezkov<br><br><br><br>-- <br>Hesha</div></font></div>
<br></span><span class="gmail-">______________________________<wbr>_________________<br>
devel mailing list<br>
<a href="mailto:devel@rtems.org" target="_blank">devel@rtems.org</a><br>
<a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman<wbr>/listinfo/devel</a><br></span></blockquote></div><br></div></div></div>
</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Hesham</div>
</div></div>