From 9f55ce099270e56c5529a365aa80b2618117628c Mon Sep 17 00:00:00 2001 From: optixx Date: Sun, 15 Mar 2009 19:25:59 +0100 Subject: [PATCH] o testing --- poc/avr_sdcard/Makefile | 13 +++---- poc/avr_sdcard/checksize | 35 +++++++++++++++++ poc/avr_sdcard/main.c | 81 +++++++++++++++++++++++++--------------- 3 files changed, 92 insertions(+), 37 deletions(-) create mode 100644 poc/avr_sdcard/checksize diff --git a/poc/avr_sdcard/Makefile b/poc/avr_sdcard/Makefile index 6f5a58a..c79b16e 100644 --- a/poc/avr_sdcard/Makefile +++ b/poc/avr_sdcard/Makefile @@ -212,8 +212,8 @@ AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) # -#flashmac: -# uisp -dprog=avr910 -dpart=ATmega8 -dserial=/dev/cu.PL2303-00002326 --erase -v --upload if=$(TARGET).hex +#flash_mac: $(TARGET).hex +# uisp -dprog=avr910 -dpart=ATmega8 -dserial=/dev/tty.PL2303-00001004 --erase -v --upload if=$(TARGET).hex @@ -331,13 +331,12 @@ gccversion : # Program the device. -flash_avrdude: flash -flash: $(TARGET).hex $(TARGET).eep - sudo $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) +#flash: $(TARGET).hex $(TARGET).eep +# sudo $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) -flash_uisp: - sudo uisp -dprog=avr910 -dpart=ATmega8 -dserial=/dev/ttyUSB0 --verify --erase -v --upload if=$(TARGET).hex +#flash_uisp: +# sudo uisp -dprog=avr910 -dpart=ATmega8 -dserial=/dev/ttyUSB0 --verify --erase -v --upload if=$(TARGET).hex diff --git a/poc/avr_sdcard/checksize b/poc/avr_sdcard/checksize new file mode 100644 index 0000000..eefc542 --- /dev/null +++ b/poc/avr_sdcard/checksize @@ -0,0 +1,35 @@ +#!/bin/sh +# Name: checksize +# Project: PowerSwitch/AVR-USB +# Author: Christian Starkjohann +# Creation Date: 2004-12-29 +# Tabsize: 4 +# Copyright: (c) 2005 OBJECTIVE DEVELOPMENT Software GmbH. +# Revision: $Id: checksize 83 2006-01-05 22:20:53Z cs $ + +error=0 +codelimit=8192 # default value +datalimit=992 # default value; leave 32 bytes for stack + +if [ $# -gt 1 ]; then + codelimit="$2" +fi +if [ $# -gt 2 ]; then + datalimit="$3" +fi + +set -- `avr-size -d "$1" | awk '/[0-9]/ {print $1 + $2, $2 + $3, $2}'` +if [ $1 -gt $codelimit ]; then + echo "*** code size $1 exceeds limit of $codelimit" + error=1 +else + echo "ROM: $1 bytes (data=$3)" +fi +if [ $2 -gt $datalimit ]; then + echo "*** data size $2 exceeds limit of $datalimit" + error=1 +else + echo "RAM: $2 bytes" +fi + +exit $error diff --git a/poc/avr_sdcard/main.c b/poc/avr_sdcard/main.c index c3b5284..bd65239 100644 --- a/poc/avr_sdcard/main.c +++ b/poc/avr_sdcard/main.c @@ -1,4 +1,4 @@ -#define F_CPU 8000000 +//#define F_CPU 8000000 #include #include @@ -24,19 +24,23 @@ #define R_DIR DDRD -#define DEBUG_BUFFER_SIZE 128 #define READ_BUFFER_SIZE 512 +#define DEBUG_BUFFER_SIZE 256 -uint8_t debug_buffer[DEBUG_BUFFER_SIZE]; +#define BLOCK_CNT 512 + +//uint8_t debug_buffer[DEBUG_BUFFER_SIZE]; uint8_t read_buffer[READ_BUFFER_SIZE]; void dprintf(const uint8_t * fmt, ...) { - va_list args; - va_start(args, fmt); - vsprintf(debug_buffer, fmt, args); - va_end(args); - uart_puts(debug_buffer); + //va_list args; + //va_start(args, fmt); + //vsnprintf(debug_buffer,DEBUG_BUFFER_SIZE-1, fmt, args); + //va_end(args); + //uart_puts(debug_buffer); + uart_puts(fmt); + } @@ -44,14 +48,15 @@ void dump_packet(uint32_t addr,uint32_t len,uint8_t *packet){ uint16_t i,j; uint16_t sum =0; for (i=0;i