JSteh
JSteh

Reputation: 185

Compiling Pascal code for embedded system (AT89C51RC2)

I am working on making a pretty trivial change to an old existing pascal source file. I have the source code, but need to generate a new hex file with my changes.

First, I tried compiling with "Embedded Pascal", which is the program used by my predecessor. Unfortunately, it is an unregistered copy and gives the message that the file is too large for the unregistered version. Support for and even the homepage for the project has disappeared (old), so I have no idea how I would register.

I tried a couple other compilers, "Free Pascal" and "Turbo51", and they are both giving similar errors:

Filename.pas (79): Error 36: BEGIN expected.
Linkcode $2E
^

The source code begins with

Linkcode $2E
LinkData $0A    // normally 8 - make room for capacitance data

Program Main; Vector LongJmp Startup_Vector; //This inserts the start to the main routine.

uses IntLib;

I'm not well-versed in Pascal or embedded programming, but as I understand it, the Linkcode and LinkData lines are required to set up the RAM as needed. Following the "Const" and "var" declarations are subroutines that indeed start with procedure... begin... end.

I realize that Pascal is a bit out of date, but we are stuck with it and our old micro. Any ideas why previously working source code with trivial changes cannot be compiled? I am willing to consider other compilers, including paid options, if any are available with decent support. I am using Windows 10 x64 processor to compile, and flashing to an Atmel 89C51RC2.

If more source code is needed for diagnosis, please let me know what in particular, as I'll need to change some proprietary information before posting. Thanks!

Upvotes: 2

Views: 94

Answers (2)

JSteh
JSteh

Reputation: 185

Thanks to all for the information. While I didn't find an exact solution here, your comments were helpful for me to understand just how compiler-specific the Pascal code was.

In the end, I was able to get into my predecessors files and transfer registration, solving the issue for now. As suggested, I think I will port to C in the future to avoid fighting all the unsupported compiler nonsense.

Upvotes: 1

Marco van de Voort
Marco van de Voort

Reputation: 26358

Statements like linkcode and linkdata are not general, but target and compiler specific. Unless you have the know-how to reengineer to a different compiler, getting the original one is best.

Upvotes: 1

Related Questions