<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-06-14 8:35 GMT+03:00 Hesham Almatary <span dir="ltr"><<a href="mailto:heshamelmatary@gmail.com" target="_blank">heshamelmatary@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On Wed, Jun 14, 2017 at 2:58 PM, Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com">denisobrezkov@gmail.com</a>> wrote:<br>
> 2017-06-14 2:18 GMT+03:00 Hesham Almatary <<a href="mailto:heshamelmatary@gmail.com">heshamelmatary@gmail.com</a>>:<br>
>><br>
>><br>
>><br>
>> On Tue, Jun 13, 2017 at 10:20 PM, Joel Sherrill <<a href="mailto:joel@rtems.org">joel@rtems.org</a>> wrote:<br>
>>><br>
>>><br>
>>><br>
>>> On Jun 12, 2017 3:10 PM, "Hesham Almatary" <<a href="mailto:heshamelmatary@gmail.com">heshamelmatary@gmail.com</a>><br>
>>> wrote:<br>
>>><br>
>>><br>
>>><br>
>>> On Tue, Jun 13, 2017 at 2:09 AM, Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com">denisobrezkov@gmail.com</a>><br>
>>> 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>
>>> ><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,<br>
>>> > the_error=2)<br>
>>> > at<br>
>>> ><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>
>>> ><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>
>>> ><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<br>
>>> > (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>
>>> ><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>
>>> ><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>
>>> ><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>
>>> ><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>
>>>><br>
>>>> /*<br>
>>>> * The stack section will occupy the remaining<br>
>>>> REGION_STACK region and may<br>
>>>> * contain the task stacks. Depending on the region<br>
>>>> distribution this<br>
>>>> * section may be of zero size.<br>
>>>> */<br>
>>><br>
>>> This means that the stack_end address is starting at your very top<br>
>>> address space (i.e. 16KiB if you set your linker size to 16KiB). The stack<br>
>>> grows dynamically downwards, so it might overflow other sections (e.g. work,<br>
>>> heap, data, etc) if you don't have enough memory size to fit. You can try to<br>
>>> see how much size each section occupies (riscv32-rtems4.12-objdump -h<br>
>>> hello.exe), especially work space.<br>
>>><br>
>>><br>
>>> This is how the SPARC start up stack is done. If you aren't careful, this<br>
>>> may not match the assumption in the default method that carves up the<br>
>>> workspace.<br>
>>><br>
>>> You need to be careful that the memory regions don't overlap.<br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> > And why there were no space for stack? is it possible to work without<br>
>>> > stack<br>
>>> > allocated in<br>
>>> > linkcmd file?<br>
>>> > Can RTEMS work with a smaller workspace?<br>
>>> ><br>
>>> As far as I remember, 4KiB was the smallest I could allocate for<br>
>>> workspace to work (with Epiphany). As I suggested before, you might want to<br>
>>> start saving up memory by using the local instruction memory (on HiFive) and<br>
>>> compressed version of RISC-V ISA.<br>
>>><br>
>>><br>
>>> Is this a characteristic of this board or the architecture in general? I<br>
>>> had the impression that the RISC-V was quite general purpose and could<br>
>>> handle plenty of RAM even if some boards don't have much.<br>
>>><br>
>>><br>
>> RISC-V itself doesn't put such restrictions on the size of memory (e.g.<br>
>> Linux, seL4, RTEMS can run on FPGA and/or simulators). There's a compressed<br>
>> extension for RISC-V (like thumb) for platforms that have small memories<br>
>> same as HiFive. Having such small memory is only HiFive related, not RISC-V.<br>
>>><br>
>>><br>
>>> > --<br>
>>> > Regards, Denis Obrezkov<br>
>>><br>
>>><br>
>>><br>
>>> --<br>
>>> Hesha<br>
>>><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>
>>><br>
>>><br>
>><br>
>><br>
>><br>
>> --<br>
>> Hesham<br>
><br>
> I think that RISC-V Compressed ISA can't reduce .bss and .data sections, am<br>
> I right?<br>
> So, it seems that space allocated by rtems for its workspace should be<br>
> reduced.<br>
><br>
</div></div>Currently all of the sections (including .bss, .text, .data, etc) are<br>
competing for 16KiB memory, if you reduced the .text (using compressed<br>
RISC-V and/or ITIM) section size, this gives more space for other<br>
sections, hence .work and .stack.<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
><br>
> --<br>
> Regards, Denis Obrezkov<br>
<br>
<br>
<br>
--<br>
</div></div><span class="gmail-HOEnZb"><font color="#888888">Hesham<br>
</font></span></blockquote></div>In my linkcmd file .text is located in flash:</div><div class="gmail_extra"><a href="https://github.com/embeddedden/rtems-riscv/blob/hifive1/c/src/lib/libbsp/riscv32/hifive1/startup/linkcmds">https://github.com/embeddedden/rtems-riscv/blob/hifive1/c/src/lib/libbsp/riscv32/hifive1/startup/linkcmds</a><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Regards, Denis Obrezkov</div>
</div></div>