Skip to content

Instantly share code, notes, and snippets.

@RickKimball
RickKimball / makefile
Created October 19, 2011 04:58
gcc port of mspg2xx3_ta_01.asm for the msp430g2553 chip
#
# Makefile - for TI sample msp430g2xx3_ta_01.asm ported to msp430-gcc
#
# Author: Rick Kimball
# email: rick@kimballsoftware.com
# Version: 1.00 Initial version 10/19/2011
MCU=msp430g2553
CC=msp430-gcc
CXX=msp430-g++
@RickKimball
RickKimball / delay.S
Created November 22, 2011 01:16
MSP430 - delay_cycles() function with one cycle granularity written for msp430-as
;--------------------------------------------------------------------------------
; gcc port of this code: http://www.43oh.com/forum/viewtopic.php?p=7273#p7265
;--------------------------------------------------------------------------------
#include <msp430.h>
#define PC r0 /* gcc doesn't know about PC,SP,SR,CG1,CG2 */
#define ARG1 R15 /*C function arguments are passed in R15-R12 */
.file "delay.S"
@RickKimball
RickKimball / build-mspgcc.sh
Created December 28, 2011 20:27
msp430gcc toolchain fetcher/builder script
#!/usr/bin/env bash
# $Id: build-mspgcc 70 2011-11-05 19:40:36Z ice $
# 2012-02-04 kimballr - modified for latest FSF directory and
# sourceforge patch file name changes
# 2012-03-13 kimballr - added patches
#
# download, build and install GCC toolchain for MSP430
#
# prerequisites
# - bash
@RickKimball
RickKimball / main.cpp
Created January 3, 2012 20:59
msp430 serial tool kit software/usci/timera/spi implementations
/**
* main.cpp - swserial/timerserial/usciserial Serial Asynch test driver.
*
* To test: use putty and connect to /dev/ttyACM0 at 9600 Baud
*
*/
#include <msp430.h>
#include <stdio.h>
#include "serial.h"
@RickKimball
RickKimball / gpio.h
Created January 11, 2012 22:45
msp430 template based gpio experiment
/*
* gpio.h - experimental template based c++ gpio abstraction
*
* Created on: Jan 14, 2012
* Author: kimballr
*
* 01/14/2012 - kimballr added volatile to SFR registers and force inline
* 01/16/2012 - kimballr more functions more experimentation
* 01/28/2012 - kimballr more complete implementation dealing with a 28 pin msp430g2553
*/
@RickKimball
RickKimball / delay.c
Created January 19, 2012 22:02
msp430-gcc delay using inline asm
/**
* void delay(uint16 cnt) - using cpu cycle counting busy loop
*
* Sit in a tight loop until delayCycles instructions cycles
* have occurred. Not very power friendly. Not very interrupt
* friendly. In fact, you should disable interrupts before
* calling this function to insure accurate results.
*
* Note: minimum of 20 cycles
*
@RickKimball
RickKimball / main.cpp
Created March 19, 2012 14:42
msp430 with minimized low level init code
/*
* main.cpp
*
* Created on: Mar 15, 2012
* Author: kimballr
*/
#include <msp430.h>
#define GREEN_LED_PIN BIT6
@RickKimball
RickKimball / framasram.x
Created March 21, 2012 00:08
msp430fr5750 - messing with fram as ram
/* Default linker script, for normal executables */
OUTPUT_FORMAT("elf32-msp430")
OUTPUT_ARCH("msp430")
INCLUDE memory.x
INCLUDE periph.x
SECTIONS
{
/* Read-only sections, merged into text segment. */
.hash : { *(.hash) }
.dynsym : { *(.dynsym) }
@RickKimball
RickKimball / diskio.h
Created April 7, 2012 04:29
msp430 Petit FatFile System sample
/*-----------------------------------------------------------------------
/ PFF - Low level disk interface modlue include file (C)ChaN, 2009
/-----------------------------------------------------------------------*/
#ifndef _DISKIO
#include "integer.h"
/* Status of Disk Functions */
typedef BYTE DSTATUS;
@RickKimball
RickKimball / main.c
Created April 10, 2012 03:20
msp430 port of tlv data dump
/**
* tlv_data dumper - msp430-gcc port
*
* see: http://www.43oh.com/forum/viewtopic.php?f=10&t=2547
*
*/
#include <msp430.h>
#include <stdint.h>
volatile unsigned ta0txbuf = 0; // Timer0_A0 Transmit buffer pseudo register