New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use armv6hf target arch by defaut for the raspberry Pi #140

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@iyedb

iyedb commented Jan 1, 2016

According to this page https://wiki.freebsd.org/FreeBSD/arm/crossbuild armv6hf is one the targets archs available to cross-compile FreeBSD:
ARMv6 and ARMv7 systems with native hardware floating point.
The raspberry Pi model A, B, B+ has a hardware FPU.

Use armv6hf target arch by defaut for the raspberry Pi
According to this page https://wiki.freebsd.org/FreeBSD/arm/crossbuild armv6hf is one the targets archs available to cross-compile FreeBSD:
ARMv6 and ARMv7 systems with native hardware floating point.
The raspberry Pi model A, B, B+ has a hardware FPU.

@iyedb iyedb referenced this pull request Jan 1, 2016

Closed

Raspberry pi armv6hf #139

@kientzle

This comment has been minimized.

Show comment
Hide comment
@kientzle

kientzle Jan 2, 2016

Contributor

This looks good. Before I merge it, can you confirm that you've tested it by doing a full complete clean build from scratch?

Contributor

kientzle commented Jan 2, 2016

This looks good. Before I merge it, can you confirm that you've tested it by doing a full complete clean build from scratch?

@kientzle

This comment has been minimized.

Show comment
Hide comment
@kientzle

kientzle Jan 2, 2016

Contributor

Hmmm.... One possible concern: Does this work with FreeBSD 10?

A lot of folks use Crochet with FreeBSD 10 sources and I've never checked to see if armv6hf is supported there.

Contributor

kientzle commented Jan 2, 2016

Hmmm.... One possible concern: Does this work with FreeBSD 10?

A lot of folks use Crochet with FreeBSD 10 sources and I've never checked to see if armv6hf is supported there.

@iyedb

This comment has been minimized.

Show comment
Hide comment
@iyedb

iyedb Jan 2, 2016

This is confirmed to work on a FreeBSD 11 source tree. I generated an image using crochet and it boots and works perfectly. And it actually builds for the arm hard fp abi for my raspberry pi B+
%readelf -a /sbin/init:
here is no dynamic section in this file.
Attribute Section: aeabi
File Attributes
Tag_CPU_name: arm1176jzf-s
Tag_CPU_arch: ARM v6
Tag_ARM_ISA_use: Yes
Tag_FP_arch: VFPv2
Tag_ABI_PCS_GOT_use: direct
Tag_ABI_PCS_wchar_t: wchar_t size 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte align
Tag_ABI_align_preserved: 8-byte align
Tag_ABI_enum_size: 32-bit
Tag_ABI_VFP_args: AAPCS (VFP variant)
Tag_ABI_FP_16bit_format: IEEE 754
Tag_conformance: 2.09

I am not aware if it does not cause any issue on FreeBSD-10.x and I did not test it.
What can be done is testing if we are building a 10 source tree or a 11 source tree using some top level variable set by crochet main script. If you agree with the approach I can go ahead make the necessary changes.
The same applies for the pi 2.
For raspberry PI really the default should be armv6hf. This is for example how Raspbian differs from Debian. They "just" recompiled all of Debian to target the hard float abi.
One down side though: there is no armv6hf pkg repo:
running pkg for the first time gives this:
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:11:armv6hf/latest/Latest/pkg.txz: Not Found
I am going to build the packages I need my self. but now I can do it on the host since I have the cross tool chain :) (building on the PI is desperately slow as you can imagine)
My build environment is FreeBSD-11 current on VirtualBox on OS X. Works flawlessly.

iyedb commented Jan 2, 2016

This is confirmed to work on a FreeBSD 11 source tree. I generated an image using crochet and it boots and works perfectly. And it actually builds for the arm hard fp abi for my raspberry pi B+
%readelf -a /sbin/init:
here is no dynamic section in this file.
Attribute Section: aeabi
File Attributes
Tag_CPU_name: arm1176jzf-s
Tag_CPU_arch: ARM v6
Tag_ARM_ISA_use: Yes
Tag_FP_arch: VFPv2
Tag_ABI_PCS_GOT_use: direct
Tag_ABI_PCS_wchar_t: wchar_t size 4
Tag_ABI_FP_denormal: Needed
Tag_ABI_FP_exceptions: Needed
Tag_ABI_FP_number_model: IEEE 754
Tag_ABI_align_needed: 8-byte align
Tag_ABI_align_preserved: 8-byte align
Tag_ABI_enum_size: 32-bit
Tag_ABI_VFP_args: AAPCS (VFP variant)
Tag_ABI_FP_16bit_format: IEEE 754
Tag_conformance: 2.09

