원문:  http://warpproject.org/trac/wiki/howto/SD_Config



오늘은, WARP v3 구매시 함께 꽂혀서 배송되는 SD 카드로 간단한 "카운터 예제" 프로그램으로 Virtex-6 FPGA를 구성하여 동작시켜보겠습니다.


WARP v3: FPGA Configuration via SD Cards

The WARP v3 board includes an SD card slot and CPLD tied to the Virtex-6 FPGA's dedicated configuration pins. Together these circuits enable configuring the FPGA using bitstreams stored on the SD card. For more details on the hardware design, refer to the WARP v3 user guide.

The basic steps for SD card configuration:

  1. Generate a valid bitstream (.bit file) for the Virtex-6 FPGA
  2. Convert the .bit file into a correctly-formatted .bin file
  3. Copy the .bin file to the correct location on the SD card

Each step is discussed in detail below.

The SD cards shipped with WARP v3 kits are pre-programmed with a known good design that implements a simple counter displayed on the hex displays. To re-program your SD card with this design, use this file: w3_sd_newCard.bin.zip (unzip to retrieve the .bin file).



WARP v3 보드를 구매하면, SD 카드가 보드의 SD카드 슬롯에 꽂혀서 배송됩니다. 

해당 SD 카드에 우리는 미리 Warp Project에서 제공하는 .bin 예제 파일을 Binary copy로 먼저 수행해야 합니다.


사실, 원래는 FPGA의 구성을 위해서는 bitstreams 을 생성하고 이를 다시 bin으로 변환하여 SD카드에 복사하고 이를 사용하여 동작시켜야 하지만, 우리는 주어지는 bin파일을 사용하여 간단하게 동작시켜 보겠습니다.

(bitstreams 생성은, 본 글의 처음부분에 링크해놓은 글을 읽으면서 천천히 따라하시면 가능합니다.)


우선, bin파일은 위의 w3_sd_newCard.bin.zip​ 을 다운로드 하여 사용합니다.



Copying .bin Files SD Cards


Now that you've generated a valid binary configuration file (.bin), you must copy it to a specific location on an SD card.

WARNING: the tools for writing binary files to arbitrary locations on the SD card are also capable of overwriting critical areas of your computer's hard drive. Always verify the output device descriptor before running these tools.

The default WARP v3 CPLD design loads configuration files from the SD card starting at an offset of 64MB. Up to 8 configuration files can be stored per card, with each file separated by 16MB. The active configuration file is selected by the config DIP switch on the WARP v3 board. You must choose which "slot" when copying the .bin file to the SD card.

We use the open-source dd tool to write configuration files to SD cards. dd is available for OS X, Linux and Windows (and probably other OSs). Each call to dd copies one configuration file. There are four required arguments:


(복사 명령어 ↘ )

dd bs=512 seek=<base_block_addr> if=<config_file.bin> of=<sd_device_descriptor>

Variables to replace:

  • <sd_device_descriptor>: Device descriptor for SD card (OS specific; see below)
  • <config_file.bin>: Input file (your .bin file)
  • <base_block_addr>: Staring address for the output file, in units of block size. Use (131072 + slotNum*32768) for standard WARP v3 config design:

    • Slot 0: 131072
    • Slot 1: 163840
    • Slot 2: 196608
    • Slot 3: 229376
    • Slot 4: 262144
    • Slot 5: 294912
    • Slot 6: 327680
    • Slot 7: 360448

The specific calls to dd depend on your operating system.


다운로드한 bin파일을 SD카드로 복사하기 위해서는 우리는 dd 라는 리눅스 명령어를 사용합니다. 


(dd란? 파일을 변환하고 복사하는 것이 주 목적인 유닉스 및 유닉스 계열 운영 체제용 명령 줄 유틸리티입니다. -위키- )


현재 사용하신 OS가 리눅스라면 그대로 dd를 사용해서 위의 복사 명령어를 사용하시면 되지만, Window를 사용하신다면 window 용 dd 유틸리티가 필요합니다. 이것도 친절하게 웹사이트에 있습니다. 아래를 참고하세요.


