benmarsan / ee445m-cmake-lab-template

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ECE 380L.12/445M Labs

This project contains the lab starter code for ECE 380L.12/ECE 445M at the University of Texas at Austin taught by Andreas Gerstlauer and Jonathon Valvano. The original starter code is available on Dr. Valvano's website.

Getting Started

Linux Dependencies:

sudo apt install gcc-arm-none-eabi gdb-multiarch binutils-multiarch cmake
sudo apt install openocd
sudo apt install lm4flash

lm4flash is optional -- the flash script is configured to flash with OpenOCD for Windows compatibility.

Windows Dependencies:

Install the following dependencies:

  • CMake
    • Make sure to select add to path in the installer (either user or system path will work)
  • Ninja (or make)
    • Download latest ninja-win.zip from the official Github
    • Copy ninja.exe to C:\Program Files\CMake\bin\ (Or elsewhere in your path)
  • GNU Arm Embedded Toolchain (get latest gcc-arm-none-eabi-*-win32.exe)
    • Make sure to select "Add path to environment variable" at the last step
  • OpenOCD
    • Download Windows release from Github.
      • v0.11.0 and v0.12.0 worked for me. Earlier versions did not work, future versions probably should work.
    • Extract the contents of openocd-v0.12.0-i686-w64-mingw32.tar.gz to C:\openocd-v0.12.0 (7-Zip can be used to extract .tar.gz archives on Windows)
    • Add C:\openocd-v0.12.0\bin to your path.
  • Visual Studio Code

Set up Visual Studio Code:

Install vscode from Microsoft

Install these extensions:

  • C/C++
  • CMake
  • CMake Tools
  • Cortex-Debug

When you first open this project in VSCode, you will need to set the "CMake Kit" to TM4C Toolchain to select the installed arm-gcc compiler and set the CMake Generator to Ninja. You will also need to set the build variant (Debug) and build target (Test.elf). Once this has been done, you should be able run CMake: Configure and CMake: Build (ctrl-shift-P to open command palette). The shortcut ctrl-shift-B can be used to run the default build task (set in .vscode/tasks.json).

When working on a lab, you should set the active target in the bottom status bar to the executable for the lab you're currently working on. This prevents building the other labs at the same time. (ex: RTOS_Lab1_Interpreter.elf, RTOS_Lab2_RTOSkernel.elf, etc.)

Command Line Development

This project will work without VSCode if you want to use another text editor. To compile and flash from the command line:

mkdir build
cd build
cmake ..
make Test.elf
make flash

Or on Windows:

mkdir build
cd build
cmake -G "Ninja" ..
ninja Test.elf
ninja flash

Notes:

  • Lab 5 User code builds and launches, though the ELF loader seems to be leaking more memory when running the ELF generated by this project than when running User.axf from Keil.

About


Languages

Language:C 98.8%Language:Assembly 0.9%Language:CMake 0.3%