Skip to content

Tazmaniac/spt2hex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

spt to hex converter

This programm extract firmware from hex2spt gerenated Cypress EZ-USB spt script file. Copyright (C) 2013 Emmanuel Fusté

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

spt is a generic USB commands scripting format, but as we know how hex files are converted to spt by standard cypress tools or procedures to get back an hex file from a hex-converted-to-spt file.

each USB transaction is described by a record record format: 32 byte header in little endian + data

uint Signature == 0x54505343 or byte[4] == 'CSPT' //4 uint RecordSize == header size + data size == 32 + data size //8 ushort HeaderSize == 32 == 0x0020//10 byte Tag == 0 == 0x00//11

Device on wich the script will be played : selected at runtime, 0x0 in the script: byte ConfigNum == 0 == 0x00 //12 byte IntfcNum == 0 == 0x00 //13 byte AltIntfc == 0 == 0x00 //14 byte EndPtAddr == 0 = 0x00 //15

byte bReqType == 0x40 in our case (TGT_DEVICE|REQ_VENDOR|DIR_TO_DEVICE) //16 byte CtlReqCode //17 byte reserved0 is generaly 0x20//18

ushort wValue //20 ushort wIndex //22 byte reserved1 ~ 0x9F //23 byte reserved2 ~ 0x00 //24

uint Timeout ~ 0x00000005 //28 uint DataLen; //32

hex to spt converter do the following: 1 CPU put in reset mode (A0 request to write 0x01 at 0xE600 for FX2LP) 2 upload of vendor_ax firmware with A0 request 3 CPU put in run mode (A0 request to write 0x00 to addresss 0xE600 for FX2LP) 4 upload of external RAM code with A3 vendor request implemented by vendor_ax 5 CPU put in reset mode 6 upload of RAM code with A0 vendor request (all code under 16k on FX2LP) 7 CPU put in run mode

spt generated by cypress tools upload inconditionnaly vendor_ax firmware. If there is nothing to upload to external ram, step 4 is skipped.

If manualy recorded, step 2,3,4,5 could be omitted if no code need to be uploaded to external ram.

all contiguous hex record data are packed in one usb transaction and re-split in two if the packed result in payload > 4k Cypress tools generate hex file with 16 bytes of data max per record. Decoded spt data payload will be re-split in 16 bytes hex record.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages