<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hello Mritunjay,</p>
<p>I have now finished an EPICS variant that works with libbsd so far. DHCP and NFS work. NTP I added a primitive reader. This is sufficient for testing.</p>
<p>You can find the development here: </p>
<p><a href="https://gitlab.fhi.mpg.de/junkes/epics-base.git">https://gitlab.fhi.mpg.de/junkes/epics-base.git</a></p>
<p>It's not perfect yet. The adaptation to the legacy stack and the processing of the environment variables from the flash (u-boot etc.) is still missing.</p>
<p><span>[h1@earth QtC-epics-base (7.0 *+)]$ ./startQemu softIoc <br />Script name: ./startQemu <br />qemu-system-aarch64: warning: nic cadence_gem.1 has no peer <br />WARNING: OS Clock time was read before being set. <br />Using 1990-01-02 00:00:00.000000 UTC <br /><br />initConsole --- Info --- <br />stdin: fileno: 0, ttyname: /dev/ttyS1 <br />stdout: fileno: 1, ttyname: /dev/ttyS1 <br />stderr: fileno: 2, ttyname: /dev/ttyS1 <br />tcsetattr failed: I/O error <br />time set to : 04/14/14 07:30:06.000055589 UTC <br />Startup. <br />epicsThreadSetPriority called by non epics thread <br /><br />***** RTEMS Version: rtems-5.0.0-m2003 (ARM/ARMv4/xilinx_zynq_a9_qemu) ***** <br /><br />***** Initializing network (dhcp) ***** <br />nexus0: <RTEMS Nexus device> <br />zy7_slcr0: <Zynq-7000 slcr block> on nexus0 <br />cgem0: <Cadence CGEM Gigabit Ethernet Interface> on nexus0 <br />miibus0: <MII bus> on cgem0 <br />e1000phy0: <Marvell 88E1111 Gigabit PHY> PHY 0 on miibus0 <br />e1000phy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto <br />e1000phy1: <Marvell 88E1111 Gigabit PHY> PHY 23 on miibus0 <br />e1000phy1:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto <br />info: cgem0: Ethernet address: 52:54:00:12:34:56 <br />info: lo0: link state changed to UP <br /><br />---- Wait for DHCP done ... <br />dhcpcd: unknown option -- pv4only <br />info: version 6.2.1 starting <br />cgem0: cgem_mediachange: could not set ref clk0 to 25000000. <br />info: cgem0: link state changed to UP <br />dhcpcd: unknown option -- pv4only <br />debug: cgem0: executing `ioc boot' PREINIT <br /><br />***** Primary Network interface : cgem0 ***** <br />debug: cgem0: executing `ioc boot' CARRIER <br /><br />***** Primary Network interface : cgem0 ***** <br />info: DUID 00:01:00:01:1a:de:4a:fe:52:54:00:12:34:56 <br />info: cgem0: IAID 00:12:34:56 <br />info: cgem0: soliciting an IPv6 router <br />debug: cgem0: delaying Router Solicitation for LL address <br />debug: cgem0: using ClientID 00:46:48:49:20:74:65:73:74:20:63:6c:69:65:6e:74 <br />info: cgem0: soliciting a DHCP lease <br />debug: cgem0: sending DISCOVER (xid 0x86686938), next in %0.1f seconds <br />info: cgem0: carrier lost <br />debug: cgem0: executing `ioc boot' NOCARRIER <br /><br />***** Primary Network interface : cgem0 ***** <br />info: cgem0: carrier acquired <br />dhcpcd: unknown option -- pv4only <br />debug: cgem0: executing `ioc boot' CARRIER <br /><br />***** Primary Network interface : cgem0 ***** <br />info: cgem0: IAID 00:12:34:56 <br />info: cgem0: soliciting an IPv6 router <br />debug: cgem0: delaying Router Solicitation for LL address <br />debug: cgem0: using ClientID 00:46:48:49:20:74:65:73:74:20:63:6c:69:65:6e:74 <br />info: cgem0: soliciting a DHCP lease <br />debug: cgem0: sending DISCOVER (xid 0x441a0d89), next in %0.1f seconds <br />debug: cgem0: wrong xid 0x86686938 (expecting 0x441a0d89) from 10.1.0.1 <br />debug: cgem0: sending DISCOVER (xid 0x441a0d89), next in %0.1f seconds <br />info: cgem0: offered 10.1.0.104 from 10.1.0.1 <br />debug: cgem0: sending REQUEST (xid 0x441a0d89), next in %0.1f seconds <br />debug: cgem0: acknowledged 10.1.0.104 from 10.1.0.1 <br />debug: cgem0: checking for 10.1.0.104 <br />debug: cgem0: sending ARP probe (1 of 3), next in %0.1f seconds <br />debug: cgem0: sending ARP probe (2 of 3), next in %0.1f seconds <br /><br />---- Wait for DHCP done ... <br />debug: cgem0: sending ARP probe (3 of 3), next in %0.1f seconds <br />info: cgem0: leased 10.1.0.104 for 6000 seconds <br />debug: cgem0: renew in 3000 seconds, rebind in 5250 seconds <br />debug: cgem0: adding IP address 10.1.0.104/24 <br />info: cgem0: adding host route to 10.1.0.104 via 127.0.0.1 <br />err: cgem0: ipv4_addroute: File exists <br />info: cgem0: adding route to 10.1.0.0/24 <br />err: cgem0: ipv4_addroute: File exists <br />info: cgem0: adding default route via 10.1.0.1 <br />debug: cgem0: writing lease `/var/db/dhcpcd-cgem0.lease' <br />debug: cgem0: executing `ioc boot' BOUND <br /><br />***** Primary Network interface : cgem0 ***** <br />Interface TGP bounded <br />rtems_bsdnet_bootp_server_name : 1001.1001@10.1.0.1:/Volumes/Epics <br />rtems_bsdnet_bootp_boot_file_name : /Volumes/Epics/myExample/bin/RTEMS-xilinx_zynq_a9_qemu/myExample.boot <br />rtems_bsdnet_bootp_cmdline : /Volumes/Epics/myExample/iocBoot/iocmyExample/st.cmd <br />debug: cgem0: sending ARP announce (1 of 2), next in 2.0 seconds <br />-------------- IFCONFIG ----------------- <br />cgem0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 <br />       options=80008<VLAN_MTU,LINKSTATE> <br />       ether 52:54:00:12:34:56 <br />       inet6 fe80::5054:ff:fe12:3456%cgem0 prefixlen 64 scopeid 0x1 <br />       inet 10.1.0.104 netmask 0xffffff00 broadcast 10.1.0.255 <br />       nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> <br />       media: Ethernet autoselect (100baseTX <full-duplex>) <br />       status: active <br />lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 <br />       options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6> <br />       inet 127.0.0.1 netmask 0xffffff00 <br />       inet6 ::1 prefixlen 128 <br />       inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2 <br />       nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> <br />       groups: lo <br />-------------- NETSTAT ------------------ <br />Routing tables <br /><br />Internet: <br />Destination        Gateway            Flags     Netif Expire <br />default            10.1.0.1           UGS       cgem0 <br />10.1.0.0/24        link#1             U         cgem0 <br />10.1.0.104         link#1             UHS         lo0 <br />127.0.0.1          link#2             UH          lo0 <br /><br />Internet6: <br />Destination                       Gateway                       Flags     Netif Expire <br />::1                               link#2                        UH          lo0 <br />fe80::%cgem0/64                   link#1                        U         cgem0 <br />fe80::5054:ff:fe12:3456%cgem0     link#1                        UHS         lo0 <br />fe80::%lo0/64                     link#2                        U           lo0 <br />fe80::1%lo0                       link#2                        UHS         lo0 <br /><br />***** Until now no NTP support in RTEMS 5 with rtems-libbsd ***** <br /><br />***** Ask ntp server once... ***** <br />time from ntp : 08/10/20 15:08:41.000055589 UTC <br /><br />***** Setting up file system ***** <br />***** Initializing NFS ***** <br />rtems_bootp_server_name: 1001.1001@10.1.0.1:/Volumes/Epics <br />nfsMount("1001.1001@10.1.0.1", "/Volumes/Epics", "/Volumes/Epics") <br />Mount 1001.1001@10.1.0.1:/Volumes/Epics on /Volumes/Epics <br />Warning: EPICS_TIMEZONE (CST6CDT,M3.2.0/2,M11.1.0/2) unrecognizable -- times will be displayed as GMT. <br />check for time registered , C++ initialization ... <br />***** Preparing EPICS application ***** <br />chdir("/Volumes/Epics/myExample/iocBoot/iocmyExample/") <br />***** Starting EPICS application ***** <br />dbLoadDatabase("../../dbd/softIoc.dbd") <br />Can't register 'system' command -- no command interpreter available. <br />softIoc_registerRecordDeviceDriver(pdbbase) <br /># Begin /Volumes/Epics/myExample/iocBoot/iocmyExample/st.cmd <br />iocInit() <br />Starting iocInit <br />############################################################################ <br />## EPICS R7.0.3.2-DEV <br />## Rev. R7.0.3.1-105-ge597f8104c18ec7b9fc5-dirty <br />############################################################################ <br />debug: cgem0: sending ARP announce (2 of 2) <br />Warning: RSRV has empty beacon address list <br />epicsThreadRealtimeLock Warning: Unable to lock the virtual address space. <br />VM page faults may harm real-time performance. errno=22 <br />iocRun: All initialization complete <br /># End /Volumes/Epics/myExample/iocBoot/iocmyExample/st.cmd<br /><br /></span></p>
<p><br /></p>
<p><br /></p>
<p><br /></p>
<p id="reply-intro">On 2020-08-08 21:58, Mritunjay Sharma wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div id="replybody1">
<div dir="ltr">
<div dir="ltr"> </div>
<br />
<div class="v1gmail_quote">
<div class="v1gmail_attr" dir="ltr">On Sat, Aug 8, 2020 at 11:10 PM Gedare Bloom <<a href="mailto:gedare@rtems.org" rel="noreferrer">gedare@rtems.org</a>> wrote:</div>
<blockquote class="v1gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">On Sat, Aug 8, 2020 at 11:08 AM Mritunjay Sharma<br /><<a href="mailto:mritunjaysharma394@gmail.com" rel="noreferrer">mritunjaysharma394@gmail.com</a>> wrote:<br />><br />><br />><br />> On Sat, Aug 8, 2020 at 9:46 PM Heinz Junkes <<a href="mailto:junkes@fhi-berlin.mpg.de" rel="noreferrer">junkes@fhi-berlin.mpg.de</a>> wrote:<br />>><br />>> Hallo Mritunjay,<br />>> everything looks pretty good. I'm commenting on the text. I also send this mail<br />>> to two EPICS experts (Andrew Johnson and Michael Davidsaver). Maybe they also have some ideas.<br />><br />><br />> Thank you so much Heinz! It will be really a great help!<br />>><br />>><br />>><br />>> ><br />>> > Current Status:<br />>> ><br />>> > 1) Successfully built EPICS7 with RTEMS5 by hand for pc-386<br />>> > 2) Worked for RSB recipe.<br />>> >    In its due process, I Wrote:<br />>> >     i) rsb/rtems/config/epics/epics-7-1.cfg<br />>> >     ii)rsb/rtems/config/epics/epics-base.bset<br />>> >     iii)rsb/source-builder/config/epics-7-1.cfg<br />>> > 3) Added Patch for RTEMS-pc-386 support which made the above recipe work successfully.<br />>> > 4) Therefore, Successully built EPICS7 with RTEMS5 by using RSB recipe as well for pc-386 as of now.<br />>> > 5) Sent 4 Patches for review of the same.<br />>> ><br />>> > What problems are in the next steps?<br />>> ><br />>> > 1) How to make it work across different architectures?<br />>> > 2) Exisiting EPICS works on the old legacy network stack.<br />>> > 3) I am not using EPICS upstream branch. It is being built<br />>> > by Heinz's epics playground.<br />>> > 4) Doubts in how to start with testing.<br />>> ><br />>> > My Resarch work for the Problem no: 1<br />>> ><br />>> > I have gone through the EPICS developer guide from here<br />>> > exhaustively in the past couple of day and here are few interesting things<br />>> > that I found which can help:<br />>> ><br />>> > 1) "The main ingredients of the build system are:<br />>> > • A set of configuration files and tools provided in the EPICS base/configure directory<br />>> > • A corresponding set of configuration files in the <top>/configure directory of a non-base <top> directory<br />>> > structure to be built. The makeBaseApp.pl and makeBaseExt.pl scripts create these configuration files. Many of<br />>> > these files just include a file of the same name from the base/configure directory.<br />>> > • Makefiles in each directory of the <top> directory structure to be built<br />>> > • User created configuration files in build created $(INSTALL_LOCATION)/cfg directories.<br />>> > "<br />>> ><br />>> > Remarks: Now since it is also mentioned in the guide that "makeBaseApp.pl<br />>> > creates directories and then copies template files into the newly created directories<br />>> > while expanding macros in the template files. EPICS base provides two sets of template files: simple and example."<br />>> > Can we think of using makeBaseApp.pl to that end? Making the user allow<br />>> > to change the configurations from the terminal?<br />>><br />>> I don't think that makeBaseApp.pl will help you. This is intended to build an example IOC. It takes the settings from the above mentioned configuration files.<br />>><br />>> You "only" need to specify the location of the RTEMS installation in configure/os/CONFIG_SITE.Common.RTEMS.<br />>> RTEMS_VERSION =<br />>> RTEMS_BASE =<br />>><br />>> Then you have to define the target in configure/CONFIG_SITE:<br />>> ...<br />>> # Which target architectures to cross-compile for.<br />>> #  Definitions in configure/os/CONFIG_SITE.<host>.Common<br />>> #  may override this setting.<br />>> CROSS_COMPILER_TARGET_ARCHS=<br />>> ...<br />>> e.g. "CROSS_COMPILER_TARGET_ARCHS=RTEMS-xilinx_zynq_a9_qemu"<br />>><br />>> And for each target there must be a file in configure/os:<br />>> e.g. CONFIG_Common.RTEMS-xilinx_zynq_a9_qemu<br />>> If it is not provided by EPICS, the RSB should install it there (adapted to the target to be used by epics make).<br />><br /><br />Probably they should be provided by EPICS for known-to-work<br />configurations. If they are not, we should push upstream.<br /><br />><br />> Yes, Heinz. I followed the above steps and created a patch which I applied in the configuration files of RSB recipe.<br />> The problem with it is that it's made only for pc-386 and I have to hardcode there about location of the RTEMS installation in<br />> configure/os/CONFIG_SITE.Common.RTEMS. My doubt is how to modify the patch that can it offer user-specific location of the RTEMS<br />> installation and bsp?<br />>><br /><br />I still think this should be done through some kind of pre-processing<br />(scripting) over these configuration files for a given target, using<br />some fixed pattern, rather than by patching. A patch is fine for<br />proof-of-concept, but I don't think we want to have x patches for x<br />BSP targets of EPICS.  Maybe it is fine, there aren't that many BSP<br />targets right now, but I can see this kind of patch-based<br />configuration getting a little unwieldy.<br /><br />If you proceed with the patch-based approach, you need to figure out<br />how to pick the right patch to apply based on the target/bsp build. So<br />that would be your next step. Create a patch for the zynq, and see if<br />you can dynamically determine which one to apply (zynq or pc386) based<br />on RSB internal state/variables.<br /><br /></blockquote>
<div>Thank you for the suggestions. I will start working on creating the patch for zynq and will see if </div>
<div>something can be done to dynamically determine them.  </div>
<blockquote class="v1gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">>><br />>> ><br />>> > 2) "The startup directory in EPICS base contains a perl script, EpicsHostArch.pl, which can be used to define<br />>> > EPICS_HOST_ARCH. This script can be invoked with a command line parameter defining the alternate compiler (e.g.<br />>> > if invoking EpicsHostArch.pl yields solaris-sparc, then invoking EpicsHostArch.pl gnu will yield<br />>> > solaris-sparc-gnu).<br />>> > The startup directory also contains scripts to help users set the path and other environment variables"<br />>> This has nothing to do with 2)<br />><br />><br />> I am sorry for the misunderstanding. All the 4 points mentioned here are my observations only for the Problem No.1<br />> `1) How to make it work across different architectures?`<br />>><br />>><br />>> There's no need to adjust anything here. The EPICS make recognizes the architecture on which it is started.<br />>><br />>> > Remarks: As EPICS_HOST_ARCH, can we do something similar for CROSS_COMPILER_TARGET_ARCHS?<br />>> ><br />>> > 3) ") The following is a summary of targets that can be specified for gnumake:<br />>> > • <action><br />>> > • <arch><br />>> > • <action>.<arch><br />>> > • <dir><br />>> > • <dir>.<action><br />>> > • <dir>.<arch><br />>> > • <dir>.<action>.<arch><br />>> > where:<br />>> > <arch> is an architecture such as solaris-sparc, vxWorks-68040, win32-x86, etc.<br />>> > <action> is help, clean, realclean, distclean, inc, install, build, rebuild, buildInstall, realuninstall, or uninstall"<br />>> ><br />>> > Remarks: Now similar to the above stated, can we work for Cross Compiler target Architecture?<br />>> ><br />>><br />>> But this does not refer to 3) ?<br />><br />><br />> No no, this remark is also for the problem 1 only as told above. Slight misunderstanding here :)<br />>><br />>><br />>><br />>><br />>> 3) You have to take "my" repo at the moment, because the adaptations to RTEMS5 are not yet included in the official epics-base. This is a hen-and-egg problem because RTEMS is only now in the release phase, so my changes have not been implemented yet.<br />><br />><br />> Ok, I hope Dr. Gedare and Chris can help you with that.<br /><br />We just need to be ready for when RTEMS 5.1 is officially released.<br />Hopefully soon, but I don't have a timeline. Releases are mostly<br />volunteer time, so they happen when they happen. We're trying to get<br />better about that, but it is hard (due to lack of incentives).<br /><br /></blockquote>
<div>I think that makes it clear, Heinz.  </div>
<blockquote class="v1gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">>><br />>><br />>> 2) I'm just about to figure out in the Epics Makefiles whether the target was built with the legacy-stack or libbsd-stack. It's working already.<br />>> Now I also have to adjust the rtems_init.c accordingly. Here I have to clean up a little bit. But I hope to have this finished by the middle of the week.<br />><br />><br />> Thank you so much for the update!<br />><br />> So I would like to ask my other mentors - what can I do for the time being? What should be the next steps for this week?<br /><br />Prepare the zynq patch and try to work out the logic of how to select<br />the right patch to apply.<br /><br />Then similar logic might be usable to script the configuration changes<br />of EPICS so we don't need patches.<br /><br /></blockquote>
<div>Sure, I will do and update soon. </div>
<div> </div>
<blockquote class="v1gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">> And yes how to begin the testing part?<br /><br />This was suggested by Heinz earlier to look at the CI test scripts<br />that EPICS maintainers use.</blockquote>
<div> </div>
<div>Yes, it slipped out of my mind. Will check and revert. </div>
<div> </div>
<div>Thanks</div>
<div>Mritunjay Sharma</div>
<blockquote class="v1gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;"><br />> I have tried to find some resources but I think it will be<br />> better if you can help somewhere to look at.<br />><br />> Thanks<br />> Mritunjay Sharma<br />>><br />>><br />>> > These were the little doubts that originated from the research work I did.<br />>> > I will like the opinion of mentors that what can be the optimal way now to approach the<br />>> > project after this? What can be some resources for better research work of the<br />>> > above problems?<br />>> ><br />>> > Also, for the reference:<br />>> > Link to the changes in commits of rsb can be found here: <a href="https://github.com/RTEMS/rtems-source-builder/compare/master...mritunjaysharma394:epics-support" target="_blank" rel="noopener noreferrer">https://github.com/RTEMS/rtems-source-builder/compare/master...mritunjaysharma394:epics-support</a><br />>> ><br />>> > The patch for epics can be found here: <a href="https://github.com/mritunjaysharma394/epics-mritunjay/tree/master/patches" target="_blank" rel="noopener noreferrer">https://github.com/mritunjaysharma394/epics-mritunjay/tree/master/patches</a><br />>> ><br />>> ><br />>> > Thanks<br />>> > Mritunjay Sharma<br />>> ><br />>> ><br />>> ><br />>> ><br />>> Heinz</blockquote>
</div>
</div>
</div>
</blockquote>
<p><br /></p>

</body></html>