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 13:23:00 -0000 [thread overview]
Message-ID: <20110822132324.D41D92F78001@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
--- Comment #11 from Ilija Kocho <ilijak@siva.com.mk> 2011-08-22 14:23:22 BST ---
(In reply to comment #9)
> (In reply to comment #8)
> > Sergei
> >
> > I did testing and I have working code, but I would postpone patch
> > generation because of the question below.
> >
> > (In reply to comment #6)
> > > (In reply to comment #5)
> > > > (In reply to comment #4)
> > > > Personally I would like CYGARC_SWAPxx(), but since CYG_SWAPxx() are
> > > > already present in hal_endian.h let's use them. It will propagate REV
> > > > instructions in other parts of code that may benefit (i guess it is
> > > > safe).
> >
> > hal_endian.h has a provision CYGBLD_HAL_ENDIAN_H for include of
> > architecture specific CYGARC_SWAPxx(). This is what I put in
> > hal_cortexm.cdl:
> >
> > define_proc {
> > puts $::cdl_system_header "#define CYGBLD_HAL_ENDIAN_H \
> > <cyg/hal/cortexm_endian.h>"
> > }
> >
>
> I like it, this is a great find!
>
> If I understood you correctly you again returned back to CYGARC prefix
> for macros. If it is not a typo then I would add below those definitions
> (CYGARC_SWAPxx macros) in ``cortexm_endian.h'' the same check and far
> definitions (overrides)
It is a my mistake:( sorry, CYG_SWAPxx() it should be.
[snip (as it is consequence to my error)]
>
> and add such CDL option in Cortex-M config file. Well, used name of the
> option is for demo only. Thus, users can rid fast inlines if they want.
>
> > Now cortexm_endian.h is a new header that contains the CYGARC_SWAPxx()
> > macros and corresponding inline functions. I added this file in order
> > to avoid include of complete hal_arch.h
> >
Here is cortexm_endian.h snippet:
#include <cyg/hal/cortexm_regs.h>
static __inline__ cyg_uint32 cyg_hal_swap32(cyg_uint32 original)
{
cyg_uint32 swapped;
CYGARC_REV(swapped, original);
return swapped;
}
static __inline__ cyg_uint16 cyg_hal_swap16(cyg_uint16 original)
{
cyg_uint16 swapped;
CYGARC_REV16(swapped, original);
return swapped;
}
#define CYG_SWAP32(__val) cyg_hal_swap32(__val)
#define CYG_SWAP16(__val) cyg_hal_swap16(__val)
> > For me it is OK to add this header in arch/include but there may be a
> > better proposal. Please comment.
> >
> > Ilija
>
> So, with your proposal we can leave hal_arch.h without any changes. Did
> you mean it? I read so and I guess that we have to manage the definition
> of LWIP_PLATFORM_BYTESWAP from configtool. In ideal world this value must
> be defined from lwip config file, e.g.
I can see 2 options:
Option 1. We include cortexm_endian.h in hal_arch.h (that's what i have
tested).
here are all changes to hal_arch.h:
diff -u -r1.3 hal_arch.h
--- hal_arch.h 13 Feb 2009 17:04:18 -0000 1.3
+++ hal_arch.h 22 Aug 2011 12:45:24 -0000
@@ -55,6 +55,9 @@
#include <cyg/hal/var_arch.h>
+#include <cyg/hal/cortexm_regs.h>
+#include <cyg/hal/cortexm_endian.h>
+
Option 2. Probably we can include hal_endian.h in lwipots.h (not tested).
My vote is for Option 1. since it would propagate cortexm_endian.h everywhere
(for better, or for worse) Cortex-M is used.
>
> 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?
If you agree with adding cortexm_endian.h and #include it in hal_arch.h I could
submit patches for review.
Ilija
--
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.
next prev parent reply other threads:[~2011-08-22 13:23 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 [this message]
2011-08-22 13:36 ` bugzilla-daemon
2011-08-22 14:24 ` bugzilla-daemon
2011-08-22 16:45 ` bugzilla-daemon
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=20110822132324.D41D92F78001@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).