Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
Per Westermark
09/21/11 02:50
Read: 896 times
Sweden


 
#183827 - Just don't kick in open doors
Responding to: Richard Erlacher's previous message
Yes, C can make programs larger.

But what is normally debated here, is that a very large percentage of people write lousy assembler, in which case they often fail to match the C compiler on size or speed. The average assembler programmer is not an expert with many years of assembler programming experience.

Next thing often debated, is that it is very hard to produce a complex program in assembler and get even close to the development times you would get with C. And development times and time-to-market are often more critical parameters than size of program.

Next thing often debated, is that a C program is way easier to modify, in case of changed customer requirements. And many customers don't have the skills to know what they want, until they have tested a prototype - or until they start to get feedback from real users.

And next thing often debated, is that a C program is way easier to move to a different processor, in case of changed customer requirements, or in case a new processor is released that would give a significant cost reduction. Today, many products have life cycles of 1-3 years. So you want to be able to take one step back, make a completely new analysis of suitable hardware (cheap for mass production) and then lift as much as possible of existing know-how into new hardware. Again, and again, and again.

Next thing often debated, is that the size difference between a program written in C or assember (or the speed differene) is normally so small that it doesn't make a difference in processor cost. The cost difference is way higher between similarly spec:ed processors from two different product families, than the cost difference is between two chips in the same family - one with extra flash or RAM. And a move to a newer processor family often gives more speed + memory at a lower current consumption and purchase price.

In my case, the issue wasn't cost of Mega48 or Mega88, but that the Mega88 had the release date significantly delayed. And fitting everything into half the space wasn't trivial just because of assembler - lots of not too nice tricks was needed. Tricks that makes it way harder for someone else to modify the code. A compiler can detect common tail code between different functions, and automatically make use of this. Same programming methods in assembler makes it very hard to modify the code - a change of function A will also affect function B that assumes that the code after a specific label should still perform the same thing, with the same register allocations.

The 8051 architecture is notoriously C-unfriendly. A general-purpose 32-bit core on the other hand is way more all-round, making it much easier for a compiler to produce extremely tight code. The compiler can perform brute-force optimizations (similar to looking n steps forward in chess) in a way that is hard for a human. We can write "clean" assembler code, but get into troubles when we have 32 general-purpose registers, to keep track of what is - at every single time - stored in them. And when is it most optimal to dump one of the registers into RAM to instead pick up other data (or switch to use the register as an index or pointer).

