# HG changeset patch # User Matt Johnston # Date 1372432560 -28800 # Node ID d07aa7644c66891e82d6113af7d49b08cdc6a721 # Parent 5a7a0ef8a958848091ca974f93acf97900dd30e9 bit more fiddling diff -r 5a7a0ef8a958 -r d07aa7644c66 Makefile --- a/Makefile Thu Jun 27 19:25:38 2013 +0800 +++ b/Makefile Fri Jun 28 23:16:00 2013 +0800 @@ -38,8 +38,8 @@ #LOCKBIT # prevent bootloader write protect: # -U lock:w:0x2f:m -# 0 unused bit7 -# 0 unused +# X unused bit7 +# X unused # 1 blb12 no writing to bootloader # 0 blb11 # 1 blb02 bootloader can write to app @@ -61,8 +61,8 @@ # ATMega8 fuse bits used above (fuse bits for other devices are different!): # Example for 8 MHz internal oscillator # Fuse high byte: -# 0xd9 = 1 1 0 1 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000) -# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0 +# 0xdb = 1 1 0 1 1 0 1 1 <-- BOOTRST (boot reset vector at 0x0000) +# ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0 (2048 bytes bootloader) # | | | | | +-------- BOOTSZ1 # | | | | +---------- EESAVE (set to 0 to preserve EEPROM over chip erase) # | | | +-------------- WDTON diff -r 5a7a0ef8a958 -r d07aa7644c66 main.c --- a/main.c Thu Jun 27 19:25:38 2013 +0800 +++ b/main.c Fri Jun 28 23:16:00 2013 +0800 @@ -175,6 +175,8 @@ DDR_PI_WARNING |= _BV(PIN_PI_WARNING); + DDR_PI_RESET &= ~_BV(PIN_PI_RESET); + #if 0 // set pullup PORTD |= _BV(PD2); @@ -303,7 +305,13 @@ hmac_file(const char* fn) { uint8_t res; - struct partition_struct* partition = partition_open(sd_raw_read, sd_raw_read_interval, 0, 0, 0); + + struct sd_raw_info disk_info; + sd_raw_get_info(&disk_info); + sd_serial = disk_info.serial; + printf_P(PSTR("serial %lx\n"), sd_serial); + + struct partition_struct* partition = partition_open(sd_raw_read, sd_raw_read_interval, sd_raw_write, sd_raw_write_interval, 1); if (!partition) { @@ -325,10 +333,6 @@ return; } - struct sd_raw_info disk_info; - sd_raw_get_info(&disk_info); - sd_serial = disk_info.serial; - struct fat_dir_struct* dd = fat_open_dir(fs, &directory); if (!dd) { @@ -342,7 +346,7 @@ return; } - fat_read_file(fd, conf_start, sizeof(conf_start)-1); + fat_read_file(fd, (uint8_t*)conf_start, sizeof(conf_start)-1); conf_start[sizeof(conf_start)-1] = '\0'; fat_close_file(fd); @@ -372,13 +376,17 @@ { PORT_PI_RESET &= ~_BV(PIN_PI_RESET); DDR_PI_RESET |= _BV(PIN_PI_RESET); - _delay_ms(200); + long_delay(200); + + printf_P(PSTR("about to raw init\n")); sd_raw_init(); + printf_P(PSTR("done raw init\n")); hmac_file(param); + printf_P(PSTR("conf_start '%s'\n"), conf_start); sd_raw_deinit(); - _delay_ms(200); + long_delay(200); DDR_PI_RESET &= ~_BV(PIN_PI_RESET); } @@ -767,6 +775,7 @@ // disable wdt wdt_disable(); + MCUSR = 0; // disable interrupts TIMSK0 = 0; @@ -1010,7 +1019,6 @@ LOCAL_PSTR(status); LOCAL_PSTR(random); LOCAL_PSTR(prog); - LOCAL_PSTR(testsd); LOCAL_HELP(set_params, " "); LOCAL_HELP(set_key, "20_byte_hex>"); LOCAL_HELP(oneshot, ""); @@ -1018,7 +1026,6 @@ LOCAL_HELP(random, " "); LOCAL_HELP(hmac, " <20_byte_hex_data>"); LOCAL_HELP(decrypt, " <20_byte_hmac|16_byte_aes_block>"); - LOCAL_HELP(testsd, ""); static const struct handler { PGM_P name; @@ -1040,7 +1047,6 @@ {random_str, cmd_random, random_help}, {vcc_str, cmd_vcc, NULL}, {reset_str, cmd_reset, NULL}, - {testsd_str, cmd_testsd, testsd_help}, {prog_str, cmd_prog, prog_help}, }; @@ -1234,7 +1240,6 @@ { // pull it low DDR_PI_RESET |= _BV(PIN_PI_BOOT); - } } diff -r 5a7a0ef8a958 -r d07aa7644c66 pihelp.graffle --- a/pihelp.graffle Thu Jun 27 19:25:38 2013 +0800 +++ b/pihelp.graffle Fri Jun 28 23:16:00 2013 +0800 @@ -2992,7 +2992,7 @@ Bounds - {{642.06523940822649, 195.79799294748042}, {55, 20}} + {{650.50931573509411, 202.59816909112666}, {55, 20}} Class ShapedGraphic FitText @@ -3017,8 +3017,10 @@ ID 1450 + Offset + -6.8001761436462402 Position - 0.85406345129013062 + 0.088183894753456116 RotationType 0 @@ -3026,6 +3028,11 @@ Rectangle Style + fill + + Draws + NO + shadow Draws @@ -3053,18 +3060,25 @@ Class LineGraphic + Head + + ID + 1364 + Info + 5 + ID 1450 OrthogonalBarAutomatic - + OrthogonalBarPoint {0, 0} OrthogonalBarPosition - -1 + 45.686443328857422 Points {702.24511708341549, 205.79799294748042} - {664.69325875965797, 206.76329169224098} + {584.76111409893213, 365.24458410714874} Style @@ -29416,7 +29430,7 @@ MasterSheets ModificationDate - 2013-06-27 11:14:51 +0000 + 2013-06-28 03:15:20 +0000 Modifier Matt NotesVisible @@ -29521,7 +29535,7 @@ SidebarWidth 120 VisibleRegion - {{161.35266220843107, 0}, {918.84060934262232, 604.83093738010689}} + {{180.19324252618199, 12.077295075481366}, {918.84060934262232, 604.83093738010677}} Zoom 1.0349999666213989 ZoomValues