public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
From: bugzilla-daemon@bugs.ecos.sourceware.org
To: ecos-patches@ecos.sourceware.org
Subject: [Bug 1001275] Cortex-M (armV7) architecture endian instructions / Applied on lwIP
Date: Mon, 22 Aug 2011 16:45:00 -0000	[thread overview]
Message-ID: <20110822164446.53C792F78001@mail.ecoscentric.com> (raw)
In-Reply-To: <bug-1001275-104@http.bugs.ecos.sourceware.org/>

Please do not reply to this email. Use the web interface provided at:
http://bugs.ecos.sourceware.org/show_bug.cgi?id=1001275

Ilija Kocho <ilijak@siva.com.mk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Attachment #1299|0                           |1
        is obsolete|                            |

--- Comment #14 from Ilija Kocho <ilijak@siva.com.mk> 2011-08-22 17:44:42 BST ---
Created an attachment (id=1345)
 --> (http://bugs.ecos.sourceware.org/attachment.cgi?id=1345)
Cortex-M architecture endian.

(In reply to comment #13)

Here I submit Cortex-M architectural patches. I took the liberty to put/leave
some additional instructions  in cortexm_regs.h (that I am using for Kinetis
port). They are CPSID and CPSIE. I hope they will be accepted but if reviewers
find that they are too off-topic they may be removed.

> (In reply to comment #11)
> In opposite I would avoid from "Option 1". Usually <hal>_regs.h, and
> hal_endian.h include inself from hal_io.h, and hal_misc.c. I liked you
> find, because I thought, Great! We do not need hack hal_arch.h :-) I
> would vote for "Option 2" and that is what I did mean in my comment 9.

Now I agree. Patch follows the Option 2.

> 
> > > to add into lwip_net.cdl:
> > > 
> > > cdl_option CYGBLD_LWIP_HTONS_HTONL_INLINED {
> > >   default_value 0
> > > }
> > > 
> > 
> > In either case we don't need CDL. Following is what I have tested (a
> > patch to your input) :
> > 
> > > to add into lwipopts.h:
> > > 
> > > #if CYGPKG_LWIP_HTONS_HTONL_INLINED
> > -#if CYGPKG_LWIP_HTONS_HTONL_INLINED
> > 
> > > # include <cyg/hal/hal_endian.h>
> > +#ifdef CYG_SWAP32
> > > # define LWIP_PLATFORM_BYTESWAP 1
> > > # define LWIP_PLATFORM_HTONS(__val) CYG_SWAP16(__val)
> > > # define LWIP_PLATFORM_HTONL(__val) CYG_SWAP32(__val)
> > > #endif
> > > 
> > > What do you think?
> 
> I see. However, in such case you make lwip stack use only the inlined
> versions for htonX(s). I have a doubt about such a forcing. What is a
> bad with CDL option?

Sergei, now I see, you want to provide the user with choice between standard
and /architecture optimized/ endian functions.

It makes sense, but IMHO that, when available, /architecture optimized/
functions should be enabled by default.

It is likely that we shall need to add CDL options in both lwIP (bool) and in
architecture's CDL (provider of default value for lwIP).
For arch name I would propose something like CYGxxx_HAL_ARCH_ENDIAN where xxx
could be {PKG, OPT, BLD, INT}, and for lwIP - CYGxxx_LWIP_ENDIAN_BY_HAL.

At the end, for reference, here are lwip modifications (as are now) with which
I have tested. Please note that now I am using CYG_CPU_TO_BExx macros, also
defined in hal_endian.h and they consider existence of big endians.

diff -u -r1.8 lwipopts.h
--- current/include/lwipopts.h    31 Jan 2011 21:52:32 -0000    1.8
+++ current/include/lwipopts.h    22 Aug 2011 16:23:38 -0000
@@ -35,6 +35,7 @@
 #include <pkgconf/net_lwip.h>

 #include <cyg/hal/hal_arch.h>
+#include <cyg/hal/hal_endian.h>

 //-------------------------------------------------------------------
 // Platform specific locking
@@ -44,6 +45,16 @@
 #define NO_SYS                      defined(CYGFUN_LWIP_MODE_SIMPLE)

 //-------------------------------------------------------------------
+// Architecture specific options
+//--------------------------------------------------------------------
+
+#if defined(CYG_CPU_TO_BE16) && defined(CYG_CPU_TO_BE32)
+# define LWIP_PLATFORM_BYTESWAP 1
+# define LWIP_PLATFORM_HTONS(__val) CYG_CPU_TO_BE16(__val)
+# define LWIP_PLATFORM_HTONL(__val) CYG_CPU_TO_BE32(__val)
+#endif // defined(CYG_CPU_TO_BE16(__val)) && defined(CYG_CPU_TO_BE32(__val))
+
+//-----------------------------------------------------------------
 // Memory options
 //----------------------------------------------------------------

-- 
Configure bugmail: http://bugs.ecos.sourceware.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

  parent reply	other threads:[~2011-08-22 16:45 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-03 17:46 [Bug 1001275] New: Cortex-M (armV7) architecture endian instructions / lwIP bugzilla-daemon
2011-07-03 17:52 ` [Bug 1001275] " bugzilla-daemon
2011-07-03 17:56 ` [Bug 1001275] Cortex-M (armV7) architecture endian instructions / Applied on lwIP bugzilla-daemon
2011-08-15 20:17 ` bugzilla-daemon
2011-08-17 20:26 ` bugzilla-daemon
2011-08-18 21:14 ` bugzilla-daemon
2011-08-19  8:41 ` bugzilla-daemon
2011-08-19 15:09 ` bugzilla-daemon
2011-08-19 15:18 ` bugzilla-daemon
2011-08-21 13:46 ` bugzilla-daemon
2011-08-22 12:10 ` bugzilla-daemon
2011-08-22 13:01 ` bugzilla-daemon
2011-08-22 13:23 ` bugzilla-daemon
2011-08-22 13:36 ` bugzilla-daemon
2011-08-22 14:24 ` bugzilla-daemon
2011-08-22 16:45 ` bugzilla-daemon [this message]
2011-08-22 18:26 ` bugzilla-daemon
2011-08-23 13:27 ` bugzilla-daemon
2011-08-23 13:32 ` bugzilla-daemon
2011-08-23 14:18 ` bugzilla-daemon
2011-08-23 16:14 ` bugzilla-daemon
2011-08-23 16:17 ` bugzilla-daemon
2011-08-23 16:19 ` bugzilla-daemon
2011-08-23 16:21 ` bugzilla-daemon
2011-08-23 19:27 ` bugzilla-daemon
2011-08-23 20:15 ` bugzilla-daemon
2011-08-23 20:47 ` bugzilla-daemon
2011-08-24  6:51 ` bugzilla-daemon
2011-08-24  7:08 ` bugzilla-daemon
2011-08-24 13:34 ` bugzilla-daemon
2011-08-24 13:47 ` bugzilla-daemon
2011-08-24 16:43 ` bugzilla-daemon
2011-08-24 17:01 ` bugzilla-daemon
2011-08-24 17:56 ` bugzilla-daemon
2011-08-25  8:02 ` bugzilla-daemon
2011-08-25  8:20 ` bugzilla-daemon
2011-08-25 14:04 ` bugzilla-daemon

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=20110822164446.53C792F78001@mail.ecoscentric.com \
    --to=bugzilla-daemon@bugs.ecos.sourceware.org \
    --cc=ecos-patches@ecos.sourceware.org \
    /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).