From: Robin Gilks <robin.gilks@tait.co.nz>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Hush shell and simple calculations
Date: Tue, 23 May 2006 12:08:37 +1200 [thread overview]
Message-ID: <44725285.1030006@tait.co.nz> (raw)
In-Reply-To: <200605222214.38257.antonio.dibacco@aruba.it>
Antonio Di Bacco wrote:
> I don't manage to do some simple calculations like:
>
> echo $((1+1))
>
> Bye,
> Antonio
I've solved this with a new command 'eval' which is used to set a
variable based on an expression. For example, I wanted to determine the
start address of the kernel in flash for both 4 and 8meg parts but since
its sits above U-Boot in the memory map (and U-Boot has to be 1M down
from the top for high boot), it has to be calculated depending on the
flash size. In this case, the new variable 'kb' contains the address of
the beginning of the kernel of either 40340000 or 40740000 for either 4M
or 8M devices.
"eval kb $flash - c00c0000;" \
This is work I did a couple of years ago and I'm no longer on the
project so I'm not able to provide a 'formal' patch. To use it, put the
file cmd_eval.c into ...uboot/common/ and make the following mods
in cmd_confdefs.h add
#define CFG_CMD_EVAL 0x0080000000000000U /* Eval arithmetics */
in your board config add
#define CONFIG_COMMANDS ( ( CONFIG_CMD_DFL \
...............
| CFG_CMD_EVAL \
in ..../uboot/common/Makefile
COBJS = main.o ACEX1K.o altera.o bedbug.o \
............
cmd_eval.o
And that should be it.
I hope it helps...
--
Robin Gilks
Senior Design Engineer Phone: (+64)(3) 357 1569
Tait Electronics Fax : (+64)(3) 359 4632
PO Box 1645 Christchurch Email : robin.gilks at tait.co.nz
New Zealand
=======================================================================
This email, including any attachments, is only for the intended
addressee. It is subject to copyright, is confidential and may be
the subject of legal or other privilege, none of which is waived or
lost by reason of this transmission.
If the receiver is not the intended addressee, please accept our
apologies, notify us by return, delete all copies and perform no
other act on the email.
Unfortunately, we cannot warrant that the email has not been
altered or corrupted during transmission.
=======================================================================
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cmd_eval.c
Url: http://lists.denx.de/pipermail/u-boot/attachments/20060523/185a34b4/attachment.txt
next prev parent reply other threads:[~2006-05-23 0:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-22 20:14 [U-Boot-Users] Hush shell and simple calculations Antonio Di Bacco
2006-05-22 20:23 ` Wolfgang Denk
2006-05-23 0:08 ` Robin Gilks [this message]
2006-05-23 8:42 ` Wolfgang Denk
2006-05-23 16:00 ` Tolunay Orkun
2006-05-23 21:48 ` Robin Gilks
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=44725285.1030006@tait.co.nz \
--to=robin.gilks@tait.co.nz \
--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