public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Gary Thomas <gary@mlbassoc.com>
To: wang cui <iucgnaw@msn.com>
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] Error when write a uint32 with not aligned pointer.
Date: Mon, 12 Feb 2007 12:13:00 -0000	[thread overview]
Message-ID: <45D059CF.6090109@mlbassoc.com> (raw)
In-Reply-To: <BAY110-F394881B34368D14FD3F676A5910@phx.gbl>

wang cui wrote:
> Hi, compiler and ARM experts:
>
> I am faceing a problem like below:
>
> Arch of my target is arm7tdmi(lpc2xxx), little endian.
>
> When I use a (cyg_uint32 *)ptr to write a 32bit value, it always error
> if the ptr is not 4-byte aligned.
>
> For example:
> ptr = 0x8106409a;
> *ptr = 0x00000001;
>
> The result is not like:
> 0x81064098: 0xXX - shouldn't be modified
> 0x81064099: 0xXX - shouldn't be modified
> 0x8106409a: 0x01
> 0x8106409b: 0x00
> 0x8106409c: 0x00
> 0x8106409d: 0x00
> but
> 0x81064098: 0x01
> 0x81064099: 0x00
> 0x8106409a: 0x00
> 0x8106409b: 0x00
> 0x8106409c: 0xXX - should be modified
> 0x8106409d: 0xXX - should be modified
>
> It always cause problem when I use tcpip stack.(not cause problem for
> other packages with luck)

How so? The TCP/IP stacks should take care to never try this.

>
> So how to solve it? Should I modify some compiling options?

This is a well known problem on ARM; such operations are undefined (some
chips/cores
may throw an exception, but in general they just quietly do the wrong
thing). The only
real solution is to just not try to perform unaligned operations of this
sort.

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

  reply	other threads:[~2007-02-12 12:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-12  5:34 wang cui
2007-02-12 12:13 ` Gary Thomas [this message]
2007-02-13  2:24 wang cui

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=45D059CF.6090109@mlbassoc.com \
    --to=gary@mlbassoc.com \
    --cc=ecos-discuss@sources.redhat.com \
    --cc=iucgnaw@msn.com \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).