Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2009-11

Defines layout for mips

9 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

Hello,

I am wondering about the best way to set the mips target. We are only targetting mipsel (32-bits, little endian), but the Linux convention for the name of this target is mipsel, while mips=mipseb, so the command to build the target should be:

make all TARGET_OS=linux TARGET_CPU=mipsel

and in the future someone could possibly use

make all TARGET_OS=linux TARGET_CPU=mips

To target the mipseb.

But looking at the arm port, it doesn't seam to be done this way, there is a general arm define and other more specific for big endian and little endian. But maybe arm is different, because in mips eb or el is very important, you cannot switch the most in software, and mipsel is the most common.

I think that the existing defines should be changed from mips to mipsel, to match the Linux target namming. But I am not sure. Any comments?

thanks,

Felipe Monteiro de Carvalho

Reply by email

Michael Schnell
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 8 lines
make all TARGET_OS=linux TARGET_CPU=mipsel and in the future someone could possibly use make all TARGET_OS=linux TARGET_CPU=mips To target the mipseb.

Looks good to me.

Please do consider to allow for TARGET_CPU=NIOS2 (or "nios2", is this case sensitive ?), additionally, for a future port to that CPU.

Show quoted text 6 lines
But looking at the arm port, it doesn't seam to be done this way, there is a general arm define and other more specific for big endian and little endian. But maybe arm is different, because in mips eb or el is very important, you cannot switch the most in software, and mipsel is the most common.

I don't know whether both possible ARM endian versions are completely supported by FPC. AFAIK, Linux nowadays mainly supports little endian. Am I right ? (I doubt that any decent user software switches the endieness of the ARM CPU "on the fly".)

What did you find when looking at the current MIPS port "beta". Is it in a state that is worth building on or is it too old or to little advanced or too chaotically done, so that building on the working ARM port seems more appropriate ?

I think that the existing defines should be changed from mips to mipsel, to match the Linux target namming. But I am not sure.

I feel the same ways.

-Michael

Reply by email

Florian Klaempfl
to Felipe Monteiro de Carvalho: I am wondering about the best way to set the mips target. We are only targetting mipsel…
Show quoted text 24 lines
Hello, I am wondering about the best way to set the mips target. We are only targetting mipsel (32-bits, little endian), but the Linux convention for the name of this target is mipsel, while mips=mipseb, so the command to build the target should be: make all TARGET_OS=linux TARGET_CPU=mipsel and in the future someone could possibly use make all TARGET_OS=linux TARGET_CPU=mips To target the mipseb. But looking at the arm port, it doesn't seam to be done this way, there is a general arm define and other more specific for big endian and little endian. But maybe arm is different, because in mips eb or el is very important, you cannot switch the most in software, and mipsel is the most common. I think that the existing defines should be changed from mips to mipsel, to match the Linux target namming. But I am not sure. Any comments?

As you might have seen, I integrated most of fpc-mips already and I think the way to go is:
- mips (compiler target)/cpumips (host) defined for all mips cpus
- cpumipsel (host) defined for all mips little endian cpus
- cpumipseb (host) defined for all mips big endian cpus
- mips32 (compiler target)/cpumips32 (host) defined for all mips 32 bit architectures cpus
- mips64 (compiler target)/cpumips32 (host) defined for all mips 64 bit architectures cpus
As well as cpumips32el, cpumips32eb, cpumips64el and cpumips64eb. Within the compiler, the eb/el decision is made based on the target_info.

The CPU targets makefile wise should be:
mips (big endian)
mipsel
mips64 (big endian)
mips64el

Reply by email

Felipe Monteiro de Carvalho
to Florian Klaempfl

Excelent. One thing I don't understand however is the link between the defines and the makefile targets.

The Lazarus project for arm uses the -darm option to build a arm compiler. For mipsel, how would that be?

-dmipsel ? That doesn't compile. -dmips compiles

But then I am confused, because I would expect the necessary define to be -dmipsel and with just -dmips it's not clear that my compiler is targeting mipsel...

Another thing is that the compiler built with -dmips in Windows always returns an internal error. I know there are no readly available binutils for this, but in my laboratory they only have Windows, and if it could run I could test the compiler by inspecting the generated assembler code, and possibly feeding it to as and ld in a mips machine. The error seams to be the lack of the system info

