cancel
Showing results for 
Search instead for 
Did you mean: 

C vs. assembly

matic
Associate III
Posted on November 07, 2015 at 21:15

Hi. I'm interested in that how you are programming - in C or in assembly language?

What are really benefits of assembly in contrast to C? Speed of code execution probably? How much faster it is, if you compare the same code written in assembly with that written in C with enabled all of optimization (level 3 in Keil and checked ''optimize for time'').

Also, when you move from one core to another (let say from Cortex M3 to M4), you have to learn many new instructions, don't you?

#32-bits-of-a-bus #assembly-language
13 REPLIES 13
jpeacock
Associate III
Posted on November 09, 2015 at 19:31

Late 40s?  By then no one even learned how to ''write'' machine language with front panel toggle switches.  Real programmers had bleeding fingertips....

Assembler was great when it was all there was, but as soon as C came along (and Bliss before it for old time PDP-10/20 systems programmers), and enough memory to make it useful, it took too much time to type in assembler code.  Does anyone even care about instruction set architectures anymore, other than as an esoteric comp-sci theoretical study?  Outside of compiler writers and virtual machines the only place I see for assembly are those small, hand optimized speedups for graphics or DSP.

C was a great invention, but it needed the explosion in memory capacity to really work for embedded.  That's one of the best points for switching to ARM, a 32-bit address.  Another 10 or 15 years the 8051, PIC, AVR and all the other 8/16 bitters will be quaint museum exhibits, sitting next to Bendix G-15s and PDP-8s.

  Jack Peacock
Posted on November 09, 2015 at 20:35

Another 10 or 15 years the 8051, PIC, AVR and all the other 8/16 bitters will be quaint museum exhibits, sitting next to Bendix G-15s and PDP-8s.

They've been telling me that for decades, the university here is still using the 68HC11 as a teaching tool, I suspect the only way to fix that is to replace the old profs with some more industry savvy ones who've been learning new skills rather than unearthing silicon antiquities.

https://www.youtube.com/watch?v=dPmiC_Zt88I

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
mikael239955_stm1_st
Associate III
Posted on November 09, 2015 at 23:11

>I'd prefer a M4/M7 any day.... > IMHO the dsPIC was a particularly bad example.

Didn't say dsPIC was the solution, just mentioned it for what it was in it's day compared to what STM (F100,102, 103) could deliver in that point of time Hz by Hz in an environment of C vs ASM to OP's question. Obviously everything else at 400Mhz TODAY makes dsPIC sort of antique. 

Oh Forum motor destroyed post order,,,again!
AvaTar
Lead
Posted on November 10, 2015 at 08:59

>Didn't say dsPIC was the solution, just mentioned it for what it was in it's day compared to what STM (F100,102, 103) could deliver ...

 

At least I also understood it in that way.

With ''bad example'' I especially meant Microchip's half-assed C language support. IMHO it seems they have strained themself with their ''everything but ARM'' strategy and incoherent MCU/core portfolio. DSP's definitely have their ''raison d'etre'', when properly supported. And there are plenty of vendors who are much better in this regard.