Skip to content
This repository has been archived by the owner on Dec 2, 2018. It is now read-only.

Commit

Permalink
Adding from softuart_gittins_avr_20101010.zip
Browse files Browse the repository at this point in the history
  • Loading branch information
blalor committed Feb 2, 2011
1 parent bb5fa42 commit da6b39e
Show file tree
Hide file tree
Showing 9 changed files with 252 additions and 165 deletions.
33 changes: 19 additions & 14 deletions Makefile
Expand Up @@ -41,8 +41,8 @@




# MCU name # MCU name
#MCU = atmega644 MCU = atmega324p
MCU = attiny85


# Processor frequency. # Processor frequency.
# This will define a symbol, F_CPU, in all source code files equal to the # This will define a symbol, F_CPU, in all source code files equal to the
Expand All @@ -62,8 +62,8 @@ MCU = attiny85
# F_CPU = 16000000 # F_CPU = 16000000
# F_CPU = 18432000 # F_CPU = 18432000
# F_CPU = 20000000 # F_CPU = 20000000
#F_CPU = 3686400 F_CPU = 8000000
F_CPU = 1000000


# Output format. (can be srec, ihex, binary) # Output format. (can be srec, ihex, binary)
FORMAT = ihex FORMAT = ihex
Expand Down Expand Up @@ -101,7 +101,7 @@ ASRC =
# 0 = turn off optimization. s = optimize for size. # 0 = turn off optimization. s = optimize for size.
# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) # (Note: 3 is not always the best optimization level. See avr-libc FAQ.)
OPT = s OPT = s
#OPT = 0


# Debugging format. # Debugging format.
# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. # Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs.
Expand Down Expand Up @@ -129,6 +129,10 @@ CSTANDARD = -std=gnu99
CDEFS = -DF_CPU=$(F_CPU)UL CDEFS = -DF_CPU=$(F_CPU)UL




# Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU)


# Place -D or -U options here for C++ sources # Place -D or -U options here for C++ sources
CPPDEFS = -DF_CPU=$(F_CPU)UL CPPDEFS = -DF_CPU=$(F_CPU)UL
#CPPDEFS += -D__STDC_LIMIT_MACROS #CPPDEFS += -D__STDC_LIMIT_MACROS
Expand Down Expand Up @@ -160,6 +164,8 @@ CFLAGS += -Wstrict-prototypes
CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst)
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))
CFLAGS += $(CSTANDARD) CFLAGS += $(CSTANDARD)
CFLAGS += -ffunction-sections -fdata-sections -fno-inline-small-functions





#---------------- Compiler Options C++ ---------------- #---------------- Compiler Options C++ ----------------
Expand All @@ -178,7 +184,7 @@ CPPFLAGS += -fpack-struct
CPPFLAGS += -fshort-enums CPPFLAGS += -fshort-enums
CPPFLAGS += -fno-exceptions CPPFLAGS += -fno-exceptions
CPPFLAGS += -Wall CPPFLAGS += -Wall
CFLAGS += -Wundef CPPFLAGS += -Wundef
#CPPFLAGS += -mshort-calls #CPPFLAGS += -mshort-calls
#CPPFLAGS += -fno-unit-at-a-time #CPPFLAGS += -fno-unit-at-a-time
#CPPFLAGS += -Wstrict-prototypes #CPPFLAGS += -Wstrict-prototypes
Expand All @@ -191,14 +197,14 @@ CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS))


#---------------- Assembler Options ---------------- #---------------- Assembler Options ----------------
# -Wa,...: tell GCC to pass this to the assembler. # -Wa,...: tell GCC to pass this to the assembler.
# -ahlms: create listing # -adhlns: create listing
# -gstabs: have the assembler create line number information; note that # -gstabs: have the assembler create line number information; note that
# for use in COFF files, additional information about filenames # for use in COFF files, additional information about filenames
# and function names needs to be present in the assembler source # and function names needs to be present in the assembler source
# files -- see avr-libc docs [FIXME: not yet described there] # files -- see avr-libc docs [FIXME: not yet described there]
# -listing-cont-lines: Sets the maximum number of continuation lines of hex # -listing-cont-lines: Sets the maximum number of continuation lines of hex
# dump that will be displayed for a given single line of source input. # dump that will be displayed for a given single line of source input.
ASFLAGS = -Wa,-adhlns=$(<:.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100




#---------------- Library Options ---------------- #---------------- Library Options ----------------
Expand Down Expand Up @@ -260,14 +266,13 @@ LDFLAGS += $(EXTMEMOPTS)
LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS))
LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB)
#LDFLAGS += -T linker_script.x #LDFLAGS += -T linker_script.x
LDFLAGS += -Wl,--gc-sections -Wl,--relax






