GCC compiler for the Parallax P2
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
loadp2_src Version 0.013. Added wait_drain function to ensure that tx buffer is … Feb 6, 2019
p2asm_src
p2link_src Detect odd object sizes and pad out to 4-byte boundary. Feb 18, 2019
s2pasm_src Added ability to generate and convert LMM assembly. Feb 3, 2019
taz_src
util Added tazos support. Feb 13, 2019
bas.c Removed explicit declaration of __ctype Jun 25, 2018
blink.c Change clock frequency from 60 MHz to 80 MHz Apr 24, 2018
build_all Initial commit Apr 14, 2018
build_all.bat
build_cygwin Added buildlibs to the top level build scripts. Feb 18, 2019
build_linux Added buildlibs to the top level build scripts. Feb 18, 2019
build_macos Added buildlibs to the top level build scripts. Feb 18, 2019
build_mingw Added buildlibs to the top level build scripts. Feb 18, 2019
build_tazos Initial commit Feb 13, 2019
chess.c Initial commit Apr 14, 2018
dry.c
fft_bench.c Initial commit Apr 14, 2018
fibo.c Now use p2clkfreq at location 0x14. Feb 4, 2019
filetest.c
freqtest.c Now exit if freq parm is out of bounds. Feb 7, 2019
fsrwtest.c Changed the SD pins Dec 29, 2018
hello.c Now use p2clkfreq at location 0x14. Feb 4, 2019
load_shell Moved shell to 0000 (384K). Stack starts at 512K-16K. User programs u… Feb 13, 2019
malloctest.c Initial commit Apr 14, 2018
p2gcc Added -D __P2GCC__ compile-time flag. Feb 12, 2019
p2gcc.bat Added -D __P2GCC__ compile-time flag. Feb 12, 2019
preshell.spin2 Moved shell to 0000 (384K). Stack starts at 512K-16K. User programs u… Feb 13, 2019
prime.c Now use p2clkfreq at location 0x14. Feb 4, 2019
readme.txt Updated date in readme.txt Dec 29, 2018
shell.c Added capability to run script files. Feb 14, 2019
start.c Initial commit Apr 14, 2018
test7.c Removed explicit declaration of __files[] from test7.c and test8.c Jun 22, 2018
test8.c Removed explicit declaration of __files[] from test7.c and test8.c Jun 22, 2018
test_all
xxtea.c Initial commit Apr 14, 2018
xxtea.h

readme.txt

                                     P2GCC
                               December 29, 2018
                                   Dave Hein

p2gcc will compile, link and load a C file onto a P2 FPGA board.  If the -s
option is specified p2gcc will run the program on the P2 simulator instead of
running it on an FPGA board.  It uses the PropGCC compiler to generate a P1 .s
assembly file.  The assembly file is converted to a P2 .spin2 file using the
utility s2pasm.  The P2 assembly file is assembled into an object file using
p2asm.  p2link is then used to link the object file with other object files
and libraries to produce an executable binary file.

If p2gcc is run without any parameters it will produce the following usage
message.

     usage: p2gcc [options] file [file...]
       options are
       -c      - Do not run the linker
       -v      - Enable verbose mode
       -d      - Enable debug mode
       -r      - Run after linking
       -t      - Run terminal emulator
       -T      - Run terminal emulator in PST mode
       -k      - Keep intermediate files
       -s      - Run simulutor
       -o file - Set output file name
       -p path - Port used for loading

If the -o option is not specified an executable binary file named a.out will be
created.

p2gcc will link with the library files located in the lib subdirectory.  The lib
subdirectory also contains an object file name prefix.o.  This file is produced
from the P2 assembly file prefix.spin2.  It contains the register definitions and
a small number of routines that run from cog memory.  prefix.spin2 is added to a
.spin2 file when it is converted from a .s file.  When linking, prefix.o is
included as the first object in the list.

The various tools are pre-built for Windows and MinGW.  They can be rebuilt using
the build script build_mingw run from a MinGW window.  The build scripts
build_cygwin, build_linux and build_macos are used to build the tools for Cygwin,
Linux and macOS.

The executable files are placed in the bin subdirectory.  The source code for the
various tools are located in the subdirectories loadp2_src, p2asm_src, p2link_src,
s2pasm_src and util.

The bin directory should be added to the user's path, or the files in the bin
directory should be copied to an existing directory that is already in the user's
path.  The environment variable, P2GCC_LIBDIR must also be defined to point to
the lib directory.  It is used for linking and also defines where prefix.spin2 is
located for s2pasm.

There are several example programs in this directory.  They can be built and run
as follows:

     p2gcc -r blink.c
     p2gcc -r -t bas.c
     p2gcc -r -t chess.c
     p2gcc -r -t dry.c
     p2gcc -r -t fibo.c
     p2gcc -r -t fft_bench.c
     p2gcc -r -t hello.c
     p2gcc -r -t malloctest.c
     p2gcc -r -t prime.c
     p2gcc -r -t xxtea.c
     p2gcc -r -t test7.c test8.c
     p2gcc -r -t fsrwtest.c
     p2gcc -r -t filetest.c

fsrwtest and filetest require that an SD card be connected to I/O pins 59, 60,
58 and 61.

Programs can also be run on the simulator by specifying the -s option.  A Windows
executable for spinsim is included in this distribution.  spinsim must be built
separately to run under Linux.  Version 0.97 or later is required.