http://www.chrysocome.net/download


위의 사이트에서, dd-0.6beta3.zip 또는 ddrelease64.exe 파일을 다운로드 하시면 사용가능합니다. 

다운로드한 파일들은 w3_sd_newCard.bin.zip​ 과 함께 같은 폴더로 복사해주세요. 편리를 위해서 이름을 그냥 win-dd.exe  로 변경하여 사용하겠습니다. 저는 c:\dd 라는 폴더에 두 파일을 복사했습니다.


이제 w3_sd_newCard.bin 파일을 SD카드로 복사하기 위해서 아래의 내용대로 따라해주세요.


http://warpproject.org/trac/wiki/howto/SD_Config/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.


1) 프로그램 및 파일 검색에서 "cmd" 를 검색하여 반드시 "관리자 권한" 으로 명령 프롬프트를 실행합니다. 

     : 관리자 권한을 얻으셔야, 현재 PC의 Disk들의 파티션이름을 정확하게 알수가 있습니다.

2) 앞서 미리 파일들을 다운로드 해놓은 폴더로 이동합니다. 

    cd\ 

    cd c:\dd

3) SD카드를 리더기를 사용하여 컴퓨터에 삽입합니다. (무슨 드라이브로 SD카드가 잡히는지 확인하세요. (예) e: ) 

4) win-dd --list 명령을 입력하여 현재 디스크정보를 모두 봅니다. 

     :위의 output 예시와 같은 디스크 정보가 출력됩니다. 

       만약 e:가 link to \\?\Device\HarddiskVolume4 를 가리킨다면, 

       이와 매칭되는 \\?\Device\Harddisk1\Partition1 의 위치를 가리킨다면, Partition0으로 변경하여 주소를 사용.

       즉, \\?\Device\Harddisk1\Partition0 이 SD카드의 위치를 의미하게 됩니다.

5) 복사 명령을 실행합니다.


win-dd bs=512 seek=131072 if=w3_sd_newCard.bin  of=\\?\Device\Harddisk1\Partition0 --progress



아마 제가 했던 방법대로 하셨다면, 위의 명령어로 복사를 진행하게 됩니다. if는 복사할 파일의 위치와 이름을 적으시면 되고 of에는 복사될 주소를 적으시면 됩니다. 또한, 131072는 SD카드의 슬롯주소를 의미하는데, WARP v3장비를 구매하면 제공하는 SD카드는 사전에 미리 8 slot으로 포맷/파티션 분할되어 제공하기 때문에 원하는 슬롯에 .bin 파일을 write 한다고 생각하면 됩니다. 예를 들면, slot0 = 131072 에는 기본적인 프로그램을 저장, slot1= 163840 에는 802.11 reference 프로그램을 저장했다고 생각해봅시다. 이때 우리는 원하는 프로그램을 동작시키고자 할때마다 새롭게 SD카드에 복사하는 것이 아니라, 미리 slot0과 1에 bin파일들을 복사해놓고 WARP v3의 DIP스위치만 변경하여 바로바로 사용하는 것입니다. (사실 SD카드 포맷해도 사용이 가능합니다. 파티션만 날아갈뿐 어쨌든 인식이 됩니다)



6) 아마 아래와 같은 복사 성공 메세지 외에도 어떠한 에러메세지가 출력될것입니다.

18032+1 records in

18032+1 records out


87 에러메서지는 단순한 표기오류일뿐 신경쓰시지 않아도 작동합니다. 


7) 이제 복사한 bin파일이 있는 SD카드를 WARP SD슬롯에 꽂고 전원을 넣어봅시다. 

    저는 아래와 같이 동작했습니다.







'N.&C. > WARP v3' 카테고리의 다른 글

6. WARPLab 7_Example  (0) 2018.01.31
5-2-2. WARPLab Quick Start 정리버전  (0) 2016.05.19
5-2. WARPLab Quick Start  (0) 2016.05.04
5-1. WARPLab Reference Design: Downloads  (0) 2016.05.03
5. WARPLab 7  (0) 2016.05.03

+ Recent posts