Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.embedded > #82

Re: Reading the Riot Act To ARM's developers

Date 2012-02-08 21:37 +0100
From David Brown <david.brown@removethis.hesbynett.no>
Newsgroups comp.os.linux.advocacy, comp.os.linux.embedded
Subject Re: Reading the Riot Act To ARM's developers
References <WGiYq.100467$WX2.28685@newsfe28.ams2> <02c9e013-9c6b-4270-8b82-c7d16b51269c@sw7g2000pbc.googlegroups.com> <i3AYq.10307$as3.6991@newsfe27.ams2>
Message-ID <x_KdnVX1OrdqQa_SnZ2dnUVZ8oCdnZ2d@lyse.net> (permalink)

Cross-posted to 2 groups.

Show all headers | View raw


On 08/02/12 20:29, 7 wrote:
> cassiope wrote:
>
>> On Feb 7, 3:43 pm, 7
>> <email_at_www_at_enemygadgets_dot_...@enemygadgets.com>  wrote:
>>> Reading the Riot Act To ARM's developers
>>> ----------------------------------------
>>>
>>> I've had the pleasure of writing some ARM code
>>> lately and honestly guys it sucks.
>>>
>>> Coming from the world of PICs, where every register
>>> and flag bit has a name and a data structure that
>>> can be used to access it, by comparison ARM code especially
>>> the CMIS library code is just utter utter purile crap.
>>>
>>> Typically the CMSIS library forces you to write code
>>> using hard coded numbers. So you want to set some flag
>>> to enable an interrupt it would read something like
>>>
>>> SYSCON->INT |= (1<<4)
>>>
>>> Here is the crunch, who the hell is going to know if
>>> its the 4th bit or the 14th bit when you got a million
>>> of these lines of code?
>>>
>>> Shortest possible answer NOBODY. Not even you!!!!!!!!!
>>>
>>> And then you change CPU, and something changes in hardware,
>>> how will you know what to look for - you gonna
>>> search for "4" all throughout the code?????
>>>
>>> Sheesh!!
>>>
>>> And what about mis-use of #defines in C sample code?
>>> Why would anyone in their right mind put xtal frequency
>>> #define in a .c file unless you are too stupid to
>>> know that it should be in a header file???
>>>
>>> At least if its in a .h file, you could #undefine it before using
>>> it and #define it to change the frequency without touching any
>>> C code that relied on it. But no, you now have go
>>> around modifying .c reference files because the #define
>>> is used immediately after its definition.
>>>
>>> doh!!!!!!!!!!!!!!
>>>
>>> The toe rags who wrote the CMSIS files are the most irresponsible
>>> idiots out there.
>>>
>>> The code that others write have to use the CMSIS libraries
>>> but if the data structures in CMSIS libraries are crap, then
>>> the resulting code built on that pile is also a pile of crap.
>>>
>>> There should a data structure somewhere in the CMSIS file for each
>>> CPU that uniquely references all registers and ALL FLAGS. At the
>>> moment it only accesses the registers unambiguously and that is
>>> extremely dangerous for building low maintenance overhead code on top.
>>>
>>> Typically for a PIC I can modify a 500k of c code to a different
>>> CPU in about 1 day by changing one file that converts between
>>> all the different hardware definitions to registers.
>>> I can do that, because everything from flags to registers have a name
>>> and all editing is highly verbose.
>>>
>>> If I try this with CMSIS, all I got are numbers. And it would take
>>> an infinite amount of time checking what all those numbers mean
>>> with a data sheet and what they are supposed to do
>>> when a new CPU is swapped in
>>> with different pinouts and register names.
>>>
>>> If I use my own names for the flags by imposing similar
>>> structures to that of PIC compiler, that code
>>> will not be compatible with other engineers who will use
>>> completely different names for the same flags.
>>>
>>> No wonder then the programmers who write CMSIS library
>>> should be rounded up and shot. They are useless and should
>>> be told that.
>>
>> Huh?  Did you neglect to write an include file that maps your chosen
>> port/pin names to their integer equivalents, and then use those names?
>
>
> 2 paragraphs above your comment:
>
> If I use my own names for the flags by imposing similar
> structures to that of PIC compiler, that code
> will not be compatible with other engineers who will use
> completely different names for the same flags.
>

I haven't used CMSIS myself, but I took a brief look at the headers for 
a sample application using CMSIS (for an STM32f10x).  The CM3 core 
header didn't seem to contain the bit numbering - but instead it 
provides accessor functions for the fields (mostly as static inline 
functions), so that you don't need to use magic numbers.  The 
vendor-specific include files had plenty of bit numbers and bit masks.

