ARM The Architecture For The Digital World  

 
Entries in February 2010

How to Call a Function from ARM Assembler

Posted by ARM_DaveB, Feb 26 2010, 05:54 PM
Once you move beyond short sequences of optimised ARM assembler, the next likely step will be to managing more complex, optimised routines using macros and functions. Macros are good for short repeated sequences, but often quickly increase the size of your code. As lower power and smaller code sizes are often closely tied, it is not long before you will need to make effective and efficient use of the processor by calling functions from your carefully hand-crafted code.

Leaving, only to Return

To start, here is a small example in ARM Assembler with one function calling another.

CODE
.globl main
.extern abs
.extern printf

.text
output_str:
.ascii "The answer is %d\n\0"

@ returns abs(z)+x+y
@ r0 = x, r1 = y, r2 = z
.align 4
do_something:
push {r4, lr}
add r4, r0, r1
mov r0, r2
bl abs
add r0, r4, r0
pop {r4, pc}

main:
push {ip, lr}
mov r0, #1
mov r1, #3
mov r2, #-4
bl do_something
mov r1, r0
ldr r0, =output_str
bl ...

Read more...

Caches and Self-Modifying Code

Posted by ARM Jacob, Feb 17 2010, 02:51 PM
Ideally, caches act as some magic make-it-go-faster logic, sitting between your processor core (or cores) and your memory bank. Whilst it can be beneficial to consider specific cache features when writing some performance-critical code, it is usually advisable to consider only general cache behaviour in mind. However, there are cases where the cache behaviour must be considered in order to get the result that you want, and self-modifying code is an excellent example.

Cached ARM architectures have a separate cache for data and instruction accesses; these are called the D-cache and the I-cache, respectively. For this reason, the ARM architecture is often considered to be a Modified Harvard Architecture, though I must admit that with most real processors existing somewhere between Harvard and von Neumann architectures, I do not find that label particularly useful. There are a few benefits of this design, but the one I have seen discussed the most often is that with two interfaces to...
Read more...

"Hello World" in Assembly

Posted by ARM Jacob, Feb 11 2010, 04:53 PM
Assembly language can be fairly daunting, even for experienced software engineers. The lists of strange instructions and squiggles can be hard to read at the best of times; indeed, that is why we use languages such as C, where the compiler worries about such things so you don't have to. However, understanding the instruction set of your processor can make C-level optimizations easier to spot and implement, and will help you to gain an understanding of what your program is really doing. In addition, it can enable you to create some finely-tuned code for specific tasks that are hard to implement in C. If nothing else, it's fun!

This post aims to provide a simple introduction to ARM assembly language. The code will be presented in such a way that you can understand what's going on without having to understand the nuances and specifics of each instruction. Future posts will explain the mechanisms in more detail.

Tools

In order to actually do anything...
Read more...

Hello World! SW Development, Optimization and Partnership on ARM

Posted by James McNiven, Feb 8 2010, 05:55 PM
ARM is hiring smile.gif OK, so that got some people’s attention and confused others – actually we are hiring, and in particular software developers. What can often come as a surprise to people is that as well as having a team of people that go plan and work alongside some our different software partners, ARM has a software engineering group that work on key bits of software, particularly on Cortex-A8 and Cortex-A9 projects. In fact it's very likely that some of the code running your mobile phone was developed by some of the ARM team.

The team cover a wide range of software projects that include:
  • Web and web runtime optimization, for example JavaScript JIT optimization work on projects such as Tamarin, Webkit and Squirrelfish NitroExtreme), and OpenJDK optimization work.
  • Operating System development – including Android, Linux kernel hacking and a mini development distribution to help...

Read more...