Sign in Join

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

Mailing lists / fpc-pascal / 2013-06

is there a ready to use FPC Cross compiler x86-Linux -> MIPS-linux?

48 messages · 9 people · –

Reply by email Subscribe to this list Your subscription

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

Dennis Poon

or x86-Windows -> MIPS-linux cross compiler
or x86-MacOS->MIPS-linux cross compiler?

any one of the above will be big help to me.

I searched the net and the http://wiki.freepascal.org/MIPS_port document seems to be at least Feb 2012 old. I wonder if there exists a more updated document or cross compiler already ready for use?

Thanks a lot in advance.

Dennis Poon.

Reply by email

Sven Barth
to Dennis Poon
Dennis Poon wrote 8 lines
or x86-Windows -> MIPS-linux cross compiler or x86-MacOS->MIPS-linux cross compiler? any one of the above will be big help to me. I searched the net and the http://wiki.freepascal.org/MIPS_port document seems to be at least Feb 2012 old. I wonder if there exists a more updated document or cross compiler already ready for use?

The instructions look valid. This way of cross compiling hasn't changed much in the 5 years I'm now working with Free Pascal...

Regards,
Sven

Reply by email

Mark Morgan Lloyd
to Dennis Poon: or x86-Windows -> MIPS-linux cross compiler or x86-MacOS->MIPS-linux cross compiler? any…
Dennis Poon wrote 8 lines
or x86-Windows -> MIPS-linux cross compiler or x86-MacOS->MIPS-linux cross compiler? any one of the above will be big help to me. I searched the net and the http://wiki.freepascal.org/MIPS_port document seems to be at least Feb 2012 old. I wonder if there exists a more updated document or cross compiler already ready for use?

Also see the link it cites, which describes building a Linux-hosted cross-compiler as a necessary stage towards getting it running natively on MIPS.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Dennis Poon
to Sven Barth: The instructions look valid. This way of cross compiling hasn't changed much in the 5…

But which FPC version should I used?
The doc said 2.4,
should I use 2.6 or 2.7?

Thanks.

Dennis

Show quoted text 27 lines
On 05.06.2013 16:33, Dennis Poon wrote: > or x86-Windows -> MIPS-linux cross compiler > or x86-MacOS->MIPS-linux cross compiler? > > any one of the above will be big help to me. > > I searched the net and the http://wiki.freepascal.org/MIPS_port > document seems to be at least Feb 2012 old. I wonder if there exists a > more updated document or cross compiler already ready for use? The instructions look valid. This way of cross compiling hasn't changed much in the 5 years I'm now working with Free Pascal... Regards, Sven _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3343 / Virus Database: 3184/6384 - Release Date: 06/04/13

Reply by email

Sven Barth
to Dennis Poon
Dennis Poon wrote
But which FPC version should I used? The doc said 2.4, should I use 2.6 or 2.7?

Ah, didn't read that. Basic rule: always use the latest release to build a development (e.g. 2.7.1) or fixes version (e.g. 2.6.3). In this case this means that you should use 2.6.2 to build a 2.7.1 compiler.

Regards,
Sven

Show quoted text 30 lines
> On 05.06.2013 16:33, Dennis Poon wrote: >> or x86-Windows -> MIPS-linux cross compiler >> or x86-MacOS->MIPS-linux cross compiler? >> >> any one of the above will be big help to me. >> >> I searched the net and the http://wiki.freepascal.org/MIPS_port >> document seems to be at least Feb 2012 old. I wonder if there exists a >> more updated document or cross compiler already ready for use? > > The instructions look valid. This way of cross compiling hasn't > changed much in the 5 years I'm now working with Free Pascal... > > Regards, > Sven > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2013.0.3343 / Virus Database: 3184/6384 - Release Date: 06/04/13 > > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Dennis Poon
to Sven Barth

On debian squeeze, I installed* fpc 2.6.0-9*
and I followed the instruction "svn checkout
http://svn.freepascal.org/svn*/fpc/trunk* fpc"
which I believe is the latest version of fpc source code

then I followed the instruction to try to compile * ppmipsel.lpi* but since that seems like a Lazarus project file I had to first compile lazarus first
but when I downloaded lazarus-src_0.9.28.2-12_all.deb and lazarus-ide_0.9.28.2-12_i386.deb from packages.debian.org/squeeze/devel/ and run Make in the /usr/lib/lazarus/0.9.28.2 folder I got the following error:

Compiling lclmemmanger.pas
lclmemmanger.ps(100,37) Error: Cannot access a private field of an object here

...
then Fatal: compilation aborted

I am new to Free Pascal.
Is there a way to compile the cross compiler *ppmipsel.lpi* without using Lazarus (since that seems to fail to compile possibly due to version conflicts)?

Thanks in advance.

Dennis

Show quoted text 56 lines
On 06.06.2013 18:33, Dennis Poon wrote: > But which FPC version should I used? > The doc said 2.4, > should I use 2.6 or 2.7? Ah, didn't read that. Basic rule: always use the latest release to build a development (e.g. 2.7.1) or fixes version (e.g. 2.6.3). In this case this means that you should use 2.6.2 to build a 2.7.1 compiler. Regards, Sven >> On 05.06.2013 16:33, Dennis Poon wrote: >>> or x86-Windows -> MIPS-linux cross compiler >>> or x86-MacOS->MIPS-linux cross compiler? >>> >>> any one of the above will be big help to me. >>> >>> I searched the net and the http://wiki.freepascal.org/MIPS_port >>> document seems to be at least Feb 2012 old. I wonder if there >>> exists a >>> more updated document or cross compiler already ready for use? >> >> The instructions look valid. This way of cross compiling hasn't >> changed much in the 5 years I'm now working with Free Pascal... >> >> Regards, >> Sven >> >> _______________________________________________ >> fpc-pascal maillist - >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> >> >> ----- >> No virus found in this message. >> Checked by AVG - www.avg.com >> Version: 2013.0.3343 / Virus Database: 3184/6384 - Release Date: >> 06/04/13 >> >> > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3343 / Virus Database: 3184/6388 - Release Date: 06/05/13

Reply by email

Sven Barth
to Dennis Poon
Dennis Poon wrote 6 lines
On debian squeeze, I installed*fpc 2.6.0-9* and I followed the instruction "svn checkout http://svn.freepascal.org/svn*/fpc/trunk* fpc" which I believe is the latest version of fpc source code then I followed the instruction to try to compile * ppmipsel.lpi* but

Hmph... I didn't see that the wiki article contained something about the Lazarus project file. Sorry. Please completely ignore the "Building with Lazarus" part and do the "Building with the makefiles". Only the latter is the officially supported way, the former is for compiler development only. I'll delete that part to avoid further confusion...

Regards,
Sven

Reply by email

Sven Barth
to Sven Barth
Sven Barth wrote 13 lines
On 08.06.2013 08:53, Dennis Poon wrote: > On debian squeeze, I installed*fpc 2.6.0-9* > and I followed the instruction "svn checkout > http://svn.freepascal.org/svn*/fpc/trunk* fpc" > which I believe is the latest version of fpc source code > > then I followed the instruction to try to compile * ppmipsel.lpi* but Hmph... I didn't see that the wiki article contained something about the Lazarus project file. Sorry. Please completely ignore the "Building with Lazarus" part and do the "Building with the makefiles". Only the latter is the officially supported way, the former is for compiler development only. I'll delete that part to avoid further confusion...

I've updated the MIPS_Port page to avoid confusion (hopefully).

Regards,
Sven

Reply by email

Dennis Poon
to Sven Barth

Sven,

Thanks for the update but the document 's Step 1 is "From Linux to Linux-MIPS"
so it only shows instructions on how to add the repository of crosstools, binutils for debian only.

But the Step 2 "Cross-compiler" only shows instructions on Windows, I tried typing the same command in debian "make cycle CPU_TARGET=mipsel OS_TARGET=linux" and it complained as :
make: *** No rule to make target 'cycle'. Stop.

So, my problem is, I don't know how to do Step 1 in Windows and Step 2 in Debian, so I am still stuck.
Would you kindly show Step 2 for Debian in the document as well.

Thanks.

Dennis

Show quoted text 31 lines
On 08.06.2013 09:53, Sven Barth wrote: > On 08.06.2013 08:53, Dennis Poon wrote: >> On debian squeeze, I installed*fpc 2.6.0-9* >> and I followed the instruction "svn checkout >> http://svn.freepascal.org/svn*/fpc/trunk* fpc" >> which I believe is the latest version of fpc source code >> >> then I followed the instruction to try to compile * ppmipsel.lpi* but > > Hmph... I didn't see that the wiki article contained something about the > Lazarus project file. Sorry. Please completely ignore the "Building with > Lazarus" part and do the "Building with the makefiles". Only the latter > is the officially supported way, the former is for compiler development > only. I'll delete that part to avoid further confusion... I've updated the MIPS_Port page to avoid confusion (hopefully). Regards, Sven _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3343 / Virus Database: 3199/6393 - Release Date: 06/07/13

