Command line tools

This section describes the usage the commandline tools installed with ppci.

Take for example the stm32f4 blinky project. To build this project, run ppci-build.py in the project folder:

$ cd examples/blinky
$ ppci-build.py

This command is used to construct build files.

Or specify the buildfile a the command line:

$ ppci-build.py -f examples/blinky/build.xml

Instead of relying on a build system, the c3 compiler can also be activated stand alone.

$ ppci-c3c.py --machine arm examples/snake/game.c3

ppci-c3c.py

C3 compiler.

Use this compiler to produce object files from c3 sources and c3 includes. C3 includes have the same format as c3 source files, but do not result in any code.

usage: ppci-c3c.py [-h] [--log log-level] [--report report-file]
                       [--html-report html-report-file]
                       [--text-report text-report-file] [--verbose] [--version]
                       [--machine {arm,avr,example,mcs6500,msp430,or1k,riscv,stm8,x86_64,xtensa}]
                       [--mtune option] [--output output-file] [-g] [-S] [--ir]
                       [--wasm] [-O {0,1,2,s}] [-i include]
                       source [source ...]
source

source file

-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

--machine, -m

target architecture

--mtune <option>

architecture option

--output <output-file>, -o <output-file>

output file

-g

create debug information

-S

Do not assemble, but output assembly language

--ir

Output ppci ir-code, do not generate code

--wasm

Output WASM (WebAssembly)

-O {0,1,2,s}

optimize code

-i <include>, --include <include>

include file

ppci-build.py

Build utility.

Use this to execute build files.

usage: ppci-build.py [-h] [--log log-level] [--report report-file]
                         [--html-report html-report-file]
                         [--text-report text-report-file] [--verbose] [--version]
                         [-f build-file]
                         [target [target ...]]
target
-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

-f <build-file>, --buildfile <build-file>

use buildfile, otherwise build.xml is the default

ppci-asm.py

Assembler utility.
usage: ppci-asm.py [-h] [--log log-level] [--report report-file]
                       [--html-report html-report-file]
                       [--text-report text-report-file] [--verbose] [--version]
                       [--machine {arm,avr,example,mcs6500,msp430,or1k,riscv,stm8,x86_64,xtensa}]
                       [--mtune option] [--output output-file] [-g]
                       sourcefile
sourcefile

the source file to assemble

-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

--machine, -m

target architecture

--mtune <option>

architecture option

--output <output-file>, -o <output-file>

output file

-g, --debug

create debug information

ppci-ld.py

Linker.

Use the linker to combine several object files and a memory layout to produce another resulting object file with images.

usage: ppci-ld.py [-h] [--log log-level] [--report report-file]
                      [--html-report html-report-file]
                      [--text-report text-report-file] [--verbose] [--version]
                      [--output output-file] [--layout layout-file] [-g]
                      obj [obj ...]
obj

the object to link

-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

--output <output-file>, -o <output-file>

output file

--layout <layout-file>, -L <layout-file>

memory layout

-g

retain debug information

ppci-objcopy.py

Objcopy utility to manipulate object files.
usage: ppci-objcopy.py [-h] [--log log-level] [--report report-file]
                           [--html-report html-report-file]
                           [--text-report text-report-file] [--verbose]
                           [--version] --segment SEGMENT
                           [--output-format OUTPUT_FORMAT]
                           input output
input

input file

output

output file

-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

--segment <segment>, -S <segment>

segment to copy

--output-format <output_format>, -O <output_format>

output file format

ppci-objdump.py

Objdump utility to display the contents of object files.
usage: ppci-objdump.py [-h] [--log log-level] [--report report-file]
                           [--html-report html-report-file]
                           [--text-report text-report-file] [--verbose]
                           [--version] [-d]
                           obj
obj

object file

-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

-d, --disassemble

Disassemble contents

ppci-opt.py

Optimizer
usage: ppci-opt.py [-h] [--log log-level] [--report report-file]
                       [--html-report html-report-file]
                       [--text-report text-report-file] [--verbose] [--version]
                       [-O O]
                       input output
input

input file

output

output file

-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

-O <o>

Optimization level

ppci-cc.py

C compiler.

Use this compiler to compile C source code to machine code for different computer architectures.

