Embedded Programming

Back to Mónica Pedro ←main page ←Assigments

 individual assignment:
    read a microcontroller data sheet 
        program your board to do something,
            with as many different programming languages
                    and programming environments as possible
    
     group assignment:
        compare the performance and development workflows
            for other architectures
    

Microcontroller data sheet

About the Microcontroller Attiny44 and MyBoard


Significant facts:

FTDI

I'll use the SparkFun FTDI Basic Breakout - 5V

Programming my board to do something

The microcontrollers that we'd been using are AVR, namely Attiny44 and Attiny45, so I need to understand how to program them


Sources of knowledge:

AVR Lib user manual.pdf
Microchip AVR Libc Reference Manual

Programming Environments

Inspired by professor Neil Gershenfel I wanted to use low level programming, namely through Mac OS Terminal, so I strugled to install it... wuite a lot....

AVR ToolChain:

  1. FSF: Free Software Foundation promotes the development of and use of free software, particularly the GNU operating system, used widely in its GNU/Linux variant.
  2. GCC - One of the main projects of GNU systems is the GNU Compiler Collection, or GCC, and its sister project, the Binutils. The two open source projects provide a foundation for a software development toolchain. (originzally to run on Linux-like systems).
  3. Bunutils: stands for "Binary Utilities". It contains the GNU assembler (gas), and the GNU linker (ld), but also contains many other utilities that work with binary files that are created as part of the software development toolchain.
  4. avr-lib: The open source AVR toolchain has its own Standard C Library project. This because GCC and Binutils provides a lot of the tools to develop software, but there is one critical component that they do not provide: a Standard C Library. There are different open source projects that provide a Standard C Library depending upon your system time, whether for a native compiler (GNU Libc), for some other embedded system (newlib), or for some versions of Linux (uCLibc).
  5. MAKE File: contains dependency rules, showing which output files are dependent upon which input files, and instructions on how to build output files from input files.
  6. AVRDUDE is a program that can interface with various hardware devices to program its processor.

Installing GNU ToolChain

  1. in Mac OS terminal: echo $PATH to see the Shell Path
  2. update the Shell Path to include AVR folder fallowing this elegant documentation: Modify the Shell Path in macOS Sierra
  3. Install GNU Binutils on AVR folder
  4. Install GNU in AVR folder
  5. brew tap homebrew/versions... and it showed the message: "Updating Homebrew..." which ended with the message: "Error: homebrew/versions was deprecated. This tap is now empty as all its formulae were migrated."
  6. brew install which ended without erros...
  7. Install AVR LibC - will try using homebrew since it had been a GCC clean installation. found this directions: Homebrew AVR Toolchain
    1. brew tap osx-cross/avr, which resulted in
    2. brew install avr-gcc - which resulted in

      , almost 20 minuts...
  8. Install avrdude - HomeBrew worked just fine above, so I used it again: brew install avrdude which resulted ...
  9. HomeBrew Instructions

Using the GNU toolchain

Readings for leaning

GCC and Make

Programming the board

Using FABIsp

Attention to the USB cable which needs to have a Female extention, as this one

Connecting the 6-pin header to FabIsp taking attention tho the board schematic

Hello World 6-pin head

Fab ISP 6-pin head

Connecting FabISP to Hello World Board

Then see if the FabISP is recognised by MAC OS Sierra I used a new command ioreg which shows the I/O Kit registry, as fallows:

$ ioreg -p IOUSB -w0 -l

which resulted in the fallowing..

now I would like to program the board using the Comand Line and the files provided in Academy

Programming with different languages

for that I fallowed the indication of Lining Yao

  1. traveled to disk folder where I'd saved the files with the comand $CD F2019, where "F2019" is the folder name
  2. introduced comand: $ make -f hello.ftdi.44.echo.c.make, which resulted in the fallowing
  3. introduced comand: $ make -f hello.ftdi.44.echo.c.make program-usbtiny , which resulted in the fallowing EROR 1
  4. SOLUTION: Connect the FTDI cabe to the Board


    And... it worked!!!

  5. next comand whas to run the Phyton Code: $ python hello.ftdi.44.py /dev/tty.usb* 115200, which resulted in..
  6. so needed some different instructions and founded Schaad

  7. $ sudo easy_install pip
  8. $ pip install pyserial
  9. $ python term.py /dev/tty. and hit the key TAB to vew the Ports ADDS as in my case
  10. then finished the comand with $ python term.py /dev/tty.usbserial-A700eEf3 115200
  11. and got an ERROR: python: can't open file 'term.py': [Errno 2] No such file or directory
FTDI