You keep talking about "the PIC compiler" as though that made sense - 
there are several different PIC architectures, and lots of compilers, 
with lots of header files, each written in their own way.  You also talk 
about "structures" - I'm guessing you mean that their headers define bit 
layouts using bitfields.  This is well-known to be a risky technique, 
especially on the ARM - compilers typically have the choice between 
implementing them with potentially wrong code, or else very inefficient 
code.  That is why it is more common to use explicit bit mask code 
(preferably with pre-defined values rather than magic numbers).

Back to comp.os.linux.embedded | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-07 23:43 +0000
  Re: Reading the Riot Act To ARM's developers cassiope <fpm@u.washington.edu> - 2012-02-08 09:51 -0800
    Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-08 19:29 +0000
      Re: Reading the Riot Act To ARM's developers David Brown <david.brown@removethis.hesbynett.no> - 2012-02-08 21:37 +0100
        Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-08 21:52 +0000
          Re: Reading the Riot Act To ARM's developers "Arie de Muynck" <nospam@nospam.com> - 2012-02-09 08:09 +0100
            Re: Reading the Riot Act To ARM's developers David Brown <david@westcontrol.removethisbit.com> - 2012-02-09 10:50 +0100
              Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-09 21:51 +0000
                Re: Reading the Riot Act To ARM's developers "Ezekiel" <zeke@nosuchemail.com> - 2012-02-10 15:41 -0500
          Re: Reading the Riot Act To ARM's developers "Ezekiel" <zeke@nosuchemail.com> - 2012-02-09 07:44 -0500
          Re: Reading the Riot Act To ARM's developers Bob Hauck <postmaster@avalanche.org> - 2012-02-09 08:28 -0500
            Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-09 23:38 +0000
              Re: Reading the Riot Act To ARM's developers David Brown <david@westcontrol.removethisbit.com> - 2012-02-10 09:26 +0100
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-10 19:51 +0000
                Re: Reading the Riot Act To ARM's developers David Brown <david.brown@removethis.hesbynett.no> - 2012-02-10 21:51 +0100
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-10 23:37 +0000
                Re: Reading the Riot Act To ARM's developers Grant Edwards <invalid@invalid.invalid> - 2012-02-13 15:11 +0000
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-13 21:30 +0000
    Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-08 19:29 +0000
      Re: Reading the Riot Act To ARM's developers Kelsey Bjarnason <kbjarnason@gmail.com> - 2012-02-10 21:25 -0800
        Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-11 09:27 +0000
  Re: Reading the Riot Act To ARM's developers Kelsey Bjarnason <kbjarnason@gmail.com> - 2012-02-10 21:22 -0800
    Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-11 09:58 +0000
      Re: Reading the Riot Act To ARM's developers David Brown <david.brown@removethis.hesbynett.no> - 2012-02-11 15:16 +0100
        Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-12 00:56 +0000
          Re: Reading the Riot Act To ARM's developers David Brown <david.brown@removethis.hesbynett.no> - 2012-02-12 10:24 +0100
            Re: Reading the Riot Act To ARM's developers "Ezekiel" <zeke@nosuchemail.com> - 2012-02-12 08:21 -0500
            Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-12 19:12 +0000
              Re: Reading the Riot Act To ARM's developers Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2012-02-13 08:54 +0200
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-13 21:37 +0000
                Re: Reading the Riot Act To ARM's developers Grant Edwards <invalid@invalid.invalid> - 2012-02-13 22:07 +0000
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-13 23:31 +0000
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-13 23:31 +0000
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-13 23:31 +0000
                Re: Reading the Riot Act To ARM's developers Peter Köhlmann <peter-koehlmann@t-online.de> - 2012-02-14 10:35 +0100
                more troll spew from eternal-september.org 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-14 11:27 +0000
                Re: more troll spew from eternal-september.org Peter Köhlmann <peter-koehlmann@t-online.de> - 2012-02-14 13:17 +0100
                Re: more troll spew from eternal-september.org Big Steel <SteelOne@SteelOne.com> - 2012-02-14 07:55 -0500
                Re: more troll spew from eternal-september.org GreyCloud <mist@cumulus.com> - 2012-02-14 11:18 -0700
                Re: more troll spew from eternal-september.org GreyCloud <mist@cumulus.com> - 2012-02-14 11:18 -0700
                Re: more troll spew from eternal-september.org Foster <frankfoster50@yahoo.com> - 2012-02-14 09:09 -0500
                Re: Reading the Riot Act To ARM's developers Foster <frankfoster50@yahoo.com> - 2012-02-14 08:38 -0500
                Re: Reading the Riot Act To ARM's developers GreyCloud <mist@cumulus.com> - 2012-02-14 11:19 -0700
                Re: Reading the Riot Act To ARM's developers GreyCloud <mist@cumulus.com> - 2012-02-14 11:17 -0700
                Re: Reading the Riot Act To ARM's developers Peter Köhlmann <peter-koehlmann@t-online.de> - 2012-02-14 21:50 +0100
                Re: Reading the Riot Act To ARM's developers GreyCloud <mist@cumulus.com> - 2012-02-14 15:42 -0700
                Re: Reading the Riot Act To ARM's developers Peter Köhlmann <peter-koehlmann@t-online.de> - 2012-02-14 23:56 +0100
                more troll spew 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-14 22:34 +0000
                Re: more troll spew GreyCloud <mist@cumulus.com> - 2012-02-15 00:12 -0700
                Re: more troll spew Foster <frankfoster50@yahoo.com> - 2012-02-15 08:29 -0500
                Re: more troll spew GreyCloud <mist@cumulus.com> - 2012-02-15 11:22 -0700
                Re: more troll spew 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-15 23:03 +0000
                Re: more troll spew Foster <frankfoster50@yahoo.com> - 2012-02-15 18:07 -0500
                Re: more troll spew GreyCloud <mist@cumulus.com> - 2012-02-15 16:36 -0700
                Re: more troll spew GreyCloud <mist@cumulus.com> - 2012-02-15 16:34 -0700
                Re: Reading the Riot Act To ARM's developers Kelsey Bjarnason <kbjarnason@gmail.com> - 2012-02-14 20:06 -0800
                Re: Reading the Riot Act To ARM's developers chrisv <chrisv@nospam.invalid> - 2012-02-15 07:20 -0600
                Re: Reading the Riot Act To ARM's developers "Ezekiel" <zeke@nosuchemail.com> - 2012-02-15 11:20 -0500
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-15 20:15 +0000
                Re: Reading the Riot Act To ARM's developers "Ezekiel" <zeke@nosuchemail.com> - 2012-02-15 15:26 -0500
                Re: Reading the Riot Act To ARM's developers Peter Köhlmann <peter-koehlmann@t-online.de> - 2012-02-15 21:38 +0100
                more troll spew 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-15 22:56 +0000
                Re: more troll spew Foster <frankfoster50@yahoo.com> - 2012-02-15 18:00 -0500
                Re: more troll spew Peter Köhlmann <peter-koehlmann@t-online.de> - 2012-02-16 00:06 +0100
                Re: more troll spew Snit <usenet@gallopinginsanity.com> - 2012-02-15 16:28 -0700
                Re: more troll spew 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-16 19:48 +0000
                Re: more troll spew Peter Köhlmann <peter-koehlmann@t-online.de> - 2012-02-16 20:57 +0100
                Re: more troll spew cc <scatnubbs@hotmail.com> - 2012-02-16 12:10 -0800
                Re: more troll spew 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-16 20:43 +0000
                Re: more troll spew Peter Köhlmann <peter-koehlmann@t-online.de> - 2012-02-16 21:45 +0100
                Re: more troll spew 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-16 21:20 +0000
                Re: more troll spew Big Steel <SteelOne@SteelOne.com> - 2012-02-15 19:37 -0500
              Re: Reading the Riot Act To ARM's developers David Brown <david@westcontrol.removethisbit.com> - 2012-02-13 09:12 +0100
      Re: Reading the Riot Act To ARM's developers Kelsey Bjarnason <kbjarnason@gmail.com> - 2012-02-11 10:34 -0800
      Re: Reading the Riot Act To ARM's developers Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-02-25 10:18 +0200
        Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-25 19:34 +0000
          Re: Reading the Riot Act To ARM's developers Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-02-27 15:52 +0200
            Re: Reading the Riot Act To ARM's developers David Brown <david.brown@removethis.hesbynett.no> - 2012-02-27 22:04 +0100
              Re: Reading the Riot Act To ARM's developers Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-03-03 02:04 +0200
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-03-03 00:20 +0000
                Re: Reading the Riot Act To ARM's developers GreyCloud <cumulus@mist.com> - 2012-03-03 00:06 -0700
                Re: Reading the Riot Act To ARM's developers Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-03-03 15:22 +0200
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-03-04 12:28 +0000
                Re: Reading the Riot Act To ARM's developers "Ezekiel" <zeke@nosuchemail.com> - 2012-03-04 09:15 -0500
                Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-03-04 21:29 +0000
            While( Ch ) if ( Ch‑1 <= 32 ) *P -= 32 ;  Jeff-Relf.Me <x@x.Invalid> - 2012-02-28 05:52 -0800
              Re: While( Ch ) if ( Ch‑1 <= 32 ) *P -= 32 ;  Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2012-03-03 02:09 +0200
        Re: Reading the Riot Act To ARM's developers 7 <email_at_www_at_enemygadgets_dot_com@enemygadgets.com> - 2012-02-25 19:34 +0000

csiph-web