EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

Anyone programming embedded systems in Pascal ?

Started by Tilmann Reh May 16, 2007
Hello,

I would like to know if anyone here is using a Pascal compiler for
embedded systems using ARM7 controllers.

The FreePascal compiler seems to support ARM7 as a target, however
there doesn't seem to be direct support for embedded systems (the
target code might require an OS like that on palms). Maybe it's usable
though, with some particular configuration or includes...

Thanks,
Tilmann

An Engineer's Guide to the LPC2100 Series

Tilmann Reh wrote:
>
> Hello,
>
> I would like to know if anyone here is using a Pascal compiler for
> embedded systems using ARM7 controllers.
>
> The FreePascal compiler seems to support ARM7 as a target, however
> there doesn't seem to be direct support for embedded systems (the
> target code might require an OS like that on palms). Maybe it's usable
> though, with some particular configuration or includes...
>

I think that is largely true. I have considered programming some apps
for an upcoming S3C2410 project in Free Pascal / Lazarus. That system
will be running Linux so an o/s will be available. I've been
programming in Pascal since my old Apple ][ days with UCSD Pascal.

IMO, once you step out of the C programming language as the primary
language for an embedded system onto a "higher" level of abstraction,
you are going to need a solid o/s foundation. Languages such as perl,
c++, pascal, etc., all require more formalized system resource
management. While you can devise some method of crippling that language
so it would work (by restricting yourself to a subset), it becomes
highly questionable as to whether the move from C to that language
bought you any real gains. Perhaps it only bought you a level of
comfort, or "gee whiz" factor....

I think that the same limitations may exist with Pascal as with C++,
that of memory management. Without an MMU being present, malloc() and
free() really become non-existent. IMO, memory management alone is a
major consideration when choosing the primary language to use on an
embedded system. At least with C, you have a high degree of control
over memory utilizations, albeit you have a lot more detail that you
would have to do yourself where a higher level language would do them
for you (object management).

Regards,

TomW
--
Tom Walsh - WN3L - Embedded Systems Consultant
http://openhardware.net http://cyberiansoftware.com http://openzipit.org
"Windows? No thanks, I have work to do..."
----------------
Hi,

> > I would like to know if anyone here is using a Pascal compiler for
> > embedded systems using ARM7 controllers.
> >
> > The FreePascal compiler seems to support ARM7 as a target, however
> > there doesn't seem to be direct support for embedded systems (the
> > target code might require an OS like that on palms). Maybe it's
> usable
> > though, with some particular configuration or includes...
> > I think that is largely true. I have considered programming some apps
> for an upcoming S3C2410 project in Free Pascal / Lazarus. That system
> will be running Linux so an o/s will be available. I've been
> programming in Pascal since my old Apple ][ days with UCSD Pascal.
>
> IMO, once you step out of the C programming language as the primary
> language for an embedded system onto a "higher" level of abstraction,
> you are going to need a solid o/s foundation. Languages such as perl,
> c++, pascal, etc., all require more formalized system resource
> management.

I've written plenty of embedded applications in Pascal, mostly for the Z80
and 68k, with and without OS/RTOS support. OS-9/68k, PSOS, VMEPROM...

> While you can devise some method of crippling that
> language so it would work (by restricting yourself to a subset), it
becomes
> highly questionable as to whether the move from C to that language
> bought you any real gains. Perhaps it only bought you a level of
> comfort, or "gee whiz" factor....

Pascal was fine for some very nice embedded systems I developed with other
engineers a long time ago, all without an OS and cross-developed from CP/M.
I even used the p-System's NCG to generate code for an embedded system to
control a 400-needle industrial knitter, all written in Pascal... Pascal
has no need for an OS and has *fewer * requirement for memory management
than C does!

--
Paul Curtis, Rowley Associates Ltd http://www.rowley.co.uk
CrossWorks for ARM, MSP430, AVR, MAXQ, and now Cortex-M3 processors
--- In l..., "Paul Curtis" wrote:
>
> Hi,
>
> > > I would like to know if anyone here is using a Pascal compiler for
> > > embedded systems using ARM7 controllers.
> > >
> > > The FreePascal compiler seems to support ARM7 as a target, however
> > > there doesn't seem to be direct support for embedded systems (the
> > > target code might require an OS like that on palms). Maybe it's
> > usable
> > > though, with some particular configuration or includes...
> > >

I haven't used Pascal for the ARM7 but I have used Embedded Pascal for
the 8051 (and derivatives, specifically the 80C552). It is also
available for the Z80. Very nice...

I have always like Pascal from the old UCSD days and I am currently
thinking about building a very small and quite fast (20 or 30 MHz)
Z180 board with a couple of CF devices for disk drives to do nothing
but run UCSD Pascal. A little external RAM, a small piece of Flash
and the internal USARTs are about all it takes. Or, add a graphics
chip and essentially recreate the Terak computer.

