Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 05-10-2012, 08:49 PM   #31
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by xueyou2 View Post
I get it.
If you use other functions,just link the XX library?
Just like
tccmake myprog -lX (with the first letter?)

In tcc forums it said:can be linked to your program with the -l switch and the name of the lib without the leading word "lib".


For example time.h
tccmake myprog -lt ?

Another question :Can i replace the header file in tcc with the same file in gcc?
Actually, a lot of the headers define "built in" functions that do not need additional linked libraries. But when the headers are for an additional loadable library module (not automatically linked), you need to do like the tcc forum said, which is -l followed by the library name (not including the "lib" prefix). It is the same for tcc and gcc. This is just a developer thing you need to learn by reading the man pages and other documentation.

The tcc and arm-linux-gcc headers (and in most cases host PC gcc headers) are interchangeable. In fact, as mentioned in the first post, I got them from the tinycc source archive AND from the codesourcery arm-linux-gcc include folder AND from the amazon gpl 5.0.0 source include files (but not all of the "buried" headers). In most cases the cross-tools are built from the same source code as the host PC build tools, so they would share the same headers (with differences depending on kernel and library versions that you need to watch for). That whole painful library version conflict thing that developers have to fight at various times is known on "other" platforms as "DLL Hell" and linux developers are not immune from that disease.

In general, you can use either gcc or tcc, but gcc generates faster code (especially with the -O3 switch), whereas tcc actually compiles many times faster than gcc and runs in the kindle, so it is very nice for debugging sessions on the device.

I like to compile with gcc just before packaging up a release (or to see the effect of optimizations in my fast graphics code). For animation, programs compiled with tcc run the animation a lot slower than when compiled with gcc. For my video player, it does not matter that it runs slower, because the program spends most of its time sleeping, waiting for the next "vertical refresh" interval when eink updates are performed.

EDIT: One last thing, although I do not always do this, in many cases I like to add -static to my build command line for the final package, which loads all the libraries used on the build platform INSIDE the compiled executable. This makes it a lot bigger (not a problem because the USB drive is so large, and most of those libraries need to be in memory anyway when the program runs). But the important thing is that the program is then robust and will keep running on different platforms with different incompatible loadable libraries and different firmware versions (unless amazon breaks stuff in the OS and drivers like they did with the 5.1.0 update). In many cases, we can copy static-linked programs directly from an android device to a kindle and it runs fine -- try that with something dependent on specific loadable libraries (which may well be missing).


Last edited by geekmaster; 05-10-2012 at 09:19 PM.
geekmaster is offline   Reply With Quote
Old 05-10-2012, 09:01 PM   #32
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by xueyou2 View Post
I get it.
If you use other functions,just link the XX library?
Just like
tccmake myprog -lX (with the first letter?)
NO

Think: "-l" shorthand for "lib"
libm == -lm
libtime == -ltime

See:
http://linux.die.net/man/1/gcc
Section: "linker options"

Remember:
"man" (the manual command) is your friend on *nix
(or in a google search box)
knc1 is offline   Reply With Quote
Advert
Old 05-10-2012, 11:21 PM   #33
xueyou2
Connoisseur
xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.xueyou2 can eat soup with a fork.
 
Posts: 58
Karma: 9096
Join Date: Apr 2012
Device: none
I understand.
i will try it.
xueyou2 is offline   Reply With Quote
Old 05-12-2012, 05:17 PM   #34
jmseight
Zealot
jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'
 
Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
Hi GeekMaster,

Have you posted linux/einkfb.h and related includes for tcc? Do you know where I can get these?

Thanks,
James
jmseight is offline   Reply With Quote
Old 05-12-2012, 06:54 PM   #35
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by jmseight View Post
Hi GeekMaster,

Have you posted linux/einkfb.h and related includes for tcc? Do you know where I can get these?

Thanks,
James
I quit using them in recent code, instead copying the structures from them into my programs. However, I did copy them to my tcc include folder, and to my arm-linux-gcc folder on my host PC, so that I can use them if I want to. I will bundle up my current tcc folder with all the extra include files (many more than just the eink files). I will update the first post with them ASAP.
geekmaster is offline   Reply With Quote
Advert
Old 05-12-2012, 11:00 PM   #36
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
I just discovered that the K3 has /lib/libm.so.6, which is needed when you use math functions in "#include <math.h>", but it is missing the libm.so symlink needed to use the "-lm" option in tcc to link in the math library. Now I am curious how many other libraries on the K3 are missing their "generic" symlink. This is not a problem on the K5(touch), where linking to the math library is not a problem.

I suppose my tcc installer needs to create any missing library symlinks on the K3.

EDIT: After doing the following commands, my K3 can now link the math library using "-lm":

cd /usr/lib
mntroot rw
ln -s /lib/libm.so.6 libm.so
mntroot ro


It would be nice to know what other libraries will be a problem for each of the different kindle models. I could do the above steps for any missing symlinks during the tcc install process. I suppose I can start with the math library, and worry about the others later. I will post kindle-tcc-1.4.tar.gz soon (after I add a fix for the missing math symlink on some kindles).



Last edited by geekmaster; 05-12-2012 at 11:09 PM.
geekmaster is offline   Reply With Quote
Old 05-13-2012, 01:10 AM   #37
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
The first post now contains version 1.4. This includes all the header files for codesourcery arm-linux-gcc, and all the linux header files for kindle gpl source version 5.1.0. The installer script also adds a symlink for the math library if missing (at least in firmware 3.3).

