public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Alessio Sangalli <alesan@manoweb.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] On simple standalone applications
Date: Fri, 29 Aug 2008 17:53:27 -0700	[thread overview]
Message-ID: <48B89A07.7010806@manoweb.com> (raw)

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

             reply	other threads:[~2008-08-30  0:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-30  0:53 Alessio Sangalli [this message]
2008-08-30 20:30 ` [U-Boot] On simple standalone applications Wolfgang Denk
2008-08-31  7:50   ` Alessio Sangalli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48B89A07.7010806@manoweb.com \
    --to=alesan@manoweb.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox