Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

hardware is still coded with machine/assembly language for efficiency, speed, etc.

Status
Not open for further replies.
RichThe Dude, your statement as follows,

I have already stated my stance – development time is far more important to me, hence I use C. I use assembly for optimisation where needed, and nowhere else.

If your programming in C is so great why do you have to waste time optimizing your program with assembly programming when you should have done it right in the first place?

Basically what you are telling us is that without assembly programming you would be lost, development time would skyrocket.

jlpelect5

You have completely missed the point, if you are stuck to a CPU (which is common in small companies due to incompetent management) then you have no option but to use a mixture of C and assembly where needs be, but I would never suggest it to the hobbyist!

And the example of the FFT I posted about earlier is further proof of stupid reliance on one toolset, one underpowered micro and assembly. It took about 2 or 3 weeks to optimise the system – for a one off sale. Upgrading to a better DSP module would have cost a few hundred pounds. We could have used the code pretty much as is and saved 3 weeks’ worth of 3 engineers salary, costs of being late, costs of not moving onto new developments, etc etc. Your telling me a few hundred pounds is worth more than the associated costs of using assembly ? I would hate for you to be my accountant! :p

I still make nice instruments, but my new boss is far more competent and hence allows the use of whatever is needed to get the job done quickly. It makes no sense at all to optimise and use assembly for low volume sales - Just buy a better micro/cpu/dsp! I have yet to use assembly since leaving my previous job, and so far everything has been on time :)

Plus real computer scientists make advancements by altering the algorithm rather than the implementation of said algorithm.
 
Last edited:
3vo,

If ASM is all we need why have so many people written so many languages over oh so many years?

Good question. It is a triumph of quantity over quality. You can teach people HL faster than Assembler. That assures more scat will get kicked out the door faster, but it won't be better quality than Assembler.

Ratch
 
RichTheDude,

Sorry if I offended you by my comments, and I understand what you you are saying about working with what you are given and management expects miracles.

Getting back to programming for ppl that want to get into new technology (microcontrollers), Assembly programming is a much more english based language that is a more understanding of the hardware. Learning the debugging part of the IDE will open your eyes to what is really going on. This part of programming the is very educational.

I know that there are ppl that think that you have to write millions of lines of code to try to achieve the same thing with hll but you have to take into considerations the leap we have taken in technology.

jlpelect5
 
3vo,

Good question. It is a triumph of quantity over quality. You can teach people HL faster than Assembler. That assures more scat will get kicked out the door faster, but it won't be better quality than Assembler.

Ratch

We have different levels and flavors of programming languages to solve different classes of problems.

Do you really think ASM is a replacement for all of these ?

Do you really think Niklaus Wirth and the others who have dedicated their time to understanding and improving computer languages were just wasting time?
 
3vo,

Do you really think ASM is a replacement for all of these ?

Not when it comes to portability.

Do you really think Niklaus Wirth and the others who have dedicated their time to understanding and improving computer languages were just wasting time?

No, someone has to write a HLL. But I think HLL is overused and Assembler is underused.

Ratch
 
@jlpelect5 no problem - apologies for the rant, being forced to spend ages optimising something is not my idea of fun haha ;)
 
3vo,

No, someone has to write a HLL. But I think HLL is overused and Assembler is underused.
Ratch

Where is the tipping point between a blinking LED and the Matrix?

If you only use a PIC16 level device then ASM looks to be a good fit. For me anything at or above the PIC18 level is C with ASM only used for critical timing.

For 32 bit systems a HLL like C is the choice by a mile due to the existing code base for programs. With a well written system based on the C language creating new drivers for devices is easy and efficient. I wrote this simple Linux kernel PCMCIA card driver (I only needed the digital I/O so the timers and ADC code was skipped but could be easily coded) a few years ago.
**broken link removed**
https://www.electro-tech-online.com/custompdfs/2012/04/340698.pdf

The Linux device driver system. http://lwn.net/Kernel/LDD3/
 
nsaspook,

If you only use a PIC16 level device then ASM looks to be a good fit. For me anything at or above the PIC18 level is C with ASM only used for critical timing.

You are selecting something that already exists, and comparing it to something that has yet to be written. That does not address whether Assembler would not be better, or at least competitive, if it also had a large data base that included those routines. For one reason or another, HL has become more popular, so it has a larger following. I think HL is ubiquitious because it is more profitable to develop sofware with it at the expense of the consumer, who is basically clueless as to what is going on.

Ratch
 
You are selecting something that already exists, and comparing it to something that has yet to be written.

Written by very good programmers and tested working easily beats something that is not even written yet.
 
misterT,

Sure, but evaluating a language according to its availability is not the same as comparing its functional capability. You are not comparing the same thing.

Ratch
 
Sure, but evaluating a language according to its availability is not the same as comparing its functional capability. You are not comparing the same thing.

Well, functional capability with ASM is very theoretical thing. Sure it is theoretically possible to write anything with ASM and the code can be extremely efficient and small in size. In practice that is an insane idea that all embedded code would be written in asm.. even in the 8-bit world.
 
3v0, you're comparing micro C to full C, different worlds. Micro C as far as an HLL goes is only a step or two apart from ASM, where as the bulk of all C programming on more complex systems is dozens of times more removed so you can't argue based on that one specific example that ASM isnt' that much better than C as it's only that one specific case where it's true, and even then improvement could be made in ASM.

