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 CPU support #3746

Closed
vicuna opened this issue Aug 5, 2005 · 7 comments
Closed

arm CPU support #3746

vicuna opened this issue Aug 5, 2005 · 7 comments
Assignees

Comments

@vicuna
Copy link

vicuna commented Aug 5, 2005

Original bug ID: 3746
Reporter: administrator
Assigned to: @xavierleroy
Status: closed (set by @xavierleroy on 2011-05-29T10:14:22Z)
Resolution: fixed
Priority: normal
Severity: feature
Category: ~DO NOT USE (was: OCaml general)
Monitored by: @glondu bacam karl n8gray gerd

Bug description

Full_Name: Robert Nagy
Version: 3.08.3
OS: OpenBSD
Submission from: amazonas-2734.adsl.datanet.hu (195.56.242.194)

I am trying to build ocaml on OpenBSD/Zaurus.
cpu0 at mainbus0: PXA27x rev 4 (XScale core)
cpu0: DC enabled IC enabled WB enabled LABT branch prediction enabled
cpu0: 32KB(32b/l,32way) I-cache, 32KB(32b/l,32way) wr-back-lock D-cache
hw.machine=zaurus
hw.model=PXA27x rev 4 (XScale core)
hw.ncpu=1
hw.byteorder=1234
hw.physmem=67108864
hw.usermem=66850816
hw.pagesize=4096
hw.disknames=wd0
hw.diskcount=1

But it seems that there are some problems in arm.S

