From 4e88dde09a30fd2105f3fc732cbe4f2edbc72244 Mon Sep 17 00:00:00 2001 From: Kevin Rosenberg Date: Thu, 20 Mar 2008 14:05:09 -0600 Subject: [PATCH] 20080320 release --- ChangeLog | 6 +- README | 22 +++---- cv_c/Makefile | 3 +- cv_c/serial_lcd.prj | 16 ++--- serial_lcd.c | 142 ++------------------------------------------ serial_lcd.h | 23 +++---- 6 files changed, 43 insertions(+), 169 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9dad81f..aaf43bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,10 @@ +2008-03-20 Kevin Rosenberg + * serial_lcd.h, serial_lcd.c: Switch to using native delay + and sleep functions for Codevision. + 2008-03-18 Kevin Rosenberg * Add Codevision port - + 2008-03-15 Kevin Rosenberg * serial_lcd.c: Add 4-bit interface mode * serial_lcd.h: Move LCD control codes here with renaming. Use diff --git a/README b/README index 1db3974..018a7b6 100644 --- a/README +++ b/README @@ -38,19 +38,19 @@ The code can be modified and redistributed as governed by the terms of the accompaning LICENSE file. -Code/Data Sizes (for 20080318 release) +Code/Data Sizes (for 20080320 release) ====================================== -Compiler Code Data Notes ---------- ---- ---- ----- -AVR-GCC C 716 48 -Os -AVR-GCC C++ 806 50 -Os -AVR-GCC Obj 1574 72 -Os -CV 2.02.6 808 48 Maximum size optimization -IAR C 622 48 Size optimization high (+ 64 bytes stack) -IAR C++ 762 49 Size optimization high (+ 64 bytes stack) -IAR Obj 1112 65 Size optimization high (+ 63 bytes stack) -ICC7 C Pro 812 48 Full optimizations (-O24) +Compiler Code Data Notes +--------- ---- ---- ----- +IAR 5.10A C 622 48 Size optimization high (+ 64 bytes stack) +AVR-GCC 4.2.2 C 716 48 -Os +IAR 5.10A C++ 762 49 Size optimization high (+ 64 bytes stack) +Codevision 2.02.6 792 48 Maximum size optimization +AVR-GCC 4.2.2 C++ 806 50 -Os +ImageCraft 7.16 Pro C 808 48 Full optimizations (-O24) +AVR-GCC 4.2.2 C++ Obj 1574 72 -Os +IAR 5.10A C++ Obj 1112 65 Size optimization high (+ 63 bytes stack) I would appreciate submissions of suggestions, improvements, or bug fixes. diff --git a/cv_c/Makefile b/cv_c/Makefile index f18ab4c..e472620 100644 --- a/cv_c/Makefile +++ b/cv_c/Makefile @@ -2,7 +2,8 @@ PROJECT := serial_lcd all: build -build: +build: distclean + @mkdir Exe Linker List Obj @echo Must run the CV IDE to build .PHONY: clean diff --git a/cv_c/serial_lcd.prj b/cv_c/serial_lcd.prj index 78eab68..ac3eea8 100644 --- a/cv_c/serial_lcd.prj +++ b/cv_c/serial_lcd.prj @@ -2,7 +2,7 @@ Toolset=AVR FormatVersion=2 Files=1 -OpenedFiles=0 +OpenedFiles=1 Top0=430 Left0=711 Height0=339 @@ -10,13 +10,13 @@ Width0=497 Active0=1 State0=0 OF1=C:\home\kevin\pub\src\avr_serial_lcd\serial_lcd.c -Top1=257 -Left1=268 -Height1=339 -Width1=497 +Top1=258 +Left1=269 +Height1=337 +Width1=495 Row1=0 Collumn1=0 -Active1=0 +Active1=1 State1=0 OF2=C:\home\kevin\pub\src\avr_serial_lcd\serial_lcd.h Top2=257 @@ -40,7 +40,7 @@ OutputListFilesDirectory=List OutputObjectFilesDirectory=Obj OutputExecutableFilesDirectory=Exe OutputLinkerFilesDirectory=Linker -AllowDisplayFunctionCallTree=0 +AllowDisplayFunctionCallTree=1 F1=C:\home\kevin\pub\src\avr_serial_lcd\serial_lcd.c [Compiler] Chip=ATtiny2313 @@ -108,7 +108,7 @@ WarningDataStackUsage=1 WarningDataStackRecursion=1 WarningHardwareStackLow=1 DebugBootLoader=0 -Build=4 +Build=20 UseEEPROMLocation0=1 IncludePath0= IncludePath1= diff --git a/serial_lcd.c b/serial_lcd.c index 1235c7b..75983d2 100644 --- a/serial_lcd.c +++ b/serial_lcd.c @@ -94,11 +94,6 @@ static FLASH_DECLARE(const unsigned char ledPwmPatterns[]) = #pragma global_register ledPwmCount:20 sUartRxHead:21 sUartRxTail:22 ledPwmCycling:23 unsigned char ledPwmCount, sUartRxHead, sUartRxTail, ledPwmCycling; -#elif defined(__CODEVISIONAVR__) -#pragma regalloc- -register unsigned char ledPwmCount, sUartRxHead, sUartRxTail, ledPwmCycling; -#pragma regalloc+ - // Use avr_compat register variables #else REGISTER_VAR(unsigned char ledPwmCount, "r4", 15); @@ -263,17 +258,13 @@ static inline void UsartInit(void) { #endif } -#if defined(__IMAGECRAFT__) || defined(__CODEVISIONAVR__) +#if defined(__IMAGECRAFT__) // Clock cycle = 67nS @ 14.7456MHz // Delay resolution ~ 1uS @ 14.7456MHz // So this function is only accurate at near above frequency void _delay_us (unsigned int d) { while (d-- != 0); -#if defined(__IMAGECRAFT__) asm("nop"); -#elif defined(__CODEVISIONAVR__) - #asm("nop") -#endif } #endif @@ -312,11 +303,7 @@ static inline void LcdInit (void) { MAIN_FUNC() { MCUSR = 0; // clear all reset flags -#if defined(__CODEVISIONAVR__) - #asm("wdr"); -#else - wdt_reset(); -#endif + wdt_reset(); WDTCSR |= (1<= 2 #include -#else -#include -#endif +#include +#include #if defined(_CHIP_ATTINY2313_) || defined(_CHIP_ATTINY2313V_) #if !defined(WDTCSR) @@ -163,14 +161,18 @@ typedef __flash unsigned int prog_uint32_t; #define SM0 4 #define SM1 6 #define SE 5 - #define sleep_enable() MCUCR |= (1<