[U-Boot] On simple standalone applications
Alessio Sangalli
alesan at manoweb.com
Sat Aug 30 02:53:27 CEST 2008
Hi, I have problems in writing an application for U-boot. I do not need
U-boot functions (for now), I just have to write some registers and then
fill some memory with a value. The HW will read that memory region for
its usage.
I work on a ARM9 board whose RAM is mapped from 0x000000 to 0x04000000
(64MB). I have been privided U-boot 1.2.0 for this board.
First problem: I can compile U-boot with ELDK 4.1 but if I enter the
"examples" directory and issue a make:
uboot-1.2.0/examples# make
Makefile:64: /config.mk: No such file or directory
Makefile:174: /rules.mk: No such file or directory
make: *** No rule to make target `/rules.mk'. Stop.
So I am unable to compile the examples. What should I do? By the way, I
noticed that:
uboot-1.2.0/doc/README.standalone
[...]
4. The default load and start addresses of the applications are as
follows:
[...]
ARM 0x0c100000 0x0c100000
I do not have RAM at that location! Shall I modify the Makefile for this?
Anyway, I wrote a small program that does what I described above:
int test02()
{
volatile int* r;
int i;
*(volatile int*)(0xc0001200) = 0x00000000;
*(volatile int*)(0xc0001220) = 0x0257031f;
*(volatile int*)(0xc0001224) = 0x00162028;
r = (int*)0x00800000;
for(i=0; i<0x100; i++)
*r = 0x00000000;
return 0;
}
I know, it's ugly and I could do everything with a bunch of u-boot's
'mw' commands, but this is only supposed to be a quick test. I have
compiled it with:
arm-gcc -c test02.c && arm-objcopy -O binary test02.o test02.bin && cp
test02.bin /tftpboot/
and then, on the target's u-boot prompt:
> tftp 1000000 test02.bin
TFTP from server 192.168.1.77; our IP address is 192.168.1.10
Filename 'test02.bin'.
Load address: 0x1000000
Loading: #
done
Bytes transferred = 252 (fc hex)
> go 1000000
## Starting application at 0x01000000 ...
The first part of the program, the register writing, works, I get my
hardware enabled. But the 'for' loop is not well 'relocated' and points
to undefined code in random memory areas, and the CPU gets stuck.
Any advice?
Thank you
Alessio
More information about the U-Boot
mailing list