gcc -c -DSYS_openbsd -pthread -o arm.o arm.S ||
{ echo "If your assembler produced syntax errors, it is probably unhappy with
the"; echo "preprocessor. Check your assembler, or try producing arm.o by
hand."; exit 2; }
arm.S: Assembler messages:
arm.S:21: Warning: ignoring redefinition of register alias 'sp'
arm.S:22: Warning: ignoring redefinition of register alias 'lr'
arm.S:23: Warning: ignoring redefinition of register alias 'pc'
arm.S:112: Error: selected processor does not support stfd f0,[sp,#-8]!' arm.S:113: Error: selected processor does not support stfd f1,[sp,#-8]!'
arm.S:114: Error: selected processor does not support stfd f2,[sp,#-8]!' arm.S:115: Error: selected processor does not support stfd f3,[sp,#-8]!'
arm.S:125: Error: selected processor does not support ldfd f4,[sp],#8' arm.S:126: Error: selected processor does not support ldfd f5,[sp],#8'
arm.S:127: Error: selected processor does not support ldfd f6,[sp],#8' arm.S:128: Error: selected processor does not support ldfd f7,[sp],#8'
arm.S:184: Error: selected processor does not support stfd f7,[sp,#-8]!' arm.S:185: Error: selected processor does not support stfd f6,[sp,#-8]!'
arm.S:186: Error: selected processor does not support stfd f5,[sp,#-8]!' arm.S:187: Error: selected processor does not support stfd f4,[sp,#-8]!'
arm.S:240: Error: selected processor does not support ldfd f4,[sp],#8' arm.S:241: Error: selected processor does not support ldfd f5,[sp],#8'
arm.S:242: Error: selected processor does not support ldfd f6,[sp],#8' arm.S:243: Error: selected processor does not support ldfd f7,[sp],#8'
If your assembler produced syntax errors, it is probably unhappy with the
preprocessor. Check your assembler, or try producing arm.o by hand.
gmake: *** [arm.o] Error 2

@vicuna
Copy link
Author

vicuna commented Aug 8, 2005

Comment author: administrator

I am trying to build ocaml on OpenBSD/Zaurus.
But it seems that there are some problems in arm.S
gcc -c -DSYS_openbsd -pthread -o arm.o arm.S ||
{ echo "If your assembler produced syntax errors, it is probably unhappy with
the"; echo "preprocessor. Check your assembler, or try producing arm.o by
hand."; exit 2; }
arm.S: Assembler messages:
arm.S:112: Error: selected processor does not support `stfd f0,[sp,#-8]!'

Apparently, your gcc toolchain is configured for "soft
floating-point", i.e. no float instructions such as stfd and ldfd.
The ARM port of ocamlopt uses "hard floating-point", with float
instructions, possibly emulated by the kernel. Hence the error.

You could try to add -mhard-float to ASPPFLAGS in config/Makefile,
but it is likely you'll run into errors later while trying to mix
softfloat-compiled code with hardfloat-compiled code.

If you really want to run ocamlopt on this platform, you should
investigate the availability of a gcc toolchain and standard libraries
built in "hard floating-point" mode.

Regards,

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Aug 10, 2005

Comment author: administrator

wish: ARM port with soft floating-point

@vicuna
Copy link
Author

vicuna commented Jan 18, 2007

Comment author: mindbender

i can only second that wish.

we at www.linkstationwiki.net tried to compile ocaml as we needed it to compile mldonkey for the LS Pro...and marvel-based board with arm9-CPU (like MANY nas devices the get released the last months!..currently i count 6 that are based on the same marvel board)....

this board does not have support for hardware-floating-point...
http://forum.linkstationwiki.net/index.php?action=vthread&forum=16&topic=2151

we need support for soft-floating-point on arm also.....

@vicuna
Copy link
Author

vicuna commented Jul 23, 2007

Comment author: gerd

I've also tried to build ocamlopt for my Nokia N800, and ran into the mentioned fp problem. As I see it the current arm status of ocaml is "out of date" (and useless):

  • No hardware is available that supports fpa natively. Kernel emulation
    is slow (and I couldn't get it working, maybe broken)
  • The way to go is to use EABI with softfp, and optionally vfp (the new
    hardware feature that speeds fp up). EABI is the new standard by ARM.
  • The toolchains for the current devices base on EABI, and it is difficult
    to build alternate ones
  • The EABI makes it easy to support soft fp for compilers, as there are
    standardized functions for fp (no OS-specific libraries etc.)
  • The EABI provides IEEE-compliant fp (didn't we want that?)

So I think it is now time to switch to EABI. Here are a few links that might be helpful:

For my Nokia there is an SDK that can be installed on x86 Debian systems. It includes the toolchain, and transparent CPU emulation (using qemu). I could successfully compile ocaml on it (except fp for native code). It might be good enough as development platform for an up-to-date ARM port:

If you need to run code on a real arm device, please tell me - I've sshd on the N800, and can leave it on now and then.


Btw. I saw that the "as" invocation is hardcoded in asmrun/proc.ml. By adding
-mfloat-abi=hard -mfpu=fpa to the "as" call I could at least build native code programs, although fp operations do not work (wrong results, but no "illegal instruction"). I guess this is an error in the Linux kernel, since mixing hardfp and softfp is said to work under EABI.

@vicuna
Copy link
Author

vicuna commented Aug 1, 2007

Comment author: @xavierleroy

Thanks for the background information. After reviewing it, I think there are two possible approaches.

One is to use VFD registers and instructions, which should fit very well the OCaml back-end architecture. For calling external C functions, softfp conventions would be used, for compatibility with EABI. This approach relies crucially on the existence of a good VFP emulation in the kernel, though.

The other is to go all the way to softfp in OCaml-generated code. It violates a number of basic assumptions of the back-end, e.g. where the back-end expects one float pseudo-register, there must be two integer pseudo-registers instead. I'm not sure this can be made to work at all.

@vicuna
Copy link
Author

vicuna commented Oct 22, 2008

Comment author: @glondu

The latter seems more elegant. Would a patch be accepted?

@vicuna
Copy link
Author

vicuna commented Mar 31, 2009

Comment author: @xavierleroy

It took a long time, but I finally managed to update the ARM OCaml port to EABI and soft floating-point. Everything seems to work well under Debian Lenny ARM-EABI running under QEMU emulation. The new port is in the CVS trunk and will be released in 3.12, replacing the previous (old-ABI) ARM port.

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

No branches or pull requests

2 participants