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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/12/04 20:13
Read: times


 
#72432 - RE: (OT-ish) Why learn assembler ?
Responding to: ???'s previous message
Steve:
The article that you linked expresses my view point at least 110%. As I read it I could almost envision that I could have written it.

It also adds strength to my argument that no programmer should be permitted to write programs for microcontrollers in a higher level language like C until they have demonstrated fluency with assembly language on the same family of microcontroller type.

Going back to the PC environment for a moment....I find it inexcusable that programmers continue to produce products that just barely provide provide usable behavior on the latest state of the art PC. Case in point when Netscape Navigator came out in Version 4 I was using it on a 300 MHz PC and saw that it was somewhat slower than the previous version. I went to an older 100 MHz box and Netscape 4 took nearly 45 seconds to load. Another case....I updated from Adobe Acrobat Reader ver 5 to ver 6. The new version takes 5 - 6 times longer to display the first page of a document as before on my 933 MHz PC.

Back to microcontrollers....At a contract job I am currently working...I have taken over the code that a prior consulting company implemented for the company joystick product. The product uses Atmel AVR controllers and they had all PC boards designed and ready for production. The consultants were writing in C code and did not use an approach that would make the smallest code. They made code that was bigger than would fit in the 8K parts on the circuit boards and so they declared the PC boards as inadequate and suggested a re-design to 16K or 32K parts. (Not withstanding that the C code is a hell of a mess, developed on too short of a schedule, the consultants had to disable some key features to even get a prototype piece of hardware to run)!! I have taken over and using a thinking process and re-design process similar to an assembly language approach I have now gotton the code for two of the PC boards to run in the 8K parts with all features enabled. Another aspect of this project was that the previous mess of code may have fit by turning on the maximum optimization in the C compiler but when this was done the code didn't run and so they concluded that optimization could not be used. I found that I could user a higher level of optimization because being an experienced assembler programmer I am able to look critically at the machine language code in the debugger and see right away why certain code was written incorrectly such that the compiler had free will to change the program behavior. I corrected those errors and fully optimized code runs fine!!

Also note that I have watched quite a number of C only embedded programmers declare that they cannot debug problems in their code when the issues get down past the variable watch window and into the code dissasembly window of the debugger. And then the insist that they must debug with all code optimization turned off such that all code debug is being done on a different set of binaries than they intend to deliver.

I know that the same problems that have blighted PC software development, bloated code written too abstractly and being too dependent on the the blazing speed of the processor is beginning to infect embedded software development. Some programmers today are declaring that C code on a microcontroller is the only way to go because the processor runs at 50 MHz anyway. I would challenge one of these same programmers to write an application on an embedded microcontroller that runs at 32.768 KHz simply because the average current draw from the battery supply must less than 20 µA so that the battery can last 1.5 years. On a controller with an instruction code cycle rate that is 1/4 that of the clocking rate this results in a total of of 8192 instruction cycles per second!! Can you write a multi-tasking executive for such a product that scans a keypad, runs an I2C bus to a A/D and a EEPROM, keeps a display up to date, and runs the modulation to a small transmitter by writing that entirely in C? Most likely not!!!

Michael Karas


List of 11 messages in thread
TopicAuthorDate
(OT-ish) Why learn assembler ?            01/01/70 00:00      
   RE: (OT-ish) Why learn assembler ?            01/01/70 00:00      
      RE: (OT-ish) Why learn assembler ?            01/01/70 00:00      
   RE: (OT-ish) Why learn assembler ?            01/01/70 00:00      
   RE: (OT-ish) Why learn assembler ?            01/01/70 00:00      
      RE: (OT-ish) Why learn assembler ?            01/01/70 00:00      
         RE: (OT-ish) Why learn assembler ?            01/01/70 00:00      
         RE: (OT-ish) Why learn assembler ?            01/01/70 00:00      
      RE: (OT-ish) Why learn assembler ?            01/01/70 00:00      
   RE: (OT-ish) Why learn assembler ?            01/01/70 00:00      
      RE: (OT-ish) Why learn assembler ?            01/01/70 00:00      

Back to Subject List