usage: ppci-cc.py [-h] [--log log-level] [--report report-file]
                      [--html-report html-report-file]
                      [--text-report text-report-file] [--verbose] [--version]
                      [--machine {arm,avr,example,mcs6500,msp430,or1k,riscv,stm8,x86_64,xtensa}]
                      [--mtune option] [--output output-file] [-g] [-S] [--ir]
                      [--wasm] [-O {0,1,2,s}] [-I dir] [-D macro] [--trigraphs]
                      [--std {c89,c99}] [--super-verbose] [-E] [--ast] [-c]
                      source [source ...]
source

source file

-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

--machine, -m

target architecture

--mtune <option>

architecture option

--output <output-file>, -o <output-file>

output file

-g

create debug information

-S

Do not assemble, but output assembly language

--ir

Output ppci ir-code, do not generate code

--wasm

Output WASM (WebAssembly)

-O {0,1,2,s}

optimize code

-I <dir>

Add directory to the include path

-D <macro>, --define <macro>

Define a macro

--trigraphs

Enable trigraph processing

--std {c89,c99}

The C version you want to use

--super-verbose

Add extra verbose output during C compilation

-E

Stop after preprocessing

--ast

Stop parsing and output the C abstract syntax tree (ast)

-c

Compile, but do not link

ppci-pascal.py

Pascal compiler.

Compile pascal programs.

usage: ppci-pascal.py [-h] [--log log-level] [--report report-file]
                          [--html-report html-report-file]
                          [--text-report text-report-file] [--verbose] [--version]
                          [--machine {arm,avr,example,mcs6500,msp430,or1k,riscv,stm8,x86_64,xtensa}]
                          [--mtune option] [--output output-file] [-g] [-S] [--ir]
                          [--wasm] [-O {0,1,2,s}]
                          source [source ...]
source

source file

-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

--machine, -m

target architecture

--mtune <option>

architecture option

--output <output-file>, -o <output-file>

output file

-g

create debug information

-S

Do not assemble, but output assembly language

--ir

Output ppci ir-code, do not generate code

--wasm

Output WASM (WebAssembly)

-O {0,1,2,s}

optimize code

ppci-pycompile.py

Compile python code statically
usage: ppci-pycompile.py [-h] [--log log-level] [--report report-file]
                             [--html-report html-report-file]
                             [--text-report text-report-file] [--verbose]
                             [--version]
                             [--machine {arm,avr,example,mcs6500,msp430,or1k,riscv,stm8,x86_64,xtensa}]
                             [--mtune option] [--output output-file] [-g] [-S]
                             [--ir] [--wasm] [-O {0,1,2,s}]
                             source [source ...]
source

source file

-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

--machine, -m

target architecture

--mtune <option>

architecture option

--output <output-file>, -o <output-file>

output file

-g

create debug information

-S

Do not assemble, but output assembly language

--ir

Output ppci ir-code, do not generate code

--wasm

Output WASM (WebAssembly)

-O {0,1,2,s}

optimize code

ppci-wasmcompile.py

Static web assembly compiler.

This command line tool takes web assembly to native code.

usage: ppci-wasmcompile.py [-h] [--log log-level] [--report report-file]
                               [--html-report html-report-file]
                               [--text-report text-report-file] [--verbose]
                               [--version]
                               [--machine {arm,avr,example,mcs6500,msp430,or1k,riscv,stm8,x86_64,xtensa}]
                               [--mtune option] [--output output-file] [-g] [-S]
                               [--ir] [--wasm] [-O {0,1,2,s}]
                               wasm file
wasm file

wasm file to compile

-h, --help

show this help message and exit

--log <log-level>

Log level (info,debug,warn)

--report

Specify a file to write the compile report to

--html-report

Write html report file

--text-report

Write a report into a text file

--verbose, -v

Increase verbosity of the output

--version, -V

Display version and exit

--machine, -m

target architecture

--mtune <option>

architecture option

--output <output-file>, -o <output-file>

output file

-g

create debug information

-S

Do not assemble, but output assembly language

--ir

Output ppci ir-code, do not generate code

--wasm

Output WASM (WebAssembly)

-O {0,1,2,s}

optimize code