maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   Learn Programming - asm on arm (https://talk.maemo.org/showthread.php?t=27056)

benohit 2009-02-22 21:24

Learn Programming - asm on arm
 
Hello all,

I hope there are some people who can advise me :
I would want to learn basic programming, beginning with ASM first.
then, i would learn C, then a little C++ stuff, and then perl and python.

But i need these things :
- a guide of ARM "assembleur"
- tools for programming in asm code on my n810

THanks in advance !

Bundyo 2009-02-22 21:26

Re: Learn Programming - asm on arm
 
Assembler isn't something that can be called basic ;)

BrentDC 2009-02-22 22:01

Re: Learn Programming - asm on arm
 
Quote:

Originally Posted by benohit (Post 266307)
Hello all,

I hope there are some people who can advise me :
I would want to learn basic programming, beginning with ASM first.
then, i would learn C, then a little C++ stuff, and then perl and python.

But i need these things :
- a guide of ARM "assembleur"
- tools for programming in asm code on my n810

THanks in advance !

You got the languages in the wrong order! :eek: Start with Python, man.

baksiidaa 2009-02-22 22:35

Re: Learn Programming - asm on arm
 
Quote:

Originally Posted by BrentDC (Post 266318)
You got the languages in the wrong order! :eek: Start with Python, man.

I second that.

Besides being beginner-friendly, you don't need to compile when using Python, so you can instantly try out your code. You can also open a command-line interface, so that you can try out individual commands.

benohit 2009-02-22 22:40

Re: Learn Programming - asm on arm - which tools to install ?
 
Quote:

Originally Posted by BrentDC (Post 266318)
You got the languages in the wrong order! :eek: Start with Python, man.

I took a look at this language indeed,but, i'm fed up with slow performance of "modern" applications.
I know python is very interesting.
I know how to do :
- algorithmic
- shell scripting
- basic to turbo pascal
- php
But since i use computers (since 1992), i don't want to debate about this, but, i'm look for performance you know.

I prefer e17 to gnome+compiz
I prefer mp3blaster to xmms
I prefer vim to gedit

I want to know how things work, and to be able to use my n810 for real tasks, than to wait for a web page to be loaded on zimbra for example, or a map to be loaded in gmaps too.

Python is used in every tools in ubuntu for update-manager and all things, but i'm the man to launch "apt-get update ; apt-get dist-upgrade". I prefer scripting a daemon instead of using a "good-looking" app that takes some time to launch its scripts, to launch the graphical stuff, update the information in its window, wait for a user interaction, etc...

So please just let me know about asm on arm stuff please ! i will then be a forever-smiling man !
Why not programming in python, but in months... ;-)

Aural 2009-02-22 22:47

Re: Learn Programming - asm on arm
 
Well, I'm not a very good programmer, but a few years ago I looked into this free ebook on PC asm, I know it isn't ARM asm, but it could be a useful start. I just happened upon this thread so I don't happen to have any useful links to free books for ARM assembly, but I'd imagine a lot of the same principles still apply and can be utilized.

Here is the link to the aforementioned book:
http://www.drpaulcarter.com/pcasm/

Hope it helps and best of luck!

attila77 2009-02-22 23:26

Re: Learn Programming - asm on arm - which tools to install ?
 
Quote:

Originally Posted by benohit (Post 266328)
I took a look at this language indeed,but, i'm fed up with slow performance of "modern" applications.
I know python is very interesting.

It's a question of balance. Assembly development can be very daunting and long winded. If you are after performance, you are probably better off writing your app in python, profiling it, and then replacing specifing routines/functions with assembly ones.

Also, after doing quite some assembly myself (admittedly not ARM) I must say it's far from what assembly was in 1992, mostly for two reasons:

1) The operating system. With DOS it was dead easy, nobody cared what your assembly code did, you had simple BIOS routines to interact with the user and that was it. That's no longer the case. Just interacting with the OS to copy a file or read a keypress can be hell.

2) You need to grow a head of the size of a basketball. Seriously. With multiple cores, pipelines, branch prediction, etc, it becomes more and more sorcery to create fast code by hand. Less instructions do no longer mean quicker execution. I had cases where just changing the order of instructions meant a difference of ~30% in speed (!).

lardman 2009-02-22 23:37

Re: Learn Programming - asm on arm
 
Learn C, the execution-speed:writing-speed ratio is very good, only very occasionally will you need to resort to raw ASM. I'd skip Python completely if you want speed (plus C is a useful thing to know).

ASM is a pita to use basically, and I only resort to it if I really have to (not very often thankfully :)). To learn it, I scoured the web, mainly looking at existing ARM ASM code (the ARM Linux site has some useful info too: http://www.arm.linux.org.uk/developer/) and also eventually bought a book (ARM Assembly Language - an introduction by J.R. Gibson), however I've not done much ASM since then, and therefore haven't really read the book, so can't actually recommend it in any way other than saying that it's the one that looked best to me at the time :)

Bundyo 2009-02-22 23:45

Re: Learn Programming - asm on arm
 
You can try Vala for speed - it is similar to Python and C#, but translates to C and compiles to native, so the execution speed is much better.

CVBruce 2009-02-23 01:05

Re: Learn Programming - asm on arm
 
Well this is really pretty easy. Let's see. First you need to stop off at the company that makes the CPU. You should be able to down load a PDF spec that will outline all of the instructions that your particular variant of the ARM processor can execute. Then you need to determine which assembler you are going to use. Probably something from GNU, so you need to get the manual for that. That manual will have all of the directives and formats used by the assemble to translate assembler into machine language. Next you will need to read the man pages for maemo. basically section 2 and 3. That is about it.

As to a book, all that would be in the book would be the machine instructions, addressing formats, etc.; all of which is in the spec sheet from the cpu manufacturer. Assembler directives, etc. are from your assembler vendor. OS callable routines are in the maemo man pages. The book would add little except sample programs.

The previous comment about growing a big head is right on. In assemble you must keep in your mind the contents of all registers and status flags, and know how each op code will effect them.

Me, I would follow Atilla77's suggestion of python, with a few optimized routines. I read a report a number of years ago that said it takes about 350 lines of assembler to do the same job as about 150 lines of C. Python wasn't mentioned, but I'm pretty sure that it would be well below 100.

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!


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

vBulletin® Version 3.8.8