Code Monkey home page Code Monkey logo

icb-toolchain's Introduction

ICB Toolchain Demo

Modified: 2022-09

Demo of using CMake to create a toolchain for building and flashing firmware for the Incuvers Control Board. I have supplied a sample program which blinks the SCK LED (PORTB1) at 2Hz. It also uses an ISR tied to the interrupt vector for completed usart reception to echo characters back to a serial console.

Setup

You will need avr-libc and the avr code generation tooling. On MacOSX you can use homebrew to install these dependancies:

brew tap osx-cross/avr
brew install avr-gcc

Your code generation tools root should be under /usr/local/bin try running avr-gcc --version in the terminal to ensure it is found.

Configuration

You will need to define the serial device for the control board. Furthermore the following programs need to be found in the CGT_ROOT path:

  • avr-gcc
  • avr-objcopy
  • avrdude
  • avr-g++
  • avr-strip

Once this is confirmed update the cmake definitions in the CMakeLists.txt:

set(SERIAL_PORT "/dev/tty.usbserial-A10JTC54")
set(CGT_ROOT "/usr/local/bin")

Run the cmake project configuration:

mkdir build
cd build
cmake ..

Compilation

Compile the firmware to .elf format and then object copy to .hex:

make -j4

Flashing

Flash the .hex binary to the control board:

make flash

The SCK should blink at 2Hz: img

Fuse Configuration

I've added a fuse directive to setup the chips fuses according to the ATMEL2560:

make fuses

Demo

Open a serial console to the control board by targetting the usb device in /dev and run at 115200 baud:

$ screen /dev/yourusbdevice 115200
...
type some random stuff in the console and ensure characters echo back.

To exit screen: ctrl+a to enter command mode, then press k for kill and then press y to confirm kill

Further Reading

ATMEL 2560 Datasheet to get started baremetal programming.

icb-toolchain's People

Contributors

ztnel avatar

Watchers

Paul avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.