Tuesday, June 18, 2013

Full RK3066 Technical Reference Manual found!

Thanks to Omegamoon, who found it, here is the full RK3066 Technical Reference Manual, 1142 pages and 26MB of completely necessary data for opensource development on this platform.


It is the same file found in chinese websites and named as "Rockchip RK30xx TRM V2.0.pdf"

And here is the full folder shared with more RK29 and RK30 documents:



Monday, June 17, 2013

Measy U2C HW serial console pins

A hardware serial console is a little module soldered to at least two pin pads of a CPU (in this case the RK3066 of the Measy U2C stick) in order to transmit to a PC the stick's boot log sequence happening long before the screen turns on.

Naturally, if a kernel (like the latest one) refuses to boot and does not even get to turn on the screen, the only way to debug the reason is to use the serial console.

With the indications and the useful blogpost (for MK808) of fellow developer Omegamoon, I set out to find the two pins necessary to watch in my PC the boot sequence, that is:

- TXD: the pin where the CPU outputs the console text
- Ground: the necessary reference for the electrical levels in TXD

These had to be connected to the RXD and GND pins, respectively, of a hardware serial-to-USB module, that is then plugged to a PC's USB port. If anybody wonders about the CPU's RXD pin, it is not necessary unless you want to send commands to the stick once it's booted.

In the PC I myself use Ubuntu's CuteCom console app, connecting to serial port /dev/ttyUSB0 at 115200 bauds 8 bits data, 1 bit stop, no parity, and no handshake.

The way in which I found the RK3066's TXD pin was by trial and error. But since I saw there were small circular pads around the same area where Omegamoon had found his stick's TXD/RXD, I supposed mine should be close.

Hence, I first soldered the ground cable to the micro USB port on top of the RK3066 CPU and started very carefully making the serial-to-USB module's RXD pin's cable touch the different pads while powering on the stick, until I found the one that was transmitting data: TXD and proceeded to solder the cable and make the smallest possible hole in the Measy U2C's enclosure to get the two cables out of it while closed.

For reference, these are the places where the cables to the serial-to-USB are soldered
TXD pad of RK3066 (to RXD on serial-to-USB) and GROUND on the Micro USB connector

The TXD pad looks tiny but with a bit of care and a little bit of solder tin on the cable tip and the solder tip, you'll get good results.

Saturday, June 15, 2013

Linux on RK3188 work in progress

Please note this is not a blog post, it's a my personal pastebin where I can put in writing to myself and other fellow developers the small things I find in the latest 3.0.36 kernel that supports rk3188 devices.

MALI and CONFIG_SYNC ( sync_fence_cancel_async )

Talking about Omegamoon's codebase (but with backported drivers folder from my previous one)

Once MALI is configured in as:

# CONFIG_ION is not set
# CONFIG_MALI400_DEBUG is not set
# CONFIG_UMP_DEBUG is not set

And /include/drm/drm.h is backported to rk3x's version, that is, the first:
#if defined(__linux__)
#if defined(__KERNEL__) || defined(__linux__)

Then compiling throws this new error:
drivers/gpu/mali/mali/common/mali_kernel_core.c:1084:4: error: implicit declaration of function 'sync_fence_cancel_async'

That function is called because now CONFIG_SYNC is forced by PLAT_RK and should be implemented in /drivers/base/sync.c (see http://lists.linaro.org/pipermail/linaro-mm-sig/2012-June/002050.html) but it's missing.
Hence, since MALI has worked without CONFIG_SYNC and a quick grep of the codebase shows it's the only driver talking about CONFIG_SYNC, my fix for this is removing the dependence with PLAT_RK by going to /arch/arm/Kconfig
and in the config for PLAT_RK commenting the following lines:

# select SYNC
# select SW_SYNC
# select SW_SYNC_USER

and then in the .config removing:


Also had to add this line at the top of /drivers/video/rockchip/rk_fb.c due to missing references to 'GET_UMP_SECURE_ID_BUF2':

#include "mali_def.h"

Monday, June 10, 2013

Disassembling .uu files

Quick post to not forget this procedure :)

Let's say we have a .uu file that is a "uu-encoded" (a kind of hex encoding of a binary file) compiled object file, for example:

In order to peek into its internals we would have to download it and:

1) Decode the file:
 uudecode rk3x_kernel_3.0.36/arch/arm/mach-rk30/ddr.uu -o ddr.o

2) Disassemble it with the specific ARM toolchain:
toolchains/android-toolchain-eabi/arm-eabi/bin/objdump -d ddr.o > disassembled-ddr.asm

The latest version (4.8) of the Linaro ARM toolchain can be downloaded from this place (thanks Omegamoon):

The result is at dissasembled-ddr.asm and, for the above ddr.uu, can be seen here.