0% found this document useful (0 votes)
37 views8 pages

Bare Metal Programming With Assembly in STM32CubeIde

The document provides a step-by-step guide for writing, building, debugging, and uploading assembly code in STM32CubeIDE, despite the lack of a built-in option for assembly programming. It outlines the necessary steps including project creation, IOC settings, project explorer adjustments, and code structure for assembly files. The guide emphasizes the importance of specific configurations to successfully implement assembly code on STM32F411 microcontrollers.

Uploaded by

mnadzir.nordin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views8 pages

Bare Metal Programming With Assembly in STM32CubeIde

The document provides a step-by-step guide for writing, building, debugging, and uploading assembly code in STM32CubeIDE, despite the lack of a built-in option for assembly programming. It outlines the necessary steps including project creation, IOC settings, project explorer adjustments, and code structure for assembly files. The guide emphasizes the importance of specific configurations to successfully implement assembly code on STM32F411 microcontrollers.

Uploaded by

mnadzir.nordin
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Bare Metal Programming with

Assembly in STM32CubeIDE
MOHD RIDZUAN BIN AHMAD
INTRODUCTION
• By default, STM32CubeIDE does not
provide a built-in option specifically for
writing assembly programs.
• However, it is still possible to write, build,
debug, and upload assembly code to a
targeted board in STM32CubeIDE by
following a few steps.
STEP 1: Create a Project
• Start a New Project in STM32CubeIDE:
Open STM32CubeIDE and select File >
New > STM32 Project.
• Choose your STM32F411 microcontroller
and proceed.
• Write the project’s name and select the
default setting in the Options. Click Next,
then click Finish.
STEP 2: IOC Setting
• Select Project Manager Tab: Under Code
Generator, locate the checkbox that says
"Generate peripheral initialization as a
pair of .c/.h files per peripheral". Uncheck
this box to avoid automatic initialization
of peripherals with the HAL library.
• The IOC page can be closed.
STEP 3: Project Explorer Setting
• In the Project Explorer, go to the Core
folder and locate a Src sub-folder:
 Delete main.c file
 Right click the Src folder and select >
New > File and name it (e.g.,
my_assembly.s). Ensure the file
extension is .s for assembly
language.
STEP 4: Add a Library in the Src folder
• Create a new file and name the file
STM32Fxxx.s
• Copy and paste these library codes to the
STM32Fxxx.s file. Save the file.
• The STM32Fxxx.s page can be closed.
STEP 5: Code Structure for my_assembly.s
• Write the following basic structure:
.cpu cortex-m4 // Set CPU to Cortex-M4
.thumb // Enable Thumb mode (uses Thumb-2 for Cortex-M4)
.syntax unified // Use unified syntax for compatibility

// assembler directives as necessary. Normally just:


.section .text
.global main

main:
// Configuration codes

loop:
// Your codes
THE END

You might also like