Page 1 of 1

How to make a bin file with FreePascal

Posted: Mon Jul 29, 2002 3:51 am
by Silenger
You can make coff and elf files with FreePascal but how do you make flat binary's?

Can someone tell me how. I saw in an old post that you should use LD to do that but how?

Re:How to make a bin file with FreePascal

Posted: Mon Jul 29, 2002 11:54 am
by Silenger
k I made the COFF files with free pascal then started ld with "ld.exe testos.o -o loader.bin -oformat binary" then i get the next thing:

testos.o(.text+0x7):testos.pas: undefined reference to `FPC_INITIALIZEUNITS'
testos.o(.text+0x15):testos.pas: undefined reference to `FPC_PUSHEXCEPTADDR'
testos.o(.text+0x1b):testos.pas: undefined reference to `FPC_SETJMP'
testos.o(.text+0x2c):testos.pas: undefined reference to `_SYSTEMV$$_WRITESTR$STR
ING'
testos.o(.text+0x31):testos.pas: undefined reference to `_SYSTEMV$$_READLN'
testos.o(.text+0x3b):testos.pas: undefined reference to `FPC_ANSISTR_DECR_REF'
testos.o(.text+0x48):testos.pas: undefined reference to `FPC_ANSISTR_DECR_REF'
testos.o(.text+0x51):testos.pas: undefined reference to `FPC_ANSISTR_DECR_REF'
testos.o(.text+0x56):testos.pas: undefined reference to `FPC_POPADDRSTACK'
testos.o(.text+0x60):testos.pas: undefined reference to `FPC_RERAISE'
testos.o(.text+0x65):testos.pas: undefined reference to `FPC_DO_EXIT'
testos.o(.data+0x34):testos.pas: undefined reference to `INIT$$SYSTEM'
testos.o(.data+0x3c):testos.pas: undefined reference to `INIT$$OBJPAS'
testos.o(.data+0x40):testos.pas: undefined reference to `FINALIZE$$OBJPAS'

Can't you use units? Like TESTOS.PAS -> is the program, SYSTEMV.PAS -> is the unit with the functions.

Re:How to make a bin file with FreePascal

Posted: Mon Jul 29, 2002 12:05 pm
by Silenger
[attachment deleted by admin]

Re:How to make a bin file with FreePascal

Posted: Mon Jul 29, 2002 1:29 pm
by Silenger
Is there a option in LD to use external functions ???

Re:How to make a bin file with FreePascal

Posted: Tue Jul 30, 2002 6:39 am
by Pype.Clicker
You're missing the runtime support library for Pascal language. This library holds strings manipulations as well as environment setup/release for any Pascal program, and obviously some code to handle exceptions ...

You have to find out which libraries implement these (i.e. by grep "FPC_ANSI_STR_..." * -r in /usr/lib or wherever your libraries are installed) and then link statically with the library that provide the missing symbols

(i.e. if it is libfpc.a, ld testos.o libfpc.a -o loader.bin -oformat binary)

Re:How to make a bin file with FreePascal

Posted: Tue Jul 30, 2002 9:14 am
by Silenger
Thx ;)

Re:How to make a bin file with FreePascal

Posted: Wed Jul 31, 2002 2:53 am
by Silenger
Can you set the dir to use? Or you have to say every file you need.

Re:How to make a bin file with FreePascal

Posted: Wed Jul 31, 2002 9:51 am
by Silenger
I found it:

C:\PasOSDev>C:\pp\bin\go32v2\ld.exe testos.o systemv.o -rpath-link C:\pp\units\g
o32v2\rtl\*.o C:\pp\units\go32v2\rtl\*.a -o loader.bin -oformat binary

You had to use the *.o files to. :D

But now i got a 231kb big binary file is this normal?

Re:How to make a bin file with FreePascal

Posted: Thu Aug 01, 2002 1:52 pm
by Pype.Clicker
for sure, RTL library needs a lot of space ... this is what you have to pay for a higher-level language :(
Now, maybe you can save some Kbs by not including *.a but only *really* mandatory files or by re-implementing a lightweight version of the library (in asm or C)

Re:How to make a bin file with FreePascal

Posted: Fri Aug 02, 2002 2:26 am
by Silenger
k Thx

Re:How to make a bin file with FreePascal

Posted: Fri Aug 02, 2002 11:53 am
by Piotr Sejfried
Hi,

I know that it isn't reply for the topic but I see that somebody try to write OS in Free Pascal. FPC is similar to TMT Pascal in which I write my OS.

I'm interested in your OS and I'd like to talk about it with you. Could you tell me what is your e-mail address?

My is: [email protected]

I'm waiting for your reply

Best Regards
Peter

Re:How to make a bin file with FreePascal

Posted: Fri Aug 02, 2002 1:43 pm
by Silenger
I think i couldn't help much, i am a asm newbie and its only for fun. I'm just trying to make something that boots ;D

If you like my mail: [email protected]