Playing the 2048 game on RIoTboard.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Playing the 2048 game on RIoTboard.

Playing the 2048 game on RIoTboard.

Hello all.

This document shows how to play the puzzle game “2048” on the RIoTboard running Ubuntu. The RIoTboard is an open source platform featuring the powerful i.MX 6Solo, a multimedia application processor with ARM Cortex-A9 core at 1 GHz.For complete information regarding RIoTboard characteristics and its user manual, you could refer to the following links:

  • Flashing the Ubuntu image to RioTboard.

First, we need to get the Ubuntu image and Mfg Tool from the following page:

http://www.element14.com/community/docs/DOC-68442/l/riotboard-bsp-images-and-tools-download--android...

Once getting the software, it is required to configure the Boot Configuration Select switches (SW1) for Serial Downloader Mode as shown below:

serial downloader mode.png

After completing the download of the software, it is requiered to configure the switches for booting from eMMC, as shown below:

emmc boot.png

For additional details regarding Boot modes, you could refer to chapter 4 of the RioTboard User Manual.

  • How to connect EVBUSB2SER to RIoT board for debug terminal.

By default, the Debug serial port of the RioTboard is routed to the J18 header (labeled as “Debug”), so, if you have a EVBUSB2SER board, you could use it to access to this serial port by USB.

In order to avoid damages between boards, please ensure of the following (on the EVBUSB2SER board):

  • Switch SW1 is in the 3.3V position.
  • Jumper J3 (which enables the level-shifter IC) is removed, as it won’t be requiered.

Finally, the connections between EVBUSB2SER and RioTboard should be as follows:

Pin Number on EVBUSB2SER header P1

Pin Number on RIoTboard header J18

7 (RXD)

<----->

1 (UART2_TXD)

8 (TXD)

<----->

2 (UART2_RXD)

9 (GND)

<----->

3 (GND)

The following image shows both board connected as mentioned:

riot and usb2ser.jpg

  • How to change the HDMI display resolution using bootargs.

With the serial console connected, you could see the boot log, and stop the boot process for enter to U-Boot for changing the HDMI display resolution (enviroment variable “bootargs”). If you want to know the default vales, you could call the following command:

   printenv bootargs

So, for changing the resolution to 1920x1080 and then booting, you should do the following:

setenv bootargs console=ttymxc1,115200 nosmp video=mxcfb0:dev=hdmi,1920x1080M@60,bpp=32 video=mxcfb1:off

saveenv

boot

  • Getting the source code of 2048 game and compiling it.

On the following webpage you could find the source code of a working 2048 game on a single C file:

https://github.com/mevdschee/2048.c

On the same page are included the instructions for downloading and compiling it, which are the shown below (using either Serial Debug console or a Terminal window). The Ubuntu image should already include the gcc compiler:

wget https://raw.githubusercontent.com/mevdschee/2048.c/master/2048.c

gcc -o 2048 2048.c

If you want to visualize the source code you could try:

cat 2048.c


  • Play!

Either using Serial Debug console or a Terminal window (or both) you could now launch the 2048 game my simply launching the compiled executable:

   ./2048

Below you can find screen captures of the game running on both scenarios:

2048 serial.png

2048 terminal.png

Hope this will be useful and funny for you.

Best regards!

/Carlos

Comments

Hi,

Thanks for sharing, any ideas where to get an pre-compiled Ubuntu 14 image for the board?

No ratings
Version history
Last update:
‎03-19-2015 03:47 PM
Updated by: