Experimental hardware abstraction layer for STM32F103 and STM32F407 devices, based on libopencm3.
This project is an in-house R&D project for the HKUST Robotics Team.
All APIs in this project is documented within the header in the most comprehensive way possible, with some references back to the libopencm3 library. We strongly recommend using our Doxygen docs.
You will be needing the following to compile:
- arm-none-eabi-gcc (Or your preferred compiler, in that case provide your own toolchain file)
- CMake
- GNU Make
- GNU awk
Optional software that will make your life easier:
- Git
- Jetbrains CLion
- One of the following flashing tools:
- Add the library files to your project by adding it as a submodule to your project:
git submodule add git://github.com/Derppening/RTLib
- Initialize all the submodule dependencies
git submodule update --init --recursive
- Make LibOpenCM3
cd RTLib/libopencm3
make
- Modify your
CMakeLists.txt
You need to let your compiler know about libopencm3
and RTLib
, checkout the CMakeLists.txt
for an example on how
to your write yours!
- Building your program
cd RTLib # Switch to the RTLib root directory first if you aren't already
mkdir build && cd build # Then create a build directory where all the generate build files will be output
# Change the -G option according to your build system, might be different for example if you were using MINGW
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../cmake/arm-toolchain.cmake -G "CodeBlocks - Unix Makefiles" ../
# Finally run the make command to initate the build process
cmake --build .
A .bin
file and .elf
file will be generated inside the build
directory.
If you are using CLion, then usually the Build All
configuration is all you need to build the project and you skip all
that terminal rubbish.
You should have either an ST-Link, USB-TTL, or JLink for your device. Check your mainboard if you are unsure.
All following code assumes your current working directory is at the root of the project.
cd scripts/
./flash_stlink.sh ../build/[target].bin # Replace target.bin with the appropriate file
cd scripts/
./flash.sh <device> ./jlink/[debug|release].jlink # Replace [debug|release] with the file you want to flash
cd build/
# Replace:
# [target.bin] with the appropriate file
# [115200] with the target baud rate
# [/dev/ttyUSB0] with the target device
sudo stm32flash -w [target.bin] -v -g 0x0 -b [115200] [/dev/ttyUSB0]
Note: Please turn your device into BOOT mode when flashing via USB-TTL.
cd RTLib # Switch to the RTLib root directory first if you aren't already
git pull origin master # Pull the latest upstream commits
cd .. # Go back to your project directory
git status # Check that there are changes to RTLib
git add RTLib # Add the RTLib directory to the change list
git commit # Commit the update
- David Mak - Derppening
- waicool20 - waicool20
This project is licensed under LGPLv3 - see COPYING and COPYING.LESSER for details.
libopencm3 is licensed under LGPLv3.