# HG changeset patch # User Daniel O'Connor # Date 1365340463 -34200 # Node ID f0563086040d20b03e6f9829e792ada82690f74a # Parent b21db2b47a27fec7fb00cfe92c8c053040f944e4 Fix more warnings. Note the 'buf might be used uninitialised' warning appears to be a GCC bug. diff -r b21db2b47a27 -r f0563086040d sd.c --- a/sd.c Sun Apr 07 22:34:05 2013 +0930 +++ b/sd.c Sun Apr 07 22:44:23 2013 +0930 @@ -98,14 +98,13 @@ } else if (!strcmp(argv[0], "rdb")) { uint32_t addr; uint8_t *buf; - uint32_t i; if (argc != 2) { printf("Block to read not specified\n"); return; } addr = atoi(argv[1]); - + if ((buf = malloc(SD_BLOCK_SIZE)) == NULL) { printf("Unable to allocate buffer\n"); return; @@ -133,7 +132,7 @@ } else if (!strcmp(argv[0], "wrb")) { uint32_t addr; uint8_t *buf; - uint32_t i; + int32_t i; if (argc < 3) { printf("Block to read and/or fill value(s) not specified\n"); @@ -210,7 +209,7 @@ if ((fserr = f_getlabel("", label, &sn)) != FR_OK) { printf("Unable to read label: %d\n", fserr); } else { - printf("Label: %s Serial: %d\n", label, sn); + printf("Label: %s Serial: %ld\n", label, sn); } if ((fserr = f_opendir(&d, argc == 1 ? "\\" : argv[1])) != FR_OK) { @@ -231,7 +230,7 @@ #else fn = fno.fname; #endif - printf("%-12s %5u %d/%d/%d %02d:%02d:%02d %s%s%s%s%s\n", fn, fno.fsize, + printf("%-12s %5lu %d/%d/%d %02d:%02d:%02d %s%s%s%s%s\n", fn, fno.fsize, FAT_YEAR(fno.fdate), FAT_MONTH(fno.fdate), FAT_DAY(fno.fdate), FAT_HOUR(fno.ftime), FAT_MIN(fno.ftime), FAT_SEC(fno.ftime), fno.fattrib & AM_DIR ? "D" : "", fno.fattrib & AM_RDO ? "R" : "", diff -r b21db2b47a27 -r f0563086040d stm32_eval.h --- a/stm32_eval.h Sun Apr 07 22:34:05 2013 +0930 +++ b/stm32_eval.h Sun Apr 07 22:44:23 2013 +0930 @@ -5,7 +5,7 @@ #undef SD_HAVE_DETECT -/* Going to 4 bit mode gives CRC errors */ +/* Going to 4 bit mode gives CRC errors in PIO mode or hangs in DMA */ #define SD_NO_4BIT #define SD_DMA_MODE ((uint32_t)0x00000000) //#define SD_POLLING_MODE ((uint32_t)0x00000002)