All of lore.kernel.org
 help / color / mirror / Atom feed
From: Graeme Russ <graeme.russ@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] OMAP3/devkit8000 division/multiplication function problems
Date: Tue, 14 Jun 2011 22:06:14 +1000	[thread overview]
Message-ID: <4DF74EB6.6030206@gmail.com> (raw)
In-Reply-To: <BANLkTimfWtFPk7Ady1R+5828KvYQJ442YA@mail.gmail.com>

Hi Simon,

On 14/06/11 18:52, Simon Schwarz wrote:
> Hi List,
> 
> as some may know I'am working on an SPL for the devkit8000.
> Now I have a problem with the UART init where I hope someone on the
> list can help.

Are you working with a latest version of U-Boot? Do you have additional
modifications not yet posted/committed?

> 
> My problem is in drivers/serial/serial.c with the function
> calc_divisor. With my defines this function is essentially just this:
> return (CONFIG_SYS_NS16550_CLK + (gd->baudrate * (MODE_X_DIV / 2))) /
> (MODE_X_DIV * gd->baudrate);
> 
> (Where MODE_X_DIV=16)
> 
> If i try to execute this line (with the step instruction of
> gdb/openOCD) the debugger just does not return and I have to use
> Strg+c to get a prompt.

Have you tried returning a hard-coded value?

> 
> Then the PC is 0x4020ffd4 (upper region of SRAM) and the CPSR is 0x600001d7
> 
> I think I have some problem with the division/multiplication functions
> as there is nothing else in this line which may cause trouble (returns
> and function calls worked before).

The problem may actually be related to gd access. I have had a heap (no pun
intended) of trouble getting gd access right in the past. Is this the first
access to gd?

> 
> U-boot is running in SRAM no SDRAM init yet.

If this is indeed the first access to gd, you need to look at the location
of gd in SRAM and make sure it not being clobbered

> 
> Has someone an idea where I can start looking? Maybe a known pitfall
> for beginners? More information needed?

Try adding another temporary variable to gd (ulong temp for example) and in
calc_divisor do:

	ulong temp = gd->temp;
	gd->temp = 1;

and step through

I'm sure that if I am wrong, somebody else here will be of further assistance

Regards,

Graeme

  reply	other threads:[~2011-06-14 12:06 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-14  8:52 [U-Boot] OMAP3/devkit8000 division/multiplication function problems Simon Schwarz
2011-06-14 12:06 ` Graeme Russ [this message]
2011-06-14 14:08   ` Simon Schwarz
2011-06-14 14:10 ` Simon Schwarz
2011-06-14 15:00   ` Simon Schwarz
2011-06-15  8:55     ` Simon Schwarz

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=4DF74EB6.6030206@gmail.com \
    --to=graeme.russ@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.