List of 76 messages in thread
TopicAuthorDate
AT89LP51xD2 ... coming?        Jan Waclawek      08/29/11 02:45      
   Sounds brilliant!      Andy Neil      08/29/11 03:25      
      Was it AVR who made low-quantity available? Or just spin-off      Per Westermark      08/29/11 05:18      
         Probably true      Andy Neil      08/29/11 07:25      
            Hobbyists and students are really important      Per Westermark      08/29/11 07:37      
               Also...      Andy Neil      08/29/11 07:42      
         That wasn't the only thing ...      Richard Erlacher      08/29/11 08:35      
            Assembler      Per Westermark      08/29/11 09:09      
               'LP simulator      Jan Waclawek      08/29/11 10:06      
                  Good      Per Westermark      08/29/11 10:15      
                  No ... I doubt he means that ...      Richard Erlacher      08/29/11 11:14      
               That may have been the case, but ...      Richard Erlacher      08/29/11 11:12      
               While that may be the case ...      Richard Erlacher      09/20/11 09:10      
                  Never used C - planned to but had to settle for half memsize      Per Westermark      09/20/11 09:54      
                     See ... 'C' can make the memory requirement greater      Richard Erlacher      09/20/11 19:56      
                        But it ain't *necessarily* so      Andy Neil      09/21/11 00:13      
                           Yes, that's a valid basis for the choice of 'C'      Richard Erlacher      09/22/11 10:59      
                        Just don't kick in open doors      Per Westermark      09/21/11 02:50      
                           Again, you may be totally correct about that ...      Richard Erlacher      09/22/11 11:14      
                        sure, and so friggin what if ...      Erik Malund      09/21/11 07:53      
                           well ... that's not exactly what I did ...      Richard Erlacher      09/22/11 11:33      
      On chip debug      Robert Revens      09/15/11 01:12      
         Why unlikely?      Per Westermark      09/15/11 01:26      
            That's true.      Robert Revens      09/15/11 02:01      
            Yes, that's what I meant!      Andy Neil      09/15/11 02:28      
         Missed the point!      Andy Neil      09/15/11 02:27      
            Ah, sorry.      Robert Revens      09/15/11 13:53      
   Single Clocker LP Chips From Atmel      Michael Karas      08/29/11 05:55      
   Samples      Andy Neil      08/29/11 07:44      
      Samples      Michael Karas      08/29/11 08:19      
         Samples      Andy Neil      09/02/11 02:47      
            Samples Not...      Michael Karas      09/02/11 05:30      
               they are good at that      Erik Malund      09/02/11 08:38      
               Atmel says...      Andy Neil      09/02/11 16:22      
               Samples Yes!!      Michael Karas      09/14/11 14:33      
                  Nothing here yet      Andy Neil      09/14/11 15:48      
                     you are not in the US      Jan Waclawek      09/15/11 12:07      
                        No excuse!      Andy Neil      09/15/11 12:55      
                        Envelope?      Michael Karas      09/15/11 18:29      
                      ... "coming" ...      Andy Neil      09/20/11 05:08      
                        Yet another missed opportunity.      Andy Neil      10/31/11 12:28      
                           Sorry thought this thread closed ...      Phillip M Gallo      10/31/11 13:11      
                              Now maybe you guys will see why I don't use 'em      Richard Erlacher      11/06/11 12:04      
                              hard to tell, but...      Jan Waclawek      11/07/11 01:45      
                                 They're thrashing about, but ...      Richard Erlacher      11/07/11 07:35      
                                    why the sigh ...        Erik Malund      11/07/11 07:52      
                                       Probably not ... but you never know ...      Richard Erlacher      11/08/11 09:58      
                                    datasheets      Jan Waclawek      11/07/11 15:25      
                                       I'm glad they're there ...      Richard Erlacher      11/08/11 10:00      
                                          Sad, but true.      Andy Neil      11/08/11 15:51      
                                             Too much "designers"      Per Westermark      11/08/11 16:03      
                                                it's that old bugaboo ... appearance over substance ...      Richard Erlacher      11/08/11 19:45      
                                                I'd say      Erik Malund      11/09/11 06:29      
                           "The part will only be available in about 3 weeks"      Andy Neil      11/09/11 14:36      
                              I've heard/read that comment from them before ...      Richard Erlacher      11/09/11 21:01      
                                 Common with delays for new chips        Per Westermark      11/10/11 03:26      
                                    Quite so!      Andy Neil      11/10/11 12:21      
                                    I have to remind the public-at-risk      Richard Erlacher      11/11/11 14:19      
                                       Again      Per Westermark      11/11/11 14:41      
                                          There's a purpose ...      Richard Erlacher      11/11/11 23:34      
                                 I agree with Per !!        Michael Karas      11/10/11 06:15      
                                    Not so, but it probably applies to every one of ATMEL's      Richard Erlacher      11/11/11 14:23      
                           samples      Jan Waclawek      12/07/11 22:43      
                              I tested...      Michael Karas      12/08/11 04:42      
                                 The AT89LP4052 works very well      David Prentice      12/08/11 09:33      
                                    Looks good, so far, eh?      Richard Erlacher      12/08/11 10:02      
                                       A typical op      David Prentice      12/08/11 12:11      
                                          singleclockers      Jan Waclawek      12/08/11 15:48      
                                          impressive      Maarten Brock      12/10/11 03:20      
                                             I will wait and see.      David Prentice      12/10/11 09:40      
                                                Transistors are cheap      Per Westermark      12/10/11 13:06      
                                          I can't find that      Jan Waclawek      12/11/11 09:41      
                                             Sorry. I thought it was unlikely.      David Prentice      12/11/11 10:19      
                                                copy/paste      Jan Waclawek      12/11/11 15:02      
                                 thanks      Jan Waclawek      12/08/11 11:23      
                              Have you received those samples, Andy?      Andy Neil      12/09/11 03:52      

Back to Subject List