P2Tooling

From wiki.evil.red

Overview[edit]

As the P2 is not on general release yet, the toolchains to support it are still in an active state of development.

This page should contain a brief overview of each tool / project and links to more detailed documentation.


P2 Assembly[edit]

PNut[edit]

A combination editor, compiler, and loader for Windows specifically designed for the P2. As this is written by the silicon designer, one may assume this is likely the 'standard' implementation of a compiler.

It will run under Linux under wine.

I see no indication that it will run as a command-line compiler (yet).

Windows Executable can be found in the FPGA zipfile (see P2Documentation)


p2asm[edit]

p2asm is a part of the p2gcc suite (see p2gcc) which can be found on DaveHein's github. Its focus is on compatibility with PNut, is a command-line compiler and has no (odd) external dependencies.

usage: p2asm
  [ -o ]     generate an object file
  [ -d ]     enable debug prints
  [ -c ]     enable case sensitive mode
  [ -hub ]   write only hub code to object file
  file       source file


fastspin[edit]

fastspin is a part of the spin2cpp suite (see spin2cpp) which can be found in totalspectrum's github. It is a command-line compiler capable of supporting a subset of spin/c/c++/basic and creating images in a mixture of said languages as well as p2 assembly.

Command line options:

Version 3.9.7-beta Compiled on: Jan  1 1970
usage: ./build/fastspin [options] filename.spin | filename.bas
  [ -h ]              display this help
  [ -L or -I <path> ] add a directory to the include path
  [ -o <name> ]      set output filename to <name>
  [ -b ]             output binary file format
  [ -e ]             output eeprom file format
  [ -c ]             output only DAT sections
  [ -l ]             output DAT as a listing file
  [ -f ]             output list of file names
  [ -q ]             quiet mode (suppress banner and non-error text)
  [ -p ]             disable the preprocessor
  [ -D <define> ]    add a define
  [ -u ]             ignore for openspin compatibility (unused method elimination always enabled)
  [ -2 ]             compile for Prop2
  [ -O# ]            set optimization level:
          -O0 = no optimization
          -O1 = basic optimization
          -O2 = all optimization
  [ -w ]             compile for COG with Spin wrappers
  [ --code=cog ]     compile for COG mode instead of LMM
  [ --fcache=N ]     set FCACHE size to N (0 to disable)
  [ --fixedreal ]    use 16.16 fixed point in place of floats


openspin[edit]

OpenSpin was ported from Chip Gracey's original compiler and adds P2 assembly language. It can be found in Parallax's github. See openspin

Command line options:

Propeller Spin/PASM Compiler 'OpenSpin' (c)2012-2018 Parallax Inc. DBA Parallax Semiconductor.
Version 1.00.81 Compiled on Jan  1 1970 00:00:01
usage: openspin
        [ -h ]                 display this help
        [ -L or -I <path> ]    add a directory to the include path
        [ -o <path> ]          output filename
        [ -b ]                 output binary file format
        [ -e ]                 output eeprom file format
        [ -c ]                 output only DAT sections
        [ -d ]                 dump out doc mode
        [ -t ]                 output just the object file tree
        [ -f ]                 output a list of filenames for use in archiving
        [ -q ]                 quiet mode (suppress banner and non-error text)
        [ -v ]                 verbose output
        [ -p ]                 disable the preprocessor
        [ -a ]                 use alternative preprocessor rules
        [ -D <define> ]        add a define
        [ -M <size> ]          size of eeprom (up to 16777216 bytes)
        [ -s ]                 dump PUB & CON symbol information for top object
        [ -u ]                 enable unused method elimination
        <name.spin>            spin file to compile


P2 Disassembly[edit]

p2dump[edit]

p2dump is a part of the p2gcc suite (see p2gcc) which can be found on DaveHein's github. NB for P2 hardware you ALWAYS want to pass the argument -hub 400.

Command line options:

usage: p2dump [options] file
  options are:
  -hub addr - Set hub exec address
  -dis      - Disassemble code
  -data     - Print address and data


C / C++[edit]

C / C++ is currently in flight for the P2 - this is where we currently stand (see: [1])

GCC[edit]

PROS CONS
Release_1_0 Works with simple library. Proven in field. Old version of gcc, has bugs.
Master Uses a newer version of gcc, contains bug fixes, contains some P2 changes Untested in field, issues with simple library
Eric's Repo Newer gcc than master, contains bug fixes, contains more P2 changes Not used as much as master branch, issues with simple library
Latest GCC Contains latest GCC features Requires extra work for P1 and P2. Untested in field. Likely issues with simple library.