<div dir="auto">Check the value in gdb without loading it on a target.<div dir="auto"><br></div><div dir="auto">Gdb hello.exe</div><div dir="auto"><br></div><div dir="auto">p symbol</div><div dir="auto"><br></div><div dir="auto">Since it is a constant, it should be as expected. If it is, you have a code loading issue.</div><div dir="auto"><br></div><div dir="auto">Is that value by any chance an instruction? </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Jun 19, 2017 4:03 PM, "Denis Obrezkov" <<a href="mailto:denisobrezkov@gmail.com">denisobrezkov@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-06-19 23:57 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 dir="ltr">Hi Denis,<br><br>If you cscope this symbol you'll end up with the following:<br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">/**                                                              <br> * By default, use the minimum stack size requested by this port.<br> */                                                              <br>#ifndef CONFIGURE_MINIMUM_TASK_STACK_S<wbr>IZE                        <br>  #define CONFIGURE_MINIMUM_TASK_STACK_S<wbr>IZE CPU_STACK_MINIMUM_SIZE<br>#endif                                                          <br></blockquote><br>This means if you, from the application (i.e. hello or ticker), didn't define CONFIGURE_MINIMUM_TASK_STACK_S<wbr>IZE it will be CPU_STACK_MINIMUM_SIZE which is 4KiB for riscv32 CPU (cpukit/score/cpu/riscv32/rtem<wbr>s/score/cpu.h:457)<br><br><br>On Mon, Jun 19, 2017 at 10:07 AM, Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com" target="_blank">denisobrezkov@gmail.com</a>> wrote:<br>> Hesham, could you check what is the value of rtems_minimum_stack_size in<br>> your SPIKE executable?<br>><br>> 2017-06-18 22:10 GMT+03:00 Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com" target="_blank">denisobrezkov@gmail.com</a>>:<br>>><br>>> Hello all,<br>>><br>>> I was able to proceed further via setting rtems_minimum_stack_size<br>>> manually to 0x200.<br>>> Now I have another error, my backtrace:<br>>> #0  0x20403728 in _Internal_error<br>>> (core_error=INTERNAL_ERROR_WOR<wbr>KSPACE_ALLOCATION)<br>>>     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>>> #1  0x2040ec40 in _Workspace_Allocate_or_fatal_e<wbr>rror (size=2976696) at<br>>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/score/src/wkspace.c:163<br>>> #2  0x2040f0e6 in _Freechain_Initialize (freechain=0x80000c3c<br>>> <_RTEMS_tasks_Information+60>, allocator=0x2040ec16<br>>> <_Workspace_Allocate_or_fatal_<wbr>error>, number_nodes=41343, node_size=72)<br>>>     at<br>>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/score/src/freechain.c:3<wbr>1<br>>> #3  0x20409346 in _Thread_Initialize_information (information=0x80000c00<br>>> <_RTEMS_tasks_Information>, the_api=OBJECTS_CLASSIC_API, the_class=1,<br>>> maximum=3908149631, is_string=false,<br>>>     maximum_name_length=4) at<br>>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/score/src/thread.c:68<br>>> #4  0x20401dac in _RTEMS_tasks_Manager_initializ<wbr>ation () at<br>>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/rtems/src/tasks.c:72<br>>> #5  0x204021bc 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>>> #6  0x2040031c 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>>> #7  0xffffcd98 in ?? ()<br>>><br>>> Is RTEMS trying to allocate 2976696 bytes?<br>>> It seems to me, that .data region is not properly initialized. What do you<br>>> think about this?<br>>><br>>> 2017-06-18 1:31 GMT+03:00 Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com" target="_blank">denisobrezkov@gmail.com</a>>:<br>>>><br>>>> 2017-06-17 22:11 GMT+03:00 Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com" target="_blank">denisobrezkov@gmail.com</a>>:<br>>>>>>><br>>>>>>><br>>>>>> Can you run RTEMS hello world? Or does printf make that too large? If<br>>>>>> that is<br>>>>>> too large, you need to force the tests to switch to printk(). There is<br>>>>>> some magic<br>>>>>> in testsuites/<a href="http://configure.ac" target="_blank">configure.ac</a> for that.<br>>>>>><br>>>>>> The low ticker examples (especially the last one) will show configure<br>>>>>> options<br>>>>>> to cut memory use.<br>>>>>><br>>>>>> But these are hacks on individual tests. If there is a simulator which<br>>>>>> has interrupts,<br>>>>>> I would be testing on it since you will be battling the architecture<br>>>>>> not a RAM limit.<br>>>>>> Your project is the port not to put RTEMS into a tiny memory space. :)<br>>>>>><br>>>>>> --joel<br>>>>>>  <br>>>>>>><br>>>>>>> --<br>>>>>>> Regards, Denis Obrezkov<br>>>>>><br>>>>>><br>>>>> I was able to run the low ticker example further than in my earlier<br>>>>> attempts.<br>>>>><br>>>>> But now I have a problem with it:<br>>>>> #0  memset (m=0xb98a0641, c=0, n=102) at<br>>>>> ../../../../../gcc-7.1.0/newli<wbr>b/libc/string/memset.c:62<br>>>>> #1  0x20403168 in _Heap_Initialize (heap=0xb98a0641,<br>>>>> heap_area_begin_ptr=0x80002456<wbr>, heap_area_size=7082, page_size=8)<br>>>>>     at<br>>>>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/score/src/heap.c:230<br>>>>> #2  0x20400954 in RTEMS_Malloc_Initialize (areas=0x80003f78,<br>>>>> area_count=1, extend=0x0)<br>>>>>     at<br>>>>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/libcsupport/src/malloc_<wbr>initialize.c:40<br>>>>> #3  0x20400378 in bsp_work_area_initialize_defau<wbr>lt<br>>>>> (area_begin=0x80000e10, area_size=12784) at<br>>>>> ../../../../../.././hifive1/li<wbr>b/include/bsp/bootcard.h:158<br>>>>> #4  0x204003c0 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>>>>> #5  0x204021bc 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>>>>> #6  0x2040031c 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>>>>> #7  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>>>>> I want to figure out, why it wants to use memset on these addresses,<br>>>>> because 0x80004000 is the maximum available address.<br>>>>><br>>>>><br>>>>> --<br>>>>> Regards, Denis Obrezkov<br>>>><br>>>><br>>>> I was able to proceed further after adding<br>>>> #define CONFIGURE_UNIFIED_WORK_AREAS<br>>>> to init.c of low_ticker example.<br>>>> Now I get an error:<br>>>> #0  0x2040d940 in _Chain_Initialize_node (the_node=0x80003ec0) at<br>>>> ../../cpukit/../../../hifive1/<wbr>lib/include/rtems/score/chaini<wbr>mpl.h:127<br>>>> #1  0x2040da82 in _Chain_Iterator_initialize (the_chain=0x80000320<br>>>> <_User_extensions_List>, the_registry=0x8000032c <_User_extensions_List+12>,<br>>>> the_iterator=0x80003ec0,<br>>>>     direction=CHAIN_ITERATOR_FORWA<wbr>RD) at<br>>>> ../../cpukit/../../../hifive1/<wbr>lib/include/rtems/score/chaini<wbr>mpl.h:1049<br>>>> #2  0x2040de90 in _User_extensions_Iterate (arg=0x80003f18,<br>>>> visitor=0x2040dd48 <_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:174<br>>>> #3  0x204036c4 in _User_extensions_Fatal (source=INTERNAL_ERROR_CORE,<br>>>> error=4) at<br>>>> ../../cpukit/../../../hifive1/<wbr>lib/include/rtems/score/userex<wbr>timpl.h:307<br>>>> #4  0x204036e8 in _Terminate (the_source=INTERNAL_ERROR_COR<wbr>E,<br>>>> the_error=4) 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>>>> #5  0x20403730 in _Internal_error<br>>>> (core_error=INTERNAL_ERROR_INT<wbr>ERRUPT_STACK_TOO_SMALL)<br>>>>     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>>>> #6  0x20403824 in _ISR_Handler_initialization () at<br>>>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/score/src/isr.c:51<br>>>> #7  0x20402170 in rtems_initialize_data_structur<wbr>es () at<br>>>> /home/reprofy/Projects/riscv/r<wbr>tems/development/rtems/kernel/<wbr>rtems-riscv/c/src/../../<wbr>cpukit/sapi/src/exinit.c:82<br>>>> #8  0x204021bc 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>>>> #9  0x2040031c 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>>>> #10 0xffffcd98 in ?? ()<br>>>><br>>>> And I found out that rtems_minimum_stack_size variable is 0xab817bb3.<br>>>> And I don't know why - in the low ticker example it is set to 512.<br>>>><br>>>> --<br>>>> Regards, Denis Obrezkov<br>>><br>>><br>>><br>>><br>>> --<br>>> Regards, Denis Obrezkov<br>><br>><br>><span class="m_6572704935090555502gmail-HOEnZb"><font color="#888888"><br>><br>> --<br>> Regards, Denis Obrezkov<br><br><br><br>-- <br>Hesham</font></span></div>
</blockquote></div><br>Yes, I have configured it in application.</div><div>Anyway, the number 0xab817bb3 is not for 4 KiB.  </div><div><div><br></div>-- <br><div class="m_6572704935090555502gmail_signature">Regards, Denis Obrezkov</div>
</div></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></div>