library of HAL functions that provide a glue layer between the upstream Texas Instruments mspdriverlib and projects that need quick prototyping while also allowing easier code migration from one msp430 microcontroller to another. on one hand it has a number of generic functions and configurable compile-time defines that will set up the hardware abstraction layer allowing the user to focus on the higher level code and on the other hand it can be out-of-the-way and allow direct access to the registers or to the TI driverlib. strives to also provide limited device-specific pin initialization for about 320 microcontrollers from the F5xx, F6xx, FR2xx, FR4xx, FR5xx and FR6xx families via code generated by scripted datasheet parsing.
source: https://github.com/rodan/atlas430
author: Petre Rodan <[email protected]>
license: BSD
- TI MSP430 DriverLib
- HAL glue for
- port init
- system and auxiliary clocks
- uart with optional interrupt driven tx
- interrupt driven i2c
- spi functions
- interrupt-based event handling
- scheduling
- sample drivers
- Honeywell High Accuracy Ceramic (HSC) and Standard Accuracy Ceramic (SSC) piezoresistive silicon pressure sensors
- Cypress FM24xxx i2c FRAM IC
- Texas Intruments ADS1110 16bit ADC
- Texas Instruments TCA6408 IO expander
- Maxim DS3231 rtc IC
- Maxim DS3234 rtc IC
- Microchip MCP41xxx, MCP42xxx Single/Dual Digital Potentiometer IC
- Texas Instruments PGA2311 stereo audio volume control IC
- Analog Devices AD7789 low power 16/24bit sigma-delta ADC IC
- Makefile-based build, tag file and document generation, code static scan
- shell scripts for checking the build environment, flashing uCs, version incrementation, RTC initialization
- a Makefile driven collection of unit tests for the drivers above
the entire development is done on both a Gentoo Linux and a FreeBSD system using makefiles, vim, the TI toolchain and gdb. while none of those are a requirement to making the library part of any msp430 project, it happens to be the beaten path. the library can be used in the following ways:
see this Makefile for the perfect example. REFLIB_ROOT defines the path to where this atlas430 repository has been cloned, TARGET represents the target microcontroller and config.h will be automatically expanded into compilation macros (-DFOO arguments to be sent to gcc). if TARGET is not hardcoded in the Makefile, then the user needs to provide it as an argument to make:
gmake TARGET=MSP430FXXXX
the makefile supports the following options:
# check if everything is installed and paths are correct
gmake envcheck
# remove the build/DEVICE/ directory
gmake TARGET=MSP430FXXXX clean
# compile the project and library
# create dependency tree and source code tags
gmake TARGET=MSP430FXXXX
# burn the firmware onto the target microcontroller
gmake TARGET=MSP430FXXXX install
# perform an optional static scan of the source code
gmake TARGET=MSP430FXXXX cppcheck # needs dev-util/cppcheck
gmake TARGET=MSP430FXXXX scan-build # needs sys-devel/clang +static-analyzer
in order to use gdb to debug the project make sure to enable the CONFIG_DEBUG macro in config.h and run in a terminal
LD_PRELOAD='~/.local/share/atlas430/lib/$(uname -s)/libmsp430.so' mspdebug --allow-fw-update tilib gdb
and then start gdb from within the project directory:
gmake TARGET=MSP430FXXXX debug
commonly used commands from within gdb provided as example for the unit tests:
target remote localhost:2000
monitor reset
monitor erase
load build/MSP430FXXXX/main.elf
b
disassemble
nexti
info registers
continue
tui enable
the included Makefile.env contains the paths for the excelent TI msp430 toolchain which is a requirement in this scenario. a shell script for checking the build environment can be run on a non-priviledged account and will provide pointers of what packages are needed for building using this library. it also helps in installing the TI toolchain and support files.
all the unit tests can be compiled with this method.
import this project as an example. the atlas430 repo is expected to be symlinked or cloned into ~/.local/share/atlas430/ while the compilation macros, the memory model, compile includes are all baked into the project's xml files - one needs to tweak them via project properties since this scenario is not using any of the provided Makefiles or scripts. compiling and debug is done via CCS.
theoretically like above, but I have never tested it.
HAL functions are expected to work on any of the supported microcontrollers and for each family there are a few devboards on which the code is manually tested. the current compatibility table can be consulted here.
the following projects are already using this library:
project | microcontroller | short description |
---|---|---|
sigdup | msp430fr5994 | software that takes PulseView digital signal captures as input and re-plays them |
proto430 | msp430fr5994 | BoosterPack-compatible development boards used for quick prototyping and interfacing with serial devices |
solar-charger rev4.1 | msp430f5510 | off-the-grid 1 cell lipo and 12v lead battery charger for low efficiency 15-36V photovoltaic cells |
ucurrent_ctrl | msp430f5510 | power controller for Dave L. Jones's µCurrent |