Tuesday, February 15, 2011

Booting the GA330

Just a few tech comments I left out in the previous post due to lack of time... but after a quick clarification about ChinaChip:

They have a lot of open fronts in a very competitive market and a limited set of resources, I assume that if the project has been put on hold is because they had no choice. Note however that they're still providing information and support, but with some limitations.

As I said, I have schematics, docs (which suck but are just what they have) and BSP code. I'm now working on the tools to boot code on the GA330 through the USB port, and as soon as I get it working and a kernel booting with a serial console, I'll publish it all (but I still believe it will be of little use to other developers without the docs and BSP). I don't like to be the bottleneck, but that's how things are now.

Now for the tech details:

The CC1800, like the JZ4732 and other SoCs alike, has several boot modes implemented in the internal ROM. The code checks the state a of a few pins and then proceeds to boot from NAND, NOR, SD or USB. Actually, USB boot means the ROM code sets up the USB port in device mode and waits for instructions. You can get CPU info, upload code to SRAM, and execute it, that's pretty much all.

Note that I wrote SRAM, not SDRAM. That's why you usually need a two stage process to boot code via USB: upload and execute a tiny piece of code to SRAM which configures and initializes the SDRAM controller (and some other peripherals) so that memory is accessible, and then upload and execute the large piece of code, the kernel, to SDRAM.

Surprisingly, in the two CC1800 based machines I have, the GA330 and an HD8900, the bootsel[2] pin is tied to 3.3V. This means you can't enter USB boot mode. The bootsel[1] pin is connected to the down input of the d-pad, which means that switching the GA330 on while keeping down pressed you enter SD boot mode. In this mode the CC1800 loads the content of sectors 2-17 (a total of 16 sectors, 8KB) from the SD card to SRAM and executes it.

