wiki:howto/SD_Config/Windows

Writing SD Cards: Windows

DD for Windows

A port of dd is available for Windows from http://www.chrysocome.net/dd. We have sucessfully tested verison 0.6beta3 on Win 7 64-bit.

Download dd.exe from the site above. Move it to somewhere in your path, then rename it win-dd.exe (this avoids conflicts with the dd.exe distributed with the EDK, which isn't useful for writing SD cards in Windows).

Finding the SD card descriptor:

  1. Insert the SD card. Take note of which drive letter it is assigned in Windows Explorer.
  2. Open a command prompt as administrator and run win-dd --list. The output will be similar to:
    C:\xps_proj\SDK_Workspace\MyProj_hw_platform>win-dd --list
    rawwrite dd for windows version 0.6beta3.
    Written by John Newbigin <jn@it.swin.edu.au>
    This program is covered by terms of the GPL Version 2.
    
    Win32 Available Volume Information
    \\.\Volume{72603844-0595-11e1-822c-806e6f6e6963}\
      link to \\?\Device\HarddiskVolume2
      fixed media
      Not mounted
    
    \\.\Volume{72603845-0595-11e1-822c-806e6f6e6963}\
      link to \\?\Device\HarddiskVolume3
      fixed media
      Mounted on \\.\c:
    
    \\.\Volume{9654066c-60bd-11e1-9757-001018af5a78}\
      link to \\?\Device\HarddiskVolume4
      removeable media
      Mounted on \\.\f:
    
    \\.\Volume{72603848-0595-11e1-822c-806e6f6e6963}\
      link to \\?\Device\CdRom0
      CD-ROM
      Mounted on \\.\d:
    
    
    NT Block Device Objects
    \\?\Device\CdRom0
      size is 2147483647 bytes
    \\?\Device\Harddisk0\Partition0
      link to \\?\Device\Harddisk0\DR0
      Fixed hard disk media. Block size = 512
      size is 500107862016 bytes
    \\?\Device\Harddisk0\Partition1
      link to \\?\Device\HarddiskVolume1
      Fixed hard disk media. Block size = 512
      size is 41094144 bytes
    \\?\Device\Harddisk0\Partition2
      link to \\?\Device\HarddiskVolume2
    \\?\Device\Harddisk0\Partition3
      link to \\?\Device\HarddiskVolume3
    \\?\Device\Harddisk1\Partition0
      link to \\?\Device\Harddisk1\DR1
      Removable media other than floppy. Block size = 512
      size is 1977614336 bytes
    \\?\Device\Harddisk1\Partition1
      link to \\?\Device\HarddiskVolume4
      Removable media other than floppy. Block size = 512
      size is 32002048 bytes
    
    Virtual input devices
     /dev/zero   (null data)
     /dev/random (pseudo-random data)
     -           (standard input)
    
    Virtual output devices
     -           (standard output)
     /dev/null   (discard the data)
    
  3. To find the descriptor for the SD card itself (and not its FAT partition):
    1. Look in the "Win32 Available Volume Information" section and find the device descriptor for the SD card FAT partition. In this system the SD card mounts as drive F:. The corresponding descriptor is \\?\Device\HarddiskVolume4
    2. Look in the "NT Block Device Objects" section and find the alias for the same descriptor. In this example, it is:
      \\?\Device\Harddisk1\Partition1
        link to \\?\Device\HarddiskVolume4
        Removable media other than floppy. Block size = 512
        size is 32002048 bytes
      
    3. Look for the device with the same Harddisk number but with Partition0. In this example, it is:
      \\?\Device\Harddisk1\Partition0
        link to \\?\Device\Harddisk1\DR1
        Removable media other than floppy. Block size = 512
        size is 1977614336 bytes
      
    4. The block device listed is your SD card descriptor. In this example it is \\?\Device\Harddisk1\Partition0.
      • Confirm that the size of the Partition0 device approximates the capacity of your SD card. The SD card in this example is 2GB (all Mango-supplied cards are 2GB).
      • Confirm that your computer's hard drives have different Harddisk numbers. In this example the C: drive is \\?\Device\Harddisk0.
NOTE: The actual device descriptor on your system is likely different than this example. The descriptor can also change between reboots. Always confirm the current descriptor before copying to the SD card.

Copying the .bin file:

  1. Run this command, replacing the last three arguments with the correct values:
    win-dd bs=512 seek=<N> if=<yourFile.bin> of=<SD_device> --progress
    
    1. <N>: depends on the target slot number; use (131072 + slotNum*32768). More details here.
    2. <yourFile.bin>: the binary FPGA configuration file
    3. <SD_device>: SD device descriptor, usually in the format of \\?\Device\HarddiskX\Partition0. See instructions above.
  2. If successful, dd should report the following:
    18032+1 records in
    18032+1 records out
    
  3. win-dd may report "Error reading file: 87 The parameter is incorrect". In our experience this is normal and not an actual error.
  4. Repeat for additional .bin config files in additional slots, if needed.
  5. Eject the SD card.

DD for Windows: Alternate Method

A port of dd is available for Windows from http://www.chrysocome.net/dd. We have sucessfully tested verison 0.6beta3 on Win 7 64-bit.

Download dd.exe from the site above. Move it to somewhere in your path, then rename it win-dd.exe (this avoids conflicts with the dd.exe distributed with the EDK, which isn't useful for writing SD cards in Windows).

  1. Insert the SD card. Take note of which drive letter it is assigned in Windows Explorer.
  2. Open a command prompt as administrator and change directory to the folder containing your .bin file
  3. Run this command, replacing the last three arguments with the correct values:
    win-dd bs=512 seek=<N> if=<yourFile.bin> od=\\.\<sd_drive_letter>: --progress
    
    • <N>: depends on the target slot number; use (131072 + slotNum*32768). More details here.
    • <yourFile.bin>: the binary FPGA configuration file
    • <sd_drive_letter>: Drive letter for the SD card as mounted by Windows

IMPORTANT: Note the output argument is od (output disk), not of, as is common with dd in other operating systems

For example, if your .bin file is ref_design.bin, you're writing to slot 0 and your SD card is mounted as H:, you would run:

win-dd bs=512 seek=131072 if=ref_design.bin od=\\.\H: --progress

If successful, dd should report the following:

18032+1 records in
18032+1 records out

win-dd may report "Error reading file: 87 The parameter is incorrect". In our experience this is normal and not an actual error.


Cygwin

Cygwin is a set of GNU and Open Source tools which provide functionality similar to a Linux distribution on Windows.

Install your preferred set of tools from the Cygwin distribution using the installer on the site above. By default, the two commands you need: fdisk and dd are part of the default installation in /usr/sbin and /usr/bin, respectively.

Finding the SD card descriptor:

  1. Insert the SD card
  2. Open the Cygwin Terminal as Administrator. In that terminal run /usr/sbin/fdisk -l.
  3. Find the SD card in the list of disks. The descriptor will have the form /dev/<something>
    1. On our test system (Windows 7 64-bit, PC with one internal hard drive; one external hard drive), the output is:
      $ /usr/sbin/fdisk -l
      
      Disk /dev/sda: 500.1 GB, 500107862016 bytes
      255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0xad574c68
      
         Device Boot      Start         End      Blocks   Id  System
      /dev/sda1              63       80324       40131   de  Dell Utility
      /dev/sda2   *       81920    27967487    13942784    7  HPFS/NTFS/exFAT
      /dev/sda3        27967488   502366207   237199360    7  HPFS/NTFS/exFAT
      /dev/sda4       502368254   976771071   237201409    5  Extended
      /dev/sda5       502368256   972666879   235149312   83  Linux
      /dev/sda6       972668928   976771071     2051072   82  Linux swap / Solaris
      
      Disk /dev/sdb: 1000.2 GB, 1000204885504 bytes
      255 heads, 63 sectors/track, 121601 cylinders, total 1953525167 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0xdd8826a4
      
         Device Boot      Start         End      Blocks   Id  System
      /dev/sdb1            2048  1953521663   976759808    7  HPFS/NTFS/exFAT
      
      Disk /dev/sdc: 1977 MB, 1977614336 bytes
      255 heads, 63 sectors/track, 240 cylinders, total 3862528 sectors
      Units = sectors of 1 * 512 = 512 bytes
      Sector size (logical/physical): 512 bytes / 512 bytes
      I/O size (minimum/optimal): 512 bytes / 512 bytes
      Disk identifier: 0x00000000
      
         Device Boot      Start         End      Blocks   Id  System
      /dev/sdc1               2       62505       31252    b  W95 FAT32
      
    2. In this output, the first disk is the computer's internal hard drive. The second disk is the computer's external hard drive. The third disk is the SD card (notice the capacity of approx 2GB, with 1 32MB FAT partition).
    3. In this example, the SD card device descriptor to use with dd is /dev/sdc.

Copying the .bin file:

  1. Run this command, replacing the last three arguments with the correct values:
    /usr/bin/dd bs=512 seek=<N> if=<yourFile.bin> of=</dev/someDevice>
    
    1. <N>: depends on the target slot number; use (131072 + slotNum*32768). More details here.
    2. <yourFile.bin>: the binary FPGA configuration file
    3. </dev/someDevice>: device descriptor for the SD card
  2. If successful, dd should report the following (the time/throughput values will differ):
    18032+1 records in
    18032+1 records out
    9232444 bytes (9.2 MB) copied, 7.50747 s, 1.2 MB/s
    
  3. Repeat for additional .bin config files in additional slots if needed.

Error Messages:

  1. If when you run /usr/sbin/fdisk -l, you get the following output:
    Cannot open /dev/sda
    Cannot open /dev/sdb
    Cannot open /dev/sdc
    
    then you are not running the Cygwin terminal as Administrator.
  2. If when you run /usr/bin/dd bs=512 seek=<N> if=<yourFile.bin> of=</dev/someDevice>, you get the following output:
    /usr/bin/dd: opening `/dev/someDevice': Permission denied
    
    then you are not running the Cygwin terminal as Administrator.

Last modified 9 years ago Last modified on Oct 19, 2015, 3:04:01 PM