C/C++ compiler and optimization with ARM processors

Make it to the Right and Larger Audience

White Paper

C/C++ compiler and optimization with ARM processors

In this tutorial, we talk about C/C++ compiler and optimization with ARM processors.

We first briefly talk about ARM architecture and then quickly move into C/C++ compiling and linking technologies and optimizations.
This tutorial has a heavy focus on arm processors which is the most popular processor family in mobile, embedded, and low power domain.

It is a 101 page slides.


The following are some of the topics touched.

What is tail-call optimization to avoid the use of unnecessary returns in function hierarchies?



How to estimate Stack size?
1. Linking with -callgraph produces a static callgraph in html showing information on all functions, including stack usage
2. Set a watchpoint on the last available location in the stack and see if the watchpoint is ever hit (severe performance penalty with ARMulator or Angel).
3. Define a stack which is much larger than you expect you need, then fill it with a known value (e.g. zero or 0xDEADDEAD). Run your application. After your application has finished running, examine the stack area of memory to see how many of the zeros (or 0xDEADDEAD) have been overwritten by stack accesses. This will show how far the stack has grown in memory. You can then adjust the size of the stack to (a little above) this known size.
4. If using ARMulator, use a map file to define a region of memory where access is not allowed (with ‘-‘). Place this region directly below your stack in memory. If the stack overflows into the forbidden region, a data abort will occur, which can be trapped by the Debugger.
5. Can do a similar thing with an MMU or MPU by marking an area as no access.


Concerns in alignment of pointers:



How to optimize base pointer:



Here is the full 101-page slides:

The following is site premium content.
Use points to gain access. You can either purchase points or contribute content and use contribution points to gain access.
Highlights: 87 words, 1 images, 1 docs
Lakeside Embedded Technologies is an embedded system design firm. We offer first class firmware design service based on our deep understanding of ARM processors and its hardware/software architectures. We also offer online and onsite ARM firmware trainings.
  1. alexsdsd69 11 months ago


  2. rao_mallikarjun 1 year ago

    good article lot of details

  3. Ouranos 2 years ago

    Nice slides.

  4. jQiu 5 years ago

    Very good explaining of ARM registers and their usage in function calls, inline assembly, etc.

  5. blairshih 5 years ago

    Good and a lot of details. It does challenge my understanding of c programming, compiler, and linker.


Contact Us

Thanks for helping us better serve the community. You can make a suggestion, report a bug, a misconduct, or any other issue. We'll get back to you using your private message ASAP.


©2021  ValPont.com

Forgot your details?