diff --git a/poc/avr_sdcard/Makefile b/poc/avr_sdcard/Makefile index 6cbbdee..664d3fc 100644 --- a/poc/avr_sdcard/Makefile +++ b/poc/avr_sdcard/Makefile @@ -181,11 +181,10 @@ LDFLAGS += $(PRINTF_LIB_MIN) $(SCANF_LIB) $(MATH_LIB) AVRDUDE_PROGRAMMER = stk500v2 # com1 = serial port. Use lpt1 to connect to parallel port. -AVRDUDE_PORT = /dev/tty.PL2303-00001324 # programmer connected to serial device + +AVRDUDE_PORT = /dev/tty.PL2303-00002006 AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex -#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep - # Uncomment the following if you want avrdude's erase cycle counter. # Note that this counter needs to be initialized first using -Yn, @@ -210,15 +209,6 @@ AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) # avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -U lfuse:w:0xfe:m # avrdude -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) -U hfuse:w:0xd9:m -<<<<<<< HEAD:poc/avr_sdcard/Makefile -#flash_mac: $(TARGET).hex -# uisp -dprog=avr910 -dpart=ATmega8 -dserial=/dev/tty.PL2303-00001004 --erase -v --upload if=$(TARGET).hex -======= ->>>>>>> sdcard_m32:poc/avr_sdcard/Makefile - - - - # --------------------------------------------------------------------------- @@ -333,13 +323,8 @@ gccversion : # Program the device. -#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: $(TARGET).hex $(TARGET).eep + sudo $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) # Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. COFFCONVERT=$(OBJCOPY) --debugging \ diff --git a/poc/avr_sdcard/main.c b/poc/avr_sdcard/main.c index 1d8b194..cf2d64d 100644 --- a/poc/avr_sdcard/main.c +++ b/poc/avr_sdcard/main.c @@ -1,7 +1,3 @@ -<<<<<<< HEAD:poc/avr_sdcard/main.c -//#define F_CPU 8000000 -======= ->>>>>>> sdcard_m32:poc/avr_sdcard/main.c #include #include @@ -11,6 +7,10 @@ #include "mmc.h" #include "fat.h" +// Debug +#define debug(x, fmt) printf("%s:%u: %s=" fmt, __FILE__, __LINE__, #x, x) +extern FILE uart_stdout; + //SREG defines #define S_MOSI PB5 #define S_MISO PB6 @@ -28,55 +28,30 @@ #define RAM_DIR DDRA #define RAM_REG PINA -<<<<<<< HEAD:poc/avr_sdcard/main.c -#define READ_BUFFER_SIZE 512 -#define DEBUG_BUFFER_SIZE 256 - -#define BLOCK_CNT 512 - -//uint8_t debug_buffer[DEBUG_BUFFER_SIZE]; -uint8_t read_buffer[READ_BUFFER_SIZE]; -======= - #define CTRL_PORT PORTB #define CTR_DIR DDRB ->>>>>>> sdcard_m32:poc/avr_sdcard/main.c - - -<<<<<<< HEAD:poc/avr_sdcard/main.c - //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); - -} -======= #define LATCH_PORT PORTB #define LATCH_DIR DDRB #define SPI_PORT PORTB #define SPI_DIR DDRB - #define LED_PORT PORTD #define LED_DIR DDRD ->>>>>>> sdcard_m32:poc/avr_sdcard/main.c +#define FILENAME "sprite.raw" +#define BUFFER_SIZE 512 +#define BLOCKS 512 +#define MEMSIZE 0x80000 -#define READ_BUFFER_SIZE 512 -#define BLOCKS 510 +uint8_t read_buffer[BUFFER_SIZE]; -#define debug(x, fmt) printf("%s:%u: %s=" fmt, __FILE__, __LINE__, #x, x) - -extern FILE uart_stdout; - -uint8_t read_buffer[READ_BUFFER_SIZE]; void dump_packet(uint32_t addr,uint32_t len,uint8_t *packet){ uint16_t i,j; - uint16_t sum =0; + uint16_t sum = 0; + uint8_t clear=0; + for (i=0;i>>>>>> sdcard_m32:poc/avr_sdcard/main.c for (j=0;j<16;j++) { printf(" %02x", packet[i+j]); } @@ -103,11 +77,7 @@ void dump_packet(uint32_t addr,uint32_t len,uint8_t *packet){ else printf("."); } -<<<<<<< HEAD:poc/avr_sdcard/main.c - dprintf("|\r\n"); -======= printf("|\n"); ->>>>>>> sdcard_m32:poc/avr_sdcard/main.c } } @@ -201,13 +171,17 @@ void sram_init(void){ LED_PORT |= (1<>>>>>> sdcard_m32:poc/avr_sdcard/main.c while ( mmc_init() !=0) { - printf("no sdcard..\n"); + printf("No sdcard...\n"); } - printf("mmc_init\n"); - + printf("MMC Init sone\n"); fat_init(read_buffer); - printf("fat_init\n"); - - + printf("FAT Init done.\n"); rom_addr = 0x000000; -<<<<<<< HEAD:poc/avr_sdcard/main.c - while (!done){ - dprintf("Look for sprite.smc\n\r"); - if (fat_search_file((uint8_t*)"sprite.smc", - &fat_cluster, - &fat_size, - &fat_attrib, - read_buffer) == 1) { - dprintf("Start loading sprite.smc\n\r"); + printf("Look for %s\n",FILENAME); - for (uint16_t block_cnt=0; block_cnt>>>>>> sdcard_m32:poc/avr_sdcard/main.c + printf("Done 0x%lx Skipped %li\n",rom_addr,skip_block); } - - dprintf("Dump memory\n\r"); - + printf("Dump Memory\n\r"); rom_addr = 0x000000; -<<<<<<< HEAD:poc/avr_sdcard/main.c - for (uint16_t block_cnt=0; block_cnt>>>>>> sdcard_m32:poc/avr_sdcard/main.c sram_read_buffer(rom_addr,read_buffer,512); dump_packet(rom_addr,512,read_buffer); rom_addr += 512; } - printf("Done\n",rom_addr); - - + printf("\nDone 0x%lx\n",rom_addr); + sram_snes_mode(); + printf("\nEnter Snes mode\n"); while(1); - - return(0); + return 0 ; + } + + + + diff --git a/snes/simpletest/Makefile b/snes/simpletest/Makefile index 9549c5f..99651f8 100644 --- a/snes/simpletest/Makefile +++ b/snes/simpletest/Makefile @@ -10,12 +10,15 @@ APP=sprite.raw SWC=sprite.swc GFX=biker.pic EMU=/Applications/ZSNES.app/Contents/MacOS/ZSNES - +DEBUG=wine /Users/david/Devel/arch/snes/tools/snes9x1/Snes9X1.43.ep9r8.exe all: clean $(APP) raw run: $(EMU) $(APP) +debug: + $(DEBUG) $(APP) + raw: $(APP) dd if=$(APP) of=raw bs=512 skip=1