Skip to content
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

ARM v6 and v7 target #34

Closed
glebpom opened this issue Sep 20, 2017 · 13 comments
Closed

ARM v6 and v7 target #34

glebpom opened this issue Sep 20, 2017 · 13 comments

Comments

@glebpom
Copy link

glebpom commented Sep 20, 2017

Hello,

There is a documentation on Musl Getting Started page regarding distinctions between ARMv6 and ARMv7. There is no information about it in the Supported Targets list. Is it possible to build sperate cross-compilers for ARMv6 and ARMv7 now?

Thanks

@xoac
Copy link

xoac commented Sep 20, 2017

Is it possible to build sperate cross-compilers for ARMv6 and ARMv7 now?

Yes.


First solution that I come in is to set:

  • OUTPUT = /opt/cross/armv7/
  • OUTPUT =/opt/cross/armv6/

Now you have two cross-compiler stored in different dirs. This compiler can be copied. (As far as I know)

You both compile with TARGET arm[eb]-linux-musleabi[hf]

  • for armv7 (arm-linux-musleabihf )
  • for armv6 (arm-linux-musleabi)

the part [hf] is from hard float (armv7)
but don't forget And add Flags from here http://wiki.musl-libc.org/wiki/Getting_started#Notes_on_ARM_Float_Mode


I have just year of experience. don't take my advices as proper solutions rather just working. if you use Archlinux or docker I can help you more.

@rofl0r
Copy link
Contributor

rofl0r commented Sep 20, 2017

i guess the most important bit apart from the proper FPU selection is --with-arch=armv7-a and the equivalent for armv6 (naive guess: --with-arch=armv6)

@richfelker
Copy link
Owner

@xoac's directions are a bit misleading in that arm and armhf are different abis (and targets as far as musl is concerned), whereas armv6 vs armv7 are just different isa levels. Either can be built for hf or non-hf abi, as you prefer.

In order to pick the default isa level, you need to add --with-arch=armv6 or armv7-a to GCC_CONFIG.

@xoac
Copy link

xoac commented Sep 21, 2017

@richfelker To make sure I understand you correct.
Can I use arm-linux-musleabihf with --with-arch=armv6 and if I have installed arm-linux-musleabi it will be the same as using arm-linux-musleabi without flag --with-arch=?

@rofl0r
Copy link
Contributor

rofl0r commented Sep 21, 2017

Can I use arm-linux-musleabihf with --with-arch=armv6

yes, that's what he just said

and if I have installed arm-linux-musleabi it will be the same as using arm-linux-musleabi without flag --with-arch=

sorry, i can't make sense of that.

@richfelker
Copy link
Owner

--with-arch just sets the default -march the compiler uses (and which musl and target libs like libgcc, libstdc++, etc. get compiled with).

Using musleabi vs musleabihf in the TARGET string selects whether you want the plain EABI (floating point arguments and return values are passed in general purpose registers) or the hardfloat variant of the EABI (floating point arguments and return values are passed in floating point registers).

@glebpom
Copy link
Author

glebpom commented Sep 21, 2017

Thanks a lot for the explanation! I think it makes sense to add information about GCC_CONFIG and specifically armv7 to the README.md

@xoac
Copy link

xoac commented Sep 25, 2017

@rofl0r
I mean arm[eb]-linux-musleabi[hf] I have build and install arm-linux-musleabihf and I wanna build my app for arm6, so i just need switch --with-arch=armv6? Or I need first to build arm-linux-musleabi because musl is targeted for armv7, so this all functions are optimized to working with hard float.

@rofl0r
Copy link
Contributor

rofl0r commented Sep 25, 2017

@xoac : yes you should build 2 different toolchains from scratch, both with the right options, but save them in 2 distinct directories. for example: $HOME/toolchains/armv6hf and $HOME/toolchains/armv7hf. then you just add the bin dir from the one or the other to $PATH as needed. even though it's theoretically possible to use the armv7hf toolchain for armv6hf too (by using the right -march switches and rebuilding musl and libgcc), it's much easier to just build 2 different toolchains. does this answer your question ?

@xoac
Copy link

xoac commented Sep 25, 2017

No ;(
For me it's very similar to what I wrote here #34 (comment) . So no I don't understand why you had wrote that my dirs are misleading.

@rofl0r
Copy link
Contributor

rofl0r commented Sep 25, 2017

ok. you want 2 different toolchains, both built with different --with-arch and --with-fpu, but with --with-float=hard. you can even put the name of the arm subarch into the toolchain name triple: for example by using
TARGET = armv7-linux-musleabihf and TARGET = armv6-linux-musleabihf.

@xoac
Copy link

xoac commented Sep 25, 2017

Ok. I see. I thought armv6 can't be with --with-float=hard. Thanks for good explanation!

@richfelker
Copy link
Owner

This seems to be resolved; please reopen if I'm mistaken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants