Assuming an ubuntu machine install following packages and test them by building a simple led blinking program as listed below.
- Install gcc-msp430, the GNU compiler collection for msp430 https://launchpad.net/ubuntu/+source/gcc-msp430 or https://www.ti.com/tool/MSP430-GCC-OPENSOURCE
- sudo apt-get install gcc-msp430
- Install msp430mcu, which ships specs files, headers and linker scripts for msp430 targets https://launchpad.net/ubuntu/+source/msp430mcu
- sudo apt-get install msp430mcu
- Install msp430-libc, which is a C library for msp430 devices https://launchpad.net/ubuntu/+source/msp430-libc
- sudo apt-get install msp430-libc
- Test tool-chain by compiling a simple program, which blinks two Leds
- msp430-gcc -mmcu=msp430g2553 blinkled.c -o blinkled.elf
- Blinkled.c:
#include <msp430g2553.h>
volatile unsigned int i=0
void main(void)
{
WDTCTL = WDTPW + WDTHOLD;
P1OUT |= BIT0;
P1OUT &= ~BIT6;
P1DIR |= BIT0 | BIT6;
while(1)
{
for(i=0;i<10000;i++);
P1OUT ^= BIT0 | BIT6;
}
}
If the build succeeds your tool-chain is ready. Next step is to flash the .elf to a device to see if it works.
Subscribe to get last updates.