<div dir="auto"><div><br><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 15, 2020, 5:59 PM Eshan Dhawan <<a href="mailto:eshandhawan51@gmail.com">eshandhawan51@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 15, 2020 at 2:22 AM Eshan Dhawan <<a href="mailto:eshandhawan51@gmail.com" target="_blank" rel="noreferrer">eshandhawan51@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"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, May 13, 2020 at 7:40 PM Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank" rel="noreferrer">joel@rtems.org</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">National free hint day!!! <div><br></div><div>Look above the line that is reported. You will see __BEGIN_DECL. It isn't defined. It is intended to expand to the __cplusplus wrapper.</div><div><br></div><div>After you fix this, you will sequentially find 2 other things to change in this file. </div><div><br></div></div></blockquote><div>I have made those changes when a new error occurs from the assembler in arm thumb mode <br></div><div>There is no support for vfp instructions in arm thumb. <br></div><div><a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471c/BABGHDBB.html" target="_blank" rel="noreferrer">http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471c/BABGHDBB.html</a><br></div><div>So in which file will the compiler instructions given in the <a href="http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471c/BABGHDBB.html" target="_blank" rel="noreferrer">page</a> added?<br></div></div></div></blockquote><div>FreeBSD has added file and architecture-specific flags in their makefile.inc <br></div><div><a href="https://github.com/freebsd/freebsd/blob/master/lib/msun/arm/Makefile.inc" target="_blank" rel="noreferrer">https://github.com/freebsd/freebsd/blob/master/lib/msun/arm/Makefile.inc</a></div><div>How will it be added in newlib <br></div><div>I tried adding the flags -mfpu=vfp -mfloat-abi=softfp (used in FreeBSD) to <a href="http://makefile.in" target="_blank" rel="noreferrer">makefile.in</a> but no effect.<br></div></div></div></blockquote></div></div><div dir="auto"><br></div><div dir="auto">This isn't going to work with newlib. They don't specify CPU flags that way.</div><div dir="auto"><br></div><div dir="auto">The fenv code is going to have to compile for every multilib variant built by arm-rtems and arm-eabi. You will have to use conditionals based on the flags gcc uses to indicate the various cpu features. This command should be close to how you you dump them.</div><div dir="auto"><br></div><div dir="auto">gcc -dM -E - </dev/null</div><div dir="auto"><br></div><div dir="auto">Add a CPU flag and see how the setting change. </div><div dir="auto"><br></div><div dir="auto">You can also look in rtems score cpu arm for examples since the core arm code will be dealing with these.</div><div dir="auto"><br></div><div dir="auto">--joel </div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div></div><div><br></div><div>thanks <br></div><div>-Eshan<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 class="gmail_quote"><div></div><div>Errors :<br></div><div><br></div><div>make[9]: Entering directory '/home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/thumb/newlib/libm/machine/arm'<br>arm-rtems5-gcc -B/home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/thumb/newlib/ -isystem /home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/thumb/newlib/targ-include -isystem /home/eshan/development/newlib/newlib-cygwin/newlib/libc/include  -mthumb -DPACKAGE_NAME=\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"3.3.0\" -DPACKAGE_STRING=\"newlib\ 3.3.0\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -I. -I../../../../../../../newlib-cygwin/newlib/libm/machine/arm -I ../../../../../../../newlib-cygwin/newlib/libm/machine/arm/../../../../newlib/libm/common -fno-builtin -mfpu=vfpv2 -ffunction-sections -fdata-sections  -D_COMPILING_NEWLIB -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN -DHAVE_INIT_FINI      -g -O2  -mthumb -c -o lib_a-fenv-vfp.o `test -f 'fenv-vfp.c' || echo '../../../../../../../newlib-cygwin/newlib/libm/machine/arm/'`fenv-vfp.c<br>/tmp/ccEHiFws.s: Assembler messages:<br>/tmp/ccEHiFws.s:37: Error: selected processor does not support `vmrs r3,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:48: Error: selected processor does not support `vmsr fpscr,r3' in Thumb mode<br>/tmp/ccEHiFws.s:81: Error: selected processor does not support `vmrs r3,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:119: Error: selected processor does not support `vmrs r3,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:134: Error: selected processor does not support `vmsr fpscr,r3' in Thumb mode<br>/tmp/ccEHiFws.s:169: Error: selected processor does not support `vmrs r3,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:182: Error: selected processor does not support `vmsr fpscr,r3' in Thumb mode<br>/tmp/ccEHiFws.s:217: Error: selected processor does not support `vmrs r3,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:251: Error: selected processor does not support `vmrs r0,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:288: Error: selected processor does not support `vmrs r3,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:303: Error: selected processor does not support `vmsr fpscr,r0' in Thumb mode<br>/tmp/ccEHiFws.s:340: Error: selected processor does not support `vmrs r3,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:374: Error: selected processor does not support `vmrs r3,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:390: Error: selected processor does not support `vmsr fpscr,r3' in Thumb mode<br>/tmp/ccEHiFws.s:424: Error: selected processor does not support `vmsr fpscr,r3' in Thumb mode<br>/tmp/ccEHiFws.s:457: Error: selected processor does not support `vmrs r1,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:466: Error: selected processor does not support `vmsr fpscr,r3' in Thumb mode<br>/tmp/ccEHiFws.s:478: Error: selected processor does not support `vmrs r2,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:503: Error: selected processor does not support `vmsr fpscr,r3' in Thumb mode<br>/tmp/ccEHiFws.s:543: Error: selected processor does not support `vmrs r0,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:559: Error: selected processor does not support `vmsr fpscr,r3' in Thumb mode<br>/tmp/ccEHiFws.s:595: Error: selected processor does not support `vmrs r3,fpscr' in Thumb mode<br>/tmp/ccEHiFws.s:612: Error: selected processor does not support `vmsr fpscr,r2' in Thumb mode<br>/tmp/ccEHiFws.s:647: Error: selected processor does not support `vmrs r3,fpscr' in Thumb mode<br>Makefile:476: recipe for target 'lib_a-fenv-vfp.o' failed<br>make[9]: *** [lib_a-fenv-vfp.o] Error 1<br>make[9]: Leaving directory '/home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/thumb/newlib/libm/machine/arm'<br>Makefile:324: recipe for target 'all-recursive' failed<br>make[8]: *** [all-recursive] Error 1<br>make[8]: Leaving directory '/home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/thumb/newlib/libm/machine'<br>Makefile:553: recipe for target 'all-recursive' failed<br>make[7]: *** [all-recursive] Error 1<br>make[7]: Leaving directory '/home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/thumb/newlib/libm'<br>Makefile:641: recipe for target 'all-recursive' failed<br>make[6]: *** [all-recursive] Error 1<br>make[6]: Leaving directory '/home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/thumb/newlib'<br>Makefile:452: recipe for target 'all' failed<br>make[5]: *** [all] Error 2<br>make[5]: Leaving directory '/home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/thumb/newlib'<br>Makefile:1260: recipe for target 'multi-do' failed<br>make[4]: *** [multi-do] Error 1<br>make[4]: Leaving directory '/home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/newlib'<br>Makefile:1176: recipe for target 'all-multi' failed<br>make[3]: *** [all-multi] Error 2<br>make[3]: Leaving directory '/home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/newlib'<br>Makefile:452: recipe for target 'all' failed<br>make[2]: *** [all] Error 2<br>make[2]: Leaving directory '/home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/newlib'<br>Makefile:8491: recipe for target 'all-target-newlib' failed<br>make[1]: *** [all-target-newlib] Error 2<br>make[1]: Leaving directory '/home/eshan/development/newlib/c-arm-rtems5-newlib'<br>Makefile:878: recipe for target 'all' failed<br>make: *** [all] Error 2</div><div><br></div><div>-Eshan<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></div><div>Then we need to make a decision whether the static inline versions of the methods in sys/fenv.h are appropriate for newlib or not.</div><div><br></div><div>--joel</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 12, 2020 at 5:20 PM Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank" rel="noreferrer">joel@rtems.org</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">Gedare is right but one more piece of information is needed. When newlib is being built, it lays target dependent files on top of generic ones. So the default sys/fenv.h is replaced with something like libc/machine/arm/sys/fenv.h. Make sure that 

