#3425 closed defect (fixed)

examples-v2: PowerPC fails to build fat_ramdisk

Reported by: Joel Sherrill Owned by:
Priority: normal Milestone: 5.1
Component: unspecified Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description (last modified by Chris Johns)

beatnik, gwlcfm, haleakala, mpc5566evb, mpc5566evb_spe, mpc5566evb_spe, mpc5643l_evb, mpc5668g, mpc5674f_ecu508_app, mpc5674f_ecu508_boot, mpc5674fevb, mpc5674fevb_spe, mpc5674f_rsm6, mvme3100, mvme3100, phycore_mpc5554, qemuprep-altivec, qemuprep

[5/7] Compiling build/powerpc-rtems5-beatnik/filesystem/fat_ramdisk/fs-root.tar
In file included from /home/joel/rtems-work/bsp-install//powerpc-rtems5/beatnik/lib/include/libcpu/powerpc-utility.h:40:0,
                 from /home/joel/rtems-work/bsp-install//powerpc-rtems5/beatnik/lib/include/bsp/vectors.h:40,
                 from /home/joel/rtems-work/bsp-install//powerpc-rtems5/beatnik/lib/include/bsp.h:27,
                 from ../../gdb/overwrite/rtems_init.c:7:
/home/joel/rtems-work/bsp-install//powerpc-rtems5/beatnik/lib/include/rtems/powerpc/powerpc.h:283:2: error: #error "Unsupported CPU Model"
 #error "Unsupported CPU Model"
  ^~~~~

In file included from /home/joel/rtems-work/bsp-install//powerpc-rtems5/beatnik/lib/include/libcpu/powerpc-utility.h:40:0,
                 from /home/joel/rtems-work/bsp-install//powerpc-rtems5/beatnik/lib/include/bsp/vectors.h:40,
                 from /home/joel/rtems-work/bsp-install//powerpc-rtems5/beatnik/lib/include/bsp.h:27,
                 from ../../hello/hello_world_c/test.c:21:
/home/joel/rtems-work/bsp-install//powerpc-rtems5/beatnik/lib/include/rtems/powerpc/powerpc.h:283:2: error: #error "Unsupported CPU Model"
 #error "Unsupported CPU Model"
  ^~~~~