I have thought about porting UCSD Pascal to the LPC2106 but I haven't
come to grips with coding the P code interpreter in assembly language.
It would make more sense to code it in C. The irony...

This project is very close to the top of my project 'to-do' list. A
UCSD Pascal based 'bot would be sweet! It would be its' own
development system and quite easy for new users (like my grandson).
I really want to do my embedded coding in Fortran IV. No reason,
really. I just want to do it. I have always wondered whether I could
build the GNU Fortran compiler for the ARM7 when I build the C
version. Anybody know?

To that end, I just built an FPGA emulation of an IBM 1130
minicomputer (first sold in 1965) that runs all of the IBM software
including the 27 pass Fortran compiler and the Disk Monitor System.
Now, if I could build PCBs for BGA devices, I could use a 40 year old
processor instead of one of these new ARM devices for my 'bot
projects. How cool would that be?

But wait! With the 1130 you also get: Algol, APL, RPG and COBOL (none
of which do I actually have). Alas, I am not sure how to apply
COBOL's 'MOVE CORRESPONDING ...' to robotics.

How about CP/M 2.2 and Digital Research's PL/I? I do have that
running on an FPGA emulation of a Z80 (just because). It would also
run on the proposed Z180 project. This project may just happen come
fall. Right now I am concentrating on sailing and building another
small boat. Gotta have your priorities straight...

Richard
--- In l..., "rtstofer" wrote:

> Pascal from the old UCSD days

BEGIN
UCSD was nice enough, but if you really want that old Z80 to get up
and sweat, you just can't beat Pascal MT (written by a guy named
Lehmann, perhaps?), the best native-code micro compiler of all time.
It was a thing of beauty, my first compiler that wrote machine code
better than I could. Uh, well its sprintf() would sometimes print 'i'
when it really meant '1', but heck you can't have everything!
END;
--- In l..., "tonalbuilder2002"
wrote:
>
> --- In l..., "rtstofer" wrote:
>
> > Pascal from the old UCSD days
>
> BEGIN
> UCSD was nice enough, but if you really want that old Z80 to get up
> and sweat, you just can't beat Pascal MT (written by a guy named
> Lehmann, perhaps?), the best native-code micro compiler of all time.
> It was a thing of beauty, my first compiler that wrote machine code
> better than I could. Uh, well its sprintf() would sometimes print 'i'
> when it really meant '1', but heck you can't have everything!
> END;
>

I have Pascal MT and spent some amount of time testing the compiler as
it was developed. I had forgotten about it. Perhaps I should get it
running again.

I see CP/M binaries and the documentation are available via links at
Wikepedia.

One advantage of the UCSD system is the ability to add devices and the
related drivers via changes to the compiler/system/interpreter.
Having source is always nice!

INP and OUT are equally useful for Pascal MT.

However, if integer arithmetic was sufficient, Dr Li-Chen Wang's Palo
Alto Tiny Basic just RIPPED! I built several 8085 gadgets with this
in EPROM.

Richard
> IMO, once you step out of the C programming language as the primary
> language for an embedded system onto a "higher" level of abstraction,
> you are going to need a solid o/s foundation. Languages such as perl,
> c++, pascal, etc., all require more formalized system resource
> management.

I don't see why. Which resources do you meant? Memory management can be
provided by the OS or by the language, this choice is open for all
languages. Perl is a rather odd beast in your list, but C, C++, Pascal,
Ada, PL/1 etc. are all very alike in 'system resources' required.

Wouter van Ooijen

-- -------
Van Ooijen Technische Informatica: www.voti.nl
consultancy, development, PICmicro products
docent Hogeschool van Utrecht: www.voti.nl/hvu
--- In l..., "rtstofer" wrote:

> I have thought about porting UCSD Pascal to the LPC2106 but I haven't
> come to grips with coding the P code interpreter in assembly language.
> It would make more sense to code it in C. The irony...

I saw source for the p-machine in the UCSD group on Yahoo. I don't
remember seeing any C source, though. I do remember seeing a linux
p-machine, so the C source is probably out there somewhere.

> To that end, I just built an FPGA emulation of an IBM 1130
> minicomputer (first sold in 1965)

That was the first computer I ever programmed, back in 1977.

Eric
--- In l..., "Tilmann Reh" wrote:
>
> Hello,
>
> I would like to know if anyone here is using a Pascal compiler for
> embedded systems using ARM7 controllers.
>

I'm using Oberon-07 (Pascal's 'grandson' via Modula-2):

http://www.cfbsoftware.com/armaide


The 2024 Embedded Online Conference