Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
avrkurs
avrkurs
Commits
d52e998a
Commit
d52e998a
authored
Mar 07, 2017
by
magho
Browse files
modified Makefile for linux programming
parent
a33569ab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Makefile
0 → 100644
View file @
d52e998a
# This is a Makefile for AVR KURS,
# attempting to provide support for compiling and flashing AtTiny817 from Linux (2017-03-07)
# Author: magne.hov@gmail.com
#
# Guide for programming AVR AtTiny817 in Linux
# To compile for AVR AtTiny817 we need some utilities for AVR, install these:
# 'sudo apt-get install gcc-avr binutils-avr gdb-avr avr-libc' for aptitude distros
# or 'pacman -S gcc-avr binutils-avr gdb-avr avr-libc' for Arch distro
#
# We also need an Atmel AtTiny Series Device Support package, which cannot easily
# be extracted on Linux and is easiest copied from a friend or AVR kurs studass.
# If copying from Windows, the Attiny folder should be located somewhere like this:
# "C:\Program Files (x86)\Atmel\Studio\7.0\packs\atmel\Attiny_DFP\1.2.112" ...
# ... after being unpacked by Atmel Studio.
# Make sure to put this package at the place where DFP_DIR in this file is directed
#
# To program the AtTiny on Linux, an unofficial tool called pyUPDI can be used.
# It can be downloaded from https://github.com/mraardvark/pyupdi through git:
# 'git clone https://github.com/mraardvark/pyupdi'
# in f.ex /home/user/repos.
#
# pyUPDI depends on python 2.7, and some python 2.7 packages, install these with
# 'pip2 install pyserial intelhex'
# Note: if you don't have pip2, install it with
# 'sudo apt-get install python-pip' for aptitude repos etc.
# or 'sudo pacman -S python2-pip' for Arch etc.
#
# Remember to edit HOME_DIR in this file to point to your home directory, and to modifiy
# DFP_DIR and PYUPDI_DIR in this file to point to the directories where you placed the
# Support package and pyUPDI.
#
# When all of these dependencies are taken care of, you should be able to run 'sudo make' from the folder with the source files and MakeFile.
# ###
# Dependency directories and binaries
HOME_DIR
=
/home/magne/
DFP_DIR
=
$(HOME_DIR)
avr/dfp/1.2.112/
PYUPDI_DIR
=
$(HOME_DIR)
repos/pyupdi/
AVR-GCC
=
avr-gcc
AVR-OBJCOPY
=
avr-objcopy
# ####
# Project files and flags
#Source files, add more files to SRC if needed: main.c uart.c ...
SRC
=
main.c
OBJ
=
$(SRC:.c=.o)
#Target name
TARGET
=
out
#Compiler and Linker flags
MCU
=
attiny817
CFLAGS
=
-B
$(DFP_DIR)
gcc/dev/attiny817
-I
$(DFP_DIR)
include
-mmcu
=
$(MCU)
-Os
LDFLAGS
=
-B
$(DFP_DIR)
gcc/dev/attiny817
-I
$(DFP_DIR)
include
-mmcu
=
$(MCU)
#-Wl,-Map=
$(TARGET)
.map
# ####
# Make rules
all
:
compile flash clean
compile
:
$(TARGET).hex
flash
:
compile
python2
$(PYUPDI_DIR)
pyupdi.py /dev/ttyACM0 tiny817
$(TARGET)
.hex
clean
:
rm
-f
$(OBJ)
$(TARGET)
.
{
elf,hex
}
# ####
# Compiler rules
%.hex
:
%.elf
$
(
AVR-OBJCOPY
)
-O
ihex
-R
.eeprom
-R
.fuse
-R
.lock
-R
.signature
$<
$@
%.elf
:
$(OBJ)
$
(
AVR-GCC
)
$^
$(LDFLAGS)
-o
$@
%.o
:
%.c
$
(
AVR-GCC
)
$(CFLAGS)
-o
$@
-c
$<
Session1/Task1/Makefile
deleted
100644 → 0
View file @
a33569ab
# This is a Makefile for AVR KURS,
# attempting to provide support for compiling and flashing from Linux
# CHANGE THIS TO THE FOLDER YOU PUT YOUR DOWNLOADS IN
# The avr_toolchain and DFP folders should be put in the following defined folder
DOWNLOAD_DIR
=
/home/magne/avr/
# WHERE GET THIS?
# This toolchain package can be downloaded from Atmel:
# http://www.atmel.com/tools/ATMELAVRTOOLCHAINFORLINUX.aspx
#
AVR8_TOOLS_DIR
=
$(DOWNLOAD_DIR)
atmel_avr_toolchain/
# WHERE GET THIS?
# This DPF folder can be found in the
# Atmel ATtiny Series Device Support (1.2.112)
# AtPack downloaded from:
# http://packs.download.atmel.com/
#
# However, the AtPack must be unpacked by Atmel Studio (read: Windows.exe),
# so it is best transferred from a friend. [ INCLUDE A DOWNLOAD ON THE COURSE PAGE? ]
# In this case, the Attiny folder should be located somewhere like this:
# "C:\Program Files (x86)\Atmel\Studio\7.0\packs\atmel\Attiny_DFP\1.2.112" ...
# ... after being unpacked by Atmel Studio.
#
DFP_DIR
=
$(DOWNLOAD_DIR)
dfp/1.2.112/
# The important options for avr-gcc are
# -B directory for spec-file folder from DFP pcakage
# -I directory for includes from DFP package
# -mmcu device id
# -o output file [in HEX ??]
compile
:
$(AVR8_TOOLS_DIR)
bin/avr-gcc
-B
$(DFP_DIR)
gcc/dev/attiny817
-I
$(DFP_DIR)
include
-mmcu
=
attiny817
-Os
-o
task1.hex main.c
# and here make some rules for flashing through pyupdi
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment