This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Assembly programming - yes, no, when, how to start, ... ??

Hello again.

As I am very interested in learning ARM architecture, I would have few questions regarding assembly programming. Questions refer primarily to programming Cortex-M processors, because they are the only one which I am using (at least for now).

So... Do you program in C or assembly and why that? How do you suggest to start learning assembly programming? Do you think that the gain of execution time is big enough to justify time spent for assembly programming instead of C programming (with full optimization). Because in my case, processing time is quite important. Do you maybe only use intrinsics in special cases? Or inline/embedded assembly?

Every hint is very welcome and appreciated. Thank you in advance.

Regards,

Matic

Parents
  • I do totally agree with peterharris.

    The most efficient way I found is to write C code with intrinsics for all non-C operations (parallel arithmetic, saturation, bit/bytes reversing ...).

    Also, be aware that C code final execution efficiency depends on you compiler choice and on the optimization options you use.

    From my point of view, you may beat a compiler writing assembly but it would probably take you 10 times the effort.

    A very simple process that you can use to be sure that your C code is efficient is to look at compiler output (disassembly listing) and to improve your C to reach better performance.

    The only exception I have in mind is for Embedded Operating Systems where you need to switch contextes and directly manipulate special registers ! But this kind of code doesn't change every morning !!

    Of course, I explained this in details on my blog because I went through the same questions than you do !

Reply
  • I do totally agree with peterharris.

    The most efficient way I found is to write C code with intrinsics for all non-C operations (parallel arithmetic, saturation, bit/bytes reversing ...).

    Also, be aware that C code final execution efficiency depends on you compiler choice and on the optimization options you use.

    From my point of view, you may beat a compiler writing assembly but it would probably take you 10 times the effort.

    A very simple process that you can use to be sure that your C code is efficient is to look at compiler output (disassembly listing) and to improve your C to reach better performance.

    The only exception I have in mind is for Embedded Operating Systems where you need to switch contextes and directly manipulate special registers ! But this kind of code doesn't change every morning !!

    Of course, I explained this in details on my blog because I went through the same questions than you do !

Children