#---------------- Programming Options (avrdude) ---------------- #---------------- Programming Options (avrdude) ----------------


# Programming hardware: alf avr910 avrisp bascom bsd # Programming hardware
# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500
#
# Type: avrdude -c ? # Type: avrdude -c ?
# to get a full listing. # to get a full listing.
# #
Expand Down Expand Up @@ -424,7 +429,7 @@ end:


# Display size of file. # Display size of file.
HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex
ELFSIZE = $(SIZE) --format=avr $(TARGET).elf ELFSIZE = $(SIZE) --mcu=$(MCU) --format=avr $(TARGET).elf


sizebefore: sizebefore:
@if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \
Expand Down Expand Up @@ -504,7 +509,7 @@ extcoff: $(TARGET).elf
%.hex: %.elf %.hex: %.elf
@echo @echo
@echo $(MSG_FLASH) $@ @echo $(MSG_FLASH) $@
$(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature $< $@


%.eep: %.elf %.eep: %.elf
@echo @echo
Expand All @@ -516,7 +521,7 @@ extcoff: $(TARGET).elf
%.lss: %.elf %.lss: %.elf
@echo @echo
@echo $(MSG_EXTENDED_LISTING) $@ @echo $(MSG_EXTENDED_LISTING) $@
$(OBJDUMP) -h -S $< > $@ $(OBJDUMP) -h -S -z $< > $@


# Create a symbol table from ELF output file. # Create a symbol table from ELF output file.
%.sym: %.elf %.sym: %.elf
Expand Down
81 changes: 0 additions & 81 deletions default/Makefile

This file was deleted.

60 changes: 60 additions & 0 deletions default/softuart_megaxx4.hex
@@ -0,0 +1,60 @@
:1000000084C000009DC000009BC0000099C000009B
:1000100097C0000095C0000093C0000091C0000090
:100020008FC000008DC000008BC0000089C00000A0
:1000300087C0000085C0000083C0000081C00000B0
:10004000A8C000007DC000007BC0000079C0000097
:1000500077C0000075C0000073C0000071C00000D0
:100060006FC000006DC000006BC0000069C00000E0
:1000700067C0000065C0000063C000002048656CD8
:100080006C6F200067656E6572696320736F6674BC
:10009000756172742064726976657220636F64653D
:1000A00020627920436F6C696E2047697474696EB1
:1000B000730D0A000D0A536F6674756172742044E3
:1000C000656D6F2D4170706C69636174696F6E0D41
:1000D0000A006164617074656420666F7220417407
:1000E0006D656C2041565220616E6420746869739E
:1000F0002064656D6F206279204D617274696E2095
:1001000054686F6D61730D0A000011241FBECFEF9C
:10011000D8E0DEBFCDBF11E0A0E0B1E0E8E9F3E058
:1001200002C005900D92A630B107D9F711E0A6E004
:10013000B1E001C01D92A433B107E1F702D02AC19A
:100140005FCF1F93CF93DF93BBD0D2D0789484EB53
:1001500090E013D184E890E010D182ED90E00DD1D1
:1001600080E091E0FED0C0E0D0E0DAD0882341F01A
:10017000C2D0182F8BE5DDD0812FDBD08DE5D9D013
:1001800021968FEFCF3FD80781F78CE790E0F5D02D
:10019000EACF1F920F920FB60F9211248F939F9365
:1001A000EF93FF9380912F01813029F580913001E9
:1001B0008150F9F4809132019091330180FF02C0A7
:1001C000599A01C0599880913201909133019695C6
:1001D0008795909333018093320180913101815052
:1001E0008093310180913101882311F410922F0105
:1001F00083E08093300180912D01882309F057C05E
:1002000080910A01882301F1809108018150809337
:100210000801882309F04BC010920A0110922E01A8
:10022000E0912B01F0E080910601E55FFE4F8083B5
:1002300080912B018F5F80932B0180912B01803265
:10024000B0F110922B0133C080912E01882381F4EC
:1002500048992DC081E080932E011092060194E010
:100260009093080198E090930701809309011FC0C3
:10027000809108018150C9F4489B07C08091060114
:1002800090910901892B8093060180910901880FC3
:100290008093090180910701815080930701882391
:1002A00019F481E080930A0183E080930801FF91B3
:1002B000EF919F918F910F900FBE0F901F90189507
:1002C00010922F0110922E0110922D01599A519ADD
:1002D00050989FB7F89489E887BD82E084BD85BDBA
:1002E000EEE6F0E080818260808316BC9FBF0895B7
:1002F00010922D01089590912C0180912B01981757
:10030000E1F3E92FF0E0E55FFE4FE081892F8F5F99
:1003100080932C01803210F010922C018E2F0895C2
:1003200090912B0120E080912C01981321E0822FE5
:100330000895982F80912F018130E1F383E080931D
:1003400030018AE080933101892F90E0880F991F56
:100350009260909333018093320181E080932F016A
:100360000895CF93DF93EC0102C02196E2DF8881EC
:100370008823D9F7DF91CF910895CF93DF93EC01D4
:1003800001C0D7DFFE01219684918823D1F7DF9148
:08039000CF910895F894FFCF0E
:060398002D2D0D0A0000EE
:00000001FF
31 changes: 22 additions & 9 deletions main.c
@@ -1,6 +1,6 @@
/* /*
AVR Software-Uart Demo-Application AVR Software-Uart Demo-Application
Version 0.3, 4/2007 Version 0.4, 10/2010
by Martin Thomas, Kaiserslautern, Germany by Martin Thomas, Kaiserslautern, Germany
<eversmith@heizung-thomas.de> <eversmith@heizung-thomas.de>
Expand All @@ -9,33 +9,46 @@


/* /*
Test environment/settings: Test environment/settings:
- avr-gcc 4.1.1/avr-libc 1.4.5 (WinAVR 1/2007) - avr-gcc 4.3.3/avr-libc 1.6.7 (WinAVR 3/2010)
- Atmel ATtiny85 @ 1MHz internal R/C - Atmel ATmega324P @ 8MHz internal RC, ATtiny85 @ 1MHz internal RC
- 2400bps - 2400bps
*/

/*
AVR Memory Usage (-Os, no-inline small-functions, relax)
----------------
Device: atmega324p
Program: 926 bytes (2.8% Full)
(.text + .data + .bootloader)
Data: 52 bytes (2.5% Full)
(.data + .bss + .noinit)
AVR Memory Usage (-Os) AVR Memory Usage (-Os)
---------------- ----------------
Device: attiny85 Device: attiny85
Program: 874 bytes (10.7% Full) Program: 828 bytes (10.1% Full)
(.text + .data + .bootloader) (.text + .data + .bootloader)
Data: 52 bytes (10.2% Full) Data: 52 bytes (10.2% Full)
(.data + .bss + .noinit) (.data + .bss + .noinit)
*/ */


// #define WITH_STDIO_DEMO #define WITH_STDIO_DEMO 0 /* 1: enable, 0: disable */


#include <avr/interrupt.h> #include <avr/interrupt.h>
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include "softuart.h" #include "softuart.h"




#ifdef WITH_STDIO_DEMO #if WITH_STDIO_DEMO
#include <stdio.h> #include <stdio.h>


// interface between avr-libc stdio and the modified Fleury uart-lib: // interface between avr-libc stdio and software-UART
static int my_stdio_putchar( char c, FILE *stream ) static int my_stdio_putchar( char c, FILE *stream )
{ {
if ( c == '\n' ) { if ( c == '\n' ) {
Expand Down Expand Up @@ -73,13 +86,13 @@ int main(void)
softuart_turn_rx_on(); /* redundant - on by default */ softuart_turn_rx_on(); /* redundant - on by default */


sei(); sei();

softuart_puts_P( "\r\nSoftuart Demo-Application\r\n" ); // "implicit" PSTR softuart_puts_P( "\r\nSoftuart Demo-Application\r\n" ); // "implicit" PSTR
softuart_puts_p( PSTR("generic softuart driver code by Colin Gittins\r\n") ); // explicit PSTR softuart_puts_p( PSTR("generic softuart driver code by Colin Gittins\r\n") ); // explicit PSTR
softuart_puts_p( pstring ); // pstring defined with PROGMEM softuart_puts_p( pstring ); // pstring defined with PROGMEM
softuart_puts( "--\r\n" ); // string "from RAM" softuart_puts( "--\r\n" ); // string "from RAM"


#ifdef WITH_STDIO_DEMO #if WITH_STDIO_DEMO
stdio_demo_func(); stdio_demo_func();
#endif #endif


Expand Down

0 comments on commit da6b39e

Please sign in to comment.