Hello community,
here is the log from the commit of package avr-example for openSUSE:Factory
checked in at Mon Jul 19 20:48:50 CEST 2010.
--------
New Changes file:
--- /dev/null 2010-05-08 11:31:08.000000000 +0200
+++ /mounts/work_src_done/STABLE/avr-example/avr-example.changes 2010-05-14 18:18:29.000000000 +0200
@@ -0,0 +1,33 @@
+-------------------------------------------------------------------
+Fri May 14 16:06:50 UTC 2010 - jw@novell.com
+
+- allow more overrides in Makefile, by using ::
+- improved AVRDUDE_OPT example to sugest PORT passing
+
+-------------------------------------------------------------------
+Wed Mar 24 09:28:24 UTC 2010 - jw@novell.com
+
+- fixed paths in avr-example.sh
+- fixed initial call to make so that default PROG_HW is still honored.
+- changed Require: cross-avr-insight into Recommends.
+ It is not *really* needed. (and does not build today..)
+
+-------------------------------------------------------------------
+Tue Mar 23 22:27:46 UTC 2010 - mhopf@novell.com
+
+- Didn't build on 11.1 due to missing BuildRoot:. Don't ask.
+- Consolidated multiple Requires:.
+
+-------------------------------------------------------------------
+Tue Mar 23 19:32:45 UTC 2010 - jw@novell.com
+
+- re-riddled the spec file.
+- using /usr/share/packages/avr-example/ instead of /opt/cross
+- logicp is here and in avr-libc: here it is a post install test.
+
+-------------------------------------------------------------------
+Sat Mar 6 20:55:39 UTC 2010 - jw@novell.com
+
+- split avr-example from avr-libc
+ to get the dependencies clean.
+
calling whatdependson for head-i586
New:
----
avr-example.changes
avr-example.sh
avr-example.spec
avr_common.mk
avr_isp.pl
logicp-1.01.tgz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ avr-example.spec ++++++
#
# spec file for package avr-example (Version 1.2)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
%define PREFIX /opt/cross
Name: avr-example
BuildRequires: avr-libc avrdude cross-avr-binutils cross-avr-gcc make
Requires: cross-avr-binutils cross-avr-gcc avr-libc avrdude make avr-programmer
Recommends: cross-avr-insight
Version: 1.2
Release: 1
Url: http://build.opensuse.org/projects
Group: Development/Libraries/C and C++
License: BSD3c
Summary: An non-trivial example project builder for Atmel AVR development
Source1: avr-example.sh
Source3: logicp-1.01.tgz
Source4: avr_isp.pl
Source5: avr_common.mk
AutoReqProv: on
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
An easy start with the Atmel AVR 8bit Microcontroller toolchain.
This package features a (non-)trivial blinkenlight application.
Comes with a an easy to use Makefile and a set of helper scripts for
compilation and supports upload through a range of hardware programmers.
This package requires the complete GNU toolchain.
Authors:
--------
Juergen Weigert
%prep
%setup -T -c -n %name-%version -b 3
%build
%install
mkdir -p $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}
cp %{S:4} %{S:5} $RPM_BUILD_ROOT/usr/share/doc/packages/%{name}
install -m 0755 -D %{S:1} $RPM_BUILD_ROOT/usr/bin/avr-example
%check
### selftest ###
cd logicp*
## IF avr-libc not yet installed
## how do we tell the linker that crt*.o is at a nonstandard location?
# ln -s $RPM_BUILD_ROOT%PREFIX/avr/lib/crttn*.o .
# ln -s $RPM_BUILD_ROOT%PREFIX/avr/lib/avr?/crtm*.o .
# make test CFLAGS="-Wall -g -Os -mint8 -I$RPM_BUILD_ROOT%PREFIX/avr/include/ -L$RPM_BUILD_ROOT%PREFIX/avr/lib/avr4" CPU=mega8
# make test CFLAGS="-Wall -g -Os -mint8 -I$RPM_BUILD_ROOT%PREFIX/avr/include/ -L$RPM_BUILD_ROOT%PREFIX/avr/lib/avr4" CPU=mega48
# make test CFLAGS="-Wall -g -Os -mint8 -I$RPM_BUILD_ROOT%PREFIX/avr/include/ -L$RPM_BUILD_ROOT%PREFIX/avr/lib" CPU=tiny2313
## ELSE
make test CFLAGS="-Wall -g -Os -mint8" CPU=mega8
make test CFLAGS="-Wall -g -Os -mint8" CPU=mega48
make test CFLAGS="-Wall -g -Os -mint8" CPU=tiny2313
## ENDIF
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr (-, root, root)
%doc /usr/share/doc/packages/%{name}
/usr/bin/avr*
/usr/share/doc/packages/*
%changelog
++++++ avr-example.sh ++++++
#! /bin/sh
#
# avr-example -- a shell script to bootstrap a new avr project
# 2008-09-01, jw -- initial draught
# 2010-02-08, jw -- Makefile extended with more comments
# 2010-03-23, jw -- no longer part of avr-libc
# from=/opt/cross/share/doc/avr-libc*/examples/
from=/usr/share/doc/packages/avr-example*/
name=example
mkdir -p $name
cd $name || exit 0
test -f avr_common.mk || cp $from/avr_common.mk .
test -f avr_isp.pl || cp $from/avr_isp.pl .
chmod a+x avr_isp.pl
test -f blink.c || cat << EOF > blink.c
/*
* blink.c -- simple LED blinker
*
* Copyright (C) 2008, jw@suse.de, distribute under GPL, use with mercy.
*
*/
// #include "config.h"
#include "cpu_mhz.h"
#include // needs F_CPU from cpu_mhz.h
#include
#ifdef PORTA
# define LED_PORT PORTA
# define LED_DDR DDRA
#else
# ifdef PORTB
# define LED_PORT PORTB
# define LED_DDR DDRB
# else
# error "This CPU has no PORTA or PORTB, try somethig different"
# endif
#endif
#define LED_BITS 0xff // try all ...
int main()
{
LED_DDR |= LED_BITS; // all pins outout
for (;;)
{
_delay_ms(200.0); LED_PORT &= ~(LED_BITS); // pull low ...
_delay_ms(200.0); LED_PORT |= LED_BITS; // pull high ...
}
}
EOF
test -f Makefile || cat << EOF > Makefile
# Makefile for project \$(NAME)
# Distribute under GPLv2, use with care.
#
# 2008-09-25, jw@suse.de
NAME = example
CFILES = blink.c # \$(NAME).c eeprom.c i2c_slave_cb.c
CPU = tiny2313
#CPU = mega48
#CPU = mega169
#CPU = mega644
PROG_HW = usbtiny # www.ladyada.com
#PROG_HW = usbasp # www.fischl.de
#PROG_HW = stk200 # www.atmel.com
#PROG_HW = butterfly # www.atmel.com
#PROG_HW = mkbutterfly # www.mikrokopter.de
#PROG_PORT = /dev/ttyUSB0
#PROG_PORT = /dev/rfcomm1
#AVRDUDE_OPT = -b 57600 -P $(PROG_PORT)
PROG_SW = avrdude
#PROG_SW = sudo avrdude # recommended
#PROG_SW = uisp # deprecated
## use this, if \$(ISP) magic fails
#UPLOAD_CMD = \$(PROG_SW) -p AT\$(CPU) -c \$(PROG_HW) \$(AVRDUDE_OPT) \$(addprefix -P,\$(PROG_PORT)) -U \$(NAME).hex -v
#CFLAGS += -Os -g -Wall
#LDFLAGS += -Wl,-u,vfprintf -lprintf_min
TOP_DIR = .
include \$(TOP_DIR)/avr_common.mk
distclean::
rm -f download* ee_data.*
## header file dependencies
#############################
include depend.mk
EOF
:>> depend.mk
set -x
export PATH=/opt/cross/bin:$PATH
ISP_OPT=-n make 1mhz
make depend
make
echo try 'make help', for a list of make variables and targets.
++++++ avr_common.mk ++++++
# avr_common.mk -- common Makefile macros for avr projects
#
# (C) Copyright 2008,2009 Juergen Weigert, jw@suse.de
# Distribute under GPLv2, use with care.
#
# 2007-07-23, jw, features: VPATH support
# 2008-01-27, jw added make depend, make help.
# make NNmhz did not generates cpu_mhz.h - fixed.
# 2008-02-01, jw fixed egrep to let error messages through.
# 2008-09-29, jw improved 'make help', added 'make clock rc=8mhz'
# 2009-08-09, jw do not rename dirs if under svn.
# 2010-02-08, jw do not overwrite CFLAGS or other Makefile variables.
# pass down -A AVRDUDE_OPT, honor UPLOAD_CMD.
#
# Makefile example:
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# # Makefile for project $(NAME)
# # Distribute under GPLv2, use with care.
# #
# # 2007-06-08, jw
#
# NAME = tinyPWMout
# OFILES = $(NAME).o eeprom.o i2c_slave_cb.o
# CPU = tiny2313
# PROG_SW = avrdude
# PROG_HW = stk200
# TOP_DIR = ..
#
# include $(TOP_DIR)/avr_common.mk
#
# distclean::
# rm -f download* ee_data.*
#
# ## header file dependencies
# #############################
# include depend.mk
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
ifeq ($(TOP_DIR),)
TOP_DIR = .
endif
ifeq ($(PROJ),)
PROJ := $(NAME)
endif
ifeq ($(PROG_HW),)
else
ISP_OPT += -c '$(PROG_HW)'
endif
ifeq ($(PROG_SW),)
else
ISP_OPT += -s '$(PROG_SW)'
endif
ifeq ($(CPU),)
else
ISP_OPT += -p '$(CPU)'
endif
ifeq ($(AVRDUDE_OPT),)
else
ISP_OPT += -A '$(AVRDUDE_OPT)'
endif
ifeq ($(CFILES),)
CFILES := $(OFILES:%.o=%.c)
endif
# OFILES reside in cwd, even if sources were found via VPATH
ifeq ($(OFILES),)
OFILES := $(subst $(TOP_DIR)/,./,$(CFILES:%.c=%.o))
endif
ifeq ($(ISP),)
ISP = $(TOP_DIR)/avr_isp.pl $(ISP_OPT)
endif
CC = avr-gcc -mmcu=at$(CPU)
ifeq ($(O2HEX),)
O2HEX = avr-objcopy -O ihex
endif
ifeq ($(O2HEX_T),)
O2HEX_T = $(O2HEX) -j .text -j .data
endif
ifeq ($(O2HEX_EE),)
O2HEX_EE = $(O2HEX) -j .eeprom --change-section-lma .eeprom=0
endif
ifeq ($(OBJDUMP),)
OBJDUMP = avr-objdump
endif
ifeq ($(OBJCOPY),)
OBJCOPY = avr-objcopy -v
endif
ifeq ($(AVRSIZE),)
AVRSIZE = avr-size
endif
# don't use -mint8, or preprocesor will issue silly warnings.
# avr-libc stdio cannot handle -mint8 either.
# have -I. here, so that .c files from VPATH find .h files in the target dir, not source dir.
ifeq ($(CFLAGS),)
CFLAGS = -I. -Wall -g -O2 # -mint8
endif
# .c files found via VPATH say
# include to prefer the config.h from the target directory via -I
# include "config.h" to prefer the config.h next to themselves.
ifeq ($(TOP_DIR),)
else
VPATH = $(TOP_DIR)
CFLAGS += -I$(VPATH)
endif
DIST_EXCLUDE = --exclude \*.tgz --exclude core --exclude \*.orig --exclude \*.swp --exclude
MAKE_SUBDIRS = for d in $(SUBDIRS); do $(MAKE) $(MFLAGS) -C $$d $@; done
MAKE_SUBDIRS_NP = for d in $(SUBDIRS); do $(MAKE) $(MFLAGS) --no-print-directory -C $$d $@; done
SHELL = /bin/sh
# .PHONY: $(NAME).hex $(NAME)-src.hex version.h flashcount
# always rebuild version.h and flashcount
.PHONY: version.h flashcount help
ifeq ($(NAME),)
all::
else
all:: $(NAME).hex
endif
%.hex:: %.out; $(O2HEX_T) $^ $@
flashcount::
@read n < flashcount; echo > flashcount "$$(($$n + 1))"
@echo -n flashcount=
@cat flashcount
help::
@echo
@echo avr_common.mk uses the following variables:
@echo
@echo 'NAME name of the binary. Specify in Makefile, no default.'
@echo 'PROJ name of the project. Specify in Makefile, defaults to "$$(NAME)".'
@echo 'OFILES list of object files. Should include at least "$$(NAME).o".'
@echo 'CFILES C files. If you specify either OFILES or CFILES, the other is automatic.'
@echo ' Specify in Makefile, no default.'
@echo 'TOP_DIR directory where avr_common.mk is found. Default "."'
@echo 'SUBDIRS directories with own Makefiles. Specify in Makefile, optional.'
@echo 'CC compiler name. Default: "$(value CC)"'
@echo 'INC include paths. Default: "$(value INC)"'
@echo 'CFLAGS compiler options. Default: "$(value CFLAGS)"'
@echo 'LDFLAGS compiler options. Default: "$(value LDFLAGS)"'
@echo 'ISP upload helper. Default: "$(value ISP)"'
@echo 'PROG_SW upload software. Use e.g. "avrdude", "uisp" or "sudo avrdude".'
@echo 'PROG_HW upload hardware dongle. Use e.g. "stk200", "usbasp",'
@echo ' "usbtiny", "butterfly".'
@echo 'CPU name of the ATMEL processor chip. Specify in Makefile,'
@echo ' no default. Valid names with $(value CC) are:'
@cpu=`$(CC) -mmcu=not_a_valid_mcu -x c /dev/null 2>&1 | grep ' at'`; echo $$cpu | fold -s
@echo
@echo avr_common.mk offers the following additional make targets:
@echo
@echo "help - print this online help."
@echo 'depend - create depend.mk using $$(OFILES).'
@echo 'all - compile and link $$(NAME) using $$(OFILES).'
@echo 'reset - reset the device. Also a useful connectivity test.'
@echo 'upload - create and load $$(NAME) into the device.'
@echo 'flashcount - file with an upload counter.'
@echo 'erase - erase flash (and eeprom) of device.'
@echo 'clock rc=1mhz rc=8mhz'
@echo 'clock wdt=128khz wdt=16khz'
@echo 'clock pll=16mhz pll=2mhz'
@echo 'clock q=32768hz q=2.5mhz q=12mhz q=16mhz q=20mhz'
@echo 'clock ext=10mhz'
@echo ' - program the device clock speed, using internal or external sources.'
@echo 'download - retrieve binary from device flash.'
@echo 'download_ee - retrieve eeprom contents from device.'
@echo 'clean - remove all generated (and temporary) files.'
@echo 'dist - pack everything into a compressed tar archive.'
@echo 'version - increment the minor version number in file "version.h"'
@echo ' and rename the current directory accordingly.'
@echo
@echo 'For further details, see $(TOP_DIR)/avr_common.mk'
depend depend.mk:: $(CFILES)
$(CC) -MM $(INC) $(CFLAGS) $(CFILES) > depend.mk || rm -f depend.mk
install:: all upload
# erase zaps the eeprom. be careful with that...
erase:: download_ee flashcount
$(ISP) erase
#upload_dist: upload_all
#upload_src: upload_all
#install_all: upload_all
#install_src: upload_all
#install_dist: upload_all
ifeq ($(NAME),)
else
## use egrep to make dude half quiet.
ifeq ($(UPLOAD_CMD),)
up upload:: $(NAME).hex flashcount
$(ISP) up $(NAME).hex 2>&1 | egrep -i '(device|bytes|failed|check)'
@# test "`wc -c < $(NAME)-ee.hex`" -gt 13 && $(ISP) up_ee $(NAME)-ee.hex
else
up upload:: $(NAME).hex flashcount
$(UPLOAD_CMD)
endif
ee_up ee_upload upload_ee up_ee:: $(NAME)-ee.hex
$(ISP) up_ee $(NAME)-ee.hex
# if __bss_start > 60, we probably have strings in RAM, check __data
# if __bss_end gets close to __stack, think of subroutine calls.
#
# In order to know how much flash the final program will consume, one needs to
# add the values for both, .text and .data (but not .bss), while the amount of
# pre-allocated SRAM is the sum of .data and .bss.
$(NAME).out: $(OFILES)
$(CC) $(LDFLAGS) $(INC) $(CFLAGS) -Wl,-Map,$(NAME).map,--cref -o $(NAME).out $(OFILES)
@$(AVRSIZE) $(NAME).out
# @$(OBJDUMP) -t $(NAME).out | egrep '(__stack|__bss|_etext)'
# @$(OBJDUMP) -h $(NAME).out | \
# perl -ane '{printf "$$1 %d bytes.\n", hex($$2) if $$_ =~ m{\.(text)\s+(\S+)}}'
.c.o:
$(CC) $(INC) $(CFLAGS) -c $<
$(NAME).s: $(NAME).c
$(CC) $(INC) $(CFLAGS) -S -o $(NAME).s -c $<
endif
ee_down ee_download download_ee down_ee::
$(ISP) down_ee ee_data.hex
@mkdir -p down
d=`date '+%Y%m%d%H%M%S'`; \
$(OBJCOPY) -I ihex -O binary ee_data.hex down/ee_data.bin.$$d; \
set -x; ln -sf down/ee_data.bin.$$d ee_data.bin
rdfuses rdfuse rd_fuses rd_fuse::; $(ISP) -q $@
2.5mhz 4mhz 12mhz 16mhz 20mhz:; $(ISP) clock $@ cpu_mhz.h
1mhz 8mhz::; $(ISP) clock i$@ cpu_mhz.h
#
# keep thit target in sync with the capabilies of
# avr_isp.pl %fuse_macro, ...
#
clock::
@if [ -n "$(rc)" ]; then \
set -x; $(ISP) clock i$(rc) cpu_mhz.h; \
elif [ -n "$(pll)" ]; then \
set -x; $(ISP) clock i$(pll) cpu_mhz.h; \
elif [ -n "$(q)" ]; then \
set -x; $(ISP) clock $(q) cpu_mhz.h; \
elif [ -n "$(wdt)" ]; then \
set -x; $(ISP) clock i$(wdt) cpu_mhz.h; \
elif [ -n "$(ext)" ]; then \
set -x; $(ISP) clock ext_$(wdt) cpu_mhz.h; \
else \
echo reading cpu_mhz.h not impl.; \
fi \
download down reset::; $(ISP) $@
install.sh:: Makefile
echo > $@ '#! /bin/sh'
echo >> $@ '# $@ -- install binaries, how the Makefile does it.'
echo >> $@ '# (C) 2005 jw@suse.de, distribute under GPL, use with care.'
echo >> $@
echo >> $@ 'ISP="$(ISP)"'
echo >> $@ 'set -x'
make -n upload | sed -n -e 's@$(ISP)@$$ISP@p' >> $@
clock=`grep 'CPU_MHZ\b' cpu_mhz.h|sed -e 's@.*CPU_MHZ@@'`; \
echo \$$ISP clock $${clock}mhz >> $@
chmod a+x $@
clean::
rm -f *.o *.s *.out *.hex
distclean:: clean
rm -f *.orig *.map *~
ifeq ($(TOP_DIR),.)
# := evaluates immediatly, but = propagates.
VERSION = $(shell read a b < version; printf "%d.%02d" $$a $$b)
VERSION_MAJ = $(shell read a b < version; echo $$a)
VERSION_MIN = $(shell read a b < version; echo $$b)
OLD_VERSION := VERSION
version:: incr_vmin rename
version.h::
@echo \#define VERSION \"$(VERSION)\" > version.h; \
echo \#define VERSION_MAJ $(VERSION_MAJ) >> version.h; \
echo \#define VERSION_MIN $(VERSION_MIN) >> version.h
incr:: incr_vmin
incr_vmin::
read a b < version; echo > version "$${a:-0} $$(($$b + 1))"
@cat version
incr_vmaj::
read a b < version; echo > version "$$(($$a + 1)) $${b:-0}"
@cat version
rename::
test -d .svn || ( \
n="$(PROJ)-$(VERSION)"; rm -f ../$(PROJ); \
mv `/bin/pwd` "../$$n" 2> /dev/null; ln -s $$n ../$(PROJ); true )
bin dist-bin:: $(NAME).hex $(NAME)-ee.hex version.h install.sh
n="$(PROJ)-$(VERSION)"; ln -s . $$n; \
tar zcvf ../$$n-bin.tgz $$n/$(NAME).hex $$n/$(NAME)-ee.hex $$n/install.sh $$n/doc/matrix.txt; \
rm $$n; test -d .svn || mv `/bin/pwd` "../$$n" 2> /dev/null; true
dist:: distclean version.h
n="$(PROJ)-$(VERSION)"; \
test -f ../$$n.tgz && (echo "WARNING: ../$$n.tgz exists, press ENTER to overwrite"; read a); \
ln -s . $$n; tar zcvf "../$$n.tgz" $(DIST_EXCLUDE) "$$n/$$n" $$n/*; \
rm $$n; test -d .svn || mv `/bin/pwd` "../$$n" 2> /dev/null; true
else
version dist bin dist-bin::; $(MAKE) -C $(TOP_DIR) $@
endif
++++++ avr_isp.pl ++++++
++++ 1180 lines (skipped)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org