I am using a CORTEX-M4 micro controller board. Could you send me an Assembly example for programming the board?
As I am not using Windows, I've chosen to use GCC and open-source tools for my development.
The assembler-syntax for GCC might differ slightly from ARM's assembler, but in general, the differences are not too big.
So if you happen to use GCC, I'll be happy to give you code-examples for the Cortex-M4.
As I am not using a Freescale chip (yet), I'll be writing my example more or less generic (I mainly use LPC microcontrollers these days).
One thing you will want to do, if you use the GCC toolchain (the assembler is called GAS), is that you want to place this line before any code:
.syntax unified
That will make the assembler automatically create IT-instructions when necessary. This will help you focus more on the code.
-But you should know a few things...
All Cortex-M0/Cortex-M0+ code, which is not hardware-specific, can be compiled/assembled unmodified for Cortex-M3 or Cortex-M4.
All Cortex-M3 code, which is not hardware-specific, can be compiled/assembled unmodified for Cortex-M4.
-When I say "hardware-specific", I mean that it accesses hardware registers that are special to the microcontroller the code was written for.
Example of hardware-specific code: Code that writes a value on a GPIO-port.
Example of non hardware-specfic code: A subroutine that performs a heavy calculation and returns the result.
Hello, Jensbauer. Thank you so much for your reply. This comment is helpful as well. Unfortunately I run out of the "helpful" options.
No problem; it's a pleasure to be able to help an assembly-programmer getting started.
You can look forward to programming the Cortex-M4, there are many nice features to explore and benefit from.
Many instructions only use a single clock-cycle, where they use two or more on a Cortex-M3.
That means if you use a large block (or loop), your code might become 3 times as fast per clock-cycle.
In addition to the above, the Cortex-M4 also have "DSP instructions", which can also save a lot of clock cycles, compared to when you had to use a different approach on the Cortex-M3.
The Freescale implementations have some extra hardware features, which you can benefit from using (especially the BME, Bit Manipulation Engine).