Skip to content

hokim72/AVR-Common

Repository files navigation

Prerequisite

AVRDUDE

$ wget https://copr-be.cloud.fedoraproject.org/results/jlindeberg/arduino-epel7/epel-7-x86_64/avrdude-6.1-2.fc22/avrdude-6.1-2.el7.centos.x86_64.rpm
$ sudo yum install libftdi
$ sudo rpm -ivh avrdude-6.1-2.el7.centos.x86_64.rpm
$ sudo usermod -a -G dialout hokim

Avrdude Test

Setup

$ sudo tar xvzf avr8-gnu-toolchain-3.4.5.1522-linux.any.x86_64.tar.gz -C /opt
$ mkdir -p ~/work/avr; cd ~/work/avr
$ git clone https://github.com/hokim72/AVR-Common.git

~/.bashrc file:

export PATH=$PATH:/opt/avr8-gnu-toolchain-linux_x86_64/bin
export AVR_ROOT=/opt/avr8-gnu-toolchain-linux_x86_64/avr
export AVR_COMMON=$HOME/work/AVR-Common
alias cmake-avr='cmake -DCMAKE_TOOLCHAIN_FILE=$AVR_COMMON/gcc-avr.cmake'
$ source ~/.bashrc

Arduino as ISP programmer

Arduino to ICSP Connection

  1. Pin12 --- MISO (yellow)

  2. VCC --- VCC (red)

  3. Pin13 --- SCK (green)

  4. Pin11 --- MOSI (blue)

  5. Pin10 --- RESET (magenta)

  6. GND --- GND (black)

Avrdude Usage

ArduinoISP programmer

$ avrdude -p atmega328p -c avrisp -P /dev/ttyUSB0 -b 19200 -e -U flash:w:firmware.hex

Usbasp programmer

$ avrdude -p atmega328p -c usbasp -e -U flash:w:firmware.hex

AVR Software

AVRlib

FatFs

avr-uip

LUFA

How To Write Simple Bootloader For AVR In C language

USnoobie Kit

HID-class USB Serial Communication for AVRs using V-USB

LUFA bootloader

DAN64, An AVR based 8-bit microcomputer

Analyzing Compiler Generated Machine Code(.lss)

Using watchdog timer in your projects

Watchdog Reset

Three ways to reset

Using Standard IO Streams in AVR GCC

Merging Bootloader HEX-File and Application HEX-File to one

How to convert .c to .S

$ avr-gcc -Os -S -DF_CPU=8000000 -mmcu=atmega328p somecode.c

.data section

The .data section contains data definitions of initialized data items. Initialized data is data that has a value before the program begins running. These values are part of the executable file. They are loaded into memory when the executable file is loaded into memory for execution.

The important thing to remember about the .data section is that the more initialized data items you define, the larger the executable file will be, and the longer it will take to load it from disk into memory when you run it.

.bss section

Not all data items need to have values before the program begins running. When you’re reading data from a disk file, for example, you need to have a place for the data to go after it comes in from disk. Data buffers like that are defined in the .bss section of your program. You set aside some number of bytes for a buffer and give the buffer a name, but you don’t say what values are to be present in the buffer.

There’s a crucial difference between data items defined in the .data section and data items defined in the .bss section: data items in the .data section add to the size of your executable file. Data items in the .bss section do not. A buffer that takes up 16,000 bytes (or more, sometimes much more) can be defined in .bss and add almost nothing (about 50 bytes for the description) to the executable file size.

Anatomy of AVR hex file

https://rajeshkovvuri.wordpress.com/2011/10/28/anatomy-of-avr-hex-file

https://en.wikipedia.org/wiki/Intel_HEX

Dump and Disassemble AVR uC Flash Memory

https://ucexperiment.wordpress.com/2015/01/04/dump-and-disassemble-avr-%C2%B5c-flash-memory/

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published