public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Error when write a uint32 with not aligned pointer.
@ 2007-02-12  5:34 wang cui
  2007-02-12 12:13 ` Gary Thomas
  0 siblings, 1 reply; 3+ messages in thread
From: wang cui @ 2007-02-12  5:34 UTC (permalink / raw)
  To: ecos-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312; format=flowed, Size: 1064 bytes --]

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)

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

Thanks in advance!

_________________________________________________________________
Ãâ·ÑÏÂÔØ MSN Explorer:   http://explorer.msn.com/lccn  


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] Error when write a uint32 with not aligned pointer.
  2007-02-12  5:34 [ECOS] Error when write a uint32 with not aligned pointer wang cui
@ 2007-02-12 12:13 ` Gary Thomas
  0 siblings, 0 replies; 3+ messages in thread
From: Gary Thomas @ 2007-02-12 12:13 UTC (permalink / raw)
  To: wang cui; +Cc: ecos-discuss

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ECOS] Error when write a uint32 with not aligned pointer.
@ 2007-02-13  2:24 wang cui
  0 siblings, 0 replies; 3+ messages in thread
From: wang cui @ 2007-02-13  2:24 UTC (permalink / raw)
  To: gary; +Cc: ecos-discuss

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=gb2312; format=flowed, Size: 638 bytes --]

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

Well, actually, TCP/IP stacks are fine, I faced this problem when I use 
vnc_server package.
It does cause problem on my target. So I have to modify it.
See patch please.

>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.

Ok, got it!

_________________________________________________________________
Ãâ·ÑÏÂÔØ MSN Explorer:   http://explorer.msn.com/lccn/  

[-- Attachment #2: vnc_server.patch.gz --]
[-- Type: application/x-gzip-compressed, Size: 2993 bytes --]

[-- Attachment #3: Type: text/plain, Size: 148 bytes --]

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-02-13  2:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-12  5:34 [ECOS] Error when write a uint32 with not aligned pointer wang cui
2007-02-12 12:13 ` Gary Thomas
2007-02-13  2:24 wang cui

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).