So after getting really gatvol of trying to find info on this archaic CPU, I just did random google searches for “RM9200 boot” and I found a page by a chap named Darrell Harmon. Looking at the page, its been a while since he has been there, but, he did modify u-boot to run as the initial loader on an AT91RM9200. After some more searching I found his source code on another page.
I started by building in command line, this took a good bit of time, and was clunky, also, the code did not work. It built fine, and I got it to upload to the CPU via minicom, but it was unresponsive. Some digging in the source led me nowhere, and I was getting tired of using gedit and terminal to build, so I installed Eclipse CDT. Some fiddling with the bashrc script and the PATH variable had me building in eclipse, oh the joy of an IDE.
So I still had a problem, the code was unresponsive, inside I found a memory test that was deactivated, I rewrote this to make it smarter and more thorough, and ran the build. It failed. I then started printing my findings to the console, and found that I could access 256k of the 8MB of the SDRAM. Some scratching (read: 4 days) later I found that the SDRAM chip on my PCB was not compatible with the loader code. Diving into the datasheets of both the CPU and the RAM revealed some answers, and a quick patch to the code had the memtest working, awesome.
Now the loader runs in the device SRAM, and can run be used to load code into either SDRAM or a FLASH device. I wanted to get the loader written to the AT45 serial DataFlash on the board, as this would save some time in the boot sequence. A quick look at the code had me thinking it should work, alas, it did not.
Among my problems was the fact that to get the device into its initial bootloader, I had to short SDI and SDO together, as this is the only way to get the device to fail its boot sequence and revert to the initial bootloader. I thought this might be part of the problem, but soon foun it was not, as I’d remove the short before trying to write to the flash. I then modified the memtest code to run on the flash, and it failed. A substantial amount of probing later, I found that the WP line was held low, not allowing writes to the first page of the device. Modifying this allowed it to pass the memtest, so now its time to get the loader into flash. This went badly, so I tried to get it running out of SDRAM, and after some digging found that the base .text address was to blame, two mods to that had it running it both SDRAM and written to dataflash.
So now I could boot the board into known code with the option to reflash and modify as I pleased. It was time for u-boot. One of the ports for u-boot is a AT91RM200 based dev board from ATMEL called the AT91RM9200-DK or -EK depending on what version you had. I had never seen one, and the schematics looked lank different from my board. Some hacking would be in order. After a few hours of reading through the code and changing both setup and config code, it built and ran on the board. Awesome! The ethernet driver was dead though. After adding tons of debug code and getting familiar with PHY’s, something that I have never used, it was as simple as lifting the reset line on the PHY as its connected to the proccessor. Bingo, dhcp found itself an IP address.
So hopefully the next installment will have the board running a Linux kernel, and that will be awesome!
Here are some logs from the terminal: