[PATCH v1 0/2] [libbsd] Install correct machine include headers

Jan Sommer jan.sommer at dlr.de
Mon May 10 14:29:06 UTC 2021


This is a follow-up on this discussion regarding the installed header files
in libbsd: https://lists.rtems.org/pipermail/devel/2021-April/066211.html

The current situation is, that for example for all machines the bus.h is installed from
within the rtemsbsd directory (https://git.rtems.org/rtems-libbsd/tree/rtemsbsd/include/machine/bus.h).

According to the file docu it originates from the amd64 version of this file.
It also has the following section in it which we ran into when compiling Chris' ptpd2 archive:

#ifdef __i386__
  #error "your include paths are wrong"

This patchset does the following:
- Add the target dependent machine include directory to 'header-paths' in libbsd.py
- Import (mostly) '_bus.h', 'bus.h' and 'cpufunc.h' for the targets from freebsd-org
- Remove those header files from rtemsbsd directory

As a result the matching versions for machine dependent header files are now installed
for each BSP.
Would this be an acceptable solution?

So far I compiled some BSPs for i386, arm, aarch64, powerpc, riscv, sparc and sparc64 to check that they still compile after the changes.
Are there any other architectures which should be included?

I ran into one problem regarding the compilation of rtemsbsd/sys/dev/dw_mmc/dw_mmc.c:105

> return (bus_space_read_4(0, sc->bushandle, off));

The first parameter creates an error for riscv (I think because dereferencing a NULL pointer).
Are there any suggestion how to solve it (I am not familiar with the bus space and there is a lot of macro magic going on)?

Also, I am not sure if I always added the header files in the right
module in libbsd.py. Any suggestions where to put them instead would be welcome.

Best regards,


Jan Sommer (2):
  rtemsbd: Remove machine dependent files and use the ones from freebsd
  machine: Add machine dependent header files to libbsd.py

 freebsd/sys/arm/include/machine/_bus.h        |  47 +
 freebsd/sys/arm/include/machine/bus.h         | 769 ++++++++++++++++
 freebsd/sys/arm64/include/machine/_bus.h      |  46 +
 freebsd/sys/arm64/include/machine/bus.h       | 469 ++++++++++
 freebsd/sys/powerpc/include/machine/_bus.h    |  50 +
 freebsd/sys/powerpc/include/machine/bus.h     | 467 ++++++++++
 freebsd/sys/riscv/include/machine/_bus.h      |  46 +
 freebsd/sys/riscv/include/machine/bus.h       | 469 ++++++++++
 freebsd/sys/riscv/include/machine/cpufunc.h   | 135 +++
 freebsd/sys/riscv/include/machine/riscvreg.h  | 246 +++++
 .../sys/sparc}/include/machine/_bus.h         |   0
 .../sys/sparc}/include/machine/bus.h          |   0
 freebsd/sys/sparc/include/machine/cpufunc.h   |   0
 freebsd/sys/sparc64/include/machine/_bus.h    |  41 +
 freebsd/sys/sparc64/include/machine/bus.h     | 852 ++++++++++++++++++
 libbsd.py                                     |  26 +-
 rtemsbsd/include/machine/cpufunc.h            |   1 -
 waf_libbsd.py                                 |   2 -
 18 files changed, 3660 insertions(+), 6 deletions(-)
 create mode 100644 freebsd/sys/arm/include/machine/_bus.h
 create mode 100644 freebsd/sys/arm/include/machine/bus.h
 create mode 100644 freebsd/sys/arm64/include/machine/_bus.h
 create mode 100644 freebsd/sys/arm64/include/machine/bus.h
 create mode 100644 freebsd/sys/powerpc/include/machine/_bus.h
 create mode 100644 freebsd/sys/powerpc/include/machine/bus.h
 create mode 100644 freebsd/sys/riscv/include/machine/_bus.h
 create mode 100644 freebsd/sys/riscv/include/machine/bus.h
 create mode 100644 freebsd/sys/riscv/include/machine/cpufunc.h
 create mode 100644 freebsd/sys/riscv/include/machine/riscvreg.h
 rename {rtemsbsd => freebsd/sys/sparc}/include/machine/_bus.h (100%)
 rename {rtemsbsd => freebsd/sys/sparc}/include/machine/bus.h (100%)
 create mode 100644 freebsd/sys/sparc/include/machine/cpufunc.h
 create mode 100644 freebsd/sys/sparc64/include/machine/_bus.h
 create mode 100644 freebsd/sys/sparc64/include/machine/bus.h
 delete mode 100644 rtemsbsd/include/machine/cpufunc.h


More information about the devel mailing list