Most importantly for some, it includes the eink header files that I use in many of my C demo programs. Before now, you had to download the GPL source code from amazon yourself to extract these header files. I did that for you.
geekmaster is offline   Reply With Quote
Old 05-13-2012, 10:20 AM   #38
markatlnk
Member
markatlnk began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2010
Device: kindle 3
Downloaded the 1.4 version of tcc.

In a Kindle Touch with 5.1, the install went great, I can even compile and run simple hello world type programs. When I attempt to compile the demo I get:

In file included from demo.c:19:
In file included from /mnt/us/tcc/include/linux/fb.h:4
/mnt/us/tcc/include/linux/types.h: ';' expected

Is the include file bad or is there another issue?
markatlnk is offline   Reply With Quote
Old 05-13-2012, 10:27 AM   #39
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
It occurred to me when I woke up after resting that v5.1.0 broke compatibility with the original freescale reference headers in their eink header files, and they may have broken compatibility with a whole lot more.

That means that programs compiled with kindle-tcc-1.4 using these new headers may create programs that ONLY work on v5.1.0. The old headers could probably compile stuff that would even work on other free-scale based (non-Kindle) eink devices.

Because the 5.1.0 headers (and firmware) was made incompatible with the world (and even with kindle firmware 5.1.x) we should probably go back to older headers. I published this just before bed, and and I did not try compiling the demo again. I will try it now.

I may need to downgrade to older headers are release another tcc package. I thought upgrading to the latest headers was a good idea, but thanks to amazon's screw up on 5.1.0, it was not a good idea. Programs compiled for 5.1.0 only work with 5.1.0, and apparently they reference other headers NOT included in the "normal" location in source distribution.

Mixing codesourcery and kindle headers SHOULD be a good thing. Version 5.1.0 breaks that.
geekmaster is offline   Reply With Quote
Old 05-13-2012, 10:47 AM   #40
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
I will test the latest tcc package on all my kindle models and report back...

Hmm. I see that fb.h is broken on the K3 too thanks to amazon's latest v5.1.0 screwup. Time to downgrade the headers back to 5.0.x.


Last edited by geekmaster; 05-13-2012 at 10:51 AM.
geekmaster is offline   Reply With Quote
Old 05-13-2012, 01:26 PM   #41
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Updated to v1.5, which contains all the old header files from v1.3, and adds many new headers that were missing from v1.3. The v1.4 I posted previously was broken because it contained broken header files from the amazon kindle gpl source code v5.1.0.

v1.5 also installs a symlink missing on firmware v3.3, needed to use the math library (#include <math.h> and -lm).
geekmaster is offline   Reply With Quote
Old 05-13-2012, 05:16 PM   #42
markatlnk
Member
markatlnk began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2010
Device: kindle 3
Thanks, it works great on Kindle touch with 5.1.0. Now to get the shell access from the gui launcher
markatlnk is offline   Reply With Quote
Old 05-13-2012, 05:31 PM   #43
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by markatlnk View Post
Thanks, it works great on Kindle touch with 5.1.0. Now to get the shell access from the gui launcher
Just install "simple usbnet" from yifanlu.

Beware that using programs compiled to use this mxcfb.h for 5.0.x and earlier may not work on 5.1.0 (main). That is why my latest programs do not use the eink headers. Instead, I copied and renamed the structures from einkfb.h and from both 5.0.x and 5.0.1 mxcfb.h versions. You can see how I did that in my latest published gmplay program, which now works on all kindles from 2.5.8 DX through K5 5.0.1, in both main and diags modes. I like portable code that runs anywhere without needing to be installed.

EDIT: Also be aware that for graphics programs that run "wide open" (not restricted to a maximum framerate), compiling on a linux host PC with "arm-linux-gcc -O3" will make these programs run many times faster than when compiled with tcc. I used codesourcery for linux, but I also have codesourcery for windows installed in my XP VM, and that works well too. I like to use tcc for "inside the kindle" testing and debugging, but I use a "real" compiler for final release.


Last edited by geekmaster; 05-13-2012 at 05:36 PM.
geekmaster is offline   Reply With Quote
Old 05-13-2012, 06:03 PM   #44
jmseight
Zealot
jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'jmseight knows the difference between 'who' and 'whom'
 
Posts: 130
Karma: 10000
Join Date: Mar 2012
Device: Kindle 3G, Kindle Touch 3G, iRiver Story HD, Sony Reader
Thanks GeekMaster!

James
jmseight is offline   Reply With Quote
Old 05-13-2012, 06:29 PM   #45
markatlnk
Member
markatlnk began at the beginning.
 
Posts: 12
Karma: 10
Join Date: Aug 2010
Device: kindle 3
Actually I am an old command line type guy and would like to have the command line operated from the eink display and touch keyboard. I have the ssh working from wireless and it works great (thanks to all that made everything work).
markatlnk is offline   Reply With Quote
Reply

Tags
tcc, tinycc

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
geekmaster simple touchscreen script support hack geekmaster Kindle Developer's Corner 12 04-21-2021 11:38 PM
Very simple guide to reading newspapers on the kindle, please? :) Pismire Amazon Kindle 7 06-01-2012 11:26 PM
Free (Kindle/Nook/ChristianBook) The Invitation: A Simple Guide to the Bible arcadata Deals and Resources (No Self-Promotion or Affiliate Links) 4 08-22-2011 01:05 PM
Simple guide to choosing a Creative Commons license for your work Bob Russell News 0 12-26-2006 11:10 AM


All times are GMT -4. The time now is 05:52 AM.


MobileRead.com is a privately owned, operated and funded community.