Pocket-Go hello world

June 29, 2019, at 05:30 PM by mgarcia in 2019, Embedded, Pics, GameDev, Blog (0 comments)

Title: Pocket-Go hello world Author: mgarcia Date: 2019-06-29 17:30 +1000 Tags: 2019, Embedded, Pics, GameDev, Blog Comments: Open


Image: Blog.2019-06-29-Pocket-Go-compile-a-hello-world-app

Click to view original image: 293kb

Pocket-Go hello world

If you're not familiar with the device, first read some of the Pocket-Go dev links.

I'm not an embedded expert, this is just my experience setting up and creating a working executable for Pocket-Go. You'll need a Linux machine, either physical or a virtual machine.

Also, this wont cover how to build the kernel or boot image, which is all on the preconfigured SD card provided with the Pocket-Go, instead, it guides you on how to make an executable and how to run it.


Set up and compile

First download Compiler (toolchain.7z): https://github.com/steward-fu/miyoo/releases/tag/v20190508_1
Extract the "miyoo" directory somewhere, I'll use "/opt", so "/opt/miyoo".
Next, download the hello world app, I'll use the simple calculator app from https://github.com/szymor/bittboy-calc
Extract it somewhere, ie "/opt/calc" and open a command shell.

Run the following, to set the environment variables-

export PATH=/opt/miyoo/bin/:$PATH
export LD_LIBRARY_PATH="/opt/miyoo/lib"
Next, enter-

make
you'll see the arm compiler working-

arm-linux-gcc main.c -o calc -ggdb -lSDL -lSDL_ttf -lm

And you will get a 33K executable called calc!

If you have SDL1.2 installed, you can type "make pc" and it will compile to linux, this is a good template to start development on linux to target Pocket-Go.


Installing the app

Unfortunately, the only way that I know to send a binary to Pocket-Go is by physically copying it to the SD card. So, remove the SD card from the Pocket-Go and put it into the microSD card USB adapter which is supplied with the Pocket-Go and mount it on the PC.
For the first time doing this, I strongly recommend removing the plastic (orange) cover of the SD card USB adapter to see how the SD card goes into it, it goes in with the SD card on an angle pointing up.
If you insert it incorrectly, you risk damaging the SD or USB adapter.
When the USB is auto mounted it will mount 3 partitions, rootfs(ext4), boot(fat16) and main(fat32).
As a dev (or even user), we're only interested in the main partition, this is where the ROM's and media (MP3's, movies etc) are stored.
You can copy your calc executable and the LiberationMono-Regular.ttf file anywhere in the main partition, I recommend creating a folder called calc in the root folder.

Next, we need to put a link on the Pocket-Go's GUI launcher, which is called G-MenuX.
Navigate to the gmenu2x/sections directory, these directories here are the tabs on the GUI, we'll install it in the applications directory, so enter this folder and create a text file called calc with no file extension and open it in a text editor.
The format is pretty simple and straight forward, you can look at the other launcher files to better configure your launcher, ie adding images etc.

In the calc file enter the following-

title=Calc
description=Calc hello word test
exec=/mnt/calc/calc
clock=702
selectorbrowser=true

Save it and unmount all the mounted SD card partitions.
Next, remove the SD card and insert it into the Pocket-Go and turn it on.
It will boot normally, click the R button to get to the app tab and start the calc app.
You should see the calculator app running, to exit click the select or reset buttons.
That's it!
Comment below or in discord.




Comments are open.


Your name or alias (required):

Your plain text comment (required):


Your entered name and comment will be displayed above this form.
There is no reply notifications or editing of comments.

 Enter value: 7015  



RSS Feed @mgarcia_org Twitter Feeder my random Youtube videos
← An IndieWeb Webring πŸ•ΈπŸ’ β†’



Page last modified on June 30, 2019, at 08:05 PM and visited 245 times.

Servered to you by a Raspberry Pi Zero running Raspbian and PmWiki