Reply by email

Reinier Olislagers
to Dennis Poon
Dennis Poon wrote
But the Step 2 "Cross-compiler" only shows instructions on Windows, I tried typing the same command in debian "make cycle CPU_TARGET=mipsel OS_TARGET=linux" and it complained as : make: *** No rule to make target 'cycle'. Stop.

The make cycle....blah command is the same on Windows and Linux. You're calling the make executable with some options.

Reply by email

Sven Barth
to Dennis Poon: Thanks for the update but the document 's Step 1 is "From Linux to Linux-MIPS" so it only…
Dennis Poon wrote 15 lines
Sven, Thanks for the update but the document 's Step 1 is "From Linux to Linux-MIPS" so it only shows instructions on how to add the repository of crosstools, binutils for debian only. But the Step 2 "Cross-compiler" only shows instructions on Windows, I tried typing the same command in debian "make cycle CPU_TARGET=mipsel OS_TARGET=linux" and it complained as : make: *** No rule to make target 'cycle'. Stop. So, my problem is, I don't know how to do Step 1 in Windows and Step 2 in Debian, so I am still stuck. Would you kindly show Step 2 for Debian in the document as well.

Please remind me not to update wiki articles early in the morning. It should be "make all" not "make cycle" and it's the same on both Windows and Linux, so you just need to adjust the paths.

Regards,
Sven

Reply by email

Dennis Poon
to Sven Barth

Sven,

Thanks for the prompt reply.
I did "make all ...." and after many lines of messages, the last few are: make[5]: mipsel-linux-as: command not found
make[5]: *** [prt0.o] Error 127
make[5]: Leavning directory '/home/dennis/fpc/rtl/linux' ....

make[1]:
make: *** [build-stamp.mipsel-linus] Error 2

Any clues?

Dennis

Show quoted text 35 lines
On 08.06.2013 12:04, Dennis Poon wrote: > Sven, > > Thanks for the update but the document 's Step 1 is "From Linux to > Linux-MIPS" > so it only shows instructions on how to add the repository of > crosstools, binutils for debian only. > > But the Step 2 "Cross-compiler" only shows instructions on Windows, > I tried typing the same command in debian "make cycle CPU_TARGET=mipsel > OS_TARGET=linux" and it complained as : > make: *** No rule to make target 'cycle'. Stop. > > So, my problem is, I don't know how to do Step 1 in Windows and Step 2 > in Debian, so I am still stuck. > Would you kindly show Step 2 for Debian in the document as well. Please remind me not to update wiki articles early in the morning. It should be "make all" not "make cycle" and it's the same on both Windows and Linux, so you just need to adjust the paths. Regards, Sven _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3343 / Virus Database: 3199/6394 - Release Date: 06/08/13

Reply by email

Sven Barth
to waldo kitty
waldo kitty wrote 5 lines
On 6/8/2013 06:31, Sven Barth wrote: > Please remind me not to update wiki articles early in the morning. Psst! Remember to not update wiki articles early in the morning! O:)

Thank you for the reminder! :)

Regards,
Sven

Reply by email

Sven Barth
to Dennis Poon: Thanks for the prompt reply. I did "make all ...." and after many lines of messages, the…
Dennis Poon wrote 13 lines
Sven, Thanks for the prompt reply. I did "make all ...." and after many lines of messages, the last few are: make[5]: mipsel-linux-as: command not found make[5]: *** [prt0.o] Error 127 make[5]: Leavning directory '/home/dennis/fpc/rtl/linux' .... make[1]: make: *** [build-stamp.mipsel-linus] Error 2 Any clues?

How are the binutils called that you generated? If they are called e.g. "mips-linux-as" and "mips-linux-ld" then you need to pass the additional option "BINUTILSPREFIX=mips-linux-" to the "make all" call.

Regards,
Sven

Reply by email

Dennis Poon
to Sven Barth

Sven,

I am really ignorant in this area. I followed the doc to download the <since I actually needed mips instead of mipsel, I choose the following deb file>
binutils-mips-linux-gnu_2.22-8_i386.deb and i Installed it after installing fpc....deb
by dpkg -i binutils-mips-linux-gnu_2.22-8_i386.deb and I believe that installed files in /usr
as I found /usr/mips-linux-gnu/bin folder contains the following files: ar
as
ld
nm
objcopy
objdump
ranlib
strip

Also, although I followed the doc and add the lines

deb http://www.emdebian.org/debian/ squeeze main

I don't know how that actually does anything. No crosstools files see to be generated when I install fpc...deb

What shuold I do now? Also, if it succeeds finally, how should I make the new target CPU available in Lazarus?

Thanks a lot.

Dennis

Show quoted text 34 lines
On 08.06.2013 13:43, Dennis Poon wrote: > Sven, > > Thanks for the prompt reply. > I did "make all ...." and after many lines of messages, the last few > are: > make[5]: mipsel-linux-as: command not found > make[5]: *** [prt0.o] Error 127 > make[5]: Leavning directory '/home/dennis/fpc/rtl/linux' > .... > > make[1]: > make: *** [build-stamp.mipsel-linus] Error 2 > > Any clues? How are the binutils called that you generated? If they are called e.g. "mips-linux-as" and "mips-linux-ld" then you need to pass the additional option "BINUTILSPREFIX=mips-linux-" to the "make all" call. Regards, Sven _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3343 / Virus Database: 3199/6394 - Release Date: 06/08/13

Reply by email

Sven Barth
to Dennis Poon
Dennis Poon wrote 18 lines
Sven, I am really ignorant in this area. I followed the doc to download the <since I actually needed mips instead of mipsel, I choose the following deb file> binutils-mips-linux-gnu_2.22-8_i386.deb and i Installed it after installing fpc....deb by dpkg -i binutils-mips-linux-gnu_2.22-8_i386.deb and I believe that installed files in /usr as I found /usr/mips-linux-gnu/bin folder contains the following files: ar as ld nm objcopy objdump ranlib strip

Ok, then add the following option: "BINUTILSPREFIX=" (there is no value after the "=", but ensure that there is a space to the next option if there is any)

Show quoted text 6 lines
Also, although I followed the doc and add the lines deb http://www.emdebian.org/debian/ squeeze main I don't know how that actually does anything. No crosstools files see to be generated when I install fpc...deb

I'm no Debian user, so I can't help you with this specific part.

What shuold I do now? Also, if it succeeds finally, how should I make the new target CPU available in Lazarus?

You'll need to change Lazarus' compiler to the newly compiled trunk compiler. If you also built the normal linux one using "make all install ..." you can point Lazarus to the directory which you passed in INSTALL_PREFIX (in the example C:\fpc\2.7.1) and add the remaining path to the fpc binary (on Windows "bin\i386-win32" on Linux just "bin"). Then you should be able to successfully set "Target CPU" in the compiler settings to Mips and confirm with OK.

Regards,
Sven

Show quoted text 38 lines
Dennis > On 08.06.2013 13:43, Dennis Poon wrote: >> Sven, >> >> Thanks for the prompt reply. >> I did "make all ...." and after many lines of messages, the last few >> are: >> make[5]: mipsel-linux-as: command not found >> make[5]: *** [prt0.o] Error 127 >> make[5]: Leavning directory '/home/dennis/fpc/rtl/linux' >> .... >> >> make[1]: >> make: *** [build-stamp.mipsel-linus] Error 2 >> >> Any clues? > > How are the binutils called that you generated? If they are called > e.g. "mips-linux-as" and "mips-linux-ld" then you need to pass the > additional option "BINUTILSPREFIX=mips-linux-" to the "make all" call. > > Regards, > Sven > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2013.0.3343 / Virus Database: 3199/6394 - Release Date: 06/08/13 > > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Dennis Poon
to Sven Barth

Sven,

I am more than happy to start all over with windows. Can give me instructions on how to install the crosstools and binutils for windows? and maybe add them to the doc as well? Will I need to install mingw and other c related stuff (like make command etc) in windows first?

Hopefully, after that I can just follow your instruction to build cross compilers in Windows word by word.

Ok, then add the following option: "BINUTILSPREFIX=" (there is no value after the "=", but ensure that there is a space to the next option if there is any)

Sorry, I am really ignorant and don't know where to add the option? Should I modify the makefile? where should I add that option?

Show quoted text 9 lines
You'll need to change Lazarus' compiler to the newly compiled trunk compiler. If you also built the normal linux one using "make all install ..." you can point Lazarus to the directory which you passed in INSTALL_PREFIX (in the example C:\fpc\2.7.1) and add the remaining path to the fpc binary (on Windows "bin\i386-win32" on Linux just "bin"). Then you should be able to successfully set "Target CPU" in the compiler settings to Mips and confirm with OK.