Waf: Leaving directory `/data/home/joel/rtems-work/examples-v2/build/powerpc-rtems5-beatnik'
Build failed

Change History (16)

comment:1 Changed on May 2, 2018 at 12:38:16 AM by Chris Johns

Description: modified (diff)

Please run with -v and have a look at the command line and compare it to a similar compile in the testsuite? Is there something in the BSP configuration that is not being set in the BSP's pkg-config file?

Last edited on May 2, 2018 at 12:38:48 AM by Chris Johns (previous) (diff)

comment:2 Changed on May 2, 2018 at 5:09:51 PM by Joel Sherrill

From waf -v

[1/7] Compiling hello/hello_world_c/test.c
12:04:58 runner ['/home/joel/rtems-work/tools/5/bin/powerpc-rtems5-gcc', '-qrtems', '-B/home/joel/rtems-work/bsp-install//powerpc-rtems5/lib/', '-B/home/joel/rtems-work/bsp-install//powerpc-rtems5/mpc5566evb/lib/', '--specs', 'bsp_specs', '-mcpu=8540', '-mcpu=8540', '-meabi', '-meabi', '-msdata=sysv', '-msdata=sysv', '-fno-common', '-fno-common', '-msoft-float', '-msoft-float', '-mno-spe', '-mno-spe', '-mstrict-align', '-mstrict-align', '-fno-keep-inline-functions', '-fno-keep-inline-functions', '-ffunction-sections', '-ffunction-sections', '-fdata-sections', '-fdata-sections', '-O2', '-g', '-DHAVE_RTEMS_SCORE_CPUOPTS_H=1', '-DHAVE_RTEMS_H=1', '../../hello/hello_world_c/test.c', '-c', '-o/data/home/joel/rtems-work/examples-v2/build/powerpc-rtems5-mpc5566evb/hello/hello_world_c/test.c.1.o']
[2/7] Compiling gdb/overwrite/rtems_init.c
12:04:58 runner ['/home/joel/rtems-work/tools/5/bin/powerpc-rtems5-gcc', '-qrtems', '-B/home/joel/rtems-work/bsp-install//powerpc-rtems5/lib/', '-B/home/joel/rtems-work/bsp-install//powerpc-rtems5/mpc5566evb/lib/', '--specs', 'bsp_specs', '-mcpu=8540', '-mcpu=8540', '-meabi', '-meabi', '-msdata=sysv', '-msdata=sysv', '-fno-common', '-fno-common', '-msoft-float', '-msoft-float', '-mno-spe', '-mno-spe', '-mstrict-align', '-mstrict-align', '-fno-keep-inline-functions', '-fno-keep-inline-functions', '-ffunction-sections', '-ffunction-sections', '-fdata-sections', '-fdata-sections', '-O2', '-g', '-DHAVE_RTEMS_SCORE_CPUOPTS_H=1', '-DHAVE_RTEMS_H=1', '../../gdb/overwrite/rtems_init.c', '-c', '-o/data/home/joel/rtems-work/examples-v2/build/powerpc-rtems5-mpc5566evb/gdb/overwrite/rtems_init.c.1.o']
In file included from /home/joel/rtems-work/bsp-install//powerpc-rtems5/mpc5566evb/lib/include/libcpu/powerpc-utility.h:40:0,
                 from /home/joel/rtems-work/bsp-install//powerpc-rtems5/mpc5566evb/lib/include/bsp.h:39,
                 from ../../hello/hello_world_c/test.c:21:
/home/joel/rtems-work/bsp-install//powerpc-rtems5/mpc5566evb/lib/include/rtems/powerpc/powerpc.h:283:2: error: #error "Unsupported CPU Model"
 #error "Unsupported CPU Model"
  ^~~~~

In file included from /home/joel/rtems-work/bsp-install//powerpc-rtems5/mpc5566evb/lib/include/libcpu/powerpc-utility.h:40:0,
                 from /home/joel/rtems-work/bsp-install//powerpc-rtems5/mpc5566evb/lib/include/bsp.h:39,
                 from ../../gdb/overwrite/rtems_init.c:7:
/home/joel/rtems-work/bsp-install//powerpc-rtems5/mpc5566evb/lib/include/rtems/powerpc/powerpc.h:283:2: error: #error "Unsupported CPU Model"
 #error "Unsupported CPU Model"
  ^~~~~

Waf: Leaving directory `/data/home/joel/rtems-work/examples-v2/build/powerpc-rtems5-mpc5566evb'
Build failed
 -> task in 'hello.exe' failed with exit status 1: 
        {task 21579488: c test.c -> test.c.1.o}
['/home/joel/rtems-work/tools/5/bin/powerpc-rtems5-gcc', '-qrtems', '-B/home/joel/rtems-work/bsp-install//powerpc-rtems5/lib/', '-B/home/joel/rtems-work/bsp-install//powerpc-rtems5/mpc5566evb/lib/', '--specs', 'bsp_specs', '-mcpu=8540', '-mcpu=8540', '-meabi', '-meabi', '-msdata=sysv', '-msdata=sysv', '-fno-common', '-fno-common', '-msoft-float', '-msoft-float', '-mno-spe', '-mno-spe', '-mstrict-align', '-mstrict-align', '-fno-keep-inline-functions', '-fno-keep-inline-functions', '-ffunction-sections', '-ffunction-sections', '-fdata-sections', '-fdata-sections', '-O2', '-g', '-DHAVE_RTEMS_SCORE_CPUOPTS_H=1', '-DHAVE_RTEMS_H=1', '../../hello/hello_world_c/test.c', '-c', '-o/data/home/joel/rtems-work/examples-v2/build/powerpc-rtems5-mpc5566evb/hello/hello_world_c/test.c.1.o']
 -> task in 'overwrite.exe' failed with exit status 1: 
        {task 21579848: c rtems_init.c -> rtems_init.c.1.o}
