This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Assembly example for programming ARM Cortex-M4

I am using a CORTEX-M4 micro controller board. Could you send me an Assembly example for programming the board?

Parents
  • In order to give you an idea of what Cortex-M4 code could look like, I'm attaching one of my own assembly sources.

    The code will not be very useful as it is; you wouldn't be able to run it on your microcontroller, but you would be able to learn a few different instructions and a few assembler-directives from looking at it.

    I'm attaching a file instead of posting it, because the tabulations get destroyed, thus making it almost unreadable.

    (Note: The file is written for tab-size 4)

    Assembler directives start with a dot, for instance ".include" is a directive.

    I've chosen to make my macros uppercase. For instance "QFUNCTION" is neither a directive, nor an assembler-instruction.

    In the example, you'll see how I use one of GCC's nice features, recursive macros, in order to 'draw' characters in the source-code.

    This makes it very easy to see what the characters look like.

    To learn the instruction set, I recommend going to the ARM Information Center and click...

    "Cortex-M series processors", then ...

      "Cortex-M4", then ...

        "Revision: r0p1", then ...

          "Cortex-M4 Devices Generic User Guide", then ...

            "The Cortex-M4 Instruction Set".

    ... and you're good to go.

Reply
  • In order to give you an idea of what Cortex-M4 code could look like, I'm attaching one of my own assembly sources.

    The code will not be very useful as it is; you wouldn't be able to run it on your microcontroller, but you would be able to learn a few different instructions and a few assembler-directives from looking at it.

    I'm attaching a file instead of posting it, because the tabulations get destroyed, thus making it almost unreadable.

    (Note: The file is written for tab-size 4)

    Assembler directives start with a dot, for instance ".include" is a directive.

    I've chosen to make my macros uppercase. For instance "QFUNCTION" is neither a directive, nor an assembler-instruction.

    In the example, you'll see how I use one of GCC's nice features, recursive macros, in order to 'draw' characters in the source-code.

    This makes it very easy to see what the characters look like.

    To learn the instruction set, I recommend going to the ARM Information Center and click...

    "Cortex-M series processors", then ...

      "Cortex-M4", then ...

        "Revision: r0p1", then ...

          "Cortex-M4 Devices Generic User Guide", then ...

            "The Cortex-M4 Instruction Set".

    ... and you're good to go.

Children
No data