I had problem compiling Lazarus, when I "make all install", it said: lazarus.pp(133,1) Error: Can't call the resource compiler "/usr/bin/fpcres", switching to external mode
lazarus.pp(133,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted
So I ended up downloading a debian Lazarus from Lazarus web site.

So far, I only had experience in compiling using Lazarus. Never used make or the fpc directly.
Can you tell me the exact command I should use to 'point Lazarus to the direcdtory which you passed in INSTALL_PREFIX ....' and "add the remaining path to...'

Thanks so much.

Dennis

Reply by email

Sven Barth
to Dennis Poon
Dennis Poon wrote 7 lines
Sven, I am more than happy to start all over with windows. Can give me instructions on how to install the crosstools and binutils for windows? and maybe add them to the doc as well? Will I need to install mingw and other c related stuff (like make command etc) in windows first?

I've never build binutils manually yet, so I'm not of much help here... :(

Show quoted text 9 lines
Hopefully, after that I can just follow your instruction to build cross compilers in Windows word by word. > Ok, then add the following option: "BINUTILSPREFIX=" (there is no > value after the "=", but ensure that there is a space to the next > option if there is any) > Sorry, I am really ignorant and don't know where to add the option? Should I modify the makefile? where should I add that option?

The command on the wiki should be

make all CPU_TARGET=mipsel OS_TARGET=linux BINUTILSPREFIX=

Show quoted text 15 lines
> > You'll need to change Lazarus' compiler to the newly compiled trunk > compiler. If you also built the normal linux one using "make all > install ..." you can point Lazarus to the directory which you passed > in INSTALL_PREFIX (in the example C:\fpc\2.7.1) and add the remaining > path to the fpc binary (on Windows "bin\i386-win32" on Linux just > "bin"). Then you should be able to successfully set "Target CPU" in > the compiler settings to Mips and confirm with OK. > I had problem compiling Lazarus, when I "make all install", it said: lazarus.pp(133,1) Error: Can't call the resource compiler "/usr/bin/fpcres", switching to external mode lazarus.pp(133,1) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted So I ended up downloading a debian Lazarus from Lazarus web site.

A downloaded Lazarus is ok.

Show quoted text 5 lines
So far, I only had experience in compiling using Lazarus. Never used make or the fpc directly. Can you tell me the exact command I should use to 'point Lazarus to the direcdtory which you passed in INSTALL_PREFIX ....' and "add the remaining path to...'

Once you did the

make all install INSTALL_PREFIX=/whereever/you/want/fpc/trunk

which I mentioned at last in the wiki article you can in Lazarus just go to Options => Settings => Environment => Compiler path (or so, I'm using the German version) and enter the path to the fpc binary there (in the example above it would be /whereever/you/want/fpc/trunk/bin/fpc). You also need to generate a fpc.cfg (normally located in ~/.fpc.cfg). You can just backup the one stored there and replace all paths in there.

Regards,
Sven

Reply by email

Dennis Poon
to Sven Barth

Sven,

make all CPU_TARGET=mipsel OS_TARGET=linux BINUTILSPREFIX=

my fpc folder is /home/dennis/fpc

I already login as root and issue the above command as you instructed but I got:

/bin/rm -f /home/dennis/fpc/rtl/units/mipsel-linux/math.rst /home/dennis/fpc/rtl/units/mipsel-linux/varutils.rst /home/dennis/fpc/rtl/units/mipsel-linux/typinfo.rst /home/dennis/fpc/rtl/units/mipsel-linux/variants.rst /home/dennis/fpc/rtl/units/mipsel-linux/sysconst.rst /home/dennis/fpc/rtl/units/mipsel-linux/rtlconsts.rst /home/dennis/fpc/rtl/units/mipsel-linux/stdconvs.rst /bin/rm -f fpcmade.mipsel-linux Package.fpc ./ppas.sh script.res link.res /bin/rm -f *.s *_ppas.sh
make[5]: Leaving directory `/home/dennis/fpc/rtl/linux' make[4]: Leaving directory `/home/dennis/fpc/rtl'
make -C /home/dennis/fpc/rtl 'OPT= ' all
make[4]: Entering directory `/home/dennis/fpc/rtl' make -C linux all
make[5]: Entering directory `/home/dennis/fpc/rtl/linux' as -32 -mips32 -EL -o /home/dennis/fpc/rtl/units/mipsel-linux/prt0.o mipsel/prt0.as
as: unrecognized option '-mips32'
make[5]: *** [prt0.o] Error 1
make[5]: Leaving directory `/home/dennis/fpc/rtl/linux' make[4]: *** [linux_all] Error 2
make[4]: Leaving directory `/home/dennis/fpc/rtl'
make[3]: *** [rtl] Error 2
make[3]: Leaving directory `/home/dennis/fpc/compiler' make[2]: *** [cycle] Error 2
make[2]: Leaving directory `/home/dennis/fpc/compiler' make[1]: *** [compiler_cycle] Error 2
make[1]: Leaving directory `/home/dennis/fpc'
make: *** [build-stamp.mipsel-linux] Error 2

Any idea what happened?

Thanks.

Dennis

Reply by email

Michael Ring
to Dennis Poon

I've browsed through this thread, as fas as I can see you are still on your intel-based linux box and you are trying to build a crosscompiler for mipsel.

If this is still correct then your problem at this stage is that you did not define the BINUTILSPREFIX correctly. When you leave this definition empty then the standard asembler of your linux distribution gets called and on an intel based linux box this assembler does only understand intel assembler and has no support for mips built in. This is why you get the as error that tells you that mips32 is an unknown option because this option only exists in a version of as that is compiled to support mips32.

As far as I understand this thread you have already installed binutils for mips on your linux box, now you need to do two things:

You need to make sure that the binaries from this binutils package are on your path. Can you please write 'mips' on your linux command prompt and then hit the tab key? You should now see a list of all binaries that start with mips...

This list should include something like mipsel-linux-gnu-as.

When you have it then type

mipsel-linux-gnu-as --help

When you receive the help content then you are all set, if not you propably have installed a version that is natively built to run on mips-linux, in this case you first have to find cross-binutils for your linux dist.

Still good?

Then please now try to compile, this time add

BINUTILSPREFIX=mipsel-linux-gnu-

to the make command.

Of course, if you crossassembler has a different name then please substitute this name with the mipsel-linux-gnu-as example I used here.

Michael

Von meinem iPad gesendet

Dennis Poon wrote 39 lines
Sven, > make all CPU_TARGET=mipsel OS_TARGET=linux BINUTILSPREFIX= my fpc folder is /home/dennis/fpc I already login as root and issue the above command as you instructed but I got: /bin/rm -f /home/dennis/fpc/rtl/units/mipsel-linux/math.rst /home/dennis/fpc/rtl/units/mipsel-linux/varutils.rst /home/dennis/fpc/rtl/units/mipsel-linux/typinfo.rst /home/dennis/fpc/rtl/units/mipsel-linux/variants.rst /home/dennis/fpc/rtl/units/mipsel-linux/sysconst.rst /home/dennis/fpc/rtl/units/mipsel-linux/rtlconsts.rst /home/dennis/fpc/rtl/units/mipsel-linux/stdconvs.rst /bin/rm -f fpcmade.mipsel-linux Package.fpc ./ppas.sh script.res link.res /bin/rm -f *.s *_ppas.sh make[5]: Leaving directory `/home/dennis/fpc/rtl/linux' make[4]: Leaving directory `/home/dennis/fpc/rtl' make -C /home/dennis/fpc/rtl 'OPT= ' all make[4]: Entering directory `/home/dennis/fpc/rtl' make -C linux all make[5]: Entering directory `/home/dennis/fpc/rtl/linux' as -32 -mips32 -EL -o /home/dennis/fpc/rtl/units/mipsel-linux/prt0.o mipsel/prt0.as as: unrecognized option '-mips32' make[5]: *** [prt0.o] Error 1 make[5]: Leaving directory `/home/dennis/fpc/rtl/linux' make[4]: *** [linux_all] Error 2 make[4]: Leaving directory `/home/dennis/fpc/rtl' make[3]: *** [rtl] Error 2 make[3]: Leaving directory `/home/dennis/fpc/compiler' make[2]: *** [cycle] Error 2 make[2]: Leaving directory `/home/dennis/fpc/compiler' make[1]: *** [compiler_cycle] Error 2 make[1]: Leaving directory `/home/dennis/fpc' make: *** [build-stamp.mipsel-linux] Error 2 Any idea what happened? Thanks. Dennis _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Dennis Poon
to Michael Ring

Michael,

Thanks for your advice.

My binutils as , ld etc files are located at /usr/mips-linux-gnu/bin/ so I
make all CPU_TARGET=mips OS_TARGET=linux
BINUTILSPREFIX=/usr/mips-linux-gnu/bin/
and this time, no errors ! And I can find the resultant *.o *.ppu in /home/dennis/fpc/rtl/units/mips-linux/

and the cross compiler programs: ppccrossmips and ppcmips are stored at /home/dennis/fpc/compiler/

However, I then followed the MIPS_port doc to the next step: make crossinstall INSTALL_PREFIX=/home/dennis/fpc
and I got the following errors:

make compiler_install FPC=/home/dennis/fpc/compiler/ppc386 ZIPDESTDIR=/home/dennis/fpc
FPCMAKE=/home/dennis/fpc/utils/fpcm/bin/i386-linux/fpcmake make[3]: Entering directory `/home/dennis/fpc'
make -C compiler install
make[4]: Entering directory `/home/dennis/fpc/compiler' make -C utils install
make[5]: Entering directory `/home/dennis/fpc/compiler/utils' make[5]: Nothing to be done for `install'.
make[5]: Leaving directory `/home/dennis/fpc/compiler/utils' /usr/bin/install -m 755 -d /home/dennis/fpc/lib/fpc/2.7.1 /usr/bin/install -c -m 755 ppcross386
/home/dennis/fpc/lib/fpc/2.7.1/ppcross386
/usr/bin/install: cannot stat `ppcross386': No such file or directory make[4]: *** [exeinstall] Error 1
make[4]: Leaving directory `/home/dennis/fpc/compiler' make[3]: *** [compiler_install] Error 2
make[3]: Leaving directory `/home/dennis/fpc'
make[2]: *** [installbase] Error 2
make[2]: Leaving directory `/home/dennis/fpc'
make[1]: *** [installall] Error 2
make[1]: Leaving directory `/home/dennis/fpc'
make: *** [crossinstall] Error 2

What should I do next?

Dennis

Then please now try to compile, this time add

BINUTILSPREFIX=mipsel-linux-gnu- to the make command

Reply by email

Marco van de Voort
to Dennis Poon

In our previous episode, Dennis Poon said:

Show quoted text 5 lines
make all CPU_TARGET=mips OS_TARGET=linux make crossinstall INSTALL_PREFIX=/home/dennis/fpc What should I do next?

Pass the same arguments to crossinstall as you did to "all"

Reply by email

Dennis Poon
to Marco van de Voort

Marco,
Thanks.

I ran:
make crossinstall INSTALL_PREFIX=/home/dennis/fpc CPU_TARGET=mips OS_TARGET=linux BINUTILSPREFIX=/usr/mips-linux-gnu/bin/

make clean all install INSTALL_PREFIX=/home/dennis/fpc CPU_TARGET=mips OS_TARGET=linux BINUTILSPREFIX=/usr/mips-linux-gnu/bin/

both went without errors.

However, when I type fpc anywhere, it should just use the original fpc in /usr/bin
instead of the my own fpc folder

Also, in Lazarus, it still report /usr/bin/fpc does not support mips-linux.

Should I go into the .lazarus folder in my user folder and change the environmentoptions.xml
from <CompilerFilename Value="/usr/bin/fpc">
to <CompilerFilename Value="/home/dennis/fpc">
?

Frankly, I don't understand why I have to BOTH change the compiler path AND change the project's option "Code Generation"->"Target Platform". That looks redundant to me.

Anyone has any idea will be highly appreciated.

Thanks.
Dennis

Show quoted text 24 lines
In our previous episode, Dennis Poon said: > make all CPU_TARGET=mips OS_TARGET=linux > > make crossinstall INSTALL_PREFIX=/home/dennis/fpc > > What should I do next? > Pass the same arguments to crossinstall as you did to "all" _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3343 / Virus Database: 3199/6396 - Release Date: 06/09/13

Reply by email

Dennis Poon
to Dennis Poon
Show quoted text 15 lines
Also, in Lazarus, it still report /usr/bin/fpc does not support mips-linux. Should I go into the .lazarus folder in my user folder and change the environmentoptions.xml from <CompilerFilename Value="/usr/bin/fpc"> to <CompilerFilename Value="/home/dennis/fpc"> ? Frankly, I don't understand why I have to BOTH change the compiler path AND change the project's option "Code Generation"->"Target Platform". That looks redundant to me.

I tried changing the environmentoptions.xml but that seems not enough. Upon starting lazarus, it complained under Compiler Tab: system.ppu not found. Check fpc.cfg

Where I can locate that fpc.cfg?

Also, if complained under "FPC Source" tab when I entered "/home/dennis/fpc/rtl"
"Warning directory rtl not found"

Dennis

Reply by email

Jonas Maebe
to Dennis Poon
Dennis Poon wrote 14 lines
> > Also, in Lazarus, it still report /usr/bin/fpc does not support > mips-linux. > > Should I go into the .lazarus folder in my user folder and change > the environmentoptions.xml > from <CompilerFilename Value="/usr/bin/fpc"> > to <CompilerFilename Value="/home/dennis/fpc"> > ? > > Frankly, I don't understand why I have to BOTH change the compiler > path AND change the project's option "Code Generation"->"Target > Platform". > That looks redundant to me.

It's not redundant because /usr/bin/fpc cannot automagically find a ppcmips binary located in a random directory on your system.

Show quoted text 5 lines
I tried changing the environmentoptions.xml but that seems not enough. Upon starting lazarus, it complained under Compiler Tab: system.ppu not found. Check fpc.cfg Where I can locate that fpc.cfg?

This is explained in the manual: http://www.freepascal.org/docs-html/user/usersu10.html . However, you should not modify the global fpc.cfg file. Instead, in your home directory create a file .fpc.cfg (note the leading "."; this is also mentioned in the manual at the same place) with as contents

#include /etc/fpc.cfg
#ifdef cpumips
-Fu/home/dennis/fpc/$fpcversion/units/$fpctarget
-Fu/home/dennis/fpc/$fpcversion/units/$fpctarget/* -Fu/home/dennis/fpc/$fpcversion/units/$fpctarget/rtl #endif

Also, if complained under "FPC Source" tab when I entered "/home/ dennis/fpc/rtl" "Warning directory rtl not found"

That's because there is no /home/dennis/fpc/rtl/rtl directory. Additionally, you have to point it to the top level directory containing the FPC *sources*. Since your previous mails showed that you specified "/home/dennis/fpc" as the INSTALL_PREFIX, I hope "/home/ dennis/fpc" is not also your source directory. It shouldn't break anything in case it is, but it's not very clean to install there.

Jonas

Reply by email

Dennis Poon
to Jonas Maebe

Jonas,
Thanks for the guidance.

Where is cpumips defined?
Also, I could not use the $fpctarget variable, I had to use the exact file path to avoid some complains in lazarus.

Show quoted text 7 lines
#include /etc/fpc.cfg #ifdef cpumips -Fu/home/dennis/fpc/$fpcversion/units/$fpctarget -Fu/home/dennis/fpc/$fpcversion/units/$fpctarget/* -Fu/home/dennis/fpc/$fpcversion/units/$fpctarget/rtl #endif
Show quoted text 5 lines
> Also, if complained under "FPC Source" tab when I entered > "/home/dennis/fpc/rtl" > "Warning directory rtl not found"

I am quite confused. I followed the svn checkout instructions and the /dennis/fpc folder contents are what I got.
Which folder within that resultant folder is the source code folder? Should I move or copy that somewhere else and then pass its path to Lazarus ?

Also, I am confused why the INSTALL_PREFIX had no effect and I still have to specify the compiler path and the source code path in fpc.cfg and lazarus.

Show quoted text 7 lines
there is no /home/dennis/fpc/rtl/rtl directory. Additionally, you have to point it to the top level directory containing the FPC *sources*. Since your previous mails showed that you specified "/home/dennis/fpc" as the INSTALL_PREFIX, I hope "/home/dennis/fpc" is not also your source directory. It shouldn't break anything in case it is, but it's not very clean to install there.

Eventually, somehow with some hardcoding of the environ...xml and the Lazarus start up screen file paths, Lazarus started without complains. I tried to compile a simple program targeted at linux and mips and the "test compile" gave me errors:
ERROR: compiled FPC unit not found avl_tree.ppu
ERROR: complied FPC unit not found: zstream.ppu
but earlier, I already "make all CPUtarget... OS_TARGET.... . " and I added the binutilsprefix . for mips-linux. to produce many *.o and *.ppu for the target.
What else more can do to product avl_tree.ppu and zstrasm.ppu? The test program is just 1 line of writeln('hello word');

Thanks a lot in advance.

Dennis

Reply by email

Dennis Poon
to Michael Schnell

Michael,

I just typed "ld -v" and it replied:
GNU ld (GNU Binutils for Debian) 2.22

I do agree they look different. I supposed they should look like "mipsel-linux-ld"
but I only followed the wiki.freepascal.org/MIPS_port doc step 1 which stated http://www.emdebian.org/debian/pool/main/b/binutils/ and on that page, the only package looke correct is: "binutils-mips-linux-gnu_2.22-8_i386.deb" and
"binutils-mipsel-linux-gnu_2.22-8_i386.deb"

After installing those, I got those as and ld files inside their respective bin folder.

Can anyone provide me with links of PROVED binutils for MIPS linux?

Thanks,

Dennis

Show quoted text 23 lines
On 06/09/2013 05:43 PM, Dennis Poon wrote: > > > My binutils as , ld etc files are located at /usr/mips-linux-gnu/bin/ > ... first try to start these files form the command-line. (e.g. "ld -v") If they don't work decently (which I do suppose), you need different files. -Michael _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3345 / Virus Database: 3199/6403 - Release Date: 06/11/13

Reply by email

Michael Schnell
to Dennis Poon
Dennis Poon wrote
Michael, I just typed "ld -v" and it replied: GNU ld (GNU Binutils for Debian) 2.22

You'd better do

gcc -v

This should output (among others) a line starting "Target:"

Same will state the architecture and be something like "Target: MIPS-linux"

-Michael

Reply by email

Dennis Poon
to Michael Schnell

But I am working on a i386 Debian box.
I typed gcc -v and it just says Target: i486-linux-gnu but isn't that normal?

Anyway, where else should I download the cross compiler binutils from linux->MIPS?

Dennis

Show quoted text 26 lines
On 06/12/2013 11:13 AM, Dennis Poon wrote: > Michael, > > I just typed "ld -v" and it replied: > GNU ld (GNU Binutils for Debian) 2.22 You'd better do gcc -v This should output (among others) a line starting "Target:" Same will state the architecture and be something like "Target: MIPS-linux" -Michael _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3345 / Virus Database: 3199/6403 - Release Date: 06/11/13

Reply by email

Michael Ring
to Dennis Poon: I just typed "ld -v" and it replied: GNU ld (GNU Binutils for Debian) 2.22 I do agree…

The other Michael answering now ;-)

Just for fun I downloaded the deb-file you described below, the deb package seems to include the correctly named binaries at correct places:

x ./usr/bin/
x ./usr/bin/mipsel-linux-gnu-addr2line
x ./usr/bin/mipsel-linux-gnu-c++filt
x ./usr/bin/mipsel-linux-gnu-ld.bfd
x ./usr/bin/mipsel-linux-gnu-gprof
x ./usr/bin/mipsel-linux-gnu-strip
x ./usr/bin/mipsel-linux-gnu-size
x ./usr/bin/mipsel-linux-gnu-ld
x ./usr/bin/mipsel-linux-gnu-nm
x ./usr/bin/mipsel-linux-gnu-elfedit
x ./usr/bin/mipsel-linux-gnu-ar
x ./usr/bin/mipsel-linux-gnu-strings
x ./usr/bin/mipsel-linux-gnu-readelf

So please type:

/usr/bin/mipsel-linux-gnu-as -help

if you see the help text then everything is correctly installed on your system.

Now make sure that you have BINUTILSPREFIX=mipsel-linux-gnu-as on your commandline whenever you try to compile a binary for mips and you should be sure that you are indeed using the right cross-versions of as & friends.

And now I'd start on commandline to see if everything works. Here's an example that should also work for you:

STEP1:
<PATHWHEREYOURCROSSCOMPILERIS>/ppcrossmipsel -Tlinux -Pmipsel -XPmipsel-linux-gnu- hello.pas

when this works and you get a binary (verify it by doing a: mipsel-linux-gnu-objdump -a hello.elf)

then next is:

STEP2:
fpc -Tlinux -Pmipsel -XPmipsel-linux-gnu- hello.pas

this will kick in the magic of fpc that selects the crosscompiler based on the fpc config files

If this build fails you will need to find out if fpc looks at the right places for your crosscompiler and your tools.

STEP3:

fpc -Tlinux -Pmipsel -XPmipsel-linux-gnu- hello.pas -vt

will help you a lot diagnosing problems with wrong paths.

if this now also works then you should have a look on integrating those parameters into lazarus (STEP4), doing it this way instead of starting with step four before step one should make your live a lot easier because the level of complexity and possible problems rises from step to step.

Dennis Poon wrote 51 lines
Michael, I just typed "ld -v" and it replied: GNU ld (GNU Binutils for Debian) 2.22 I do agree they look different. I supposed they should look like "mipsel-linux-ld" but I only followed the wiki.freepascal.org/MIPS_port doc step 1 which stated http://www.emdebian.org/debian/pool/main/b/binutils/ and on that page, the only package looke correct is: "binutils-mips-linux-gnu_2.22-8_i386.deb" and "binutils-mipsel-linux-gnu_2.22-8_i386.deb" After installing those, I got those as and ld files inside their respective bin folder. Can anyone provide me with links of PROVED binutils for MIPS linux? Thanks, Dennis > On 06/09/2013 05:43 PM, Dennis Poon wrote: >> >> >> My binutils as , ld etc files are located at >> /usr/mips-linux-gnu/bin/ ... > > first try to start these files form the command-line. (e.g. "ld -v") > If they don't work decently (which I do suppose), you need different > files. > > -Michael > > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > > ----- > No virus found in this message. > Checked by AVG - www.avg.com > Version: 2013.0.3345 / Virus Database: 3199/6403 - Release Date: > 06/11/13 > > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Mark Morgan Lloyd
to Dennis Poon: I just typed "ld -v" and it replied: GNU ld (GNU Binutils for Debian) 2.22 I do agree…
Dennis Poon wrote 17 lines
Michael, I just typed "ld -v" and it replied: GNU ld (GNU Binutils for Debian) 2.22 I do agree they look different. I supposed they should look like "mipsel-linux-ld" but I only followed the wiki.freepascal.org/MIPS_port doc step 1 which stated http://www.emdebian.org/debian/pool/main/b/binutils/ and on that page, the only package looke correct is: "binutils-mips-linux-gnu_2.22-8_i386.deb" and "binutils-mipsel-linux-gnu_2.22-8_i386.deb" After installing those, I got those as and ld files inside their respective bin folder. Can anyone provide me with links of PROVED binutils for MIPS linux?

I've already given you a link, on our wiki, describing how to build them from scratch on a Debian system.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Michael Ring
to Michael Ring: The other Michael answering now ;-) Just for fun I downloaded the deb-file you described…

Small mixup:

Please see that
BINUTILSPREFIX=mipsel-linux-gnu-

is set when you buid your corosscompiler and make sure that

-XPmipsel-linux-gnu- is present on your commandline when compiling a program.

Michael

Michael Ring wrote 124 lines
The other Michael answering now ;-) Just for fun I downloaded the deb-file you described below, the deb package seems to include the correctly named binaries at correct places: x ./usr/bin/ x ./usr/bin/mipsel-linux-gnu-addr2line x ./usr/bin/mipsel-linux-gnu-c++filt x ./usr/bin/mipsel-linux-gnu-ld.bfd x ./usr/bin/mipsel-linux-gnu-gprof x ./usr/bin/mipsel-linux-gnu-strip x ./usr/bin/mipsel-linux-gnu-size x ./usr/bin/mipsel-linux-gnu-ld x ./usr/bin/mipsel-linux-gnu-nm x ./usr/bin/mipsel-linux-gnu-elfedit x ./usr/bin/mipsel-linux-gnu-ar x ./usr/bin/mipsel-linux-gnu-strings x ./usr/bin/mipsel-linux-gnu-readelf So please type: /usr/bin/mipsel-linux-gnu-as -help if you see the help text then everything is correctly installed on your system. Now make sure that you have BINUTILSPREFIX=mipsel-linux-gnu-as on your commandline whenever you try to compile a binary for mips and you should be sure that you are indeed using the right cross-versions of as & friends. And now I'd start on commandline to see if everything works. Here's an example that should also work for you: STEP1: <PATHWHEREYOURCROSSCOMPILERIS>/ppcrossmipsel -Tlinux -Pmipsel -XPmipsel-linux-gnu- hello.pas when this works and you get a binary (verify it by doing a: mipsel-linux-gnu-objdump -a hello.elf) then next is: STEP2: fpc -Tlinux -Pmipsel -XPmipsel-linux-gnu- hello.pas this will kick in the magic of fpc that selects the crosscompiler based on the fpc config files If this build fails you will need to find out if fpc looks at the right places for your crosscompiler and your tools. STEP3: fpc -Tlinux -Pmipsel -XPmipsel-linux-gnu- hello.pas -vt will help you a lot diagnosing problems with wrong paths. if this now also works then you should have a look on integrating those parameters into lazarus (STEP4), doing it this way instead of starting with step four before step one should make your live a lot easier because the level of complexity and possible problems rises from step to step. Am 12.06.13 11:13, schrieb Dennis Poon: > Michael, > > I just typed "ld -v" and it replied: > GNU ld (GNU Binutils for Debian) 2.22 > > I do agree they look different. I supposed they should look like > "mipsel-linux-ld" > but I only followed the wiki.freepascal.org/MIPS_port doc step 1 > which stated http://www.emdebian.org/debian/pool/main/b/binutils/ > and on that page, the only package looke correct is: > "binutils-mips-linux-gnu_2.22-8_i386.deb" and > "binutils-mipsel-linux-gnu_2.22-8_i386.deb" > > After installing those, I got those as and ld files inside their > respective bin folder. > > Can anyone provide me with links of PROVED binutils for MIPS linux? > > Thanks, > > Dennis > > >> On 06/09/2013 05:43 PM, Dennis Poon wrote: >>> >>> >>> My binutils as , ld etc files are located at >>> /usr/mips-linux-gnu/bin/ ... >> >> first try to start these files form the command-line. (e.g. "ld -v") >> If they don't work decently (which I do suppose), you need different >> files. >> >> -Michael >> >> _______________________________________________ >> fpc-pascal maillist - >> http://lists.freepascal.org/mailman/listinfo/fpc-pascal >> >> >> ----- >> No virus found in this message. >> Checked by AVG - www.avg.com >> Version: 2013.0.3345 / Virus Database: 3199/6403 - Release Date: >> 06/11/13 >> >> > _______________________________________________ > fpc-pascal maillist - > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Michael Schnell
to Dennis Poon: But I am working on a i386 Debian box. I typed gcc -v and it just says Target:…
Dennis Poon wrote
But I am working on a i386 Debian box. I typed gcc -v and it just says Target: i486-linux-gnu but isn't that normal?

Of course this is normal. what is not normal is that a cross-gcc (which is part of binutils) is supposed to be named just "gcc". (It should be named something like "mips-linux-gcc").

What I meant by "starting from the command line" is (on linux:)

either give the full path:
/usr/mips-linux-gnu/bin/gcc -v

or cd to the appropriate directory
cd/usr/mips-linux-gnu/bin/
and then do
./gcc -v

if this still says "Target: i486-linux-gnu" you don't have for example see this with my cross binutils (for a completely different target):

./fido-none-elf-gcc -v
Using built-in specs.
COLLECT_GCC=./fido-none-elf-gcc
COLLECT_LTO_WRAPPER=/home/mschnell/CodeSourcery/Sourcery_CodeBench_for_fido_ELF/bin/../libexec/gcc/fido-none-elf/4.6.1/lto-wrapper Target: fido-none-elf
....

-Michael

Reply by email

Dennis Poon
to Michael Ring: The other Michael answering now ;-) Just for fun I downloaded the deb-file you described…

Michael,
You are right, those files are also present at /usr/bin. Now I see that they seem to be the same set of files, only with the difference of a prefix. They have the same file size and date. If I open the .deb file with archive manager, it seems to suggest the set of files in side /usr/bin are LINKS to the set in the /usr/mips-linux-gnu/ folder

To be safe, I cam re 'make' ing every thing with the new BINUTILSPREFIX let you know later my results.

Dennis

Reply by email

Dennis Poon
to Marco van de Voort: In our previous episode, Dennis Poon said: Then type ld -V (with capital)

Marco,

When I typed ./ld -V within /usr/mips-linux-gnu/bin/ and it gave :

GNU ld (GNU Binutils for Debian) 2.22
Supported emulations:
elf32btsmip
elf32ltsmip
elf32btsmipn32
elf64btsmip
elf32ltsmipn32
elf64ltsmip
elf_x86_64
elf32_x86_64
elf_i386
i386linux
elf_l1om
elf_k1om

What does that mean?

Dennis

Show quoted text 21 lines
In our previous episode, Dennis Poon said: > I just typed "ld -v" and it replied: > GNU ld (GNU Binutils for Debian) 2.22 > Then type ld -V (with capital) _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2013.0.3345 / Virus Database: 3199/6403 - Release Date: 06/11/13

Reply by email

Dennis Poon
to Mark Morgan Lloyd: I've already given you a link, on our wiki, describing how to build them from scratch on…

Mark,

If you are referring to http://wiki.freepascal.org/MIPS_port then I did use that one but somehow along the way, I still cannot produce a binary program for mips, so someone suggested the binutils I got from that link might be the cause.

If you are referring to a different link, please kindly send again as I did not see it on the fpc discussion list.

Thanks.

Dennis

Show quoted text 22 lines
Dennis Poon wrote: > Michael, > > I just typed "ld -v" and it replied: > GNU ld (GNU Binutils for Debian) 2.22 > > I do agree they look different. I supposed they should look like > "mipsel-linux-ld" > but I only followed the wiki.freepascal.org/MIPS_port doc step 1 > which stated http://www.emdebian.org/debian/pool/main/b/binutils/ > and on that page, the only package looke correct is: > "binutils-mips-linux-gnu_2.22-8_i386.deb" and > "binutils-mipsel-linux-gnu_2.22-8_i386.deb" > > After installing those, I got those as and ld files inside their > respective bin folder. > > Can anyone provide me with links of PROVED binutils for MIPS linux? I've already given you a link, on our wiki, describing how to build them from scratch on a Debian system.

Reply by email

Mark Morgan Lloyd
to Dennis Poon
Dennis Poon wrote 6 lines
Mark, If you are referring to http://wiki.freepascal.org/MIPS_port then I did use that one but somehow along the way, I still cannot produce a binary program for mips, so someone suggested the binutils I got from that link might be the cause.

At the top of that page is a "health warning", which I put in when there was a flurry of activity merging David Zhang's work- for some reason he'd flattened directories etc. and I was working through comparing files to find what had changed.

Immediately below that is a link to
http://wiki.freepascal.org/Native_MIPS_Systems which includes blow-by-blow accounts of building cross-binutils from source: I put those in using cut-and-paste as I did them but somebody has since tweaked the format. Florian and others started putting a significant amount of effort into the compiler in the middle of last year, at which point I stepped back since (a) they're the experts and (b) I'm stuck using Qemu which isn't really fast enough (Fuxin at Lemote promised a netbook for development which didn't materialise).

I'm not saying that link will answer all your questions about the innards of the compiler, but it should result in your having usable tools.

If you are referring to a different link, please kindly send again as I did not see it on the fpc discussion list.

http://lists.freepascal.org/lists/fpc-pascal/2013-June/038362.html

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

waldo kitty
to Dennis Poon: I just typed "ld -v" and it replied: GNU ld (GNU Binutils for Debian) 2.22 I do agree…
Dennis Poon wrote
Michael, I just typed "ld -v" and it replied: GNU ld (GNU Binutils for Debian) 2.22

and what do you get if you type

/usr/mips-linux-gnu/bin/ld -v

??

just typing "ld -v" uses the one in your path and not necessarily the one that you want to verify/validate... you might want to test each of those utilities as above by specifying the full path from your manual command line...

NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted.

Reply by email

waldo kitty
to Michael Schnell: You'd better do gcc -v This should output (among others) a line starting "Target:" Same…
Michael Schnell wrote 12 lines
On 06/12/2013 11:13 AM, Dennis Poon wrote: > Michael, > > I just typed "ld -v" and it replied: > GNU ld (GNU Binutils for Debian) 2.22 You'd better do gcc -v This should output (among others) a line starting "Target:" Same will state the architecture and be something like "Target: MIPS-linux"

why not specify the full path? it seems that someone is blindly typing exactly what is written instead of adding the specific path "/usr/mips-linux-gnu/bin/" to the command...

NOTE: No off-list assistance is given without prior approval. Please keep mailing list traffic on the list unless private contact is specifically requested and granted.

Reply by email

Dennis Poon
to Mark Morgan Lloyd: At the top of that page is a "health warning", which I put in when there was a flurry of…

I eventually found this page which talked about downloading a special toolchain from openwrt web site

http://www.dd-wrt.com/phpBB2/viewtopic.php?t=61112

I followed its instruction and successfully compiled a helloworld c program and
successfully RUN the helloworld binary on Netgear 3700 running DD-Wrt !

I was overjoyed.

Then I tried to modify the steps to compile fpc

my toolchains is at /home/dennis/toolchains/staging_dir_mips/bin/ and in this folder, there are files: mips-linux-ar and mips-linux-as so I
make clean all CPU_TARGET=mips OS_TARGET=linux
BINUTILSPREFIX=/home/dennis/toolchains/staging_dir_mips/bin/mips-linux-

but I got errors:

/home/dennis/toolchains/staging_dir_mips/bin/mips-linux-as -32 -mips32 -EB -o /home/dennis/fpc/2.7.1/rtl/units/mips-linux/prt0.o mips/prt0.as mips/prt0.as: Assembler messages:
mips/prt0.as:23: Error: illegal operands `lui $a2,%hi(__dl_fini)' mips/prt0.as:25: Error: illegal operands `sw $v0,%lo(__dl_fini)($a2)' mips/prt0.as:54: Error: illegal operands `move $s8,$sp' mips/prt0.as:56: Error: illegal operands `sw $s8,%lo(__stkptr)($at)' mips/prt0.as:65: Error: illegal operands `lw $a0,0($s8)' mips/prt0.as:66: Error: illegal operands `lui
$a1,%hi(operatingsystem_parameter_argc)'
mips/prt0.as:67: Error: illegal operands `sw
$a0,%lo(operatingsystem_parameter_argc)($a1)'
mips/prt0.as:70: Error: illegal operands `addiu $a1,$s8,4' mips/prt0.as:71: Error: illegal operands `lui
$a2,%hi(operatingsystem_parameter_argv)'
mips/prt0.as:72: Error: illegal operands `sw
$a1,%lo(operatingsystem_parameter_argv)($a2)'
mips/prt0.as:75: Error: illegal operands `addiu $a2,$a0,1' mips/prt0.as:76: Error: illegal operands `sll $a2,$a2,0x2' mips/prt0.as:77: Error: illegal operands `addu $a2,$a2,$a1' mips/prt0.as:78: Error: illegal operands `lui
$a3,%hi(operatingsystem_parameter_envp)'
mips/prt0.as:79: Error: illegal operands `sw
$a2,%lo(operatingsystem_parameter_envp)($a3)'
mips/prt0.as:80: Error: illegal operands `lui $t9,%hi(PASCALMAIN)' mips/prt0.as:81: Error: illegal operands `addiu $t9,$t9,%lo(PASCALMAIN)' mips/prt0.as:82: Error: illegal operands `jalr $t9' mips/prt0.as:95: Error: illegal operands `sw $a0,16($sp)' mips/prt0.as:97: Error: illegal operands `lw $t9,%lo(__dl_fini)($at)' mips/prt0.as:98: Error: illegal operands `beqz $t9,.L1' mips/prt0.as:100: Error: illegal operands `jalr $t9' mips/prt0.as:103: Error: illegal operands `lw $a0,16($sp)' mips/prt0.as:104: Error: illegal operands `li $v0,4001' make[5]: *** [prt0.o] Error 1
make[5]: Leaving directory `/home/dennis/fpc/2.7.1/rtl/linux' make[4]: *** [linux_all] Error 2
make[4]: Leaving directory `/home/dennis/fpc/2.7.1/rtl' make[3]: *** [rtl] Error 2
make[3]: Leaving directory `/home/dennis/fpc/2.7.1/compiler' make[2]: *** [cycle] Error 2
make[2]: Leaving directory `/home/dennis/fpc/2.7.1/compiler' make[1]: *** [compiler_cycle] Error 2
make[1]: Leaving directory `/home/dennis/fpc/2.7.1' make: *** [build-stamp.mips-linux] Error 2

I feel I am almost there. Any help on the above?

Dennis

Reply by email

Michael Ring
to Dennis Poon

Seems that the assembler is not understanding the $xx notation for the registers.

Instead of trying to change the toolchain I would fire up gdb on your device and single step through the initialisation code of the helloworld.pas file.

From my point of view it is more likely that you will find the problem in the startup-code and not the toolchain. There were good hints in this o the other thread that fpc startup code is checking the proc filesystem. There might be a few more incompatibility issues with the wrt-linux implementation, those will most likely only reveal themselves in gdb

Michael

Von meinem iPad gesendet

Dennis Poon wrote 64 lines
I eventually found this page which talked about downloading a special toolchain from openwrt web site http://www.dd-wrt.com/phpBB2/viewtopic.php?t=61112 I followed its instruction and successfully compiled a helloworld c program and successfully RUN the helloworld binary on Netgear 3700 running DD-Wrt ! I was overjoyed. Then I tried to modify the steps to compile fpc my toolchains is at /home/dennis/toolchains/staging_dir_mips/bin/ and in this folder, there are files: mips-linux-ar and mips-linux-as so I make clean all CPU_TARGET=mips OS_TARGET=linux BINUTILSPREFIX=/home/dennis/toolchains/staging_dir_mips/bin/mips-linux- but I got errors: /home/dennis/toolchains/staging_dir_mips/bin/mips-linux-as -32 -mips32 -EB -o /home/dennis/fpc/2.7.1/rtl/units/mips-linux/prt0.o mips/prt0.as mips/prt0.as: Assembler messages: mips/prt0.as:23: Error: illegal operands `lui $a2,%hi(__dl_fini)' mips/prt0.as:25: Error: illegal operands `sw $v0,%lo(__dl_fini)($a2)' mips/prt0.as:54: Error: illegal operands `move $s8,$sp' mips/prt0.as:56: Error: illegal operands `sw $s8,%lo(__stkptr)($at)' mips/prt0.as:65: Error: illegal operands `lw $a0,0($s8)' mips/prt0.as:66: Error: illegal operands `lui $a1,%hi(operatingsystem_parameter_argc)' mips/prt0.as:67: Error: illegal operands `sw $a0,%lo(operatingsystem_parameter_argc)($a1)' mips/prt0.as:70: Error: illegal operands `addiu $a1,$s8,4' mips/prt0.as:71: Error: illegal operands `lui $a2,%hi(operatingsystem_parameter_argv)' mips/prt0.as:72: Error: illegal operands `sw $a1,%lo(operatingsystem_parameter_argv)($a2)' mips/prt0.as:75: Error: illegal operands `addiu $a2,$a0,1' mips/prt0.as:76: Error: illegal operands `sll $a2,$a2,0x2' mips/prt0.as:77: Error: illegal operands `addu $a2,$a2,$a1' mips/prt0.as:78: Error: illegal operands `lui $a3,%hi(operatingsystem_parameter_envp)' mips/prt0.as:79: Error: illegal operands `sw $a2,%lo(operatingsystem_parameter_envp)($a3)' mips/prt0.as:80: Error: illegal operands `lui $t9,%hi(PASCALMAIN)' mips/prt0.as:81: Error: illegal operands `addiu $t9,$t9,%lo(PASCALMAIN)' mips/prt0.as:82: Error: illegal operands `jalr $t9' mips/prt0.as:95: Error: illegal operands `sw $a0,16($sp)' mips/prt0.as:97: Error: illegal operands `lw $t9,%lo(__dl_fini)($at)' mips/prt0.as:98: Error: illegal operands `beqz $t9,.L1' mips/prt0.as:100: Error: illegal operands `jalr $t9' mips/prt0.as:103: Error: illegal operands `lw $a0,16($sp)' mips/prt0.as:104: Error: illegal operands `li $v0,4001' make[5]: *** [prt0.o] Error 1 make[5]: Leaving directory `/home/dennis/fpc/2.7.1/rtl/linux' make[4]: *** [linux_all] Error 2 make[4]: Leaving directory `/home/dennis/fpc/2.7.1/rtl' make[3]: *** [rtl] Error 2 make[3]: Leaving directory `/home/dennis/fpc/2.7.1/compiler' make[2]: *** [cycle] Error 2 make[2]: Leaving directory `/home/dennis/fpc/2.7.1/compiler' make[1]: *** [compiler_cycle] Error 2 make[1]: Leaving directory `/home/dennis/fpc/2.7.1' make: *** [build-stamp.mips-linux] Error 2 I feel I am almost there. Any help on the above? Dennis _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

Sven Barth
to Dennis Poon: I eventually found this page which talked about downloading a special toolchain from…
Dennis Poon wrote 19 lines
I eventually found this page which talked about downloading a special toolchain from openwrt web site http://www.dd-wrt.com/phpBB2/viewtopic.php?t=61112 I followed its instruction and successfully compiled a helloworld c program and successfully RUN the helloworld binary on Netgear 3700 running DD-Wrt ! I was overjoyed. Then I tried to modify the steps to compile fpc my toolchains is at /home/dennis/toolchains/staging_dir_mips/bin/ and in this folder, there are files: mips-linux-ar and mips-linux-as so I make clean all CPU_TARGET=mips OS_TARGET=linux BINUTILSPREFIX=/home/dennis/toolchains/staging_dir_mips/bin/mips-linux-

It seems not to be your problem, but your arguments are not entirely correct (and it "works" just by accident). BINUTILSPREFIX is *only* the prefix of the binaries, in your case "mips-linux-". The path must be passed as CROSSBINDIR like so:
CROSSBINDIR=/home/dennis/toolchains/staging_dir_mips/bin And did you choose the correct endianess? Aka CPU_TARGET=mipsel or CPU_TARGET=mipseb?

Maybe you could try to fiddle around with the arguments passed to mips-linux-as by hand. This means take the command below and try to get the prt0.as file to assemble:

/home/dennis/toolchains/staging_dir_mips/bin/mips-linux-as -32 -mips32 -EB -o /home/dennis/fpc/2.7.1/rtl/units/mips-linux/prt0.o mips/prt0.as

(current directory should be /home/dennis/fpc/2.7.1/rtl/linux )

Regards,
Sven

Reply by email

Mark Morgan Lloyd
to Sven Barth
Sven Barth wrote 37 lines
On 15.06.2013 19:19, Dennis Poon wrote: > > I eventually found this page which talked about downloading a special > toolchain from openwrt web site > > http://www.dd-wrt.com/phpBB2/viewtopic.php?t=61112 > > I followed its instruction and successfully compiled a helloworld c > program and > successfully RUN the helloworld binary on Netgear 3700 running DD-Wrt ! > > I was overjoyed. > > Then I tried to modify the steps to compile fpc > > my toolchains is at /home/dennis/toolchains/staging_dir_mips/bin/ > and in this folder, there are files: mips-linux-ar and mips-linux-as > so I > make clean all CPU_TARGET=mips OS_TARGET=linux > BINUTILSPREFIX=/home/dennis/toolchains/staging_dir_mips/bin/mips-linux- It seems not to be your problem, but your arguments are not entirely correct (and it "works" just by accident). BINUTILSPREFIX is *only* the prefix of the binaries, in your case "mips-linux-". The path must be passed as CROSSBINDIR like so: CROSSBINDIR=/home/dennis/toolchains/staging_dir_mips/bin And did you choose the correct endianess? Aka CPU_TARGET=mipsel or CPU_TARGET=mipseb? Maybe you could try to fiddle around with the arguments passed to mips-linux-as by hand. This means take the command below and try to get the prt0.as file to assemble: /home/dennis/toolchains/staging_dir_mips/bin/mips-linux-as -32 -mips32 -EB -o /home/dennis/fpc/2.7.1/rtl/units/mips-linux/prt0.o mips/prt0.as (current directory should be /home/dennis/fpc/2.7.1/rtl/linux )

That's probably a uClibc toolchain, one of the known issues is that it has to load the right .so file on the target. The big question is whether it also implies that there has to be special support for the Atheros (Broadcom?) target in the RTL.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email

Dennis Poon
to Sven Barth: It seems not to be your problem, but your arguments are not entirely correct (and it…

Sven,

I tried your suggestion and the result is exactly the same. So, I guess putting the path in BINUTILSPREFIX has the same effect as CROSSBINDIR. It will just concatenate both variable to get the full 'as' and 'ar' file paths.

As per your second suggestion, my knowledge of assembler is too limited. I don't how hot to fiddle the paramters passed to the 'as'. I typed the -help below. Can anyone give me some advice as to how to solve the 'as' problem:
Error: illegal operands `lui $a2,%hi(__dl_fini)'

Usage: /home/dennis/toolchains/staging_dir_mips/bin/mips-linux-as [option...] [asmfile...]
Options:
-a[sub-option...] turn on listings
Sub-options [default hls]:
c omit false conditionals
d omit debugging directives
h include high-level source
l include assembly
m include macro expansions
n omit forms processing
s include symbols
=FILE list to FILE (must be last sub-option)
--alternate initially turn on alternate macro syntax -D produce assembler debugging messages --defsym SYM=VAL define symbol SYM to given value --em=[mipsbelf | mipslelf | mipself]
emulate output (default mipsbelf)
--execstack require executable stack for this object --noexecstack don't require executable stack for this object -f skip whitespace and comment preprocessing -g --gen-debug generate debugging information --gstabs generate STABS debugging information --gstabs+ generate STABS debug info with GNU extensions --gdwarf-2 generate DWARF2 debugging information --hash-size=<value> set the hash table size close to <value> --help show this message and exit --target-help show target specific options -I DIR add DIR to search list for .include directives -J don't warn about signed overflow -K warn when differences altered for long displacements
-L,--keep-locals keep local symbols (e.g. starting with `L') -M,--mri assemble in MRI compatibility mode --MD FILE write dependency information in FILE (default none)
-nocpp ignored
-o OBJFILE name the object-file output OBJFILE (default a.out)
-R fold data section into text section --reduce-memory-overheads
prefer smaller memory use at the cost of longer
assembly times
--statistics print various measured statistics from execution --strip-local-absolute strip local absolute symbols --traditional-format Use same format as native assembler when possible --version print assembler version number and exit -W --no-warn suppress warnings
--warn don't suppress warnings
--fatal-warnings treat warnings as errors
--itbl INSTTBL extend instruction set to include instructions matching the specifications defined in file
INSTTBL
-w ignored
-X ignored
-Z generate object file even after errors --listing-lhs-width set the width in words of the output data column of
the listing
--listing-lhs-width2 set the width in words of the continuation lines of the output data column; ignored if smaller
than
the width of the first line
--listing-rhs-width set the max width in characters of the lines from the source file
--listing-cont-lines set the maximum number of continuation lines used for the output data column of the listing
@FILE read options from FILE
MIPS options:
-EB generate big endian output
-EL generate little endian output
-g, -g2 do not remove unneeded NOPs or swap branches -G NUM allow referencing objects up to NUM bytes implicitly with the gp register [default 8]
-mips1 generate MIPS ISA I instructions -mips2 generate MIPS ISA II instructions -mips3 generate MIPS ISA III instructions -mips4 generate MIPS ISA IV instructions -mips5 generate MIPS ISA V instructions -mips32 generate MIPS32 ISA instructions -mips32r2 generate MIPS32 release 2 ISA instructions -mips64 generate MIPS64 ISA instructions -mips64r2 generate MIPS64 release 2 ISA instructions -march=CPU/-mtune=CPU generate code/schedule for CPU, where CPU is one of:
mips1, mips2, mips3, mips4, mips5, mips32,
mips32r2, mips64, mips64r2, r3000, r2000, r3900,
r6000, r4000, r4010, vr4100, vr4111, vr4120,
vr4130, vr4181, vr4300, r4400, r4600, orion,
r4650, r8000, r10000, r12000, vr5000, vr5400,
vr5500, rm5200, rm5230, rm5231, rm5261, rm5721,
rm7000, rm9000, 4kc, 4km, 4kp, m4k, 24k, 24kc,
24kf, 24kx, 5kc, 5kf, 20kc, sb1, from-abi
-mCPU equivalent to -march=CPU -mtune=CPU. Deprecated. -no-mCPU don't generate code specific to CPU. For -mCPU and -no-mCPU, CPU must be one of:
3900, 4010, 4100, 4650
-mips16 generate mips16 instructions
-no-mips16 do not generate mips16 instructions -mdsp generate DSP instructions
-mno-dsp do not generate DSP instructions
-mmt generate MT instructions
-mno-mt do not generate MT instructions -mfix-vr4120 work around certain VR4120 errata -mfix-vr4130 work around VR4130 mflo/mfhi errata -mgp32 use 32-bit GPRs, regardless of the chosen ISA -mfp32 use 32-bit FPRs, regardless of the chosen ISA -mno-shared optimize output for executables -msym32 assume all symbols have 32-bit values -O0 remove unneeded NOPs, do not swap branches -O remove unneeded NOPs and swap branches --[no-]construct-floats [dis]allow floating point values to be constructed --trap, --no-break trap exception on div by 0 and mult overflow --break, --no-trap break exception on div by 0 and mult overflow -KPIC, -call_shared generate SVR4 position independent code -non_shared do not generate position independent code -xgot assume a 32 bit GOT
-mpdr, -mno-pdr enable/disable creation of .pdr sections -mshared, -mno-shared disable/enable .cpload optimization for non-shared code
-mabi=ABI create ABI conformant object file for: 32, o64, n32, 64, eabi
-32 create o32 ABI object file (default) -n32 create n32 ABI object file
-64 create 64 ABI object file

Show quoted text 41 lines
On 15.06.2013 19:19, Dennis Poon wrote: > > I eventually found this page which talked about downloading a special > toolchain from openwrt web site > > http://www.dd-wrt.com/phpBB2/viewtopic.php?t=61112 > > I followed its instruction and successfully compiled a helloworld c > program and > successfully RUN the helloworld binary on Netgear 3700 running DD-Wrt ! > > I was overjoyed. > > Then I tried to modify the steps to compile fpc > > my toolchains is at /home/dennis/toolchains/staging_dir_mips/bin/ > and in this folder, there are files: mips-linux-ar and mips-linux-as > so I > make clean all CPU_TARGET=mips OS_TARGET=linux > BINUTILSPREFIX=/home/dennis/toolchains/staging_dir_mips/bin/mips-linux- It seems not to be your problem, but your arguments are not entirely correct (and it "works" just by accident). BINUTILSPREFIX is *only* the prefix of the binaries, in your case "mips-linux-". The path must be passed as CROSSBINDIR like so: CROSSBINDIR=/home/dennis/toolchains/staging_dir_mips/bin And did you choose the correct endianess? Aka CPU_TARGET=mipsel or CPU_TARGET=mipseb? Maybe you could try to fiddle around with the arguments passed to mips-linux-as by hand. This means take the command below and try to get the prt0.as file to assemble: /home/dennis/toolchains/staging_dir_mips/bin/mips-linux-as -32 -mips32 -EB -o /home/dennis/fpc/2.7.1/rtl/units/mips-linux/prt0.o mips/prt0.as (current directory should be /home/dennis/fpc/2.7.1/rtl/linux ) Regards, Sven

Reply by email