Bug 5900 - config flags to the Xenomai build system ...
Summary: config flags to the Xenomai build system ...
Status: RESOLVED INVALID
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2012.05
Hardware: PC Linux
: P5 normal
Target Milestone: 2014.08
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-04 21:53 UTC by teratux
Modified: 2014-07-30 20:05 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description teratux 2013-02-04 21:53:46 UTC
The only two options passed to the xenomai package in the package/xenomai/xenomai.mk are:

ifeq ($(BR2_PACKAGE_XENOMAI_SMP),y)
XENOMAI_CONF_OPT += --enable-smp
endif

XENOMAI_CONF_OPT += --includedir=/usr/include/xenomai/

On my target arch ( smdk2440 / s3c24xx ) I need these also:
XENOMAI_CONF_OPT += CFLAGS="-march=armv4t -msoft-float" LDFLAGS="-march=armv4t -msoft-float"

without them, the xenomai test suite fails to detect any FPU support at all, even if it's emulated by software such as this case.  It's something that needs to be passed to the ./configure according to their "Getting Started" document, and something that has been discussed recently in their mailing lists ...

I know it can't be passed on like this exactly, but maybe with a conditional block for this architecture.  Here are the options by arch that you should pass ( taken from the Xenomai site ):

at91rm9200     :: CFLAGS="-march=armv4t -msoft-float"
at91sam9x      :: CFLAGS="-march=armv5 -msoft-float"
imx1           :: CFLAGS="-march=armv4t -msoft-float"
imx21          :: CFLAGS="-march=armv5 -msoft-float"
imx31          :: CFLAGS="-march=armv6 -mfpu=vfp"
imx51/imx53    :: CFLAGS="-march=armv7-a -mfpu=vfp3"
imx6q          :: CFLAGS="-march=armv7-a -mfpu=vfp3"
ixp4xx         :: CFLAGS="-march=armv5 -msoft-float" --enable-arm-tsc=ixp4xx
omap3          :: -march=armv7-a -mfpu=vfp3
omap4          :: -march=armv7-a -mfpu=vfp3
orion          :: -march=armv5 -mfpu=vfp
pxa            :: -march=armv5 -msoft-float
pxa3xx         :: CFLAGS="-march=armv5 -msoft-float" --enable-arm-quirks=xscale3
s3c24xx        :: CFLAGS="-march=armv4t -msoft-float"
sa1100         :: CFLAGS="-march=armv4t -msoft-float" --enable-arm-quirks=sa1100
Comment 1 Thomas Petazzoni 2013-02-04 21:57:38 UTC
If you select the proper armv4t core in "Target Architecture Variant" and have the BR2_SOFT_FLOAT option enabled, then we are normally already passing those two flags to Xenomai ./configure script.
Comment 2 teratux 2013-02-04 22:06:01 UTC
Yes I'm using those two options:
BR2_arm920t=y
BR2_PREFER_SOFT_FLOAT=y
BR2_SOFT_FLOAT=y

I noted they were missing when I saw the config.log in the build/xenomai-2.6.0/ directory.  This is how it looks now after adding them manually in the xenomai.mk recipe:

  $ ./configure --target=arm-linux --host=arm-linux --build=i686-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --program-prefix= --disable-gtk-doc --enable-ipv6 --enable-static --enable-shared --includedir=/usr/include/xenomai/ CFLAGS=-march=armv4t -msoft-float LDFLAGS=-march=armv4t -msoft-float

Notice the CFLAGS and LDFLAGS at the end ...