:

  842 {$ifdef CPUMIPS}
  843   {$ifdef linux}
  844     set_source_info(system_mipsel_linux_info);
  845   {$endif linux}
  846 {$endif CPUMIPS}

It seams that the mips system info is only added if you build the compiler from Linux, is that correct? It's a bit confusing to me, because I understand that the define linux is active based on the host operating system, not the target, but if I want to cross-compile from windows to mipsel-linux, then this define would block this possibility?

thanks,

Felipe Monteiro de Carvalho

Reply by email

Florian Klaempfl
to Felipe Monteiro de Carvalho
Show quoted text 11 lines
Excelent. One thing I don't understand however is the link between the defines and the makefile targets. The Lazarus project for arm uses the -darm option to build a arm compiler. For mipsel, how would that be? -dmipsel ? That doesn't compile. -dmips compiles But then I am confused, because I would expect the necessary define to be -dmipsel and with just -dmips it's not clear that my compiler is targeting mipsel...

The mips integration is not ready yet.

Reply by email

Felipe Monteiro de Carvalho
to Michael Schnell

I see that mips is progressing =) I added a ppmipsel.lpi file which builds a cross-compiler here, but I haven't yet managed to build the compiler from the makefiles or the rtl.

For the RTL I tryed:

C:\Programas\fpctrunk\rtl\linux>make fpc_units CPU_TARGET=mipsel OS_TARGET=linux OPT='-s'
make: *** No rule to make target `../mipsel/mips.inc', needed by `system.ppu'. Stop.

I searched, but I didn't find what would need to be fixed to get a target for mips.inc ... any ideas?

I am using fpc_units and -s because I'm in Windows, and I don't have binutils, but I could still test compilation.

For the compiler I read the buildfaq, but it already starts from targets capable of doing a build cycle, so I am not actually sure what to do. I can build it with the Lazarus project, so maybe you cannot build the compiler for a starting target with make? Only by calling fpc directly?

thanks,

Felipe Monteiro de Carvalho

Reply by email

Marc Weustink
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 13 lines
I see that mips is progressing =) I added a ppmipsel.lpi file which builds a cross-compiler here, but I haven't yet managed to build the compiler from the makefiles or the rtl. For the RTL I tryed: C:\Programas\fpctrunk\rtl\linux>make fpc_units CPU_TARGET=mipsel OS_TARGET=linux OPT='-s' make: *** No rule to make target `../mipsel/mips.inc', needed by `system.ppu'. Stop. I searched, but I didn't find what would need to be fixed to get a target for mips.inc ... any ideas?

mipsel is not ready yet, even if you copy mips.inc from ../mips and you fix prt0.as and touch the right .as files and you have the crossbinutils, then still not all abstract methods of the compiler are implemented, resulting in:

Free Pascal Compiler version 2.5.1 [2009/12/06] for mipsel Copyright (c) 1993-2009 by Florian Klaempfl
Target OS: Linux for MIPSEL
Compiling system.pp
Fatal: Compilation aborted
An unhandled exception occurred at $080AEE50 :
EAccessViolation : Access violation
$080AEE50
$080A2326
$080A1D1F
$080A23BE
$0817DC73
$0817FC5F
$08180D4C
$0816C6DF
$080680EC
$08048296

make[2]: *** [system.ppu] Error 217

So I guess we need to be patient.

Marc

Reply by email

Jonas Maebe
to Marc Weustink
Marc Weustink wrote 12 lines
mipsel is not ready yet, even if you copy mips.inc from ../mips and you fix prt0.as and touch the right .as files and you have the crossbinutils, then still not all abstract methods of the compiler are implemented, resulting in: Free Pascal Compiler version 2.5.1 [2009/12/06] for mipsel Copyright (c) 1993-2009 by Florian Klaempfl Target OS: Linux for MIPSEL Compiling system.pp Fatal: Compilation aborted An unhandled exception occurred at $080AEE50 : EAccessViolation : Access violation

An unimplemented abstract method should result in run time error 211, not in a segmentation fault.

Jonas

Reply by email