Re[3]: [fpc-other]reputation of Pascal

Florian Klaempfl Florian.Klaempfl@gmx.de
Sun, 09 Jun 2002 12:02:06 +0200


At 10:38 09.06.02 +0200, you wrote:

>Yesterday I had a closer look to the Infineon TriCore TC1775
>microcontroller. It is a 32 bit µC with looots of funny things inside.
>(but it is a BGA329 package, but I'll manage that ;-) ). I thought of
>writing a nice assembler for Linux, GPLed of course. But only assembler
>is a bit poor, so I thought of extending FreePascal to use that
>assembler.
>
>My question: How difficult and how much work is it to extend FPC for
>that processor?

I'am too lazy to look up the web for the instruction set of TC1775 :)
but what kind of instruction set does it use?

>Some time ago I heard of a new internal structure to
>easily implement newer processors. Is that restructuration already in
>1.1?

Yes, a lot is already done though it isn't finished yet.


>Additionally this Pascal would have to be more complex than normal FPC,
>because I'd need interrupt procedures like in Keil C for the Infineon
>C166. e.g.
>
>Procedure TimerISR; interrupt 12;
>Var Counter : LongInt; static;
>Begin
>   if P12.2 = 1 then
>     Inc(Counter);
>End;
>
>Here are three specialities:
>  1) "interrupt 12" ... this should tell the compiler to automatically
>     put this procedure to the interrupt vector table (or whatever the
>     µC uses)

No problem.

>  2) "static" ... this variable should be static. I think using "Const"
>     instead of "Var" would do the job.
>  3) "P12.1" ... direct access to bits of bit addressable
>     registers/memory

This is a little bit more difficult, but it is possible.


>Additionally the TriCore has a second Peripheral processor inside, which
>has other opcode set and its own data and code memory. ISRs can be
>executed there instead of the main core CPU. Lots of interesting
>features, and I'd love to have them in FPC. :-) I would help to
>implement that. But, is it possible?

Possible is everything, it's a matter of doing the work :). A compiler
port to another processor is always hard work, the necessary work
depends on the complexity of the target processor. If you're seriously
interessted, ask via fpc-devel or me in a personal email.


>Another thing interesting me: can FPC give me a binary file instead of
>an executable. So that the first byte starts with real code, as a MS-DOS
>.com or .bin file did?

It simply depends on the linker you use. FPC itself (can) output(s) 
assembler so it's up
to you to use the right assembler and linker.


>How can one avoid to use the System unit?

You can use a dummy system unit, for the basic types like integer etc. a tiny
system unit is necessary. I guess it's already available in rtl/fakertl.
For an example for a small system unit have a look at PalmOS System unit
(rtl/palmos).

>I only want a few procedures,
>which don't need so many system functions. The Linux kernel itself
>doesn't use libc either. (BTW: It is not nice to see a tiny FPC program
>with 80kB executable, where a far more complex C program only has 7k. I
>don't care, but how to argue to others?)

At least for go32v2 I can say that it contains the dos extender as well. 
Further,
pascal contains a lot of "hidden" code for run time error handling etc. This
leads to a hello world size for win32 of 14kB (1.0.6, options -XX -Xs).