/home/eshan/development/newlib/newlib-cygwin/newlib/libc/include/fenv.h is in fact the file you think it should be.<div><br></div><div>Also look at what is supposed to be in the generic fenv.h and <sys/fenv.h>. You will probably have to tweak it some. </div><div><br></div><div>Check out what is in x86_64/fenv.h and riscv/fenv.h with respect to the default environment variable. It looks to be declared differently in the other ports so you may have to make it match.</div><div><br></div><div>But more output does help.</div><div><br></div><div>--joel<br><div><br></div><div><br></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 12, 2020 at 4:53 PM Gedare Bloom <<a href="mailto:gedare@rtems.org" target="_blank" rel="noreferrer">gedare@rtems.org</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">Take the first error reported, and show what is being compiled. You've<br>
trimmed off too much preceding this to know what is being compiled and<br>
how this might be influencing your error.<br>
<br>
The specific error you're getting is often due to some syntax errors<br>
preceding the line shown.<br>
<br>
On Tue, May 12, 2020 at 2:59 PM Eshan Dhawan <<a href="mailto:eshandhawan51@gmail.com" target="_blank" rel="noreferrer">eshandhawan51@gmail.com</a>> wrote:<br>
><br>
> Hello everyone,<br>
> After adding the files and compiling. I am<br>
> getting a few errors which I am not able to rectify.<br>
> If you could take a look and tell how to sort them.<br>
><br>
> link to newlib's git repo: <a href="https://github.com/eshandhawan51/newlib-cygwin/tree/add_fenv_support" rel="noreferrer noreferrer" target="_blank">https://github.com/eshandhawan51/newlib-cygwin/tree/add_fenv_support</a><br>
><br>
> errors :<br>
><br>
> In file included from /home/eshan/development/newlib/newlib-cygwin/newlib/libc/include/fenv.h:15:0,<br>
>                  from ../../../../../../newlib-cygwin/newlib/libm/fenv/feclearexcept.c:57:<br>
> /home/eshan/development/newlib/c-arm-rtems5-newlib/arm-rtems5/thumb/newlib/targ-include/sys/fenv.h:82:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'extern'<br>
>  extern const fenv_t *_fe_dfl_env;<br>
>  ^~~~~~<br>
> In file included from ../../../../../../newlib-cygwin/newlib/libm/fenv/feclearexcept.c:57:0:<br>
> /home/eshan/development/newlib/newlib-cygwin/newlib/libc/include/fenv.h:22:1: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'int'<br>
>  int feclearexcept(int excepts);<br>
>  ^~~<br>
><br>
> thanks<br>
> -Eshan<br>
> On Sat, May 9, 2020 at 2:53 AM Joel Sherrill <<a href="mailto:joel@rtems.org" target="_blank" rel="noreferrer">joel@rtems.org</a>> wrote:<br>
>><br>
>><br>
>><br>
>> On Thu, May 7, 2020 at 1:33 PM Eshan Dhawan <<a href="mailto:eshandhawan51@gmail.com" target="_blank" rel="noreferrer">eshandhawan51@gmail.com</a>> wrote:<br>
>>><br>
>>> Hello everyone,<br>
>>> This the tread to discuss adding fenv support for ARM architecture in newlib.<br>
>>><br>
>>> Link to previous thread: <a href="https://lists.rtems.org/pipermail/devel/2020-March/058473.html" rel="noreferrer noreferrer" target="_blank">https://lists.rtems.org/pipermail/devel/2020-March/058473.html</a><br>
>>><br>
>>> ---FreeBSD Source<br>
>>> # <a href="https://github.com/freebsd/freebsd/tree/master/lib/msun/arm" rel="noreferrer noreferrer" target="_blank">https://github.com/freebsd/freebsd/tree/master/lib/msun/arm</a><br>
>>> # <a href="https://github.com/freebsd/freebsd/blob/master/sys/arm/include/ieeefp.h" rel="noreferrer noreferrer" target="_blank">https://github.com/freebsd/freebsd/blob/master/sys/arm/include/ieeefp.h</a><br>
>>> ---NetBSD Source<br>
>>> # <a href="https://github.com/NetBSD/src/tree/trunk/lib/libm/arch/arm" rel="noreferrer noreferrer" target="_blank">https://github.com/NetBSD/src/tree/trunk/lib/libm/arch/arm</a><br>
>>><br>
>>> --- Musl has no implementation for fenv support for ARM  in it<br>
>>><br>
>>> After going through the implementations both FreeBSD and NetBSD have a stub implementation.<br>
>>> But then FreeBSD implementation seems to be more portable compared to that in NetBSD.<br>
>>><br>
>>> Should I start porting it from FreeBSD?<br>
>>> And which ARM BSP should I use for testing the changes?<br>
>>> Currently, I have xilinx_zynq_a9_qemu build<br>
>><br>
>><br>
>> I think the FreeBSD implementation is the one to use. It looks to support hard and soft floating point implementations.<br>
>><br>
>> I think the fenv.h file there will have to be worked on so some of the contents go into sys or machine/fenv.h. There is a portable fenv.h.<br>
>><br>
>>><br>
>>><br>
>>> There would also be a requirement to discuss where to place the files in Newlib.<br>
>><br>
>><br>
>> Not much to discuss. It should go into newlib-cygwin/newlib/libm/machine/arm.<br>
>>><br>
>>><br>
>>> Thanks<br>
>>> -Eshan<br>
>>><br>
> _______________________________________________<br>
> devel mailing list<br>
> <a href="mailto:devel@rtems.org" target="_blank" rel="noreferrer">devel@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/devel</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div></div>
</blockquote></div></div>
</blockquote></div></div></div>