View Single Post
Old 08-02-2025, 07:29 PM   #1
smbgaiden
Junior Member
smbgaiden rocks like Gibraltar!smbgaiden rocks like Gibraltar!smbgaiden rocks like Gibraltar!smbgaiden rocks like Gibraltar!smbgaiden rocks like Gibraltar!smbgaiden rocks like Gibraltar!smbgaiden rocks like Gibraltar!smbgaiden rocks like Gibraltar!smbgaiden rocks like Gibraltar!smbgaiden rocks like Gibraltar!smbgaiden rocks like Gibraltar!
 
Posts: 8
Karma: 100000
Join Date: Jul 2025
Device: none
[Release] TinyC - TCC for armhf hard float

Okay, sorted through all the issues. Attached is a release of the TCC program that runs on Kindles with hard float. This was built from the open source TCC mob branch and assembled with other contents and sometimes with changes as described below.

INSTALLATION
Prerequisites: A jailbroken Kindle. Said Kindle on a higher SW version that uses hardfloat. A way to transfer this package to the Kindle. A way to have a terminal on the kindle.

Spoiler:

Jailbreak - search this forum, not this post.
Checking hardfloat: Go to terminal and run ldd /bin/ls and look for armhf in the libraries it loads.
Transfer to Kindle: Use USB from Computer to kindle or SCP.
Terminal on kindle: Kterm, or SSH from USBNetLite. (setting up usbnetlite and ssh on colorsoft was a little painful).


Same installation routine as geekmaster's package, so copying verbatim but only changing the package name.
1) download and extract kindlehf-tcc-1.0-0928.tar.gz (below) to /mnt/us (USB drive)
2) install: "/mnt/us/tcc/install"
3) compile: "tccmake demo"
4) run: "./demo"
5) Watch the kindle draw square and round tubes on its eink screen.


FILE CONTENTS
The file contains the following, structured as name followed by description:
1) tcc - The program which was newly built for arm hard float using kox toolkit from tcc mob branch sources with changes
From geekmaster's package, some with changes
2) tccmake - a convenience makefile
3) install - script to install it so you can just run tcc or tccmake from anywhere
4) uninstall - script to undo the installation of tcc and tccmake
5) tcc.libc.so - C Library helper to address full path to libc
6) tcc.libpthread.so - C Library helper to address full path to libc
7) demo - executable demo program of dithermatron (screenshot from colorsoft attached)
8) demo.c - the source of the program, so your installation can be quickly tested by compiling it
9) lib directory and contents - C runtime initialization objects.
10) include (stdarg.h and stddef.h, i think) - the root include of kox lacked these, so i grabbed from here
From kox toolkit:
11) include directory (except the two files above) - So tcc has heads to reference for compilations

History, Changes, and Tech Notes
Spoiler:
History:
1.0 based on mob branch tiny c TCC version 0.928rc

Changes:
None. Initial package.

Tech Notes
This describes what was changed after pulling from other packages.
1) tccmake - Removed the -I, because I forced tcc to look at /mnt/us/tcc/include without needing explicit instruction. If your project uses other include directories, you'll need -I
2) install - commented out interactions with /usr/lib, such as cd to there and copying CRT to there, because I forced tcc to find crt in /mnt/us/tcc/lib
3) uninstall - like install, it removes consideration of /usr/lib
4) demo - executable working on hard float, compiled from updated demo.c, see below
5) demo.c - Now also does color! Randomly selects background, box, and ball to be red, green, or blue. Although they have a random color, they'll never share a color. See screenshot attached at the bottom.
a) Use eips_v2 if available
b) For color (my colorsoft v1, maybe others) update the screen more frequently
c) When using eips v1. Make it silent, in case it wants to write feedback or errors
d) Restructure code to absorb changes related with color and above, but ensure it runs in B&W (tested on a PW gen 11)
6) C runtime initialization objects. The crt1.o was recreated by disassembling geekmaster's through objdump, tweaking into compilable assembly, verifying no thumb code and no soft float attempts are made, and then assembling using the armhf TCC compiler. crti.o was copied over and used as both crti.o and crtn.o since it lacks any exports.
10) stdarg.h and stddef.h, i think, from geekmaster's package were added to the root of include/ because programs wouldn't compile without it.


FINAL NOTES
TCC is a single pass compiler, so you can get much faster code with GCC. However, it is small and is fairly easy to build, so it's good to put on a jailbroken kindle and execute directly on it. It has some support for debugging, since kindle has gdb. Just put -g option into your makefile. Sometimes things get a little weird in gdb though.

Not implemented: If you come across the tcc -run option or programmatically embedding C into your program to on the fly compile and executing it, well that's unfortunately not going to work on this. Maybe later. I did not compile libtcc1.a. Even if libtcc1.a is compiled and put somewhere, I probably broke the loader for it to ensure I could get this functional, so it will likely need a new tcc executable along with the libtcc1.a. Maybe will do this change by making tcc on kindlehf compile for kindlehf and remove the kox toolkit from the equation.
Attached Thumbnails
Click image for larger version

Name:	dithermatron.png
Views:	24
Size:	228.8 KB
ID:	217234  
Attached Files
File Type: gz kindlehf-tcc-1.0-0928.tar.gz (1.60 MB, 9 views)
smbgaiden is offline   Reply With Quote