wiki:GSoC/2019/POSIX_Compliance

Version 5 (modified by Vaibhav Gupta, on 08/21/19 at 07:21:00) (diff)

--

POSIX Compliance

Student(s): Vaibhav Gupta.

Mentors: Joel Sherrill, Aditya Upadhyay, Hesham Almatary .

Ticket: POSIX Compliance

Development Blog: My GSoC 2019 Journey

Introduction to Project

Project Description

Developers and community have made the Real Time Executive for Multiprocessor Systems (RTEMS) well compliant with various standards like POSIX (6) IEEE Standard 1003.1™ , C99, C11, and various profiles of FACE (8) and SCA. This makes it possible for RTEMS to be executed on a large variety of architectures, devices and environments.

But this is an indefinite task as with advancement in technology and necessity, these standards keep updating and hence creates the need for updating the compliance status too.

Due to physical resource constraints some real time systems like small embedded system needs limited set of operating system functionality. For these type of system it is necessary that the standards allow implementation to support only a particular subset of POSIX functions. For instance, there is an approved change request against FACE 3.0 to make support for multiple processes optional. Any method listed in the FACE Technical Standard Edition 3.0, in Appendix A.1 as POSIX_MULTI_PROCESS is now optional. This is logical for embedded systems like RTEMS which follows Single Process Multi Threading Concept.

Project Goal

The goal of the project is to update the compliance status of RTEMS with POSIX IEEE and FACE General purpose profile. Various functions and headers were required to be implemented. As the project will advance, many headers, stubs, documentation and test-suites will be added.

Project Setup

Steps I followed to setup RTEMS on host OS (my system):

Project Sandboxing on my System

Home Folder (~): /home/varodek

~/development
	|
	|____/rtems
	|	|
	|	|____/5 	#- Directory for toolchain for rtems5
	|	|____/rsb 	#- contains RSB
	|	|____/kernel
	|		|____/erc32 			#- contains RTEMS kernel for SPARC
	|		|____/xilinx_zynq_a9_qemu 	#- contains RTEMS kernel for ARM
	|		|____/rtems			#- rtems clone from git repository
	|
	|
	|
	|
	|____/newlib
		|____/b-sparc-rtems5-newlib	#- newlib compiled for SPARC using rtems5 toolchain
		|____/b-arm-rtems5-newlib	#- newlib compiled fro ARM using rtems5 toolchain
                |____/newlib-cygwin             #- Clone of newlib from git repository

Managing Autoconf versions in sub-directories of Newlib Source Tree

For my GSoC project, I need to port some codes in Newlib. As other good projects, Newlib also uses Autoconf tools for producing “Makefile.in” and various other useful scripts. The situation is, inside its source tree, newlib-cygwin/uses autoconf tools version 2.64. Whereas newlib-cygwin/newlib/libc uses autoconf tools version 2.69.

I wrote a blog for this: How To Handle Two Versions of autoconf?

Apply Newlib Patche to RTEMS Source Builder

After creating patches for Newlib, I need to submit them to Newlib mailing list for review. But before I must make sure that the changes are successfully working. As Newlib is used by RTEMS as its C Library, one way is to use the patch in RTEMS and design a testsuite for it. If tests are successful, the changes are fine.

Apply Newlib Patch to RTEMS Source Builder

Task: Add psxinttypes01 for <inttypes.h> methods

This task was continued by me, original work belongs to the GSoC 2017 student of same project. The working directory is : rtems/testsuites/psxtests.

Modify the testsuite psxinttypes01/init.c

There was need to modify the original code to add some more tests and fix some bugs. inttypes uses strtoimax and wcstoimax. The 'opengroup' page contains every information to write testcases. For a good testsuite, every output (expected or error value) has to be verified.

The patch: https://devel.rtems.org/changeset/d9fcb22/rtems

Add psxinttypes01/psxinttypes01.doc and psxinttypes01/psxinttypes01.scn

Modify configure.ac

Entry had to be made for psxinttypes01 in configure.ac, so as it gets build with rest of the testsuites of rtems. Note, not to change the alphabetical order of the previous entries.

diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index cdd6ee7e4e..85559e4aa5 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -91,6 +91,7 @@ RTEMS_TEST_CHECK([psxid01])
 RTEMS_TEST_CHECK([psximfs01])
 RTEMS_TEST_CHECK([psximfs02])
 RTEMS_TEST_CHECK([psxintrcritical01])
+RTEMS_TEST_CHECK([psxinttypes01])
 RTEMS_TEST_CHECK([psxitimer])
 RTEMS_TEST_CHECK([psxkey01])
 RTEMS_TEST_CHECK([psxkey02])

Modify Makefile.am

This entry is made to generate make commands inside Makefile.in. Note $(support_includes) CPPFLAG is necesaary to include required header files.

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 1e354c0df7..59c9f2085b 100755
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -523,6 +523,13 @@ psxintrcritical01_CPPFLAGS = $(AM_CPPFLAGS) \
 endif
 endif

+if TEST_psxinttypes01
+psx_tests += psxinttypes01
+psxinttypes01_SOURCES = psxinttypes01/init.c
+psxinttypes01_CPPFLAGS = $(AM_CPPFLAGS) $(TEST_FLAGS_psxinttypes01) \
+       $(support_includes)
+endif
+
 if HAS_POSIX
 if TEST_psxitimer
 psx_tests += psxitimer

References