It turns out that due to some errors in the CC1800 design (not sure if it's the silicon or the ROM code) the USB0 port being used wasn't stable. Since the ROM code can't be changed, the hardware designers were forced to use some other alternate boot mode, and went with SD. Now, if you put in the SD a modified version of the USB boot code in ROM which uses USB1 instead of USB0, you're back on track and can complete the flash burn process through the USB1 port.

(note that in SoC of this complexity it is very usual to have tens or even hundreds of errors which are generally described by the manufacturer together with workarounds in the corresponding errata sheets, see the LM3S9B96 from Texas Instruments for instance)

Needing to have an SD card inserted to enter USB boot mode is a small inconvenience for the manufacturer, but can be a blessing for final users, because:

  1. It makes a dual boot unnecessary. You will be able to boot dingux from the SD card without any modifications to the GA330.
  2. Even if a dual boot is necessary, the install method would require only an SD card (no more USB driver madness).

For us developers it's an insignificant inconvenience. We need USB boot because it makes compiling and testing code very easy, and we just happen to need an SD card inserted all the time. Note that the partition table in sector 0 of the SD card is not affected, so you can set the first partition to start anywhere beyond sector 17 and have an usable data partition while still keeping the boot code in sectors 2-17.


  1. Thanks for the update.

    Good to know. ;-)

  2. Happy to see this project is still moving forward.

  3. Thanks for the update, hope all goes smoothly.

    I'm planning on getting some development done on a SoC also used on this kind of devices; the Actions ATJ2259C.

    I'm in a very early stage and thinking of first making a tool to backup the firmware for the device, hope you can advice on were to start.

    BTW is the CC1800 a MIPS chip or is it ARM9 ?


  4. Good luck and you can resolve these difficulties ...
    Thanks for the big work

  5. @Jorge Muñoz

    Unless you have the SoC datasheet and programmer's manual and/or some BSP, I'd forget about it. You'll never reach a decent hardware support just by reverse engineering.

    The CC1800 is an ARM926EJ-S. The extremely preliminary kernel I was handed uses the Atmel AT91SAM9260 as a starting point.

  6. I know this is off-topic, but please read my reply to your comment in your last post. That has important information about why I got such a long name.

  7. @booboo

    I've have the SoC pin out, but yes it is hard to do something like a Linux port with just that.
    I wanted to know if it is possible to do a backup of the firmware of this type of devices reading the NAND while connected trough USB.

    Any recommended books for the novice.

  8. @Jorge

    There's no "direct" nor "standard" way to read out the flash via USB. I can't tell for user in the case of your SoC, but anything different wound't make sense: the ROM code needs to be absolutelly error free, and getting it simple helps a lot, so any kind of USB boot mode in a SoC will be necessarily simple, as in the CC1800. In fact, the CC1800 is an excellent example of the bare minimum you need: get CPU info, upload and execute. If what you need is to read then NAND, you'll have to compile your code to do so via USB and upload and execute it.

    Books... mmm... these are the three I have about the linux kernel and they're pretty good:


  9. @Jorge

    (start with the third: Linux Kernel Development)

  10. @c6

    Ok, I shall call you "c6" :-)

  11. ...I meant "Ziggy Zigzagoon," my "hacker" name.

  12. Is pocible the dingux read files from an external memory stick? (i have the mini usb to usb cable, more a hume with energy, i test on the gemei a330 this i a haven't sucess :(

    If dingux was completly done on gemei a330 (in the final version) what should be the diference of the dingux in a320? (something new like multiplayer suport and maybe tv out with 1080p resolution for playing videos)

  13. And another thing what the USB otg will do in gemei a330/dingux ?

  14. @Lucas

    According to CC, the GA330 USB port is OTG and functional, except it doesn't have +5V power.

    So yes, you could connect a memory stick as long as OTG supported in the dingux kernel and you provide your own +5V external power (for example via a powered USB hub).

    Difference to the A320: better and faster emulation, mostly due to existing ARM assembly optimized emulation cores and the native 24 bit framebuffer. Don't know how much faster this would be.

  15. Well i try the usb in a hub with +5V pluged in the gemei a330 power (but gemei was loading your battery and didnt see the memory stick, i try this with a external HD with a energy cable pluged in the power gemei a330 font, and my gemei a330 was loading your battery by the HD (and didnt work :( )....

    Is dificult to spoke but should be pocible in dingux watch a 1080p video with the tv out in 1080p? (i know the component video suport 1080p)

  16. @Lucas

    The CC1800 is capable of decoding FullHD (the Gemei HD8900 does), but I don't think it'll ever be supported in dingux, since it requires extensive use of the OMIP, sort of a video decoder coprocessor, for which I don't have any info, and I doubt it'll ever be released (though I'll ask CC about this).

  17. Hi, booboo!
    At first I want to thank you for your work!
    I'm reading your blog for a very long time.
    Because I'm planning to buy Gemei a330. I want it veeeeery much, but i don't want to buy it if there's no dingux ported( I don't understand anything about booting problems and other HW&SW things, so I just want to know will you port dingux on a330? Is it possible? Is it reasonable to buy Gemei a330 while there is no dingux?

  18. Well i buy my gemei a330 (i havent dingoo a320 and others), and i loved, because:can play 1080p videos (i wrote a word document comparing gemei and dingoo a320), The record i much better than nokia 5310 record, the translations of the picture software in the a330 surprise me (i didnt expect so many translations)....

    But at now i'm only whaiting a descent srt sutitle (without cut subtitle and acentuate the subtitles), tv-out with suport at 720p and maybe 1080p (only suport 420p,476i,576i) and acess a memory stick and read movies from it (i try but the gemei start loading the battery and cant detect the memory stick :( )

  19. Dmitry-san, he would not port DIngux himself, but rather make drivers that would make Dingux porting actually possible.

    As for buying the Gemei, I am rather pleased by itself. I mean, the system can play NES, SNES, Genesis, GBA, and NeoGeo (even in multi-player), can play some videos (even those that you downloaded off YouTube), just about every music file, can read e-books, txt files, and html files...

    Even without Dingux, the Gemei can hold its own by itself.

    - Ziggy Zigzagoon

  20. Booboo would like to ask about the SDK for the GA330, and a also about a tool to unbrick for the GA330.
    Thank you for your attention

  21. @Neno

    I already have an unbricking tool for the GA330 (since I've already bricked one of the two provided by CC), however, I haven't been able to make it work and I'm trying to sort it out with CC (Chinese new year, communication slow you know). I'll release it (with CC permission) as soon as I make sure it works.

    Don't know anything about the SDK, will ask.

  22. @Nero

    Asked CC about the SDK. There's already an unofficial SDK released. See http://code.google.com/p/mp4sdk/downloads/detail?name=A330-SDK-Setup-20101106.exe&can=2&q=

  23. boboo do your have a unbriking tool for gemei a 330 ? i had bricke my own with a hxf tool mistake tring to make a custom menus in firmware...

    and uploaded the 1.1 firmware of gemei a330 (edited) in my gemei but when the update finish my gemei die.... and i gone wild with anger of myself for bein so such dumbass... for doing that...

    please help me...

    an plus.. i am graphic designer and had made some sketches of a (hypotetic) new version of gemei a330 thats a call "gemei victory" or cherfully GEMEI V

    look at my drawings on the link... and please answerme...

    youre my last hope.... for reviving my gemei...


    i will be wating your answer on my email...