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

Go Back   MobileRead Forums > E-Book Readers > Kobo Reader > Kobo Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 06-29-2013, 06:31 PM   #1
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
Compiling C++ on the Kobo Glo

Hello

I have a problem and have searched for days for a solution
how do I compile a .CPP file on the Kobo Glo

Do I compile it on the device or using some package installed on windows like
CodeSourcery G++ or do i just enter some command like #>compile code.cpp

I have got telnet usb RNDIS python and pygame working fine
even soldered wires to the pcb to get rs232 login from /dev/ttymcx0
so I can do pretty much everything I want
the problem is the file that i found online ( here i think )
that updates the e-ink ( full_updatescreen ) only works correctly on the touch and possibly mini.

The fullupdatre works but it only updates 800x600 not the 1024x758 of the glo

I have the source code .cpp and .h supplied by <PLACE NAME HERE > thanks heaps
but i am basing my app on the glo so either need to know how to compile or have a compiled file that works with the glo..

For the moment i only really want the executable ( i am guessing someone has this already )

I have tried various example of gcc make g++ etc but done seem to be installed on the kobo so i am not sure if it is possible to compile on the kobo or if it needs to be done on the pc

Help would be appreciated

P.S

This is my first post and a bit about my career is in the new user introduction section of the forum.. 25 years with playing with gadgets etc
fat265 is offline   Reply With Quote
Old 06-29-2013, 06:57 PM   #2
BWinmill
Nameless Being
 
There are instructions for a Linux (x86) hosted toolchain over here:
https://www.mobileread.com/forums/sho...d.php?t=185680
  Reply With Quote
Advert
Old 06-29-2013, 08:17 PM   #3
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
alternative to re-compiling c

i replaced the full_updatescreen call from within python with my own .sh code

#!/bin/sh

cat /dev/fb0 > screen
cat ./screen | /usr/local/Kobo/pickel showpic


this worked perfectly as pickel already is aware of the screen resolution
compared to thhe hard coded full_screenupdate executable

I still want to be able to compile c so i will look into thhe link above

for the moment i have got past a hurdle that was slowing down by application development

Cheers
fat265 is offline   Reply With Quote
Old 06-30-2013, 01:23 PM   #4
yoq
Developer
yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.yoq ought to be getting tired of karma fortunes by now.
 
Posts: 77
Karma: 206176
Join Date: Apr 2013
Location: Europe
Device: Kobo Glo
you can compile on your pc for the kobo although it is a different processor architecture, it's called cross-compiling.

kobo supplies all you need on their github repository: https://github.com/kobolabs/Kobo-Reader
but afaik it's only possible to download the whole 3.5G repo, so i'll post the links here for what you need to compile for the glo:

assuming you are running 2.6+, use this toolchain:
Code:
gcc-linaro-arm-linux-gnueabihf-4.8-2013.04-20130417
you can get it here: https://launchpad.net/linaro-toolcha...ries/+download
linux:https://launchpad.net/linaro-toolcha..._linux.tar.bz2
win32: https://launchpad.net/linaro-toolcha...0417_win32.exe
i'm a linux user, so i haven't tried the windows version, but it should work as well.

you'll probably need some linux headers, this is the kernel for the glo and most newer models:
http://www.sendspace.com/file/0sd6ej

compile with:
Code:
arm-linux-gnueabihf-g++ -I X:/path/to/linux-2.6.35.3-507/include -Wall -o programFilename code.c
happy coding
yoq is offline   Reply With Quote
Old 08-11-2013, 04:53 PM   #5
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
I have followed your instructions ( thanks heaps )and have managed to compile a small helloworld.c file with no errors but when i run it on the kobo it gives me a error so I thinkI have done something wrong.

can someone give me a small helloworld.c file that they know will run on the kobo glo / mini as a test using the above enviroment

once I get one file compiled and running on the kobo I am sure my skills will be usefull to others on this forum.. ( and I will share )

I have done alot of codding just getting my pc setup to run the compiler etc
is my current challenge. as the last time I setup a dev environment for C was years ago
fat265 is offline   Reply With Quote
Advert
Old 08-11-2013, 06:05 PM   #6
tshering
Wizard
tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.tshering ought to be getting tired of karma fortunes by now.
 
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
You could try compiling Yoq's night mode hack, or sergeyvl12's file monitor (part of Kobo launcher). You can find the source code of both in this forum. Did you run file against your executable and check whether it is really compiled for ARM?
tshering is offline   Reply With Quote
Old 08-11-2013, 07:26 PM   #7
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Quote:
Originally Posted by fat265 View Post
I have followed your instructions ( thanks heaps )and have managed to compile a small helloworld.c file with no errors but when i run it on the kobo it gives me a error so I thinkI have done something wrong.
Yoq's guide is only for firmware 2.6 and above. For previous firmware you need to use a different compiler. On Ubuntu you can install an arm compiler for older firmware with 'sudo apt-get install gcc-arm-linux-gnueabi'.

In firmware 2.6 Kobo switched to a hard-float compiler. Before that they used a soft float compiler, so when you're compiling your own software for the Kobo you need to make sure you're using the right compiler for the right firmware version.

I've used this helloworld.cpp file on my Kobo:
Code:
#include <iostream>
using namespace std;

int main()
{
	cout << "Hello world!" << endl;
	return 0;
}
KevinShort is offline   Reply With Quote
Old 08-12-2013, 06:46 AM   #8
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
I tried this " 'sudo apt-get install gcc-arm-linux-gnueabi'. "
as previous post but I am not sure where to find the installed application.