['/home/joel/rtems-work/tools/5/bin/powerpc-rtems5-gcc', '-qrtems', '-B/home/joel/rtems-work/bsp-install//powerpc-rtems5/lib/', '-B/home/joel/rtems-work/bsp-install//powerpc-rtems5/mpc5566evb/lib/', '--specs', 'bsp_specs', '-mcpu=8540', '-mcpu=8540', '-meabi', '-meabi', '-msdata=sysv', '-msdata=sysv', '-fno-common', '-fno-common', '-msoft-float', '-msoft-float', '-mno-spe', '-mno-spe', '-mstrict-align', '-mstrict-align', '-fno-keep-inline-functions', '-fno-keep-inline-functions', '-ffunction-sections', '-ffunction-sections', '-fdata-sections', '-fdata-sections', '-O2', '-g', '-DHAVE_RTEMS_SCORE_CPUOPTS_H=1', '-DHAVE_RTEMS_H=1', '../../gdb/overwrite/rtems_init.c', '-c', '-o/data/home/joel/rtems-work/examples-v2/build/powerpc-rtems5-mpc5566evb/gdb/overwrite/rtems_init.c.1.o']

Looks like the -D option from the CPU_CFLAGS is missing and many of the options are duplicated.

CPU_CFLAGS = -mcpu=8540 -meabi -msdata=sysv -fno-common $(CPU_CFLAGS_FLOAT) \
    -D__ppc_generic -mstrict-align
Last edited on May 3, 2018 at 2:22:58 AM by Chris Johns (previous) (diff)

comment:3 Changed on May 3, 2018 at 2:25:09 AM by Chris Johns

Thank you, it is what I suspected. There are BSPs where something special or different is happening. It highlights the issue with BSP configurations in a format like make.

If we can collect what we need to have on the CFLAGS in the .pc files I can look at fixing it.

comment:4 Changed on May 7, 2018 at 8:07:13 PM by Joel Sherrill

The underlying problem is that the rtems_waf application support eats a few gcc arguments that are needed to build applications. In this case it is -Dxxx where xxx is a macro indicating PowerPC type.

The proper solution to this is to ban use of -D in the required BSP CFLAGS. We should not require a -D to be specified on the application command line to either compiler correctly or at all.

This impacts some PowerPC BSPs and defining the expected symbol in bsp.h will work based on this traceback.

In file included from /home/joel/rtems-work/bsp-installpowerpc-rtems5/mpc5566evb/lib/include/libcpu/powerpc-utility.h:40:0,

from /home/joel/rtems-work/bsp-installpowerpc-rtems5/mpc5566evb/lib/include/bsp.h:39,
from ../../gdb/overwrite/rtems_init.c:7:

/home/joel/rtems-work/bsp-installpowerpc-rtems5/mpc5566evb/lib/include/rtems/powerpc/powerpc.h:283:2: error: #error "Unsupported CPU Model"

#error "Unsupported CPU Model"


My solution is to move the -D in impacted PowerPC BSPs from CFLAGS (or CPU_CFLAGS) to bsp.h

comment:5 in reply to:  4 Changed on May 7, 2018 at 9:04:02 PM by Chris Johns

Replying to Joel Sherrill:

My solution is to move the -D in impacted PowerPC BSPs from CFLAGS (or CPU_CFLAGS) to bsp.h

I agree, applications should only be required to match some machine related flags to make sure the correct ABI is being used.

comment:6 Changed on May 8, 2018 at 7:37:02 AM by Sebastian Huber

There are a couple of BSPs which use -D flags:

