Community SSU/Thumb


[edit] Introduction

[edit] Instruction Set Architecture's

The Cortex-A8 SoC we have in our N900 supports several Instruction Set Architecture's (ISA).

These include ARM, Thumb, Thumb2, ThumbEE.

As stock Fremantle, CSSU and all of the software currently in the repositories* come with binaries (i.e. executable files, libraries) compiled using ARM instruction set.

Which is the most powerful and fastest. Every ARM instruction uses exactly 4 bytes of memory.

Note:- *Facebook sharing plugin was compiled by mistake with Thumb2 ISA.

[edit] Thumb2

Thumb2 is another instruction set, which has most of the power and speed of ARM ISA, but its instructions could be 2 bytes in length instead of 4 bytes.

According to some research that can be found on internet, using Thumb2 ISA leads to reduction of code size in 30-40% without sacrificing much of the performance (some 2-5% performance decrease).

[edit] Memory Usage

We all know that the major performance bottleneck on the N900 is the size of RAM. Constantly swapping pages in and out of memory leads to stutter and lag.

Part of that RAM is used to hold the executable code, so the smaller the code is, the larger part of the RAM will be free to be used for data.

While it is a simplified explanation, you should be able to get the general idea. Smaller code means better code cache usage, less reading from the storage and therefore faster application start times.

With packages that are so far in CSSU-thumb repository, the code size is reduced by approximately 35MiB.

As more packages are included, more RAM and storage space will be regained in the future.

[edit] The Catch

The SoC revision inside our N900 has silicon erratas or put simply bugs in the hardware. These render Thumb2 compiled binaries unstable if no countermeasures are taken.

A system without fixes for the erratas, that tries to run Thumb2 binaries, crashes randomly, not only in Thumb2 compiled executables/libraries, but in ordinary ARM ones too.

[edit] The Countermeasures

There are two erratas that must be worked around on N900 in order for Thumb2 compiled binaries to not lead to system instability.

These are ARM errata 430973 and ARM errata 657417

[edit] ARM errata 430973

This is worked around in the kernel by clearing a special type of cache (Branch Target Buffer) inside the chip on every context switch made by the CPU.

In theory that slows down the system. I didn't make any benchmarks, but from current testing there is no visible performance loss.

A special call to Secure Monitor (that is a piece of ROM in our SoC programmed by Texas Instruments during chip manufacture) is needed to properly enable the workaround.

Therefore CSSU Thumb requires a kernel which has the workaround. This is provided in Kernel-CSSU or the latest version of Kernel Power

[edit] ARM errata 657417

This is worked around in the in linker, all binaries in the CSSU Thumb repository are compiled using Linaro gcc 4.7.2 and binutils 2.22.

Information on how to setup the CSSU-thumb toolchain (gcc4.7.2-linaro) in scratchbox is linked below

CSSU Thumb Toolchain Setup

[edit] Installation

Make sure Nokia and Extras catalogues are enabled in application manager.

Using MicroB on your N900 click on the link below.

CSSU Thumb Install

The installation process is the same as other CSSU Flavours

CSSU Installation

CSSU-Thumb is based on CSSU-Testing flavor.

If you have kernel-power v51r1 or above, no custom kernel will be installed, as needed errata workaround is now included in kernel-power.

[edit] Uninstallation

There is no way to uninstall, i.e. the same rules apply as for the other CSSU flavors. The only way to rollback without messing with apt-get is to Reflash. Or you can downgrade all of the packages manually using apt-get.

[edit] Disclaimer

This is still in development stage and while so far there are no known issues, I will take no responsibility for any damage and/or data loss caused by using CSSU-thumb repository. It is highly unlikely to happen, but be prepared to reflash if something goes south. Make a full backup of your data and settings before installing.

[edit] Changelog

Main article: Community_SSU/Thumb/Changelog