2006-07-14 Added thumb mode second cpu (940T) example
2006-07-12 Added thumb mode second cpu (940T) example
2006-07-12 Added/fixed simple second cpu (940T) example
2006-07-11 Added/fixed simple second cpu (940T) example
2006-07-10 Added simple second cpu (940T) example
2006-07-06 Added GamePark gcc 4.0.2 dhrystone numbers


This is the demo version of HI-TECH softwares ARM compiler. It is not that fast compared to gcc. But instead of struggling to figure out how to get it remove items you dont want, like gcc and others, you have to tell it to put things in.

--OPT=none 166076 50.35 mips
--OPT=as_all 152108 55.17 mips
(nothing, assume this is --OPT=all) 137054 61.23 mips

ht-hello-20060714a.zip This is not 100%, it would print the ticks but not the mips, not sure if it is the math library or what. Sometimes it would just appear to hang, sometimes the screen would go blank shortly after printing the test time (in ticks).


Changed the example to thumb mode. Good thing is it looks like they are using a 32 bit bus. Thumb is a touch slower than arm as it should be.

Without the MPU setup, THUMB mode:
-O3 2776627 3.023 mips
-O2 3610236 2.325 mips
-O1 3598072 2.332 mips
-O0 6891982 1.218 mips

With Dzz's MPU setup, THUMB mode:
-O3 67471 124.4 mips
-O2 87408 96.02 mips
-O1 88760 94.55 mips
-O0 151832 55.27 mips

gcc940-20060712b-thumb.zip This is not 100%, it would print the ticks but not the mips, not sure if it is the math library or what. Sometimes it would just appear to hang, sometimes the screen would go blank shortly after printing the test time (in ticks).
Now that I have the 940 booting properly and can fiddle with pixels, I can write text and do some experiments
Using a homebrew gcc, built on Linux using these build instructions.
binutils-2.17.tar.gz newlib-1.14.0.tar.gz gcc-core-4.1.1.tar.bz2

Without any MPU setup (perhaps does more to compare compiler settings than system performance), ARM mode, little endian
-O3 2375650 3.353 mips
-O2 3106282 2.702 mips
-O1 3126056 2.685 mips
-O0 4859573 1.727 mips

Ryleh's MPU setup code didnt run for me, dont know why yet

Dzz's (I assume, it was the demo6b.zip code) MPU setup (cache enabled in particular)
-O3 62030 135.3 mips
-O2 75364 111.4 mips
-O1 76408 109.8 mips
-O0 122390 68.57 mips

Interesting that the 940t is not yet up to the speed of the 920 below, although these are differently built and different versions of gcc.



Do over. I had noticed a comment about the H2 bit related to the LCD backlight, so when I was messing with the H4 (GPIO) bit the first time I hit H2 once. That and some other things sent me into a death spiral. So I started over and these work (well I hope). The a version compiles the 940 binary into the executable. The b version loads a file named 00000000.bin, so this is basically a generic 940 loader program.



Here is a simple example of how to get a program into 940T and start it. Actually rlyeh and the others did all of the work, all I did was a little asm to confirm it was working. This includes a very slightly modified version of rlyeh's library.

Version b, looks like I got lucky on version A. My guess is, and so far it is working, that the timer was not always or completely setup. A few setup writes and the led blinks more reliably (took a while to get it blinking again after the early success).

and then version C. I had made a few dumb mistakes the previous two or three times I tried to just read a file (thought it was my file i/o before I realized the original version stopped working, went back and fixed that then came back to the file i/o to find that it does work). So if you download the c version then you simply have to upload a file named 00000000.bin, and not have to re-build and re-load hello.gpe. Just run the same hello.gpe

simple940t20060710a.zip simple940t20060710b.zip simple940t20060710c.zip


You may remember me from http://www.dwelch.com/gba or http://www.dwelch.com/ipod. Now I have a GP2X, and as usual, all I care about is learning how to write to the hardware directly and demonstrating that your compiler or other settings you take for granted make a huge difference in performance. (And despite having mame for the gp2x I may port Asteroids to this platform. Want to stress out your compiler? feed it tens of thousands of lines of code in a single switch statement resulting from a static recompile). Yes I know dhrystone may or may not be the ideal benchmark or maybe you think it is a useless benchmark, that is fine, I wont argue the point, its not a great benchmark. Consider this an interesting study on how compiler options, etc, affect the execution time of the same lines of C code.

2006-07-06 So far I have written maybe three programs for the gp2x. I have zero interest in SDL based programs, so I went right for rlyeh's minimal library. For now I went with the 1) lazy, simplest approach at getting a compiler for the gp2x (from the gp2x.org wiki) which is gameparks gcc based tools. It reports as being gcc version 4.0.2. I have no idea what level of control my program has over the machine, clearly there are some interrupts or something else getting in the way as the execution times are rarely if ever the same number twice. This version is derived from ryleh's examples. Enough, on to the numbers:

108824 77.120 Mips GamePark gcc 4.0.2 -O0 option
61960 135.450 Mips GamePark gcc 4.0.2 -O1 option
61453 136.568 Mips GamePark gcc 4.0.2 -O2 option
47287 177.480 Mips GamePark gcc 4.0.2 -O3 option
I struggled with ryleh's constant for converting to seconds. Then I tried Magic Eyes number until I saw that they had a mistake in their document. Well I say this because both ryleh's constant and magic eyes 27us comment mean that the vax can out run the gp2x, which I doubt. So as you can see in the code:
2000 / ( 1757 * (1/7372800) * ticks)
Is what I used to calculate Mips. Now saying that, ARM advertises, or at least used to, 95% mhz to mips, so if this thing is running at 200mhz (assumption) then you should get 190 mips. When I started this years ago, gcc's code was half the speed of arms ADS code. gcc has been catching up, and I am not too familiar with gcc 4.x, so perhaps these numbers are reasonable. 88% mhz to mips...

dhrygcc20060706a.zip source for above tests.