<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_SIZE                        <br>  #define CONFIGURE_MINIMUM_TASK_STACK_SIZE 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_SIZE it will be CPU_STACK_MINIMUM_SIZE which is 4KiB for riscv32 CPU (cpukit/score/cpu/riscv32/rtems/score/cpu.h:457)<br><br><br>On Mon, Jun 19, 2017 at 10:07 AM, Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com">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">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_WORKSPACE_ALLOCATION)<br>>>     at<br>>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:44<br>>> #1  0x2040ec40 in _Workspace_Allocate_or_fatal_error (size=2976696) at<br>>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../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_error>, number_nodes=41343, node_size=72)<br>>>     at<br>>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/freechain.c:31<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/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/thread.c:68<br>>> #4  0x20401dac in _RTEMS_tasks_Manager_initialization () at<br>>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/rtems/src/tasks.c:72<br>>> #5  0x204021bc 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>>> #6  0x2040031c 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>>> #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">denisobrezkov@gmail.com</a>>:<br>>>><br>>>> 2017-06-17 22:11 GMT+03:00 Denis Obrezkov <<a href="mailto:denisobrezkov@gmail.com">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">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/newlib/libc/string/memset.c:62<br>>>>> #1  0x20403168 in _Heap_Initialize (heap=0xb98a0641,<br>>>>> heap_area_begin_ptr=0x80002456, heap_area_size=7082, page_size=8)<br>>>>>     at<br>>>>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../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/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/libcsupport/src/malloc_initialize.c:40<br>>>>> #3  0x20400378 in bsp_work_area_initialize_default<br>>>>> (area_begin=0x80000e10, area_size=12784) at<br>>>>> ../../../../../.././hifive1/lib/include/bsp/bootcard.h:158<br>>>>> #4  0x204003c0 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>>>>> #5  0x204021bc 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>>>>> #6  0x2040031c 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>>>>> #7  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>>>>> 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/lib/include/rtems/score/chainimpl.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_FORWARD) at<br>>>> ../../cpukit/../../../hifive1/lib/include/rtems/score/chainimpl.h:1049<br>>>> #2  0x2040de90 in _User_extensions_Iterate (arg=0x80003f18,<br>>>> visitor=0x2040dd48 <_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:174<br>>>> #3  0x204036c4 in _User_extensions_Fatal (source=INTERNAL_ERROR_CORE,<br>>>> error=4) at<br>>>> ../../cpukit/../../../hifive1/lib/include/rtems/score/userextimpl.h:307<br>>>> #4  0x204036e8 in _Terminate (the_source=INTERNAL_ERROR_CORE,<br>>>> the_error=4) at<br>>>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:35<br>>>> #5  0x20403730 in _Internal_error<br>>>> (core_error=INTERNAL_ERROR_INTERRUPT_STACK_TOO_SMALL)<br>>>>     at<br>>>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/interr.c:44<br>>>> #6  0x20403824 in _ISR_Handler_initialization () at<br>>>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/score/src/isr.c:51<br>>>> #7  0x20402170 in rtems_initialize_data_structures () at<br>>>> /home/reprofy/Projects/riscv/rtems/development/rtems/kernel/rtems-riscv/c/src/../../cpukit/sapi/src/exinit.c:82<br>>>> #8  0x204021bc 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>>>> #9  0x2040031c 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>>>> #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>><br>><br>> --<br>> Regards, Denis Obrezkov<br><br><br><br>-- <br>Hesham</div>