Bootstrap and definition library for programming STM32L100RC in ARM assembler. This was a class project to learn ARM assembly
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

114 lines
3.9 KiB

# Bootstrap project and an asm library for STM32L100
10 years ago
[Česká verze](README.cz.md)
10 years ago
## Project description
10 years ago
The project consists of a definition library for the STM32L100 ARM microcontroller.
10 years ago
The library is in a large part converted from the device-specific CMSIS header files, other
files are based on the datasheets.
10 years ago
The project also includes a simple "Hello World" program which demonstrates usage of the library
by blinking the LEDs on your STM32L100 Discovery board.
10 years ago
A startup script (startup_stm32l100xc.s) comes from the Keil device packages, and can also be
found in the CMSIS.
10 years ago
## Target hardware
10 years ago
The project targets the STM32L100RC on the STM32L100C-DISCO Discovery development board. The kit
is attached to the computer using a USB cable.
10 years ago
## Library structure
10 years ago
The assembler library is located in a `lib/` folder, and consists of multiple modules.
10 years ago
To use any of the modules, first include `INI_BASE.s`, then the required modules (in any order).
10 years ago
Example of the library usage:
10 years ago
```asm
; Base file
GET lib/INI_BASE.s
10 years ago
; Registers and bit presets for the peripherals
10 years ago
GET lib/INI_BITS_GPIO.s
GET lib/INI_BITS_RCC.s
GET lib/INI_BITS_FLASH.s
```
## Code style
All comments are in English. Files are formatted with spaces, or tabs 4 spaces wide.
All files should use Windows line endings for compatibility with Keil.
## Development environment
### Keil MDK-ARM (Windows)
The library will work with any tool that supports the ARM assembler.
Included are project files for **µVision MDK-ARM v.5** (Keil).
### Working on Linux
10 years ago
On Linux, you can run Keil in Wine (without hardware support), and also in Virtualbox
(but with ST-Link v2 only).
10 years ago
If you choose to use a more native "IDE" (read: vim, Sublime Text...), you can use the
provided Makefile for compilation and flashing.
10 years ago
First, though, you have to setup the compiler:
10 years ago
1. Install Keil in `wine` (into `~/.wine`) - we'll be using the trial version of
the otherwise paid compiler, and for that we need the Keil license files.
10 years ago
If you are adventurous, you can try to use the Keil license files with the native Linux
version of the compiler.
10 years ago
2. Check that the Makefile variable `WINEPREFIX` points to the folder with the Keil
compiler binaries. If you are using the linux versions of those, adjust your Makefile
accordingly.
10 years ago
3. For a disassembler support, install `arm-none-eabi-binutils`. This is optional.
10 years ago
4. Install the `stlink` package - drivers for communication with the development board.
This step is optional, if you don't need flashing.
10 years ago
*Tip:* ArchLinuxu users can find both `stlink` and `arm-none-eabi-binutils` in the Community
repository.
10 years ago
### Using the ARM DS-5
10 years ago
The "official" ARM IDE, DS-5, is really expensive, but there's a free "Community Edition".
10 years ago
The IDE is a customized Eclipse, so if you have some Eclipse experience, you're right at home.
**The catch** is that this variant **can't compile anything** - not even assembler.
The editor and the context-help manual viewer work perfectly, though.
There is some Makefile support, but I've found it rather pathetic. If you, however, install
a terminal plugin into the IDE, you can conveniently run the Makefile tasks to compile and
flash your program.
10 years ago
## Credits
10 years ago
This project is developed for educational purposes at the [Department of Measurement][measure] of the CTU in Prague. The project may be used in the [NVS][nvs] and [MMP][mmp] courses.
10 years ago
- The example program is based on an old code by Michal Tomáš © 2010.
- Base of the library extracted from CMSIS by Petr Douša © 2015.
- Further library improvements, organisation and the Makefile © Ondřej Hruška, 2015.
10 years ago
The library code is free to use in any educational and non-commercial projects, provided you retain the copyright notice and the file header files.
10 years ago
[measure]: http://measure.feld.cvut.cz/
10 years ago
[nvs]: http://measure.feld.cvut.cz/vyuka/predmety/A4B38NVS
[mmp]: http://measure.feld.cvut.cz/vyuka/predmety/A3B38MMP