(In reply to comment #1)
> If you select the proper armv4t core in "Target Architecture Variant" and have
> the BR2_SOFT_FLOAT option enabled, then we are normally already passing those
> two flags to Xenomai ./configure script.
Comment 3 Thomas Petazzoni 2013-02-04 22:31:41 UTC
They are in fact not necessarily present on the command line because since you use the internal backend, we build gcc to generate armv4t code by default, so it's not useful to pass -march=armv4t all the time.

Is Xenomai actually checking the presence of those command line flags directly?
Comment 4 teratux 2013-02-05 14:42:17 UTC
I asked the Xenomai team and this is their response:

Xenomai does not do anything special, it uses the autotools default
which is:
- if you pass CFLAGS and LDFLAGS on the right hand of the configure
command line, the generated makefiles are hardcoded with these flags
values, and you need not do anything special later on to get these flags
used for all the compilations. This has been the recommended way of
passing CFLAGS and LDFLAGS when building autotools-based projects for
many years.

- if you want to pass them as environment variables (so, on the left
hand of the configure command line), the makefiles are not generated
with these flags, so, you have to pass them in the environment of the
"make" command.

Maybe buildroot passes the parameters differently ??

(In reply to comment #3)
> They are in fact not necessarily present on the command line because since you
> use the internal backend, we build gcc to generate armv4t code by default, so
> it's not useful to pass -march=armv4t all the time.
> 
> Is Xenomai actually checking the presence of those command line flags directly?
Comment 5 Thomas De Schampheleire 2014-07-16 19:38:01 UTC
I tried reproducing this issue. Since I don't have a target board to test with, I have to resort to checking the parameters passed to the compilation.

Since I believe that the FPU support check you are referring to in the testsuite originates from the 'switchtest', I checked with strace which parameters are passed to the real compiler (by the compiler wrapper):

execve("/home/tdescham/repo/contrib/buildroot-reproduce/output/host/opt/ext-toolchain/bin/arm-none-linux-gnueabi-gcc", ["/home/tdescham/repo/contrib/buildroot-reproduce/output/host/opt/ext-toolchain/bin/arm-none-linux-gnueabi-gcc", "--sysroot", "/home/tdescham/repo/contrib/buildroot-reproduce/output/host/usr/arm-buildroot-linux-gnueabi/sysroot", "-mabi=aapcs-linux", "-msoft-float", "-marm", "-pipe", "-mfloat-abi=soft", "-march=armv4t", "-mcpu=arm920t", "-DHAVE_CONFIG_H", "-I.", "-I../../../src/include", "-I../../../include/posix", "-O2", "-D_GNU_SOURCE", "-D_REENTRANT", "-Wall", "-Werror-implicit-function-declaration", "-pipe", "-D__XENO__", "-D__IN_XENO__", "-Wstrict-prototypes", "-g", "-I../../../include", "-D_LARGEFILE_SOURCE", "-D_LARGEFILE64_SOURCE", "-D_FILE_OFFSET_BITS=64", "-D_LARGEFILE_SOURCE", "-D_LARGEFILE64_SOURCE", "-D_FILE_OFFSET_BITS=64", "-pipe", "-Os", "-MT", "switchtest-switchtest.o", "-MD", "-MP", "-MF", ".deps/switchtest-switchtest.Tpo", "-c", "-o", "switchtest-switchtest.o", "switchtest.c"], [/* 54 vars */]) = 0



This shows that the requested flags are effectively passed to the compilation, so I don't expect issues. 

This was checked with an external sourcery toolchain. The defconfig (buildroot 2014.05-git) is:

BR2_arm=y
BR2_arm920t=y
BR2_DL_DIR="~/repo/contrib/dl"
BR2_TOOLCHAIN_EXTERNAL=y
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_DEFCONFIG="mx1"
BR2_LINUX_KERNEL_EXT_XENOMAI=y

(don't mind the kernel defconfig, it is bogus).

So at this point, we believe that there is no issue.

If you do believe there is an issue, then please:
- provide a .config for us to reproduce
- provide more details / confirmation about the test that fails (switchtest?)
- verify the output of strace as I did above
Comment 6 romain.naour 2014-07-22 21:22:39 UTC
Hello,

I was working with xenomai in 2012 with the mini2440, and I still have it :)

I don't think the bug report is relevant with this board.

I tried to add this line in xenomai.mk:
XENOMAI_CONF_OPT += CFLAGS="-march=armv4t -msoft-float" LDFLAGS="-march=armv4t -msoft-float"

I always get the following message:
# switchtest
== Testing FPU check routines...
== FPU check routines: unimplemented, skipping FPU switches tests.
[...]

That's because the VFP support (CONFIG_VFP) is not enabled in the linux kernel.

config VFP
	bool "VFP-format floating point maths"
	depends on CPU_V6 || CPU_V6K || CPU_ARM926T || CPU_V7 || CPU_FEROCEON

None of these requirements are met with the s3c2440.

So, in the check_fpu_thread() the check (check != 1) is always false.

xenomai-2.6/src/testsuite/switchtest/switchtest.c:
from check_fpu_thread():

check = fp_regs_check(2);
if (check != 1) {
	fprintf(stderr,
		"== FPU check routines: unimplemented, "
		"skipping FPU switches tests.\n");
	return NULL;
}

fp_regs_check() is defined in xenomai-2.6/include/asm-arm/fptest.h:

static inline unsigned fp_regs_check(unsigned val)
{
	unsigned result = val;

	if (have_vfp) {
	[snip]
	}

	return result;
}

And have_vfp depends on CONFIG_VFP

#ifdef CONFIG_VFP
#define have_vfp (elf_hwcap & HWCAP_VFP)
#else /* !CONFIG_VFP */
#define have_vfp (0)
#endif /* !CONFIG_VFP */

So, I'm agree with ThomasDS, this is not a buildroot issue.

Note: I'm using Buildroot 2014.05-git, xenomai-2.6.3 and linux kernel 3.5.7 and 3.8.13.
Comment 7 Thomas De Schampheleire 2014-07-30 20:05:10 UTC
Based on my observations, the feedback from Romain, and the missing feedback of the original submitter, I'm closing this bug report.