Compare the same code generated that uses floating point numbers. C performance gets flushed down the toilet.
 
Last edited:
3v0, the entire reason we need multi core multi ghz processors is because of bad programmers and bloated HLL language extended process instruction sets varying API and a failure to stop and take a new look at things and redesign them to be more efficient and just throwing additional layers on top.
 
Here is a nice example what you can do with ASM and 8-bit microcontroller.. still unfinished project, no surprise there. After all, he is using ASM.
http://www.youtube.com/watch?v=5j5KP5nknNA
http://uzebox.org/forums/viewtopic.php?f=10&t=1108

Here is an example what you can do with an 8-bit microcontroller using C (with some asm on critical places). Who here is so insane that would code this kind of project with asm, when you know that you can do the same job with C.
http://www.youtube.com/watch?v=AGVulezIDxw&feature=related
 
Last edited:
misterT, you're hand picking examples that suit your viewpoint, there is nothing scientifically useful in comparison there outside of those two examples to the large field of the efficiency gains that can be had with ASM vs C, with good programmers.

Given equal skill in each language both of a high level, ASM is better period, but it's only as good as it's programmer. C has more flexibility with programmer skill, as the simpler things take less time.

Both you and 3v0 seem to continue to distort what can be done on an equal knowledge basis, 3v0 claims the time to product abilities of C which shouldn't even be considered as this is a comparison between programming language not economics, where he has done the same thing as to show a narrow example where the high gains spoke of for ASM aren't achievable, but that's because of the specific nature of the example, the same as your case of showing a few unfinished projects which look a little sketchy and one that looks polished even if efficiency wise it's a crime against humanity. This has nothing whatsoever to do with ASM vs C, again you're just pulling examples from the net to suit your viewpoint without a critical view of the facts.

I will state a simple thing.

There is no C program that could not be made to run faster using inline assembly given equal knowledge of both languages.

What is sad is that this viewpoint of dislike and ignorance of the power of ASM in a higher level language circles and specifically in production environments.

It's like always throwing a bigger engine in a car when you need more power rather than reducing weight and streamlining it's aerodynamics. Sure no one is going to by an ugly care because it's ultra efficient, but no one is going to buy a 1mpg car either.

Everything I see happening in OS/softare development leans towards a possible complete abandonment of the x86 architecture in favor of RISC (like ARM) or more specifically designed CISC (like video processors) with the addition of dedicated codec chips. C will benefit more from these advents, because it hides the dirty truth that most C libraries are criminally wasteful on a general purpose machine and the hardware itself has to be changed.

IOS and Android started the trend, but Microsofts support of ARM chips for Windows8 blinks an overwhelming light at the fact that you can't just keep increasing processor speed and throwing more code at it to make it work. You can do more with a restructured development environment. It will be absolutely based on C, but the hardware will be designed to be more friendly from a C basis and core routines will still be coded in ASM.

Given this C itself won't go anywhere, but the way it is used will change over time and gradually we'll get back closer towards an only slightly abstracted software layer on hardware that was designed to run the software.

It's not C vs ASM, it's the abstraction from the actual instruction set that makes HLL's less efficient as crap keeps getting piled on them. That's what Microsoft did with Windows7 they streamlined their base code. 8 is going to be interesting to see as it's clear showing that MS wants to continue to support older software but move into the 'now' with truly improved designs.
 
Last edited:
misterT, you're hand picking examples that suit your viewpoint, there is nothing scientifically useful in comparison there outside of those two examples to the large field of the efficiency gains that can be had with ASM vs C, with good programmers.

There is nothing scientifically useful in this thread.

I think I picked very good examples for ASM and for C.. maybe my comments were bias. Sorry for that. The console project is very impressive for 8-bit microcontroller. The mp3 player also reguires efficiency, but is a very large project, so combination of C and ASM is a very good choice. I think there is about 10% asm code and a third party mp3 decoder.
 
Last edited:
3v0, the entire reason we need multi core multi ghz processors is because of bad programmers and bloated HLL language extended process instruction sets varying API and a failure to stop and take a new look at things and redesign them to be more efficientand just throwing additional layers on top.

Bad programmers and a refusal to redesign alone are a roadmap to trouble. We could be in even deeper trouble if these bad programmers were using ASM because it would allow them to generate bugs at the machine level.

I would like to add the the need for security and intense graphics have added significantly to the overhead.

Both you and 3v0 seem to continue to distort what can be done on an equal knowledge basis,....3v0 claims the time to product abilities of C which shouldn't even be considered as this is a comparison between programming language not economics
Given the same amount of time and the same talent level any programmer will finish a project sooner with a HLL. It is all about economics, because time is money.
 
Last edited:
I will state a simple thing.
There is no C program that could not be made to run faster using inline assembly given equal knowledge of both languages.

I believe we have all agreed from the very beginning that asm is the only language that can produce perfectly efficient and small code. Nobody has said anything against that.

While there is no C program that could not be made run faster, there are high level programs that are practically impossible to write solely in asm. There is around 50..100 million lines of code in any modern operating system + all the applications. Most of this code is high level languages.. You would not have animated movies without high level languages, or even cellphones. Are you really saying that all this could have happened using asm only?
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top