grep -- -D bsps/*/*/config/*
bsps/arm/rtl22xx/config/rtl22xx_t.cfg:#CPU_CFLAGS += -mthumb-interwork -D __THUMB_INTERWORK__ -mthumb
bsps/arm/rtl22xx/config/rtl22xx_t.cfg:#CPU_ASFLAGS += -D __THUMB_INTERWORK__  -mthumb-interwork
bsps/arm/smdk2410/config/smdk2410.cfg:CPU_CFLAGS = -mcpu=arm920t -DCPU_S3C2410
bsps/powerpc/beatnik/config/beatnik.cfg:CPU_CFLAGS = -mcpu=7400 -D__ppc_generic 
bsps/powerpc/haleakala/config/haleakala.cfg:CPU_CFLAGS = -mcpu=405 -Dppc405
bsps/powerpc/motorola_powerpc/config/mcp750.cfg:CPU_CFLAGS = -mcpu=750 -Dmpc750
bsps/powerpc/motorola_powerpc/config/mtx603e.cfg:CPU_CFLAGS = -mcpu=603e -Dppc603e
bsps/powerpc/motorola_powerpc/config/mvme2100.cfg:CPU_CFLAGS = -mcpu=603e -Dppc603e
bsps/powerpc/motorola_powerpc/config/qemuprep-altivec.cfg:CPU_CFLAGS = -mcpu=7400 -mmultiple -mstring -mstrict-align -D__ppc_generic
bsps/powerpc/motorola_powerpc/config/qemuprep.cfg:CPU_CFLAGS = -mcpu=powerpc -mmultiple -mstring -mstrict-align -D__ppc_generic
bsps/powerpc/mpc55xxevb/config/mpc55xx.inc:    -D__ppc_generic -mstrict-align
bsps/powerpc/mpc8260ads/config/mpc8260ads.cfg:CPU_CFLAGS = -mcpu=603e -mstrict-align -Dmpc8260 \
bsps/powerpc/mvme3100/config/mvme3100.cfg:CPU_CFLAGS = -mcpu=powerpc -msoft-float -D__ppc_generic
bsps/powerpc/mvme5500/config/mvme5500.cfg:CPU_CFLAGS = -mcpu=7450 -mtune=7450 -Dmpc7455
bsps/powerpc/psim/config/psim.cfg:CPU_CFLAGS = -meabi -mcpu=603e -msdata=sysv -fno-common -Dppc603e
bsps/powerpc/qemuppc/config/qemuppc.cfg:CPU_CFLAGS = -mcpu=603e  -Dppc603e
bsps/powerpc/qoriq/config/qoriq_e6500_32.cfg:   -D__ppc_generic
bsps/powerpc/qoriq/config/qoriq_e6500_64.cfg:   -D__ppc_generic
bsps/powerpc/qoriq/config/qoriq.inc:    -D__ppc_generic
bsps/powerpc/ss555/config/ss555.cfg:CPU_CFLAGS = -mcpu=$(GCC_CPU_MODEL) -Dmpc555
bsps/powerpc/t32mppc/config/t32mppc.cfg:        -D__ppc_generic
bsps/powerpc/tqm8xx/config/tqm8xx.inc:CPU_CFLAGS = -mcpu=860 -Dmpc860 \
bsps/powerpc/virtex4/config/virtex4.cfg:CPU_CFLAGS = -mcpu=405 -Dppc405
bsps/powerpc/virtex5/config/virtex5.cfg:CPU_CFLAGS = -mcpu=440 -Dppc440 -msoft-float
bsps/powerpc/virtex/config/virtex.cfg:CPU_CFLAGS = -mcpu=403 -Dppc405 -meabi -msdata=sysv -fno-common
bsps/sparc64/niagara/config/niagara.cfg:CPU_CFLAGS = -mcpu=niagara -DSUN4V
bsps/sparc64/usiii/config/usiii.cfg:CPU_CFLAGS = -mcpu=ultrasparc3 -DUS3 -DSUN4U

We should ban the use of command line defines.

Getting rid of the -D__ppc_generic is easy. Getting rid of the -Dppc405, etc. is more difficult and there is some interaction with the GCC specs:

#undef CPP_OS_DEFAULT_SPEC
#define CPP_OS_DEFAULT_SPEC "\
%{!mcpu*:  %{!Dppc*: %{!Dmpc*: -Dmpc750} } }\
%{mcpu=403:  %{!Dppc*: %{!Dmpc*: -Dppc403}  } } \
%{mcpu=505:  %{!Dppc*: %{!Dmpc*: -Dmpc505}  } } \
%{mcpu=601:  %{!Dppc*: %{!Dmpc*: -Dppc601}  } } \
%{mcpu=602:  %{!Dppc*: %{!Dmpc*: -Dppc602}  } } \
%{mcpu=603:  %{!Dppc*: %{!Dmpc*: -Dppc603}  } } \
%{mcpu=603e: %{!Dppc*: %{!Dmpc*: -Dppc603e} } } \
%{mcpu=604:  %{!Dppc*: %{!Dmpc*: -Dmpc604}  } } \
%{mcpu=750:  %{!Dppc*: %{!Dmpc*: -Dmpc750}  } } \
%{mcpu=821:  %{!Dppc*: %{!Dmpc*: -Dmpc821}  } } \
%{mcpu=860:  %{!Dppc*: %{!Dmpc*: -Dmpc860}  } } \
%{mcpu=8540: %{!Dppc*: %{!Dmpc*: -Dppc8540}  } } \
%{mcpu=e6500: -D__PPC_CPU_E6500__}"

comment:7 Changed on May 8, 2018 at 10:35:29 PM by Joel Sherrill <joel@…>

In 2a1171d8/rtems:

rtl22xx_t.cfg: Remove comment with -D THUMB_INTERWORK

Updates #3425.

comment:8 Changed on May 10, 2018 at 10:25:29 PM by Joel Sherrill <joel@…>

In c8dcdf54/rtems:

sparc64 niagara, usiii: Remove -D options from cfg file and move to bspopts.h

Updates #3425.

comment:9 Changed on May 10, 2018 at 10:27:19 PM by Joel Sherrill

I think this ticket is down to the PowerPC BSPs. If you had a solution in mind Sebastian, please implement it.

comment:10 Changed on May 11, 2018 at 4:57:20 AM by Sebastian Huber

I don't have time for this ticket at least in the next two weeks.

comment:11 Changed on May 15, 2018 at 2:25:55 PM by Joel Sherrill <joel@…>

In 9d62874/rtems:

sparc64 BSPs: Hard define configuration required settings

Updates #3425.

comment:12 in reply to:  10 Changed on May 15, 2018 at 11:04:01 PM by Joel Sherrill

Replying to Sebastian Huber:

I don't have time for this ticket at least in the next two weeks.

Is the approach I used on the arm and sparc64 BSPs acceptable? I am testing a similar patch for the PowerPC BSPs. Use BSP_SETOPTS when variants and AC_DEFINE when there are no variants.

If so, this will eliminate the use of -Dxxx in .cfg files.

comment:13 Changed on May 18, 2018 at 1:22:54 PM by Joel Sherrill <joel@…>

In eaf5bec/rtems:

virtex5: Move -Dxxx to configure.ac

Updates #3425.

comment:14 Changed on May 18, 2018 at 1:24:32 PM by Joel Sherrill

Resolution: fixed
Status: newclosed

No BSPs use -D in CFLAGS now. #3431 is a ticket to track some identified follow up work.

comment:15 Changed on Jun 11, 2018 at 12:48:11 PM by Sebastian Huber <sebastian.huber@…>

In 07c5976/rtems:

bsps/powerpc: Hack to fix the build

The ppc405 define must be checked before the ppc403 define. The ppc405
define is provided by <bspopts.h>. The ppc403 define is provided by GCC
as a built-in define if no ppc* or mpc* define is set via the
command line (see GCC sources "gcc/config/rs6000/rtems.h").

Update #3425.

comment:16 Changed on Jun 11, 2018 at 12:48:21 PM by Sebastian Huber <sebastian.huber@…>

In 5249a4c/rtems:

powerpc: Fix ss555 build

The mpc555 define is provided via <bspopts.h>. It must not be used in
cpukit header files.

Update #3425.

Note: See TracTickets for help on using tickets.