<div dir="ltr"><div>Hi Joel,</div><div><br></div>I still did not resolve the problem with my CPU card  mcp750 with 32MB. I would like to run RTEMS5 + EPICS7 on it.<div><br></div><div>I have tried to tweak various options in <EPICS_BASE>/modules/libcom/RTEMS/posix/rtems_config.c<br></div><div>but still the same:</div><div>The error messages I get are:<br><font color="#0000ff">pthread_create error No more processes<br>CAS: unable to start the event facility</font><br></div><div><br></div><div>The problem refers, I guess, to too small size of memory for mallocs (as i have shown in my previous email in this thread)</div><div><br></div><div>My <EPICS_BASE>/modules/libcom/RTEMS/posix/rtems_config.c looks like:</div><div><br></div><div><font color="#0000ff">#define CONFIGURE_POSIX_INIT_THREAD_TABLE<br>#define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT POSIX_Init<br>#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE  (128*1024)<br><br>#define CONFIGURE_MAXIMUM_PERIODS       5<br>#define CONFIGURE_MICROSECONDS_PER_TICK 10000<br>#define CONFIGURE_MALLOC_STATISTICS     1<br><br>/* MINIMUM_STACK_SIZE == 8K */<br>#define CONFIGURE_EXTRA_TASK_STACKS         (2048 * RTEMS_MINIMUM_STACK_SIZE) /* 16MB */<br><br></font></div><div><font color="#0000ff">#if __RTEMS_MAJOR__ > 4<br>#define CONFIGURE_FILESYSTEM_DEVFS<br>#define CONFIGURE_FILESYSTEM_TFTPFS<br>#endif<br>#define CONFIGURE_FILESYSTEM_NFS<br>#define CONFIGURE_FILESYSTEM_IMFS<br><br>#ifndef RTEMS_LEGACY_STACK<br>#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM<br>/* Configure LibBSD. */<br>#define RTEMS_BSD_CONFIG_BSP_CONFIG<br>#define RTEMS_BSD_CONFIG_INIT<br>#include <machine/rtems-bsd-config.h><br>#endif // not LEGACY_STACK<br></font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">/* Max FDs cannot exceed FD_SETSIZE from newlib (64) */<br>#define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 64<br>#define CONFIGURE_IMFS_ENABLE_MKFIFO    2<br><br>#define CONFIGURE_MAXIMUM_NFS_MOUNTS            3<br>#define CONFIGURE_MAXIMUM_USER_EXTENSIONS       5<br><br>#define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 32<br>#define CONFIGURE_UNLIMITED_OBJECTS<br><b>#define CONFIGURE_UNIFIED_WORK_AREAS</b><br><br>#define CONFIGURE_STACK_CHECKER_ENABLED<br></font></div><div><font color="#0000ff"><br></font></div><div><font color="#0000ff">#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK<br>#define CONFIGURE_BDBUF_BUFFER_MAX_SIZE (128 * 1024)<br>#define CONFIGURE_BDBUF_MAX_READ_AHEAD_BLOCKS 8<br>#define CONFIGURE_BDBUF_CACHE_MEMORY_SIZE (2 * 1024 * 1024)</font><br></div><div><br></div><div>>If it is configured for unified workspace, you wouldn't specify extra stacks and this wouldn't have been tripped.</div>>Unified and unlimited can avoid some issues.<div><br></div><div>Do you think that for the card with 32MB of RAM better option would be to use just:</div><div>#define CONFIGURE_EXECUTIVE_RAM_SIZE (30*1024*1024)<br></div><div>#define CONFIGURE_UNIFIED_WORK_AREAS</div><div><br></div><div>Best Regards</div><div>Mirek</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">pon., 23 maj 2022 o 17:55 Miroslaw Dach <<a href="mailto:miroslaw.dach@gmail.com">miroslaw.dach@gmail.com</a>> napisał(a):<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="ltr"><div dir="ltr">I have changed the CONFIGURE_EXTRA_TASK_STACKS <div>from </div><div>#define CONFIGURE_EXTRA_TASK_STACKS         (4000 * RTEMS_MINIMUM_STACK_SIZE)</div><div>down to <br><div>#define CONFIGURE_EXTRA_TASK_STACKS         (3000 * RTEMS_MINIMUM_STACK_SIZE)<br></div></div></div><div>so now it is 24MB instead of the original 32MB.</div><div><br></div><div>The system boots now without the error: INTERNAL_ERROR_TOO_LITTLE_WORKSPACE</div><div><br></div><div>Unfortunately the problem is not completely solved:</div><div>I get error periodic error message:</div><div><br></div><div>pthread_create error No more processes<br>CAS: unable to start the event facility<br></div><div><br></div><div>I used the diagnostic shell command:</div><div>rt malloc :</div><div>Number of free blocks:                              28<br>Largest free block:                               6288<br>Total bytes free:                                12456<br>Number of used blocks:                           16522<br>Largest used block:                            1048848<br>Total bytes used:                             30342640<br>Size of the allocatable area in bytes:        30355096<br>Minimum free size ever in bytes:                 12456<br>Maximum number of free blocks ever:                107<br>Maximum number of blocks searched ever:             54<br>Lifetime number of bytes allocated:           31278104<br>Lifetime number of bytes freed:                 917336<br>Total number of searches:                        37008<br>Total number of successful allocations:          18126<br>Total number of failed allocations:                  40<br>Total number of successful frees:                 1604<br>Total number of successful resizes:                169<br></div><div><br></div><div>It looks like there is problem with the memory allocation (Total number of failed allocations:                  40)</div><div>It is also quit small Number of free blocks: (Number of free blocks:                              28)</div><div><br></div><div>Could you advise me please which config parameters to tweak to resolve the issue with the number of failed allocations. I hope that the RAM size (32MB) of the mcp750 card is good enough.  </div><div><br></div><div>Best Regards</div><div>Mirek</div><div><br></div><div><br></div><div><br></div><div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">sob., 21 maj 2022 o 12:42 Miroslaw Dach <<a href="mailto:miroslaw.dach@gmail.com" target="_blank">miroslaw.dach@gmail.com</a>> napisał(a):<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="ltr"><div dir="ltr">Hi Joel,<div><br></div><div>>If it is configured for unified workspace, you wouldn't specify extra stacks and this wouldn't have been tripped.</div><div>Do you mean that CONFIGURE_EXTRA_TASK_STACKS is not taken into account when CONFIGURE_UNIFIED_WORK_AREAS is defined? </div><div>I have checked the powerpc-rtems5/mcp750/lib/include/rtems/confdefs/wkspace.h and it seems the CONFIGURE_EXTRA_TASK_STACKS is used to calculate the stack size?</div><div><br></div></div><div>#define _CONFIGURE_STACK_SPACE_SIZE \<br>  ( _CONFIGURE_INIT_TASK_STACK_EXTRA \<br>    + _CONFIGURE_POSIX_INIT_THREAD_STACK_EXTRA \<br>    + _CONFIGURE_LIBBLOCK_TASKS_STACK_EXTRA \<br>    + CONFIGURE_EXTRA_TASK_STACKS \<br>    + rtems_resource_maximum_per_allocation( _CONFIGURE_TASKS ) \<br>      * _Configure_From_stackspace( CONFIGURE_MINIMUM_TASK_STACK_SIZE ) \<br>    + rtems_resource_maximum_per_allocation( CONFIGURE_MAXIMUM_POSIX_THREADS ) \<br>      * _Configure_From_stackspace( CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE ) \<br>    + _CONFIGURE_HEAP_HANDLER_OVERHEAD )<br><br>#else /* CONFIGURE_EXECUTIVE_RAM_SIZE */<br></div><div><br></div><div>What is the meaning of CONFIGURE_UNLIMITED_ALLOCATION_SIZE . Does it express the size in KB?</div><div>Currently epics defines:</div><div><br></div><div>#define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 32</div><div>#define CONFIGURE_UNLIMITED_OBJECTS</div><div><br></div><div>Best Regards</div><div>Mirek</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">sob., 21 maj 2022 o 10:06 Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank">joel@rtems.org</a>> napisał(a):<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><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, May 21, 2022, 11:02 AM Miroslaw Dach <<a href="mailto:miroslaw.dach@gmail.com" target="_blank">miroslaw.dach@gmail.com</a>> wrote:<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="ltr">Hi Hainz,<div><br></div><div>Thanks for the indication. I have exactly found this setting and am going to reduce </div><div>CONFIGURE_EXTRA_TASK_STACKS which is currently setup by default in EPICS to 32MB.<br></div><div>The mcp750 has just 32MB so it is no wonder that it does not work.</div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">If it is configured for unified workspace, you wouldn't specify extra stacks and this wouldn't have been tripped.</div><div dir="auto"><br></div><div dir="auto">Unified and unlimited can avoid some issues.</div><div dir="auto"><br></div><div dir="auto">--joel</div><div dir="auto"><div class="gmail_quote"><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"><div><br></div><div>I will test the new configuration next week.</div><div>Have a nice weekend</div><div>Best Regards</div><div>Mirek</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">sob., 21 maj 2022 o 05:39 Heinz Junkes <<a href="mailto:junkes@fhi-berlin.mpg.de" rel="noreferrer" target="_blank">junkes@fhi-berlin.mpg.de</a>> napisał(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Mirek,<br>
You can find the configuration of the RTEMS at EPICS here:<br>
<br>
epics-base/modules/libcom/RTEMS/posix/rtems_config.c<br>
<br>
There for example<br>
...<br>
#define CONFIGURE_EXTRA_TASK_STACKS         (4000 * RTEMS_MINIMUM_STACK_SIZE)<br>
<br>
#define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 32<br>
#define CONFIGURE_UNLIMITED_OBJECTS<br>
#define CONFIGURE_UNIFIED_WORK_AREAS<br>
…<br>
<br>
best regards,<br>
Heinz<br>
<br>
> On 21. May 2022, at 00:21, Joel Sherrill <<a href="mailto:joel@rtems.org" rel="noreferrer" target="_blank">joel@rtems.org</a>> wrote:<br>
> <br>
> On Fri, May 20, 2022 at 3:55 PM Miroslaw Dach <<a href="mailto:miroslaw.dach@gmail.com" rel="noreferrer" target="_blank">miroslaw.dach@gmail.com</a>><br>
> wrote:<br>
> <br>
>> Hi Chris,<br>
>> <br>
>> Thank you very much for your expertise and attached links which are very<br>
>> helpful.<br>
>> As regards the INTERNAL_ERROR_TOO_LITTLE_WORKSPACE error message:<br>
>> Is it possible to determine with some debug information what is the<br>
>> foreseen by RTEMS WORKSPACE size?<br>
>> <br>
> <br>
> This CONFIGURE_MEMORY_OVERHEAD is there as a mechanism to toss<br>
> extra memory at the workspace in case confdefs.h makes a mistake. I think<br>
> this<br>
> is more likely to be something else like a misconfigured system. But adding<br>
> this<br>
> to your RTEMS configuration with some chunk of memory like 128K might<br>
> allow this to proceed. But if it is a memory allocation error in the BSP<br>
> like<br>
> not assigning memory right to RTEMS, this won't fix it. See:<br>
> <br>
> <a href="https://docs.rtems.org/branches/master/c-user/config/general.html#configure-memory-overhead" rel="noreferrer noreferrer" target="_blank">https://docs.rtems.org/branches/master/c-user/config/general.html#configure-memory-overhead</a><br>
> <br>
> Chris has touched one of the boards in the motorola_powerpc family<br>
> more recently than I have. I would think this would work unless something<br>
> is off in the EPICS configuration of RTEMS. There was a discussion of the<br>
> EPICS RTEMS configuration with Till recently on tech-talk and I thought<br>
> it looked ok.<br>
> <br>
> --joel<br>
> <br>
>> <br>
>> Best Regards<br>
>> Mirek<br>
>> <br>
>> śr., 18 maj 2022 o 00:53 Chris Johns <<a href="mailto:chrisj@rtems.org" rel="noreferrer" target="_blank">chrisj@rtems.org</a>> napisał(a):<br>
>> <br>
>>> On 18/5/2022 9:36 am, Miroslaw Dach wrote:<br>
>>>> Dear RTEMS Users and Developers,<br>
>>>> <br>
>>>> I have built RTEMS 5 with EPICS 7 and tried to boot my application on<br>
>>>> mcp750 cPCI board.<br>
>>>> The first thing that I have encountered is that the boot file is in the<br>
>>> elf<br>
>>>> format so I have<br>
>>>> converted it to the binary one.:<br>
>>>> powerpc-rtems5-objcopy -I elf32-powerpc -O binary myApp.boot<br>
>>> myApp.boot.bin<br>
>>> <br>
>>> We removed the various post-link hooks.<br>
>>> <br>
>>>> So far so good<br>
>>>> Next, I booted the system with my app and it fails in the *bsp_early*<br>
>>>> function in<br>
>>>> bsps/powerpc/motorola_powerpc/start/bspstart.c<br>
>>>> <br>
>>>> The boot sequence:<br>
>>>> Network Boot File load in progress... To abort hit <BREAK><br>
>>>> <br>
>>>> Bytes Received =&1270208, Bytes Loaded =&1270208<br>
>>>> Bytes/Second =&635104, Elapsed Time =2 Second(s)<br>
>>>> <br>
>>>> Residual-Data Located at: $01F88000<br>
>>>> <br>
>>>> Model: (e2)<br>
>>>> Serial: MOT0000000<br>
>>>> Processor/Bus frequencies (Hz): 366680480/66671508<br>
>>>> Time Base Divisor: 4000<br>
>>>> Memory Size: 2000000<br>
>>>> Residual: 1f88000 (length 27148)<br>
>>>> <br>
>>>> PCI: Probing PCI hardware<br>
>>>> <br>
>>>> RTEMS 5.0.0/PPC load:<br>
>>>> Uncompressing the kernel...<br>
>>>> done<br>
>>>> Now booting...<br>
>>>> -----------------------------------------<br>
>>>> Welcome to rtems-5.0.0 (PowerPC/Generic (classic FPU)/mcp750) on<br>
>> Mesquite<br>
>>>> cPCI (MCP750)<br>
>>>> -----------------------------------------<br>
>>>> idreg 0 = 0x1208029271<br>
>>>> OpenPIC found at 0xc1000000.<br>
>>>> pci : Configuring interrupt routing for 'Mesquite cPCI (MCP750)'<br>
>>>> pci : No bridge from bus 0 towards root found<br>
>>>> pci : No bridge from bus 0 towards root found<br>
>>>> pci : Device 1:0x0b:0 routed to interrupt_line 27<br>
>>>> pci : Device 1:0x0d:0 routed to interrupt_line 25<br>
>>>> Cleared PCI errors: pci_stat was 0x2280<br>
>>>> OpenPIC Version ? (2 CPUs and 16 IRQ sources) at 0x3238002688<br>
>>>> OpenPIC Vendor 0 (Unknown), Device 0 (Unknown), Stepping 2<br>
>>>> OpenPIC timer frequency is 8333848 Hz<br>
>>> <br>
>>> This all looks OK.<br>
>>> <br>
>>>> <br>
>>>> *** FATAL ***<br>
>>>> fatal source: 0 (INTERNAL_ERROR_CORE)<br>
>>>> fatal code: 2 (INTERNAL_ERROR_TOO_LITTLE_WORKSPACE)<br>
>>>> RTEMS version: 5.0.0.fc89cc76804499eba3f3bc4097b795a84f07571a-modified<br>
>>>> RTEMS tools: 7.5.0 20191114 (RTEMS 5, RSB 5 (6225eadda1de), Newlib<br>
>>> 7947581)<br>
>>>> executing thread is NULL<br>
>>>> <br>
>>>> My application in the binary format uncompressed with stripped symbols<br>
>>> is a<br>
>>>> 2.3M + 501K bootloader so I do not think that it<br>
>>>> is an issue with the WORKSPACE? The mcp750 has 32MB of RAM.<br>
>>>> How to detect what is the real cause of<br>
>>> INTERNAL_ERROR_TOO_LITTLE_WORKSPACE<br>
>>>> ?<br>
>>>> Would it be the problem with the linker script ppcboot.lds?<br>
>>> <br>
>>> I do not think so. I suggest you check the Classic API Guide here:<br>
>>> <br>
>>> <br>
>>> <br>
>> <a href="https://ftp.rtems.org/pub/rtems/releases/5/5.1/docs/html/c-user/config/intro.html#sizing-the-rtems-workspace" rel="noreferrer noreferrer" target="_blank">https://ftp.rtems.org/pub/rtems/releases/5/5.1/docs/html/c-user/config/intro.html#sizing-the-rtems-workspace</a><br>
>>> <br>
>>> The accounting of memory is better and this means the extra space needed<br>
>>> may<br>
>>> need to be adjusted. I am not sure where in EPCIS this is controlled and<br>
>>> if it<br>
>>> can be overridden in your local configuration.<br>
>>> <br>
>>> RTEMS 5 has a unified workspace and heap. This means the heap and<br>
>>> workspace can<br>
>>> use memory until it is all used. The benefit is not need to manage the<br>
>>> workspace<br>
>>> size statically:<br>
>>> <br>
>>> <br>
>>> <br>
>> <a href="https://ftp.rtems.org/pub/rtems/releases/5/5.1/docs/html/c-user/config/general.html#configure-unified-work-areas" rel="noreferrer noreferrer" target="_blank">https://ftp.rtems.org/pub/rtems/releases/5/5.1/docs/html/c-user/config/general.html#configure-unified-work-areas</a><br>
>>> <br>
>>> Chris<br>
>>> <br>
>> _______________________________________________<br>
>> users mailing list<br>
>> <a href="mailto:users@rtems.org" rel="noreferrer" target="_blank">users@rtems.org</a><br>
>> <a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
> _______________________________________________<br>
> users mailing list<br>
> <a href="mailto:users@rtems.org" rel="noreferrer" target="_blank">users@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
<br>
</blockquote></div>
</blockquote></div></div></div>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div>