Live data from Hacker News

Introduction to ARM Assembly Basics

azeria-labs.com

11–20 of 48 posts

Re: Introduction to ARM Assembly Basics

#11
post #3

Why don't people use AT&T syntax for ARM?

AT&T syntax is a uniquely X86 thing.

I was very surprised when I'd discovered that the assembly in the Linux kernel sources for x86 was written in the AT&T syntax and the assembly for ARM was not. I always thought that the AT&T syntax was supposed to be independent from an architecture.

Re: Introduction to ARM Assembly Basics

#12

Does any one here use a lot of assembly in their job? If so, what do you do? I started getting fascinated about computer architecture a while back, but then I saw how dead embedded programming was in my area.

Not for writing code but for reading C/C++ compiler output during performance optimization and debugging sessions.

Same here.

I do have to drop little snippets of asm in to code for bare metal stuff, but generally looking at the output of the compiler to see if it and I are on the same page is my main use.

However, as we may well be about to switch our IoT device to ARM from AVR, this might be a useful primer...

Re: Introduction to ARM Assembly Basics

#13

Does any one here use a lot of assembly in their job? If so, what do you do? I started getting fascinated about computer architecture a while back, but then I saw how dead embedded programming was in my area.

Mostly reading disassembly for some types of low-level debugging.

Re: Introduction to ARM Assembly Basics

#14

Does any one here use a lot of assembly in their job? If so, what do you do? I started getting fascinated about computer architecture a while back, but then I saw how dead embedded programming was in my area.

I've done several embedded projects in the past 5-10 years years. Mostly it's a matter of writing just enough assembly to get things running, and flipping into C when humanly possible because life is short.

Talk to old video game veterans [waves]. We wrote tons of assembly because there wasn't much choice. But these were largely 8-bit processors, the compilers weren't any good and the code space was constrained. But I was talking with a guy recently who said he'd written hundreds of thousands of lines of 68K assembly, and I have no idea why you would do that because 68K C compilers, Pascal compilers, anything compilers were pretty good even back in the benighted 80s. Well, better than assembly.

Of course, once you flip into C you're still not in an environment where you have much of a runtime (I kept having to explain to a contractor why he couldn't do heap operations in an early boot phase, much less expect the results to be addressable later).

Even in a very code-space sensitive project, I started off with a tiny bit of assembly, then made everything more or less functional in C, then went back and hand-coded routines as we needed to get bytes back: http://www.dadhacker.com/blog/?p=1911

My level of fascination with an architecture can be dramatically by the quality of the available tooling. If there's nothing then that's fine, green fields are great fun. But if the tooling sucks (TI and your DSP software, I'm looking at you) or is horridly expensive, then I'm usually going to look for excuses to use something else.

Re: Introduction to ARM Assembly Basics

#16

Does any one here use a lot of assembly in their job? If so, what do you do? I started getting fascinated about computer architecture a while back, but then I saw how dead embedded programming was in my area.

Like kabdib, I've done far more reading disassembly than writing it, because for most purposes it's easier to use C as a macro assembler.

I used to work next to someone programming Tilera manycore systems in assembler, because that's a sufficiently weird architecture that you need to do that in order to see any benefit. This is probably why manycore has never really taken off.

Re: Introduction to ARM Assembly Basics

#17

Earlier quoted context omitted.

AT&T syntax is a uniquely X86 thing.

I was very surprised when I'd discovered that the assembly in the Linux kernel sources for x86 was written in the AT&T syntax and the assembly for ARM was not. I always thought that the AT&T syntax was supposed to be independent from an architecture.

"Architecture independent assembly language". Just say that out loud and set it sink in for a moment. Anyways, glad that there's no AT&T abomination for ARM, too.

Re: Introduction to ARM Assembly Basics

#18
post #10

Does any one here use a lot of assembly in their job? If so, what do you do? I started getting fascinated about computer architecture a while back, but then I saw how dead embedded programming was in my area.

Since you ask, I use lots of assembly level programming for digital audio signal processing. Some ARM instructions offer special DSP specific features like saturation and fractional arithmetic that have no equivalent int C, so it justifies using assembly. Smaller ARM cores without NEON offer some kind of miniature SIMD by operating on two 16-bit or four 8bit numbers, these can speed up things as well. To take full ad…

Do you have any good examples?

It's something id like to try (however in c++) but I'm not sure how to do it in a smart/not-too-ugly way

Re: Introduction to ARM Assembly Basics

#19
post #10

Does any one here use a lot of assembly in their job? If so, what do you do? I started getting fascinated about computer architecture a while back, but then I saw how dead embedded programming was in my area.

Since you ask, I use lots of assembly level programming for digital audio signal processing. Some ARM instructions offer special DSP specific features like saturation and fractional arithmetic that have no equivalent int C, so it justifies using assembly. Smaller ARM cores without NEON offer some kind of miniature SIMD by operating on two 16-bit or four 8bit numbers, these can speed up things as well. To take full ad…

I've also been working with DSP processors in audio processing. The only time I've used actual inline assembly was storing stack pointer to measure stack usage.

For saturating arithmetic and other stuff we used compiler intrinsics, which freed us from handling register allocation, stack management etc by hand. On that processor there weren't special instructions for saturating arithmetic but a flag was used instead, the compiler also kept track of that one too.

We did read the assembly result and tweaked C code until assembly looked like what was expected, though.

Re: Introduction to ARM Assembly Basics

#20
Some of the arm instruction set manuals seem harder to come by than others. Recently I reverse engineered one of the firmwares of the ImmersionRC Vortex 150 racing quadcopter (it uses an stm32f3 chip, arm cortex instruction set). It was pretty hard to come by a copy of the full instruction set manual - i just assumed that kind of thing would be a quick google away. Eventually i got there and made my changes but it was harder to get going than i expected but for different reasons than i was anticipating.
Post reply on HN