Fixes for PVS errors
This commit is contained in:
parent
fbb8341323
commit
9e91c31e31
|
|
@ -54,7 +54,7 @@ Altera::Altera(Jtag *jtag, const std::string &filename,
|
||||||
printError("\tplease use rbf or svf file");
|
printError("\tplease use rbf or svf file");
|
||||||
printError("\tor use --write-flash with: ", false);
|
printError("\tor use --write-flash with: ", false);
|
||||||
printError("-b board_name or --fpga_part xxxx");
|
printError("-b board_name or --fpga_part xxxx");
|
||||||
std::runtime_error("Error: wrong file");
|
throw std::runtime_error("Error: wrong file");
|
||||||
} else {
|
} else {
|
||||||
_mode = Device::SPI_MODE;
|
_mode = Device::SPI_MODE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,6 @@ int AnlogicCable::setClkFreq(uint32_t clkHZ)
|
||||||
|
|
||||||
if (clkHZ > 6000000) {
|
if (clkHZ > 6000000) {
|
||||||
printWarn("Anlogic JTAG probe limited to 6MHz");
|
printWarn("Anlogic JTAG probe limited to 6MHz");
|
||||||
clkHZ = 6000000;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clkHZ >= 6000000) {
|
if (clkHZ >= 6000000) {
|
||||||
|
|
|
||||||
|
|
@ -160,9 +160,9 @@ static std::map <std::string, target_board_t> board_list = {
|
||||||
DFU_BOARD("icebreaker-bitsy", "", "dfu", 0x1d50, 0x6146, 0),
|
DFU_BOARD("icebreaker-bitsy", "", "dfu", 0x1d50, 0x6146, 0),
|
||||||
JTAG_BOARD("kc705", "", "digilent", 0, 0, CABLE_DEFAULT),
|
JTAG_BOARD("kc705", "", "digilent", 0, 0, CABLE_DEFAULT),
|
||||||
JTAG_BOARD("LD-SCHOKO", "LFE5U-45F-6CABGA256", "", 0, 0, CABLE_MHZ(6)),
|
JTAG_BOARD("LD-SCHOKO", "LFE5U-45F-6CABGA256", "", 0, 0, CABLE_MHZ(6)),
|
||||||
DFU_BOARD("LD-SCHOKO", "", "dfu", 0x16d0, 0x116d, 0),
|
DFU_BOARD("LD-SCHOKO-DFU", "", "dfu", 0x16d0, 0x116d, 0),
|
||||||
JTAG_BOARD("LD-KONFEKT", "LFE5U-12F-6BG256C", "", 0, 0, CABLE_MHZ(6)),
|
JTAG_BOARD("LD-KONFEKT", "LFE5U-12F-6BG256C", "", 0, 0, CABLE_MHZ(6)),
|
||||||
DFU_BOARD("LD-KONFEKT", "", "dfu", 0x16d0, 0x116d, 0),
|
DFU_BOARD("LD-KONFEKT-DFU", "", "dfu", 0x16d0, 0x116d, 0),
|
||||||
JTAG_BOARD("licheeTang", "", "anlogicCable", 0, 0, CABLE_DEFAULT),
|
JTAG_BOARD("licheeTang", "", "anlogicCable", 0, 0, CABLE_DEFAULT),
|
||||||
/* left for backward compatibility, use tec0117 instead */
|
/* left for backward compatibility, use tec0117 instead */
|
||||||
JTAG_BOARD("littleBee", "", "ft2232", 0, 0, CABLE_DEFAULT),
|
JTAG_BOARD("littleBee", "", "ft2232", 0, 0, CABLE_DEFAULT),
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ CmsisDAP::CmsisDAP(const cable_t &cable, int index, int8_t verbose):_verbose(ver
|
||||||
std::vector<struct hid_device_info *> dev_found;
|
std::vector<struct hid_device_info *> dev_found;
|
||||||
_ll_buffer = (unsigned char *)malloc(sizeof(unsigned char) * 65);
|
_ll_buffer = (unsigned char *)malloc(sizeof(unsigned char) * 65);
|
||||||
if (!_ll_buffer)
|
if (!_ll_buffer)
|
||||||
std::runtime_error("internal buffer allocation failed");
|
throw std::runtime_error("internal buffer allocation failed");
|
||||||
_buffer = _ll_buffer+2;
|
_buffer = _ll_buffer+2;
|
||||||
|
|
||||||
/* only hid support */
|
/* only hid support */
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "colognechip.hpp"
|
#include "colognechip.hpp"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#define JTAG_CONFIGURE 0x06
|
#define JTAG_CONFIGURE 0x06
|
||||||
#define JTAG_SPI_BYPASS 0x05
|
#define JTAG_SPI_BYPASS 0x05
|
||||||
#define SLEEP_US 500
|
#define SLEEP_US 500
|
||||||
|
|
@ -125,7 +127,7 @@ bool CologneChip::dumpFlash(uint32_t base_addr, uint32_t len)
|
||||||
if (_spi) {
|
if (_spi) {
|
||||||
/* enable output and hold reset */
|
/* enable output and hold reset */
|
||||||
_spi->gpio_clear(_rstn_pin | _oen_pin);
|
_spi->gpio_clear(_rstn_pin | _oen_pin);
|
||||||
} else {
|
} else if (_ftdi_jtag) {
|
||||||
/* enable output and disable reset */
|
/* enable output and disable reset */
|
||||||
_ftdi_jtag->gpio_clear(_oen_pin);
|
_ftdi_jtag->gpio_clear(_oen_pin);
|
||||||
_ftdi_jtag->gpio_set(_rstn_pin);
|
_ftdi_jtag->gpio_set(_rstn_pin);
|
||||||
|
|
@ -134,13 +136,9 @@ bool CologneChip::dumpFlash(uint32_t base_addr, uint32_t len)
|
||||||
/* prepare SPI access */
|
/* prepare SPI access */
|
||||||
printInfo("Read Flash ", false);
|
printInfo("Read Flash ", false);
|
||||||
try {
|
try {
|
||||||
SPIFlash *flash;
|
std::unique_ptr<SPIFlash> flash(_spi ?
|
||||||
if (_spi) {
|
new SPIFlash(reinterpret_cast<SPIInterface *>(_spi), false, _verbose):
|
||||||
flash = new SPIFlash(reinterpret_cast<SPIInterface *>(_spi), false,
|
new SPIFlash(this, false, _verbose));
|
||||||
_verbose);
|
|
||||||
} else {
|
|
||||||
flash = new SPIFlash(this, false, _verbose);
|
|
||||||
}
|
|
||||||
flash->reset();
|
flash->reset();
|
||||||
flash->power_up();
|
flash->power_up();
|
||||||
flash->dump(_filename, base_addr, len);
|
flash->dump(_filename, base_addr, len);
|
||||||
|
|
@ -172,14 +170,14 @@ void CologneChip::program(unsigned int offset, bool unprotect_flash)
|
||||||
if (_mode == Device::NONE_MODE || _mode == Device::READ_MODE)
|
if (_mode == Device::NONE_MODE || _mode == Device::READ_MODE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ConfigBitstreamParser *cfg;
|
std::unique_ptr<ConfigBitstreamParser> cfg;
|
||||||
if (_file_extension == "cfg") {
|
if (_file_extension == "cfg") {
|
||||||
cfg = new CologneChipCfgParser(_filename);
|
cfg.reset(new CologneChipCfgParser(_filename));
|
||||||
} else if (_file_extension == "bit") {
|
} else if (_file_extension == "bit") {
|
||||||
cfg = new RawParser(_filename, false);
|
cfg.reset(new RawParser(_filename, false));
|
||||||
} else { /* unknown type: */
|
} else { /* unknown type: */
|
||||||
if (_mode == Device::FLASH_MODE) {
|
if (_mode == Device::FLASH_MODE) {
|
||||||
cfg = new RawParser(_filename, false);
|
cfg.reset(new RawParser(_filename, false));
|
||||||
} else {
|
} else {
|
||||||
throw std::runtime_error("incompatible file format");
|
throw std::runtime_error("incompatible file format");
|
||||||
}
|
}
|
||||||
|
|
@ -192,18 +190,16 @@ void CologneChip::program(unsigned int offset, bool unprotect_flash)
|
||||||
|
|
||||||
switch (_mode) {
|
switch (_mode) {
|
||||||
case Device::FLASH_MODE:
|
case Device::FLASH_MODE:
|
||||||
if (_jtag != NULL) {
|
if (_jtag != NULL)
|
||||||
programJTAG_flash(offset, data, length, unprotect_flash);
|
programJTAG_flash(offset, data, length, unprotect_flash);
|
||||||
} else if (_jtag == NULL) {
|
else
|
||||||
programSPI_flash(offset, data, length, unprotect_flash);
|
programSPI_flash(offset, data, length, unprotect_flash);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Device::MEM_MODE:
|
case Device::MEM_MODE:
|
||||||
if (_jtag != NULL) {
|
if (_jtag != NULL)
|
||||||
programJTAG_sram(data, length);
|
programJTAG_sram(data, length);
|
||||||
} else if (_jtag == NULL) {
|
else
|
||||||
programSPI_sram(data, length);
|
programSPI_sram(data, length);
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default: /* avoid warning */
|
default: /* avoid warning */
|
||||||
break;
|
break;
|
||||||
|
|
@ -389,7 +385,7 @@ int CologneChip::spi_wait(uint8_t cmd, uint8_t mask, uint8_t cond,
|
||||||
uint32_t timeout, bool verbose)
|
uint32_t timeout, bool verbose)
|
||||||
{
|
{
|
||||||
uint8_t rx[2];
|
uint8_t rx[2];
|
||||||
uint8_t dummy[2];
|
uint8_t dummy[2] = {0xff};
|
||||||
uint8_t tmp;
|
uint8_t tmp;
|
||||||
uint8_t tx = ConfigBitstreamParser::reverseByte(cmd);
|
uint8_t tx = ConfigBitstreamParser::reverseByte(cmd);
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,6 @@ bool ConfigBitstreamParser::decompress_bitstream(string source, string *dest)
|
||||||
|
|
||||||
/* clean up and return */
|
/* clean up and return */
|
||||||
(void)inflateEnd(&strm);
|
(void)inflateEnd(&strm);
|
||||||
return ret == Z_STREAM_END;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -561,7 +561,7 @@ int DFU::dfu_detach()
|
||||||
|
|
||||||
int DFU::get_status(struct dfu_status *status)
|
int DFU::get_status(struct dfu_status *status)
|
||||||
{
|
{
|
||||||
uint8_t buffer[6];
|
uint8_t buffer[6] = {0};
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = send(false, DFU_GETSTATUS, 0, buffer, 6);
|
res = send(false, DFU_GETSTATUS, 0, buffer, 6);
|
||||||
|
|
@ -586,7 +586,7 @@ int DFU::get_status(struct dfu_status *status)
|
||||||
*/
|
*/
|
||||||
char DFU::get_state()
|
char DFU::get_state()
|
||||||
{
|
{
|
||||||
char c;
|
char c = 0;
|
||||||
|
|
||||||
int res = send(false, DFU_GETSTATE, 0, (unsigned char *)&c, 1);
|
int res = send(false, DFU_GETSTATE, 0, (unsigned char *)&c, 1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ bool Ice40::program_cram(const uint8_t *data, uint32_t length)
|
||||||
progress.done();
|
progress.done();
|
||||||
|
|
||||||
/* send 48 to 100 dummy bits */
|
/* send 48 to 100 dummy bits */
|
||||||
uint8_t dummy[12];
|
uint8_t dummy[12] = {0xff};
|
||||||
_spi->spi_put(dummy, NULL, 12);
|
_spi->spi_put(dummy, NULL, 12);
|
||||||
|
|
||||||
/* wait CDONE */
|
/* wait CDONE */
|
||||||
|
|
|
||||||
|
|
@ -187,8 +187,8 @@ void JedParser::parseEField(const vector<string> &content)
|
||||||
{
|
{
|
||||||
_featuresRow = 0;
|
_featuresRow = 0;
|
||||||
string featuresRow = content[0].substr(1);
|
string featuresRow = content[0].substr(1);
|
||||||
for (size_t i = 0; i < featuresRow.size(); i++)
|
for (size_t i = 0; i < featuresRow.size(); ++i)
|
||||||
_featuresRow |= ((featuresRow[i] - '0') << i);
|
_featuresRow |= (uint64_t(featuresRow[i] - '0') << i);
|
||||||
string feabits = content[1];
|
string feabits = content[1];
|
||||||
_feabits = 0;
|
_feabits = 0;
|
||||||
for (size_t i = 0; i < feabits.size(); i++) {
|
for (size_t i = 0; i < feabits.size(); i++) {
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,8 @@ Jtag::Jtag(const cable_t &cable, const jtag_pins_conf_t *pin_conf,
|
||||||
}
|
}
|
||||||
|
|
||||||
_tms_buffer = (unsigned char *)malloc(sizeof(unsigned char) * _tms_buffer_size);
|
_tms_buffer = (unsigned char *)malloc(sizeof(unsigned char) * _tms_buffer_size);
|
||||||
|
if (_tms_buffer == nullptr)
|
||||||
|
throw std::runtime_error("Error: memory allocation failed");
|
||||||
memset(_tms_buffer, 0, _tms_buffer_size);
|
memset(_tms_buffer, 0, _tms_buffer_size);
|
||||||
|
|
||||||
detectChain(5);
|
detectChain(5);
|
||||||
|
|
@ -618,7 +620,7 @@ void Jtag::set_state(tapState_t newState)
|
||||||
_state = RUN_TEST_IDLE;
|
_state = RUN_TEST_IDLE;
|
||||||
} else {
|
} else {
|
||||||
tms = 1;
|
tms = 1;
|
||||||
_state = SELECT_DR_SCAN;
|
_state = SELECT_IR_SCAN;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UNKNOWN:;
|
case UNKNOWN:;
|
||||||
|
|
|
||||||
|
|
@ -765,11 +765,10 @@ bool Lattice::program_flash(unsigned int offset, bool unprotect_flash)
|
||||||
} else if (_file_extension == "pub") {
|
} else if (_file_extension == "pub") {
|
||||||
/* clear current SRAM content */
|
/* clear current SRAM content */
|
||||||
clearSRAM();
|
clearSRAM();
|
||||||
retval = program_pubkey_MachXO3D();
|
program_pubkey_MachXO3D();
|
||||||
} else {
|
} else {
|
||||||
// machox2 + bit
|
// machox2 + bit
|
||||||
if (_file_extension == "bit" && _fpga_family == MACHXO2_FAMILY) {
|
if (_file_extension == "bit" && _fpga_family == MACHXO2_FAMILY) {
|
||||||
retval = true;
|
|
||||||
try {
|
try {
|
||||||
LatticeBitParser _bit(_filename, true, _verbose);
|
LatticeBitParser _bit(_filename, true, _verbose);
|
||||||
_bit.parse();
|
_bit.parse();
|
||||||
|
|
@ -1357,23 +1356,24 @@ int Lattice::spi_put(uint8_t cmd, const uint8_t *tx, uint8_t *rx, uint32_t len)
|
||||||
|
|
||||||
int Lattice::spi_put(const uint8_t *tx, uint8_t *rx, uint32_t len)
|
int Lattice::spi_put(const uint8_t *tx, uint8_t *rx, uint32_t len)
|
||||||
{
|
{
|
||||||
int xfer_len = len;
|
if (len == 0)
|
||||||
uint8_t jtx[xfer_len];
|
return 0;
|
||||||
uint8_t jrx[xfer_len];
|
uint8_t jtx[len];
|
||||||
|
uint8_t jrx[len];
|
||||||
|
|
||||||
if (tx) {
|
for (uint32_t i = 0; i < len; ++i) {
|
||||||
for (uint32_t i=0; i < len; i++)
|
jtx[i] = (tx) ? LatticeBitParser::reverseByte(tx[i]) : 0;
|
||||||
jtx[i] = LatticeBitParser::reverseByte(tx[i]);
|
jrx[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* send first already stored cmd,
|
/* send first already stored cmd,
|
||||||
* in the same time store each byte
|
* in the same time store each byte
|
||||||
* to next
|
* to next
|
||||||
*/
|
*/
|
||||||
_jtag->shiftDR(jtx, (rx == NULL)? NULL: jrx, 8*xfer_len);
|
_jtag->shiftDR(jtx, (rx) ? jrx : nullptr, 8 * len);
|
||||||
|
|
||||||
if (rx != NULL) {
|
if (rx) {
|
||||||
for (uint32_t i=0; i < len; i++)
|
for (uint32_t i = 0; i < len; ++i)
|
||||||
rx[i] = LatticeBitParser::reverseByte(jrx[i]);
|
rx[i] = LatticeBitParser::reverseByte(jrx[i]);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -1383,7 +1383,7 @@ int Lattice::spi_wait(uint8_t cmd, uint8_t mask, uint8_t cond,
|
||||||
uint32_t timeout, bool verbose)
|
uint32_t timeout, bool verbose)
|
||||||
{
|
{
|
||||||
uint8_t rx;
|
uint8_t rx;
|
||||||
uint8_t dummy[2];
|
uint8_t dummy[2] = {0xff};
|
||||||
uint8_t tmp;
|
uint8_t tmp;
|
||||||
uint8_t tx = LatticeBitParser::reverseByte(cmd);
|
uint8_t tx = LatticeBitParser::reverseByte(cmd);
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
|
|
@ -2045,9 +2045,6 @@ bool Lattice::program_pubkey_MachXO3D()
|
||||||
printf("%02x", pubkey[j]);
|
printf("%02x", pubkey[j]);
|
||||||
}
|
}
|
||||||
printf("]\n");
|
printf("]\n");
|
||||||
}
|
|
||||||
|
|
||||||
if (_verbose) {
|
|
||||||
printf("Trailing bytes: [");
|
printf("Trailing bytes: [");
|
||||||
for (; i < len; i++) {
|
for (; i < len; i++) {
|
||||||
printf("%02x ", data[i]);
|
printf("%02x ", data[i]);
|
||||||
|
|
|
||||||
|
|
@ -179,7 +179,7 @@ static std::map <uint32_t, fpga_model> fpga_list = {
|
||||||
/* Lattice MachXO3 */
|
/* Lattice MachXO3 */
|
||||||
{0x012BB043, {"lattice", "MachXO3LF", "LCMX03LF-1300C", 8}},
|
{0x012BB043, {"lattice", "MachXO3LF", "LCMX03LF-1300C", 8}},
|
||||||
{0x012B2043, {"lattice", "MachXO3LF", "LCMX03LF-1300E", 8}},
|
{0x012B2043, {"lattice", "MachXO3LF", "LCMX03LF-1300E", 8}},
|
||||||
{0x012BB043, {"lattice", "MachXO3LF", "LCMX03LF-2100C", 8}},
|
{0x612BB043, {"lattice", "MachXO3LF", "LCMX03LF-2100C", 8}},
|
||||||
{0x012B3043, {"lattice", "MachXO3LF", "LCMX03LF-2100E", 8}},
|
{0x012B3043, {"lattice", "MachXO3LF", "LCMX03LF-2100E", 8}},
|
||||||
{0x012BC043, {"lattice", "MachXO3LF", "LCMX03LF-4300C", 8}},
|
{0x012BC043, {"lattice", "MachXO3LF", "LCMX03LF-4300C", 8}},
|
||||||
{0x012B4043, {"lattice", "MachXO3LF", "LCMX03LF-4300E", 8}},
|
{0x012B4043, {"lattice", "MachXO3LF", "LCMX03LF-4300E", 8}},
|
||||||
|
|
@ -207,8 +207,8 @@ static std::map <uint32_t, fpga_model> fpga_list = {
|
||||||
{0x010F1043, {"lattice", "CrosslinkNX", "LIFCL-40", 8}},
|
{0x010F1043, {"lattice", "CrosslinkNX", "LIFCL-40", 8}},
|
||||||
|
|
||||||
/* Lattice Certus-NX */
|
/* Lattice Certus-NX */
|
||||||
{0x010F0043, {"lattice", "CertusNX", "LFD2NX-17", 8}},
|
{0x310F0043, {"lattice", "CertusNX", "LFD2NX-17", 8}},
|
||||||
{0x010F1043, {"lattice", "CertusNX", "LFD2NX-40", 8}},
|
{0x310F1043, {"lattice", "CertusNX", "LFD2NX-40", 8}},
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/* Gowin */
|
/* Gowin */
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,8 @@ void SVF_jtag::parse_XYR(vector<string> const &vstr, svf_XYR &t)
|
||||||
}
|
}
|
||||||
if (write_data != -1) {
|
if (write_data != -1) {
|
||||||
size_t byte_len = (t.len + 7) / 8;
|
size_t byte_len = (t.len + 7) / 8;
|
||||||
|
if (byte_len == 0)
|
||||||
|
return;
|
||||||
unsigned char *write_buffer = parse_hex(t.tdi, byte_len, 0);
|
unsigned char *write_buffer = parse_hex(t.tdi, byte_len, 0);
|
||||||
if (!t.smask.empty()) {
|
if (!t.smask.empty()) {
|
||||||
unsigned char *smaskbuff = parse_hex(t.smask, byte_len, 0);
|
unsigned char *smaskbuff = parse_hex(t.smask, byte_len, 0);
|
||||||
|
|
@ -171,6 +173,8 @@ void SVF_jtag::parse_XYR(vector<string> const &vstr, svf_XYR &t)
|
||||||
cerr << uppercase << hex << int(read_buffer[j]);
|
cerr << uppercase << hex << int(read_buffer[j]);
|
||||||
}
|
}
|
||||||
cerr << " isn't the one expected: " << uppercase << t.tdo << endl;
|
cerr << " isn't the one expected: " << uppercase << t.tdo << endl;
|
||||||
|
delete[] tdobuf;
|
||||||
|
delete[] maskbuf;
|
||||||
throw exception();
|
throw exception();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -434,7 +434,7 @@ UsbBlasterII::UsbBlasterII(const string &firmware_path)
|
||||||
{
|
{
|
||||||
std::string fpath;
|
std::string fpath;
|
||||||
uint8_t buf[5];
|
uint8_t buf[5];
|
||||||
if (firmware_path.empty() && BLASTERII_DIR == "") {
|
if (firmware_path.empty() && strlen(BLASTERII_DIR) == 0) {
|
||||||
printError("missing FX2 firmware");
|
printError("missing FX2 firmware");
|
||||||
printError("use --probe-firmware with something");
|
printError("use --probe-firmware with something");
|
||||||
printError("like /opt/intelFPGA/VERSION/quartus/linux64/blaster_6810.hex");
|
printError("like /opt/intelFPGA/VERSION/quartus/linux64/blaster_6810.hex");
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "jtag.hpp"
|
#include "jtag.hpp"
|
||||||
#include "bitparser.hpp"
|
#include "bitparser.hpp"
|
||||||
|
|
@ -371,10 +372,11 @@ void Xilinx::program(unsigned int offset, bool unprotect_flash)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (_mode == Device::FLASH_MODE && _file_extension == "jed") {
|
if (_mode == Device::FLASH_MODE && _file_extension == "jed") {
|
||||||
JedParser *jed;
|
if (_fpga_family != XC95_FAMILY && _fpga_family != XC2C_FAMILY)
|
||||||
|
throw std::runtime_error("Error: jed only supported for xc95 and xc2c");
|
||||||
printInfo("Open file ", false);
|
printInfo("Open file ", false);
|
||||||
|
|
||||||
jed = new JedParser(_filename, _verbose);
|
std::unique_ptr<JedParser> jed(new JedParser(_filename, _verbose));
|
||||||
if (jed->parse() == EXIT_FAILURE) {
|
if (jed->parse() == EXIT_FAILURE) {
|
||||||
printError("FAIL");
|
printError("FAIL");
|
||||||
return;
|
return;
|
||||||
|
|
@ -382,11 +384,9 @@ void Xilinx::program(unsigned int offset, bool unprotect_flash)
|
||||||
printSuccess("DONE");
|
printSuccess("DONE");
|
||||||
|
|
||||||
if (_fpga_family == XC95_FAMILY)
|
if (_fpga_family == XC95_FAMILY)
|
||||||
flow_program(jed);
|
flow_program(jed.get());
|
||||||
else if (_fpga_family == XC2C_FAMILY)
|
else if (_fpga_family == XC2C_FAMILY)
|
||||||
xc2c_flow_program(jed);
|
xc2c_flow_program(jed.get());
|
||||||
else
|
|
||||||
throw std::runtime_error("Error: jed only supported for xc95 and xc2c");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -974,7 +974,7 @@ std::string Xilinx::flow_read()
|
||||||
std::string buffer;
|
std::string buffer;
|
||||||
uint8_t wr_buf[16+2]; // largest section length
|
uint8_t wr_buf[16+2]; // largest section length
|
||||||
uint8_t rd_buf[16+2];
|
uint8_t rd_buf[16+2];
|
||||||
memset(wr_buf, 0xff, 16);
|
memset(wr_buf, 0xff, sizeof(wr_buf));
|
||||||
|
|
||||||
/* limit JTAG clock frequency to 1MHz */
|
/* limit JTAG clock frequency to 1MHz */
|
||||||
if (_jtag->getClkFreq() > 1e6)
|
if (_jtag->getClkFreq() > 1e6)
|
||||||
|
|
@ -1433,7 +1433,6 @@ std::string Xilinx::xc2c_flow_read()
|
||||||
|
|
||||||
bool Xilinx::xc2c_flow_program(JedParser *jed)
|
bool Xilinx::xc2c_flow_program(JedParser *jed)
|
||||||
{
|
{
|
||||||
uint8_t wr_buf[249]; // largest section length
|
|
||||||
uint32_t delay_loop = (_jtag->getClkFreq() * 20) / 1000;
|
uint32_t delay_loop = (_jtag->getClkFreq() * 20) / 1000;
|
||||||
uint8_t shift_addr = 8 - _cpld_addr_size;
|
uint8_t shift_addr = 8 - _cpld_addr_size;
|
||||||
|
|
||||||
|
|
@ -1472,6 +1471,7 @@ bool Xilinx::xc2c_flow_program(JedParser *jed)
|
||||||
for (auto row : listfuse) {
|
for (auto row : listfuse) {
|
||||||
uint16_t pos = 0;
|
uint16_t pos = 0;
|
||||||
uint8_t addr = _gray_code[iter] >> shift_addr;
|
uint8_t addr = _gray_code[iter] >> shift_addr;
|
||||||
|
uint8_t wr_buf[249] = {0}; // largest section length
|
||||||
for (auto col : row) {
|
for (auto col : row) {
|
||||||
if (col)
|
if (col)
|
||||||
wr_buf[pos >> 3] |= (1 << (pos & 0x07));
|
wr_buf[pos >> 3] |= (1 << (pos & 0x07));
|
||||||
|
|
@ -1577,7 +1577,7 @@ int Xilinx::spi_wait(uint8_t cmd, uint8_t mask, uint8_t cond,
|
||||||
uint32_t timeout, bool verbose)
|
uint32_t timeout, bool verbose)
|
||||||
{
|
{
|
||||||
uint8_t rx[2];
|
uint8_t rx[2];
|
||||||
uint8_t dummy[2];
|
uint8_t dummy[2] = {0xff};
|
||||||
uint8_t tmp;
|
uint8_t tmp;
|
||||||
uint8_t tx = McsParser::reverseByte(cmd);
|
uint8_t tx = McsParser::reverseByte(cmd);
|
||||||
uint32_t count = 0;
|
uint32_t count = 0;
|
||||||
|
|
|
||||||
|
|
@ -82,8 +82,8 @@ class XVC_server {
|
||||||
int _sock; /*!< server socket descriptor */
|
int _sock; /*!< server socket descriptor */
|
||||||
struct sockaddr_in _sock_addr;
|
struct sockaddr_in _sock_addr;
|
||||||
std::thread *_thread; /*!< connection thread */
|
std::thread *_thread; /*!< connection thread */
|
||||||
bool _is_stopped; /*!< true when thread is stopped */
|
volatile bool _is_stopped; /*!< true when thread is stopped */
|
||||||
bool _must_stop; /*!< true to stop thread */
|
volatile bool _must_stop; /*!< true to stop thread */
|
||||||
uint32_t _buffer_size; /*!< buffer max capacity TDI+TMS */
|
uint32_t _buffer_size; /*!< buffer max capacity TDI+TMS */
|
||||||
uint8_t *_tmstdi; /*!< TDI/TMS from client */
|
uint8_t *_tmstdi; /*!< TDI/TMS from client */
|
||||||
uint8_t *_result; /*!< buffer for server -> client */
|
uint8_t *_result; /*!< buffer for server -> client */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue