TINY14PI Development

See Getting Started with Pascal on the Pi for details for getting a Lazarus set up on the Pi in order to compile TINY14PI.

We summarise below the stages of development of TINY14PI from TINY14ELF.

  • Testing assembler code (see here) showed us that we needed indirect addressing for loading and storing variables. We adjusted the code in uCodeGenPi accordingly.
  • We needed to precede each block of data with the .data directive and each block of code with the .text directive.
  • To avoid error messages we encountered for TINY14ELF, we needed to output .ltorg at appropriate positions as advised in lecture notes.
  • In order to make the whole translation work from a batch file, we put in an argument-handling code so that immediately after the identifier of the compiler (TINY14PI) you need to supply the pathname of the source.
  • The ppcarm compiler does not recognise assignFile and closeFile so we use assign and close, respectively.

Please be aware of these limitations:

  • We have been content to write code that works on the Pi without worrying about the most efficient solution. For example, global variables are saved in memory. We do not use the many available registers instead, which would have speeded up the processing.
  • All parameters are passed via the stack.

TINY14PI compiles all the programs that we used to test TINY14ELF and TINY14E. You can use these programs to see acceptable syntax.

Having compiled the TINY14PI compiler in Lazarus to obtain the TINY14PI executable, you can compile a source file myfile.txt in the same directory by typing instructions similar to these at the command prompt.
  1. cd TINY to change the current directory to the one containing the TINY compiler;
  2. ./TINY14PI myfile.txt to produce the ARM assembler file myfile.s;
  3. /usr/bin/gcc -o myfile myfile.s to produce the executable myfile;
  4. ./myfile to execute your TINY program.

This screenshot shows a test program for TINY14E running on the Pi.

Testing TINY on the Pi Testing TINY on the Pi

You could make a text file named myfile.sh containing instructions like these then execute the batch file with the command sh myfile.sh. We invite you to run our TINY_IDE on your Pi. It syntax highlights your TINY code then produces an executable upon the click of an icon.

See the complete code of the TINY14PI compiler by following the links below.

Programming - a skill for life!

by PPS in association with Jack Crenshaw