I tried this ( to find the installed app )

stuart@STUART-EEEPC:/$ sudo find / -name "*gcc-arm*"
[sudo] password for stuart:
/var/lib/dpkg/info/gcc-arm-linux-gnueabi.list
/var/lib/dpkg/info/gcc-arm-linux-gnueabi.md5sums
/var/cache/apt/archives/gcc-arm-linux-gnueabi_4%3a4.7.2-1_i386.deb
/usr/share/doc/gcc-arm-linux-gnueabi
stuart@STUART-EEEPC:/$

once i have managed to install it what switches do
i need to compile hello.cpp

gcc-arm-linux-gnueabi -static -march=armv5 hello.cpp -o hi

or something else..

sorry for all the dumb questions..
fat265 is offline   Reply With Quote
Old 08-12-2013, 09:54 AM   #9
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
Oh, I should of mentioned that the installed name is 'arm-linux-' followed by the tool name, such as gcc or g++. So to compile the helloworld.cpp file for pre-2.6 firmware, this should work:
Code:
arm-linux-g++ helloworld.cpp
If you get 'arm-linux-g++: command not found', install 'g++-arm-linux-gnueabi'. I can't remember if the g++ compiler is installed with the gcc one.
KevinShort is offline   Reply With Quote
Old 08-12-2013, 01:14 PM   #10
fat265
Member
fat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watchfat265 is clearly one to watch
 
Posts: 18
Karma: 10638
Join Date: Jun 2013
Location: Australia
Device: kobo glo touch & mini
This worked

arm-linux-gnueabi-g++ -o hello hello.cpp

it was found in /usr/bin after i ran this

sudo apt-get install g++-arm-linux-gnueabi

sweet !!!

and the code runs on my kobo thanks a million now I am cooking with gas

sligntly different to your instructions ( but you just want to me to learn more don't you )



Now the million $ questions
can i install g++-arm-linux-gnueabi on the kobo instead of ubuntu so i can do it all via just telnet and vi ?

there is no apt-get on the kob but busybox has a install function that I cant work out yet ???
I would like to be able to do everythong from the kob ( if this is possible )

Last edited by fat265; 08-12-2013 at 01:20 PM. Reason: because
fat265 is offline   Reply With Quote
Old 08-12-2013, 03:13 PM   #11
KevinShort
Addict
KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.KevinShort ought to be getting tired of karma fortunes by now.
 
KevinShort's Avatar
 
Posts: 348
Karma: 209937
Join Date: Jan 2012
Location: Virginia, US
Device: Kobo Wifi, Kobo Glo
There's some posts over in the Kindle dev forum on installing the tcc compiler on the Kindle. I don't know if their Kindle version would work on the Kobo, but it might be worth a try. You could also try downloading the armel gcc package from debian.

I don't know anything about busybox's install function.
KevinShort is offline   Reply With Quote
Old 08-16-2013, 04:42 AM   #12
hawhill
Wizard
hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.hawhill ought to be getting tired of karma fortunes by now.
 
hawhill's Avatar
 
Posts: 1,379
Karma: 2155307
Join Date: Nov 2010
Location: Goettingen, Germany
Device: Kindle Paperwhite, Kobo Mini
Busybox might have an "install" applet, but that is just a fancy "cp", i.e. a file copy tool.

You need something more elaborate than that - like it was said, a debian armel chroot would probably work. Or an ARM archlinux chroot. But matters get complicated there and I don't see much benefit to development via cross-compilation. More elaborate C++ compilation will also need some substantiate amount of RAM which the device simply doesn't have.
hawhill is offline   Reply With Quote
Old 03-27-2014, 02:41 PM   #13
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
Do you think that if I set up a virtual machine under Virtualbox as an ARM arch, programs compiled under that machine will run on Kobo?
Lucas Malor is offline   Reply With Quote
Old 03-27-2014, 02:50 PM   #14
PeterT
Grand Sorcerer
PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.PeterT ought to be getting tired of karma fortunes by now.
 
PeterT's Avatar
 
Posts: 12,103
Karma: 73447988
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
It would be FAR FAR easier to just cross compile from a regular Linux install; plus VirtualBox only provides for X86 emulation, NOT cross architecture emulation.

Qemu on the other hand DOES emulate ARM V7....
PeterT is offline   Reply With Quote
Old 03-27-2014, 03:31 PM   #15
Lucas Malor
Pain in the arse
Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.Lucas Malor will give the Devil his due.
 
Lucas Malor's Avatar
 
Posts: 758
Karma: 77856
Join Date: Apr 2013
Device: Kobo Aura One, Kindle 4
Yes, I was reading just now QEmu. Probably an overkill
Lucas Malor is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Glo Problems compiling Qt for Kobo Glo j4GGy Kobo Developer's Corner 6 08-03-2013 09:25 AM
Glo Can kobo glo run android app such as nook glo? suspect Kobo Developer's Corner 1 12-28-2012 11:25 PM
Glo How to import reading Life Statistics from Kobo Touch to Kobo Glo? the_m Kobo Reader 5 12-13-2012 03:40 PM
Kobo Glo Vs Kobo Touch Sizes (Want to use my Skindigital cover) Chocky Kobo Reader 3 09-25-2012 10:47 AM
Compiling for Lubuntu (regarding compiling instructions) jgratero Sigil 5 07-15-2012 07:54 PM


All times are GMT -4. The time now is 12:32 AM.


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