Two questions come to my mind: which "flavor" of ARM? And what hardware would it run on? There's no "standard ARM" computer like the x86 has the de facto PC standards (peripherals, firmware, etc).
Perhaps the R.Pi could do it, but it's certainly easier that you can just run the code on the desktop computer you're working on. The university behind OP probably has a lab full of Linux x86 desktop computers ready to use. They probably don't have a bunch of R.Pis or ARM devkits around.
I don't see any advantages in ARM over x86 for taking your first baby steps in assembly. Either will do but the latter is probably easier to set up.
You're not a believer in learning for fun?! It's really interesting the different viewpoints people have on these things. One of my friends refused to go through a Coursera course that he couldn't get full points for because he joined a couple of weeks late.
I'm taking a couple of Udacity courses and I'm trying to learn a little Chinese on Coursera. I'm not looking for points or a certificate. I try to have goals. China, for instance, is on my short list of places to visit, and I'm taking classes to refresh what I can hopefully use for my projects. I learned Go and wrote websites in it:
There's a lot that I'd like to learn but unless you can incorporate it into something where you'll use it, the payoff will be small. There's so little time and so much to learn.
You shift between using "I" to express your opinion, and "you" which seems to assert your opinions effects are general. It's very confusing when it's in the same sentence, and possibly not your intention.
You shift between using "I" to express your opinion, and "you" which seems to assert your opinions effects are general. It's very confusing when it's in the same sentence, and possibly not your intention.
I think what he means is: don't just learn for learning, get a project and learn by building it. It's even more fun and you will REALLY learn.
His examples about doing a website to learn a language are spot on. If you know you are going to visit a place, why not learn the language before hands, it will motivates you and you will be able to use what you learned eventually.
I might not agree with the idea of only learning if you're going to use it, but this comment, and melling's other comment below certainly don't deserve downvotes. I've upvoted them both to counter.
The RISC "core" of the ARM instruction set is both simple enough to learn (sixteen registers of which the last two are special, almost all instructions work equally on all registers) and works unmodified across a range of systems. It's a popular choice in "intro to assembly" courses for this reason.
By comparison, x86-32 has more baggage from x86-16 and is less orthogonal. It also suffers from nonstandardisation of the vector instructions like ARM does, although you can reasonably assume FPU and MMX these days.
AMD64 might be an interesting choice to start with these days.
Well I agree that the ARM instruction set is more elegant, but I don't see it as a big enough improvement to warrant the extra hassle of getting set up. It's too easy for the student to get confused with all the tools and spend less time on the actual matter at hand.
When learning assembly, what matters is getting used to instructions, registers, control flow and explicit memory accesses rather than statements, expressions, functions and variables. It really doesn't matter which ISA you're learning, the actual skill you learn is how to read the documentation of a CPU architecture and tools to write and debug assembly code.
> It also suffers from nonstandardisation of the vector instructions like ARM does, although you can reasonably assume FPU and MMX these days.
This is not correct. ARM has at least 7 different FPU ISAs: 5 versions of VFP and 2 versions of NEON. I have devices at hand with three different float units (all consumer devices). In x86 world you can rely on SSE2 safely, it's been around since Pentium 4 (1999) and is required on all 64 bit architectures (by contrast, NEON is rather new). But this is kind of a moot point since introductory assembly courses don't go too deep on floating point units anyway.
Additionally, in the ARM world, there's several revisions of the ISA/architecture being used, ARMv7 (32bit) and ARMv8 (64bit) and a dozen different variants for embedded products. And two different instruction encodings (thumb). It's not at all less confusing.
> AMD64 might be an interesting choice to start with these days.
For basic user space programming it probably doesn't make a difference but for bare metal/kernel programming, the AMD64 architecture is more, not less, confusing than the x86_32.
But in my opinion, it really doesn't matter what you learn first. The details of the ISA itself is of secondary importance, understanding how to read the documentation of the architecture and getting some hands on experience is way more important.
The obvious choice today would be armv7, using the R.Pi2. The only real advantage I see over x86 would be that the performance model of Cortex-A7 is much simpler than that of any modern x86 core, so it's much easier to isolate performance effects that one would like to study in an architecture course.
A Cortex-M3 or -M4 would be significantly nicer still for that reason (also it has a nice stripped down ISA), but I don't know of any systems with as much nice tooling as the R.Pi.
Choice of assembler CPU architecture is rather irrelevant for educational purposes. Once you know one architecture, you'll quickly pick up any other. X86 will do, it's one of the quirkiest.
Granted, there's one major quirk on ARM CPUs. Instruction predicates, conditional execution for each instruction based on flags. However it's falling out of favor, because it requires CPU flags register to have a lot of read ports. That in turn limits frequencies, instruction reordering opportunities and consumes power. ARMv8 doesn't have predicates in 64-bit mode anymore.
It's same LoaDs [1] / STores [1], SUBstract / ADD / CoMPare, MULtiply / DIVide, SHift Left / SHift Right, XOR / AND / OR / NEGate / NOT and conditional BRanching / Bcc [2] based on flags-register everywhere. On top of that, if it's anything modern, there's usually FPU, vector extensions and MMU control.
[1]: But "MOV" on x86, "MOVE" on 680x0.
[2]: JMP/Jcc on x86. "cc" is short for condition code, like "Jump Equal", "Jump Not Equal".
I did some PDP11 in college and I knew 6502 really well.
So, back to my original question: I still think it's better to start with ARM because it's more useful. You can learn a little assembler then ship. You don't need to master assembler. For example, you might do a Mandlebrot and optimize your register usage to avoid touching memory and ship that app.
You can learn enough in an a few days to ship something that might be amazing on mobile or a Raspberry Pi. Perhaps there are some vector operations in ARM?
In order to use assembler you need a good reason because most optimizing compilers are good.
A beginner is definitely not going to need assembler to ship an app. It's unlikely anyone with just a few days/weeks/months of experience will be able to touch what optimizing C/C++ compilers do.
Mandelbrot you'd do anyways easily as a pixel shader. I'd guess it's trivial to get 60 fps full screen for something like 30 iterations. Second best option is using ARM NEON. But I doubt anyone is interested seeing another useless app in any store.
Amazing performance wise on Raspberry Pi needs to be written in Videocore IV assembler. 24 Gflops there. On RPi2, you could also try NEON vector instructions, but I doubt it can hold a candle to VCIV even if using all 4 cores.
And don't forget soon ARMv7 assembler is thing of a past. 64-bit ARMv8 is rather different to code for. In a few short years only place where you'll find 32-bit CPUs are cheap microcontrollers.
But anyways, it really doesn't matter which CPU architecture is used for educational purposes. 6502 would do. Or heck, PDP-11. For most programmers, it's enough to just have some idea how things work under the hood.
26 comments
[ 2.9 ms ] story [ 70.4 ms ] threadPerhaps the R.Pi could do it, but it's certainly easier that you can just run the code on the desktop computer you're working on. The university behind OP probably has a lab full of Linux x86 desktop computers ready to use. They probably don't have a bunch of R.Pis or ARM devkits around.
I don't see any advantages in ARM over x86 for taking your first baby steps in assembly. Either will do but the latter is probably easier to set up.
http://thespanishsite.com
http://www.h4labs.com
There's a lot that I'd like to learn but unless you can incorporate it into something where you'll use it, the payoff will be small. There's so little time and so much to learn.
His examples about doing a website to learn a language are spot on. If you know you are going to visit a place, why not learn the language before hands, it will motivates you and you will be able to use what you learned eventually.
By comparison, x86-32 has more baggage from x86-16 and is less orthogonal. It also suffers from nonstandardisation of the vector instructions like ARM does, although you can reasonably assume FPU and MMX these days.
AMD64 might be an interesting choice to start with these days.
When learning assembly, what matters is getting used to instructions, registers, control flow and explicit memory accesses rather than statements, expressions, functions and variables. It really doesn't matter which ISA you're learning, the actual skill you learn is how to read the documentation of a CPU architecture and tools to write and debug assembly code.
> It also suffers from nonstandardisation of the vector instructions like ARM does, although you can reasonably assume FPU and MMX these days.
This is not correct. ARM has at least 7 different FPU ISAs: 5 versions of VFP and 2 versions of NEON. I have devices at hand with three different float units (all consumer devices). In x86 world you can rely on SSE2 safely, it's been around since Pentium 4 (1999) and is required on all 64 bit architectures (by contrast, NEON is rather new). But this is kind of a moot point since introductory assembly courses don't go too deep on floating point units anyway.
Additionally, in the ARM world, there's several revisions of the ISA/architecture being used, ARMv7 (32bit) and ARMv8 (64bit) and a dozen different variants for embedded products. And two different instruction encodings (thumb). It's not at all less confusing.
> AMD64 might be an interesting choice to start with these days.
For basic user space programming it probably doesn't make a difference but for bare metal/kernel programming, the AMD64 architecture is more, not less, confusing than the x86_32.
But in my opinion, it really doesn't matter what you learn first. The details of the ISA itself is of secondary importance, understanding how to read the documentation of the architecture and getting some hands on experience is way more important.
A Cortex-M3 or -M4 would be significantly nicer still for that reason (also it has a nice stripped down ISA), but I don't know of any systems with as much nice tooling as the R.Pi.
Granted, there's one major quirk on ARM CPUs. Instruction predicates, conditional execution for each instruction based on flags. However it's falling out of favor, because it requires CPU flags register to have a lot of read ports. That in turn limits frequencies, instruction reordering opportunities and consumes power. ARMv8 doesn't have predicates in 64-bit mode anymore.
It's same LoaDs [1] / STores [1], SUBstract / ADD / CoMPare, MULtiply / DIVide, SHift Left / SHift Right, XOR / AND / OR / NEGate / NOT and conditional BRanching / Bcc [2] based on flags-register everywhere. On top of that, if it's anything modern, there's usually FPU, vector extensions and MMU control.
[1]: But "MOV" on x86, "MOVE" on 680x0.
[2]: JMP/Jcc on x86. "cc" is short for condition code, like "Jump Equal", "Jump Not Equal".
So, back to my original question: I still think it's better to start with ARM because it's more useful. You can learn a little assembler then ship. You don't need to master assembler. For example, you might do a Mandlebrot and optimize your register usage to avoid touching memory and ship that app.
You can learn enough in an a few days to ship something that might be amazing on mobile or a Raspberry Pi. Perhaps there are some vector operations in ARM?
In order to use assembler you need a good reason because most optimizing compilers are good.
Mandelbrot you'd do anyways easily as a pixel shader. I'd guess it's trivial to get 60 fps full screen for something like 30 iterations. Second best option is using ARM NEON. But I doubt anyone is interested seeing another useless app in any store.
Amazing performance wise on Raspberry Pi needs to be written in Videocore IV assembler. 24 Gflops there. On RPi2, you could also try NEON vector instructions, but I doubt it can hold a candle to VCIV even if using all 4 cores.
And don't forget soon ARMv7 assembler is thing of a past. 64-bit ARMv8 is rather different to code for. In a few short years only place where you'll find 32-bit CPUs are cheap microcontrollers.
But anyways, it really doesn't matter which CPU architecture is used for educational purposes. 6502 would do. Or heck, PDP-11. For most programmers, it's enough to just have some idea how things work under the hood.
http://gcc.godbolt.org/
http://www.drpaulcarter.com/pcasm/