Who is this for?

This is an introductory topic for software developers who are interested in programming microcontrollers with C/Assembly.

What will you learn?

Upon completion of this Learning Path, you will be able to:

  • Write a mixed C program and assembly language subroutines for the microcontroller. 
  • Call the subroutines written in assembly in a C function. 
  • Use Arm register calling conventions when writing subroutines in assembly language. 
  • Step through the code to understand operation.

Prerequisites

Before starting, you will need the following:

  • Some familiarity with C/Assembly.
  • An installation of Keil MDK

Summary

AI-assisted

This summary was drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.

Close
?
You’ll build a small mixed C and assembly program for Cortex-M using Keil MDK. First, you’ll set up a project in either Keil Studio (VS Code) or μVision for the ARMCM4 target, add CMSIS core and startup components where required, and configure the Cortex-M4 Fixed Virtual Platform as the debug target. Then, you’ll write two assembly subroutines for string copy and capitalization, called from a C main() function, while following the Arm Procedure Call Standard. By stepping through the program in the debugger, you’ll observe register use and memory updates and verify that the destination buffer reflects the copied and capitalized string.

Frequently asked questions

AI-assisted

These FAQs were drafted with an approved AI-assisted workflow and reviewed by Arm contributors before publication. Human technical review remains part of the process so the final page reflects engineering rigor, accuracy, and Arm editorial standards.

Close
?
Do I need a physical board to run the examples?
No. The steps use the Cortex-M4 Fixed Virtual Platform provided with MDK, so you can run and debug without hardware.
Which target device should I select when creating the project?
Select ARMCM4 as the target device. This applies to both Keil Studio (VS Code) and μVision.
How do I configure debugging to use the Fixed Virtual Platform in μVision?
Open Options for Target, go to the Debug tab, and select Models Cortex-M Debugger. Use this configuration to run on the Cortex-M4 FVP.
Which components do I add when setting up the μVision project?
Add CMSIS > Core and Device > Startup when prompted for software components. This prepares the project for the ARMCM4 device and startup sequence.
What result should I expect when the C and assembly functions run correctly?
The destination buffer contains a copy of the source string, and the capitalization routine updates characters as intended. Step through the code to observe register usage and memory changes that match these operations.
Next