build of libbsd for powerpc fails with error: redefinition of 'eieio'

Sebastian Huber sebastian.huber at embedded-brains.de
Thu Jul 18 05:16:03 UTC 2019


On 17/07/2019 23:42, dufault at hda.com wrote:
>> On Jul 17, 2019, at 01:48 , Sebastian Huber <sebastian.huber at embedded-brains.de> wrote:
>>
>> Hello Peter,
>>
>> On 16/07/2019 19:58, Peter Dufault wrote:
>>> I have a build failure with the MVME5500 “beatnik” BSP. Therefore I tried to build the “psim” BSP and have the same failure: the FreeBSD PowerPC “cpufunc.h” and the RTEMS PowerPC “io.h” headers both define static inline "eioeio()" functions.
>>> - RTEMS, libbsd, RSB and the build tools are up-to-date as of this AM.
>>> - Building for arm xilinx_zynq_a9_qemu succeeds.
>>> - I’ll work-around it but I believe I must have something locally screwed up, I can't find any recent changes associated with this.
>>
>> libbsd doesn't work for all BSPs. For each new BSP you there are probably some things to fix and adjust. I think the <bsp.h> should not include the low level io.h header file. The only powerpc BSP that supported by libbsd is the qoriq.
>>
> 
> First an easy question: what rtems-libbsd branch is best to work with: master or 5-freebsd-12?

For production systems I would use 5-freebsd-12.  I regularly 
synchronize it with the FreeBSD stable/12 branch.

> 
> As for properly fixing the include of libcpu/io.h:
> 
> This fix is clear:
> - Any .c file below bsps/powerpc/shared/ that need it should include libcpu/io.h directly.  The header is in bsps/powerpc/include/ and both are below bsps/powerpc.

Yes.

> 
> This fix is not clear:
> - There are .c files in bsps/shared that reference e.g. “inport_byte()” (e.g. bsps/shared/dev/rtc/mc146818a_ioreg.c).  There are definitions of “inport_byte()” in cpukit/score headers for x86 architectures and in bsp.h headers for PowerPC (arm/gumstix, powerpc/beatnik, powerpc/motorola_powerpc).  For PowerPC the definition is based on what’s in "libcpu/io.h”.  The PowerPC definition of “inport_byte()" should be moved from bsp.h into bsps/powerpc/shared/libcpu/io.h, but then I don’t know the right way to get that header included in the bsps/shared code, there isn’t something like “bsps/shared/include” where a definition could go (and count on proper configuration of the BSPs for everything to link properly).

I would move the

#define outport_byte(port,value) outb(value,port)
#define outport_word(port,value) outw(value,port)
#define outport_long(port,value) outl(value,port)

#define inport_byte(port,value) (value = inb(port))
#define inport_word(port,value) (value = inw(port))
#define inport_long(port,value) (value = inl(port))

from the PowerPC <bsp.h> to <libcpu/io.h>.

> 
> As an aside, mc146818a_ioreg.c is brittle. It requires that “inport_byte" be a macro and if its definition is moved out of bsp.h the code will not compile properly:
> 
> #include <rtems.h>
> #include <bsp.h>
> #include <libchip/rtc.h>
> #include <libchip/mc146818a.h>
> 
> /*
>   *  At this point, not all CPUs or BSPs have defined in/out port routines.
>   */
> #if defined(__i386__) || defined(__PPC__)
> #if defined(inport_byte)
> ...

Use

#ifdef __PPC__
#include <libcpu/io.h>
#endif

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.


More information about the devel mailing list