Active Topics

 


Reply
Thread Tools
Posts: 37 | Thanked: 9 times | Joined on Nov 2008
#11
I also agree with lardman. C is a very good compromise between speed of development and speed of execution.
 

The Following User Says Thank You to CVBruce For This Useful Post:
Posts: 1,224 | Thanked: 1,763 times | Joined on Jul 2007
#12
C is no compromise. If you never programmed in assembly (or C, C++, python, perl) then your assembly code is not going to be faster than your C code for anything more useful then a countdown loop, for at least a few years. By then, even ARM might be superscalar and out of order, so you will need to start optimizing your super fast code all over again.

If you do want to learn ARM assembly (it is useful for a lot of things, just not for speed), you need the ARM ARM, since that is the standard text.
 
pycage's Avatar
Posts: 3,404 | Thanked: 4,474 times | Joined on Oct 2005 @ Germany
#13
Speed is not a matter of choosing a certain language, speed is a matter of choosing the right algorithms.

Apart from that, writing whole programs in assembler is not recommended on modern operating systems because you would have to program against a C-level interface. But nothing (except for portability) speaks against writing small functions (e.g. for image processing) in assembler. But don't get the illusion that asm is faster than C. Most C-compilers nowadays produce optimized asm code that is faster than anything you would write yourself in asm.
I'd also suggest to skip C++ and learn Java instead. C++ is (or should be) a dead language (although many people don't want to believe so) and not a good choice for object-oriented programming. In other words, C++ is a mess and mostly incompatible with itself.
Python OTOH is a really nice and comfortable object-oriented language.
C is tiny, easy to learn, but it's not really comfortable for writing big programs.
 

The Following User Says Thank You to pycage For This Useful Post:
Posts: 29 | Thanked: 7 times | Joined on Nov 2008 @ France
#14
Originally Posted by CVBruce View Post
I've done assembler programming as a job. I've been programming since 1969. My shortest assembler program was a CICS transaction that was 3 lines of code. It was used for a number of years by my employer. Avoid assembler programming!
Don't worry !
I want to learn assembler, in order to understand how the machine works, then indeed, to make a little C stuff ! it's the main goal.

I know and think that 80% of programmers today don't think about optimisating their code. I'm one of them in PHP.
So before reading a book that mentioned "garbage collector", i didn't had any idea about flushing caches for example.

I'm just, again, looking for a guide af ARM assembler, with exercices for example, that i could do on my n810.

Because i think that it will be obsolete in 4 years, and that a 1998's powerbook g3 laptop isn't yet, thanks to linux.

So why not learn java indeed. But in this order :
ASM => C => Perl => java => UML 2 => XML => PHP5

C++ will be necessary to understand linux code. Not to create, but to understand in debug.
Learning these languages will make me code in different manners. And optimize algorithms.

I ordered a book to learn object oriented programmation.

Last edited by benohit; 2009-02-23 at 09:05.
 
Guest | Posts: n/a | Thanked: 0 times | Joined on
#15
Originally Posted by Matan View Post
If you do want to learn ARM assembly (it is useful for a lot of things, just not for speed), you need the ARM ARM, since that is the standard text.
And here it is: The ARM Architecture Reference Manual. It's not a tutorial but a comprehensive overview of the "ideal" ARM architecture. Real ARM CPUs amend this text with their own specifications. See http://www.arm.com for details.

Learning ARM assembly on Linux is very time consuming. The OS is stepping on your fingers at every opportunity. You would make better use of your time to learn ARM assembly on a simple ARM7TDMI-based development board, such as this one (33 euros, also see prices for other boards). They cost only tens of dollars and run your program without the burden of an operating system. After you get the hang of assembly programming, you'll see better where the extra effort is beneficial. Most any user-facing software can be written in mixed Python/C/Asm these days.

EDIT: Here's a real-world scenario I'm currently working on. Maybe this will illustrate how relevant assembly code is on modern CPU architectures:
  • NXP LPC2103 ARM7TDMI-based microcontroller
  • About 60 MHz (58.9824 MHz actually)
  • 32 kB Flash memory
  • 8 kB RAM
  • Monochrome 240x64 graphical user interface
  • USB and serial port for communication with automation systems
  • Several time-sensitive peripherals to monitor and control
  • Requirement: Sub-millisecond response time to fault conditions
  • Requirement: Sub-microsecond response time to external pulses
  • About 13000 lines of code
  • ... of which about 500 lines is written in assembly code, rest is in C.

So even in a deeply embedded time-critical application such as this one, assembly code accounts for less than 4% of total lines of code. A desktop- or pocket-class machine has even less use for assembly optimization.

Last edited by jethro.itt; 2009-02-23 at 09:22.
 

The Following 4 Users Say Thank You to For This Useful Post:
Posts: 29 | Thanked: 7 times | Joined on Nov 2008 @ France
#16
Thanks to all of you !

I also found this :
http://linux.onarm.com/

But i still don't know which tools to install on my n810 to write/run ASM and C code...
 
Posts: 2,102 | Thanked: 1,309 times | Joined on Sep 2006
#17
You need to install GCC - there's a thread somewhere on the board about on-board development, follow those instructions.
 

The Following User Says Thank You to lardman For This Useful Post:
Posts: 883 | Thanked: 980 times | Joined on Jul 2007 @ Bern, Switzerland
#18
No one around of the old C64 scene? I vaguely remember some ASM from back then, for Scrolltexts, Music and Sprite-Animations...
Why anyone would like to start with ASM is way beyond me, however :-)
 
Posts: 631 | Thanked: 837 times | Joined on May 2007 @ Milton, Ontario, Canada
#19
One final vote for C, coming from somebody's who's been along a similar learning path. I gleaned most of my programming (at least the modern useful stuff) from PHP, but started getting into doing embedded device development and found that PHP had all the capabilities, but was WAY too slow and resource-intensive. Started looking into C, and found it amazingly easy to learn because the syntax and concepts are almost exactly the same. (to the point where half of my PHP code could have almost been copied and pasted, compiled and it ran in C sort of thing). The real trick to learning C from a PHP point of view is just to get the whole memory management thing figured out, which really isn't as hard as people make it sound... you just need to make sure you plan and pay a lot of attention when you create variables that you remember to free them later, that's all. If you start getting into UIs and things it can be a little more complex, but for back-end/daemon type stuff it's not hard at all.
 
lcuk's Avatar
Posts: 1,635 | Thanked: 1,816 times | Joined on Apr 2008 @ Manchester, England
#20
let me backup lardman's assertion about c.
I use it every day onboard the device and writing in it gives me 2 very important things after compilation:

(1) very close to asm performance
(2) code reuse, the same things I write in c are recompilable on arm and x86

that simply is not possible with asm.

Also, if whilst learning all about c you NEED an algorithm coding in asm (just like pascal) you can do inline asm directly with your c file and GCC will magically make it for you!


You should be well past your "why" things work, just translate your pascal thinking slightly and you end up with c code.


by the way, am I the only one who can smell something?
__________________
liqbase sketching the future.
like what i say? hit the Thanks, thanks!
twitter.com/lcuk
 
Reply

Tags
arm, asm, programming


 
Forum Jump


All times are GMT. The time now is 13:36.