I am not aware if it does not cause any issue on FreeBSD-10.x and I did not test it.
What can be done is testing if we are building a 10 source tree or a 11 source tree using some top level variable set by crochet main script. If you agree with the approach I can go ahead make the necessary changes.
The same applies for the pi 2.
For raspberry PI really the default should be armv6hf. This is for example how Raspbian differs from Debian. They "just" recompiled all of Debian to target the hard float abi.
One down side though: there is no armv6hf pkg repo:
running pkg for the first time gives this:
pkg: Error fetching http://pkg.FreeBSD.org/FreeBSD:11:armv6hf/latest/Latest/pkg.txz: Not Found
I am going to build the packages I need my self. but now I can do it on the host since I have the cross tool chain :) (building on the PI is desperately slow as you can imagine)
My build environment is FreeBSD-11 current on VirtualBox on OS X. Works flawlessly.

@kientzle

This comment has been minimized.

Show comment
Hide comment
@kientzle

kientzle Jan 3, 2016

Contributor

FREEBSD_MAJOR_VERSION is set during the check phase. It should be "10" or "11" accordingly after that point.

Contributor

kientzle commented Jan 3, 2016

FREEBSD_MAJOR_VERSION is set during the check phase. It should be "10" or "11" accordingly after that point.

@zxombie

This comment has been minimized.

Show comment
Hide comment
@zxombie

zxombie Jan 3, 2016

Contributor

armv6 is already hard float, all armv6hf gives you is it will pass floating-point data to functions in floating-point registers. I also expect that armv6 will be using the hard float ABI soon (within a month) an at this time armv6hf will be removed.

Contributor

zxombie commented Jan 3, 2016

armv6 is already hard float, all armv6hf gives you is it will pass floating-point data to functions in floating-point registers. I also expect that armv6 will be using the hard float ABI soon (within a month) an at this time armv6hf will be removed.

@iyedb

This comment has been minimized.

Show comment
Hide comment
@iyedb

iyedb Jan 3, 2016

Can you please expand on that? According to this wiki page https://wiki.freebsd.org/FreeBSD/arm/crossbuild, armv6 is to be deprecated in favor of armv6h.
I am little confused I guess I am missing something. You said that armv6 is already hard float And that it will using the hf ABI soon? What I understand is that armv6 already generates VFPv2 instructions for floating point operations but does not pass float arguments in the float registers (the ABI). How is this going to happen? Is there a way to track the progress.
Thanks.

iyedb commented Jan 3, 2016

Can you please expand on that? According to this wiki page https://wiki.freebsd.org/FreeBSD/arm/crossbuild, armv6 is to be deprecated in favor of armv6h.
I am little confused I guess I am missing something. You said that armv6 is already hard float And that it will using the hf ABI soon? What I understand is that armv6 already generates VFPv2 instructions for floating point operations but does not pass float arguments in the float registers (the ABI). How is this going to happen? Is there a way to track the progress.
Thanks.

@zxombie

This comment has been minimized.

Show comment
Hide comment
@zxombie

zxombie Jan 3, 2016

Contributor

That page is a few months old, since then it has been decided to move the armv6 ABI to hard-float. The start of this work has been committed in https://svnweb.freebsd.org/changeset/base/293069. This will allow us to change the ABI while allowing existing applications to still run.

Contributor

zxombie commented Jan 3, 2016

That page is a few months old, since then it has been decided to move the armv6 ABI to hard-float. The start of this work has been committed in https://svnweb.freebsd.org/changeset/base/293069. This will allow us to change the ABI while allowing existing applications to still run.

@iyedb

This comment has been minimized.

Show comment
Hide comment
@iyedb

iyedb Jan 3, 2016

Ok great.
For reference here are the compiler default options when building an elf on
an armv6hf FreeBSD build:
-target-cpu arm1176jzf-s -target-abi aapcs-linux -mfloat-abi hard
an armv6 FreeBSD build:
-target-cpu arm1176jzf-s -target-feature +soft-float -target-feature +soft-float-abi -target-feature -neon -target-feature -crypto -target-abi aapcs-linux -msoft-float -mfloat-abi soft
I am going to close the pull request.
One question though, does this mean the packages from http://pkg.FreeBSD.org/FreeBSD:11:armv6/latest/Latest/pkg.txz need not be rebuilt?

iyedb commented Jan 3, 2016

Ok great.
For reference here are the compiler default options when building an elf on
an armv6hf FreeBSD build:
-target-cpu arm1176jzf-s -target-abi aapcs-linux -mfloat-abi hard
an armv6 FreeBSD build:
-target-cpu arm1176jzf-s -target-feature +soft-float -target-feature +soft-float-abi -target-feature -neon -target-feature -crypto -target-abi aapcs-linux -msoft-float -mfloat-abi soft
I am going to close the pull request.
One question though, does this mean the packages from http://pkg.FreeBSD.org/FreeBSD:11:armv6/latest/Latest/pkg.txz need not be rebuilt?

@iyedb iyedb closed this Jan 3, 2016

@kientzle

This comment has been minimized.

Show comment
Hide comment
@kientzle

kientzle Jun 9, 2016

Contributor

Follow-up note: armv6 now uses hard-float, so "armv6hf" as a build type has been deprecated.

Contributor

kientzle commented Jun 9, 2016

Follow-up note: armv6 now uses hard-float, so "armv6hf" as a build type has been deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment