Zack Lalanne
Published © MIT

Automated Deployment of MSP430 Firmware

Automated deployment of MSP430 Firmware on a network using Ansible + Raspberry Pi

IntermediateFull instructions provided1,423
Automated Deployment of MSP430 Firmware

Things used in this project

Story

Read more

Code

Code

YAML
---
# Generic things to get machines up to date and usable

- name: Install packages
  apt:
    pkg={{item}}
    state=installed
  sudo: yes
  with_items:
    - vim
    - zsh
    - git
    - tmux
    - htop

- name: Change default shell
  user:
    name=pi
    shell=/usr/bin/zsh
  sudo: yes

Code

YAML
---
# Playbook to install msp debug

- name: Install libmsp430.so
  copy:
    src=libmsp430.so
    dest=/usr/local/lib
  sudo: yes

- name: Install mspdebug
  copy:
    src=mspdebug
    dest=/usr/local/bin
    mode=775
  sudo: yes

- name: Add /usr/local/lib to LD_SEARCH_PATH
  lineinfile:
    dest=/etc/ld.so.conf
    line=/usr/local/lib
    state=present
  sudo: yes
  register: ld

- name: Rebuild LD cache
  command: /sbin/ldconfig
  sudo: yes
  when: ld.changed

Code

YAML
---
# Playbook to update firmware on connected devices

- name: Create a directory to store the firmware
  file:
    path=/var/ansible
    state=directory
    owner=pi
  sudo: yes

- name: Copy the firmware to the hosts
  copy:
    src={{ firmware_name }}.out
    dest=/var/ansible

- name: Download the firmware to the devices
  shell: mspdebug tilib --allow-fw-update --force-reset "prog /var/ansible/{{ firmware_name }}.out"
  sudo: yes

Code

YAML
---
# This playbook deploys firmware to all hosts

- name: Configure and deploy firmware
  hosts: all
  remote_user: pi
  roles:
    - common
    - mspdebug

Code

Plain text
---
# Generic things to get machines up to date and usable

- name: Install packages
  apt:
    pkg={{item}}
    state=installed
  sudo: yes
  with_items:
    - vim
    - zsh
    - git
    - tmux
    - htop

- name: Change default shell
  user:
    name=pi
    shell=/usr/bin/zsh
  sudo: yes

Code

YAML
---
# Playbook to install msp debug

- name: Install libmsp430.so
  copy:
    src=libmsp430.so
    dest=/usr/local/lib
  sudo: yes

- name: Install mspdebug
  copy:
    src=mspdebug
    dest=/usr/local/bin
    mode=775
  sudo: yes

- name: Add /usr/local/lib to LD_SEARCH_PATH
  lineinfile:
    dest=/etc/ld.so.conf
    line=/usr/local/lib
    state=present
  sudo: yes
  register: ld

- name: Rebuild LD cache
  command: /sbin/ldconfig
  sudo: yes
  when: ld.changed

Code

YAML
---
# Playbook to update firmware on connected devices

- name: Create a directory to store the firmware
  file:
    path=/var/ansible
    state=directory
    owner=pi
  sudo: yes

- name: Copy the firmware to the hosts
  copy:
    src={{ firmware_name }}.out
    dest=/var/ansible

- name: Download the firmware to the devices
  shell: mspdebug tilib --allow-fw-update --force-reset "prog /var/ansible/{{ firmware_name }}.out"
  sudo: yes

Code

YAML
---
# This playbook deploys firmware to all hosts

- name: Configure and deploy firmware
  hosts: all
  remote_user: pi
  roles:
    - common
    - mspdebug

Github

https://github.com/zlalanne/msp-rpi-ansible

Credits

Zack Lalanne

Zack Lalanne

1 project • 1 follower
I'm an Software Engineer working at Texas Instruments with the MSP430. I graduated from UT Austin in 2012 and now live in Dallas, TX with my wife and dog.

Comments