Skip to content

GNAT-Academic-Program/mcu_bootloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mcu_bootloader

This repository contains an STM32-compatible microcontroller bootloader written in the Ada programming language. It is designed to be used with the Ada Bootloader CLI.

Introduction

This project was made for a senior design project at Pennsylvania State University, Behrend College, and was sponsored by AdaCore and part of its GNAT Academic Program. The goal of the project is to create a bootloader written in Ada for the STM32 microcontroller family. This project was tested for the STM32F746GDISCOVERY Board. The following repository is for the microcontroller bootloader to be loaded onto a STM32F746G-DISCO Board that directly communicates with the Ada Microcontroller Bootloader CLI on a host computer. More about the project can be found on the project's senior design web page.

Building and Flashing

This project uses the Alire package manager. The bootloader can be built by running alr build. This creates the microcontroller's binary at bin/mcu_bootloader. This binary can then be flashed to the target microcontroller with your choice of flashing program, such as OpenOCD. For the STM32F746G-DISCO, this can be done with the following command:

   openocd -d2 -f board/stm32f746g-disco.cfg -c 'program bin/mcu_bootloader verify reset exit'

Entering the bootloader

Once the bootloader is flashed STM32 microcontroller, it will by default jump to the application address at 0x08080000. To instead stay in the bootloader for host communication, follow this procedure:

  1. Reset your microcontroller by clicking on the reset button on the back of the board.
  2. Interrupt the booting sequence by pressing the user button on the back of the board within the first 100ms of start up.

Interrupting the board at start up:

STM32F746G-DISCO User and Reset Buttons:

Tests

This project uses ShUnit2 to run automated test cases. Tests are currently only located in the test-cases branch of this repository. All tests can be ran using ./tests/test.sh from the project root, or a specific test can be ran using ./tests/test.sh -- <insert test name here>. For example, to run the clear command test case, execute ./tests/test.sh -- test_clear_command. Multiple tests can be run by listing multiple names separated by spaces.

Repository organization

This repository contains some extra branches corresponding to features that were not yet ready to merge into main. The test-cases branch contains the necessary code to run test cases for the features of this repository, in addition to an early experimental boot menu. The Async-Initialization branch contains the necessary bootloader code to autodetect a connected host by asynchronously monitoring the serial port on startup. The Mode-Demo branch contains the merging of the Async-Initialization branch with the development branch as of the conclusion of the original project.

Credits

Thank you to Pennsylvania State University, Behrend College, and AdaCore for sponsoring and hosting this project.

Further credits goes to Mr. Olivier Henley (GitHub: ohenley), our industry advisor from AdaCore, and Dr. Chen Cao, our project advisor for senior design.

Final credits goes to the senior design team:

  1. Alan Everett (GitHub: thatcomputerguy0101 )
  2. Joseph Smith (GitHub: Jas8101)
  3. Xavier Zhang (GitHub: Lereona)

About

Ada microcontroller bootloader for STM32

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages