Differences

This shows you the differences between two versions of the page.

Link to this comparison view

msplinux [2012/02/14 21:22]
john
msplinux [2018/03/06 08:59]
Line 1: Line 1:
-====== Using the MSP430 Launchpad in Arch Linux ====== 
-Start by installing all the stuff listed in the top part of [[http://​losinggeneration.homelinux.org/​2010/​07/​02/​msp430-launchpad-on-linux/​|this document]]. 
  
-You can get all this stuff through AUR, and its dependencies through pacman. 
-  *binutils-msp430 ​ 
-  *gcc-msp430 
-  *msp430-gdb 
-  *msp430-libc 
-  *msp430mcu 
-  *mspdebug 
- 
-Next, you need a make file. This one has worked for me. 
- 
-<file c 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) 
-</​file>​ 
- 
-Get your hands on some sample code to play with, something like this that blinks an LED works fine. 
- 
-<file c main.c> 
-#include <​msp430g2553.h>​ 
- 
-#define pause for (i=0; i < 100; i++) wait(7000) 
- 
-void wait(int ticks) 
-{ 
- TAR=0; 
- while(TAR < ticks) _NOP(); 
-} 
- 
-void main(void) 
-{ 
- int i = 0; 
- WDTCTL = WDTPW + WDTHOLD; // stop watchdog 
- 
- TACTL = TASSEL_2 | MC_2; 
- 
- // setup TXD and RXD 
- P1SEL =  0;   // all ports GPIO 
- P1DIR = 0xFF; // all is output 
-  
- 
- while(1) 
- { 
- P1OUT ^= (BIT0); // toggle bit0 (red LED) 
- pause; // wait 
- } 
-} 
-</​file>​ 
- 
-Now, type "​make"​. If jesus loves you, this should happen: 
- 
-<​code>​ 
-[john@TX100 blinktest]$ make  
-msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -c main.c ​ 
-main.c:​11:​6:​ warning: return type of '​main'​ is not '​int' ​ 
-msp430-gcc -Os -Wall -g -mmcu=msp430g2553 -o main.elf main.o ​ 
-[john@TX100 blinktest]$ ls  
-main.c ​ main.elf ​ main.o ​ makefile 
-</​code>​ 
- 
- 
-Now, start mspdebug: 
- 
-<​code>​ 
-[john@TX100 blinktest]$ sudo mspdebug rf2500 
-MSPDebug version 0.18 - debugging tool for MSP430 MCUs 
-Copyright (C) 2009-2011 Daniel Beer <​dlbeer@gmail.com>​ 
-This is free software; see the source for copying conditions. ​ There is NO 
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
-Trying to open interface 1 on 004 
-Initializing FET... 
-FET protocol version is 30066536 
-Configured for Spy-Bi-Wire 
-Set Vcc: 3000 mV 
-Device ID: 0x2553 
-Device: MSP430G2553 
-Code memory starts at 0xc000 
-Number of breakpoints:​ 2 
-fet: FET returned NAK 
-fet: warning: message 0x30 failed 
- 
-Available commands: 
-    =         ​delbreak ​ gdb       ​load ​     opt       ​reset ​    simio 
-    alias     ​dis ​      ​help ​     locka     ​prog ​     run       step 
-    break     ​erase ​    ​hexout ​   md        read      set       sym 
-    cgraph ​   exit      isearch ​  ​mw ​       regs      setbreak 
- 
-Available options: 
-    color           ​gdb_loop ​       iradix 
-    fet_block_size ​ gdbc_xfer_size ​ quiet 
- 
-Type "help <​topic>"​ for more information. 
-Press Ctrl+D to quit. 
- 
-(mspdebug) 
-</​code>​ 
- 
-Now at this point, things get a little bit convoluted. I think the guide I linked above does a few extra/weird things, but whatever, it works. 
- 
-At the (mspdebug) prompt, type '​erase'​ to wipe the chip, then type prog main.elf and your program will be dumped on the chip. Now you need to start the debugger. I suggest you use tmux or screen for all of this, because you'll need two terminals at once. In the first terminal, run the command '​gdb'​ and switch to another terminal. Here, run msp430-gdb main.elf as a standard user. At the (gdb) prompt, enter '​target remote localhost:​2000'​ and then type continue. After a few seconds, your program should start and your LED will begin blinking. 
msplinux.txt ยท Last modified: 2018/03/06 08:59 (external edit)
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0