Merge pull request #347 from motec-research/efinix
JLINK updates and Efinix JTAG fix
This commit is contained in:
commit
81e0e5c631
|
|
@ -182,6 +182,12 @@ jlink:
|
||||||
Description: SEGGER J-Link Debug Probes
|
Description: SEGGER J-Link Debug Probes
|
||||||
URL: https://www.segger.com/products/debug-probes/j-link
|
URL: https://www.segger.com/products/debug-probes/j-link
|
||||||
|
|
||||||
|
- Name: jlink_base
|
||||||
|
Description: SEGGER J-Link BASE Debug Probes
|
||||||
|
|
||||||
|
- Name: jtrace_pro
|
||||||
|
Description: SEGGER J-Trace PRO Debug Probes
|
||||||
|
|
||||||
|
|
||||||
jtag-smt2-nc:
|
jtag-smt2-nc:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,27 @@ or, for xyloni board
|
||||||
|
|
||||||
Since openFPGALoader access the flash directly in SPI mode the ``-b fireant``, ``-b xyloni_spi`` is required (no
|
Since openFPGALoader access the flash directly in SPI mode the ``-b fireant``, ``-b xyloni_spi`` is required (no
|
||||||
autodetection possible).
|
autodetection possible).
|
||||||
|
|
||||||
|
Trion and Titanium JTAG usage
|
||||||
|
==========================================
|
||||||
|
|
||||||
|
*openFPGALoader* supports loading to RAM and SPI Flash with JTAG
|
||||||
|
|
||||||
|
Tested with J-Link BASE
|
||||||
|
|
||||||
|
bin file load
|
||||||
|
-------------
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
openFPGALoader --cable jlink_base -m /somewhere/project/outflow/*.bin
|
||||||
|
|
||||||
|
hex file flash
|
||||||
|
-------------
|
||||||
|
|
||||||
|
Example for ti60f225.
|
||||||
|
NOTE: JTAG chains with more than one device (eg --index-chain) are currently not supported for writing to SPI flash
|
||||||
|
|
||||||
|
.. code-block:: bash
|
||||||
|
|
||||||
|
openFPGALoader --cable jlink_base --fpga-part ti60f225 -f /somewhere/project/outflow/*.hex
|
||||||
|
|
@ -107,6 +107,8 @@ static std::map <std::string, cable_t> cable_list = {
|
||||||
{"ft4232", FTDI_SER(0x0403, 0x6011, FTDI_INTF_A, 0x08, 0x0B, 0x08, 0x0B)},
|
{"ft4232", FTDI_SER(0x0403, 0x6011, FTDI_INTF_A, 0x08, 0x0B, 0x08, 0x0B)},
|
||||||
{"ecpix5-debug", FTDI_SER(0x0403, 0x6010, FTDI_INTF_A, 0xF8, 0xFB, 0xFF, 0xFF)},
|
{"ecpix5-debug", FTDI_SER(0x0403, 0x6010, FTDI_INTF_A, 0xF8, 0xFB, 0xFF, 0xFF)},
|
||||||
{"jlink", CABLE_DEF(MODE_JLINK, 0x1366, 0x0105 )},
|
{"jlink", CABLE_DEF(MODE_JLINK, 0x1366, 0x0105 )},
|
||||||
|
{"jlink_base", CABLE_DEF(MODE_JLINK, 0x1366, 0x0101 )},
|
||||||
|
{"jtrace_pro", CABLE_DEF(MODE_JLINK, 0x1366, 0x1020 )},
|
||||||
{"jtag-smt2-nc", FTDI_SER(0x0403, 0x6014, FTDI_INTF_A, 0xe8, 0xeb, 0x00, 0x60)},
|
{"jtag-smt2-nc", FTDI_SER(0x0403, 0x6014, FTDI_INTF_A, 0xe8, 0xeb, 0x00, 0x60)},
|
||||||
{"lpc-link2", CMSIS_CL(0x1fc9, 0x0090 )},
|
{"lpc-link2", CMSIS_CL(0x1fc9, 0x0090 )},
|
||||||
{"orbtrace", CMSIS_CL(0x1209, 0x3443 )},
|
{"orbtrace", CMSIS_CL(0x1209, 0x3443 )},
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ Efinix::Efinix(Jtag* jtag, const std::string &filename,
|
||||||
} else if (board_name == "titanium_ti60_f225_jtag") {
|
} else if (board_name == "titanium_ti60_f225_jtag") {
|
||||||
spi_board_name = "titanium_ti60_f225";
|
spi_board_name = "titanium_ti60_f225";
|
||||||
} else {
|
} else {
|
||||||
printInfo("Using efinix JTAG interface (no GPIO)");
|
init_common(prg_type);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -116,8 +116,10 @@ Efinix::Efinix(Jtag* jtag, const std::string &filename,
|
||||||
|
|
||||||
void Efinix::init_common(const Device::prog_type_t &prg_type)
|
void Efinix::init_common(const Device::prog_type_t &prg_type)
|
||||||
{
|
{
|
||||||
_spi->gpio_set_input(_done_pin);
|
if (_spi) {
|
||||||
_spi->gpio_set_output(_rst_pin | _oe_pin);
|
_spi->gpio_set_input(_done_pin);
|
||||||
|
_spi->gpio_set_output(_rst_pin | _oe_pin);
|
||||||
|
}
|
||||||
|
|
||||||
switch (prg_type) {
|
switch (prg_type) {
|
||||||
case Device::WR_FLASH:
|
case Device::WR_FLASH:
|
||||||
|
|
@ -142,8 +144,10 @@ Efinix::~Efinix()
|
||||||
|
|
||||||
void Efinix::reset()
|
void Efinix::reset()
|
||||||
{
|
{
|
||||||
if (!_spi) // not supported
|
if (!_spi) {
|
||||||
|
printError("jtag: reset not supported");
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
uint32_t timeout = 1000;
|
uint32_t timeout = 1000;
|
||||||
_spi->gpio_clear(_rst_pin | _oe_pin);
|
_spi->gpio_clear(_rst_pin | _oe_pin);
|
||||||
usleep(1000);
|
usleep(1000);
|
||||||
|
|
@ -218,6 +222,11 @@ void Efinix::program(unsigned int offset, bool unprotect_flash)
|
||||||
|
|
||||||
bool Efinix::dumpFlash(uint32_t base_addr, uint32_t len)
|
bool Efinix::dumpFlash(uint32_t base_addr, uint32_t len)
|
||||||
{
|
{
|
||||||
|
if (!_spi) {
|
||||||
|
printError("jtag: dumpFlash not supported");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t timeout = 1000;
|
uint32_t timeout = 1000;
|
||||||
_spi->gpio_clear(_rst_pin);
|
_spi->gpio_clear(_rst_pin);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,11 @@ Jlink::Jlink(uint32_t clkHz, int8_t verbose, int vid = VID, int pid = PID):_base
|
||||||
throw std::runtime_error("libusb init failed\n");
|
throw std::runtime_error("libusb init failed\n");
|
||||||
|
|
||||||
// search for all compatible devices
|
// search for all compatible devices
|
||||||
if (!jlink_scan_usb(vid,pid))
|
if (!jlink_scan_usb(vid,pid)) {
|
||||||
|
if (_verbose)
|
||||||
|
printf("vid:pid %04x:%04x\n", vid, pid);
|
||||||
throw std::runtime_error("can't find compatible device");
|
throw std::runtime_error("can't find compatible device");
|
||||||
|
}
|
||||||
|
|
||||||
// get device capacity
|
// get device capacity
|
||||||
if (!get_caps())
|
if (!get_caps())
|
||||||
|
|
@ -137,7 +140,10 @@ int Jlink::writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end)
|
||||||
xfer_len = len - rest; // reduce xfer len
|
xfer_len = len - rest; // reduce xfer len
|
||||||
uint16_t tt = (xfer_len + 7) >> 3; // convert to Byte
|
uint16_t tt = (xfer_len + 7) >> 3; // convert to Byte
|
||||||
memset(_tms, tms, tt); // fill tms buffer
|
memset(_tms, tms, tt); // fill tms buffer
|
||||||
memcpy(_tdi, tx_ptr, tt); // fill tdi buffer
|
if (tx)
|
||||||
|
memcpy(_tdi, tx_ptr, tt); // fill tdi buffer
|
||||||
|
else
|
||||||
|
memset(_tdi, 0, tt); // clear tdi buffer
|
||||||
_num_bits = xfer_len; // set buffer size in bit
|
_num_bits = xfer_len; // set buffer size in bit
|
||||||
if (end && xfer_len + rest == len) { // last sequence: set tms 1
|
if (end && xfer_len + rest == len) { // last sequence: set tms 1
|
||||||
_last_tms = 1;
|
_last_tms = 1;
|
||||||
|
|
@ -677,8 +683,13 @@ bool Jlink::jlink_scan_usb(int vid, int pid)
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc.idProduct != pid || desc.idVendor != vid)
|
if (desc.idVendor != vid)
|
||||||
continue;
|
continue;
|
||||||
|
if (desc.idProduct != pid) {
|
||||||
|
if (_verbose)
|
||||||
|
cerr << "skip pid" << hex << desc.idProduct << dec << endl;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (_verbose)
|
if (_verbose)
|
||||||
printf("%04x:%04x (bus %d, device %2d)\n",
|
printf("%04x:%04x (bus %d, device %2d)\n",
|
||||||
|
|
|
||||||
|
|
@ -118,11 +118,16 @@ class Jlink: public JtagInterface {
|
||||||
};
|
};
|
||||||
|
|
||||||
// JLink hardware type
|
// JLink hardware type
|
||||||
const std::string jlink_hw_type[4] = {
|
const std::string jlink_hw_type[9] = {
|
||||||
"J-Link",
|
"J-Link",
|
||||||
"J-Trace",
|
"J-Trace",
|
||||||
"Flasher",
|
"Flasher",
|
||||||
"J-Link Pro"
|
"J-Link Pro",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
"J-Trace Pro"
|
||||||
};
|
};
|
||||||
|
|
||||||
// Jlink configuration structure
|
// Jlink configuration structure
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue