This project tries to extend tiny c compiler to support Poxim Architecture
- C++14 capable compiler
- C99 capable compiler
- Linux (Only)
- Make
- Posix Shell (we're using shell in poxim.mak)
$ ./configure --cpu=poxim --cc=gcc
$ make run CXX=clang++
Feel free to change the CXX
variable to another C++14 capable compiler. Same goes for --cc
option.
This will compile tcc with Poxim Backend and run it on the examples/main.c file that produces examples/bin/main.bin binary file. By default it also runs the other examples.
Now inspect the examples/out/
folder. You'll see both interp
and dump
folder that contains the output of interpretation and dumping of examples/bin/main.bin file respectively.
If you just want to compile the tcc-poxim you can run the below instead.
$ make all
To see Poxim Terminal output generated by examples/main.c run:
$ make display
You can edit the file examples/minimal.c
that already includes the minimal setup
To compile and interpret the same way as the other examples run:
$ make examples
This will generate
examples/out/bin/minimal.bin
,examples/out/bin/minimal.hex
examples/out/interp/minimal.interp
,examples/out/interp/minimal.term
examples/out/bin/minimal.poxim.dump
$ ./tcc input.c -o output.bin
The output is raw binary poxim machine code with no runtime, statically linked, with no libc, you have to define _start
function/label yourself, also for copying array and struct (in argument passing for example) you need to define memset and memmove as well, see examples/_start.h
to see how it can be done.
$ ./poxim-dump --bin input.bin output.dump
Execute the bytes, the machine code.
$ ./poxim-interp --bin input.bin output.interp
This will create two files called output.interp and output.term.
The output.term has the output of poxim terminal. The other one has both the tracing and terminal. This is done because it might be slow to open output.interp.
Open Replit link below and press the Run
button to compile the C compiler tcc-poxim (executable is named only tcc
), compile all .c
files in the examples
folder using tcc-poxim, dump and interpret these files in the examples/out/dump/
and examples/out/interp/
respectively.
This will load the Enviroment, run and show the output on a console right in the middle
To edit the files you can fork it such as this (has to be logged on replit):
Then you'll have access to anything you wanna change, just edit any file .c under examples folder and it will be compiled and interpret when you press the Run button on Replit
Look folder docs
there will have 3 pdfs and 1 video
2023-10-02-IHS-Apresentacao.pdf
, this one is my real life presentation of the projectPoxim-Instruction-Set.pdf
, this is the instruction set for the Poxim ArchitecturePoxim-Backend-Details.pdf
, this pdf shows how tcc-poxim works internally, what are the limitations and features implemented.
TCC-Compile,Dump,Interpret.mkv
, this is a video of me compiling and running tcc-poxim
- Avr port of TCC https://github.com/thethumbler/avr-tcc
- Another option https://github.com/chaoslawful/tcc
- Kernel with tcc https://wiki.osdev.org/TCC
If you're cross compiling for i386 pacman -S lib32-glibc
is necessary. This might be useful for comparing outputs