MGUIDE - Minimal NoOS Sample - 1

lbenini
Hi all.
In the last days I'was exploring mini2440 as no-os development platform and
due the lack of "modern" samples (sorry but ADS doesn't work very well on
windows 7) I've decided to post some (i hope useful) information.

Step 0 - Put some code on mini2440
Well there's a lot (too much for me!) use-without-understand code in 2440
test to be useful as a starting guide, so my first objective is 
"Use supervivi to upload executable code and go on it"

Step 1 - Acquire arm toolchain
Build or download an arm toolchain. 
I've used YAGARTO (http://www.yagarto.de/) for windows based system (i
built a lot of toolchain in the past and i'm not really interested in it :)
)

Step 2 - Seek for an output registry
Looking in S3C2440A user manual and in test2440 i've found that registry
UTXH0 is mapped at 0x50000020 (or 0x50000023 for BE). For this first
example we can use UART 'cause supervivi already does needed initialization
for us.

Step 3 - Write code
Write a .c file with the following code as the only content:
/***** Code Start Here *****/
void _start(void)
{
 while(1)
 {
   (*(volatile unsigned char *)0x50000020) = (unsigned char) 'x';
 }
}
/***** Code End Here *****/

Step 4 - Compiling
Open a prompt, go in the source file's folder and type (with yagarto in
path):
arm-none-eabi-gcc -c -mcpu=arm920t main.c
This will produce a main.o object file that we can link with:
arm-none-eabi-ld main.o -o main.out
This will produce a ELF file named main.out... now someone will say you to
use objcopy, but for this example is not needed just type:
arm-none-eabi-nm main.out
And note "_start" starting offset, it'll be something like:
00008000 T _start

Step 5 - Downloading
Start board in NOR, connect with dnw, hail supervivi and press 'q'
kindly ask vivi to accept an upload in ram with:
load ram 0x31000000 0xA0000 u
Use dnw to load main.out

Step 6 - Run
Now our machine code is loaded in memory starting for 0x31000000, devices
are initialized (by supervivi) so we can jump at our entry point.
It's address is 0x31000000 + [_start offset in ELF file] so just type:
go 0x31008000
and enjoy.

Special Thanks to Manuele B. (the arm owner) and Elisa D. (my heart owner
:))

eduardo
Hi lbenini,

I followed your steps, tested your program and it works.

Now I wanna to build a program that uses gpio pins (to control micro 2440
leds), but I don't know how to create a new project using the yagarto and
eclipse.


Do you know where could I find useful information to be able to do that?
Could you post an example project with makefile and some code please?

I'm trying to use "2440test", but its too complex to me.

Regards