Outils pour utilisateurs

Outils du site


msp430_linux

MSP430 && Linux

Le but de cette page est d'installer un toolchain + debugger sur un environnement Linux.

Dans notre cas, il va s'agir de Archlinux.

Installation des paquets

  • gcc-msp430
  • binutils-msp430
  • msp430-libc
  • msp430mcu
  • mspdebug

Ce qui donne avec yaourt :

yaourt -S gcc-msp430 binutils-msp430 msp430-libc msp430mcu mspdebug
Makefile
CC=msp430-gcc
CFLAGS=-Os -Wall -g -mmcu=msp430g2553
 
OBJS=main.o
 
 
all: $(OBJS)
	$(CC) $(CFLAGS) -o main.elf $(OBJS)
 
%.o: %.c
	$(CC) $(CFLAGS) -c $<
 
clean:
	rm -fr main.elf $(OBJS)
 
upload:
	mspdebug rf2500 "prog main.elf"
Main.c
#include <msp430g2553.h>
 
#define LED1 BIT6
#define LED0 BIT0
 
void delay_cycles(unsigned long long delay) {
	volatile unsigned long long i;
	for (i = 0; i < delay; i++);
}
 
int main(void)
{
 
	P1DIR |= (LED1 | LED0);
	P1OUT &= (LED1 | LED0);
	while (1){
		P1OUT ^= (LED1 | LED0);
		delay_cycles(1000000);
	}
	return 0;
}
Compilation & Upload
make && make upload
msp430_linux.txt · Dernière modification: 2015/01/28 03:09 (modification externe)