main: enable xvc_server
This commit is contained in:
parent
34ff4f4020
commit
a90a7b6fa5
|
|
@ -98,6 +98,8 @@ openFPGALoader -- a program to flash FPGA
|
||||||
2:debug
|
2:debug
|
||||||
-h, --help Give this help list
|
-h, --help Give this help list
|
||||||
--verify Verify write operation (SPI Flash only)
|
--verify Verify write operation (SPI Flash only)
|
||||||
|
--xvc Xilinx Virtual Cable Functions
|
||||||
|
--port arg Xilinx Virtual Cable Port (default 3721)
|
||||||
-V, --Version Print program version
|
-V, --Version Print program version
|
||||||
|
|
||||||
Mandatory or optional arguments to long options are also mandatory or optional
|
Mandatory or optional arguments to long options are also mandatory or optional
|
||||||
|
|
|
||||||
|
|
@ -229,3 +229,10 @@ xvc-client:
|
||||||
- Name: Xilinx Virtual Cable
|
- Name: Xilinx Virtual Cable
|
||||||
Description: Xilinx Virtual Cable (XVC) is a TCP/IP-based protocol that acts like a JTAG cable.
|
Description: Xilinx Virtual Cable (XVC) is a TCP/IP-based protocol that acts like a JTAG cable.
|
||||||
URL: https://github.com/Xilinx/XilinxVirtualCable
|
URL: https://github.com/Xilinx/XilinxVirtualCable
|
||||||
|
|
||||||
|
|
||||||
|
xvc-server:
|
||||||
|
|
||||||
|
- Name: Xilinx Virtual Cable (server side)
|
||||||
|
Description: Xilinx Virtual Cable (XVC) is a TCP/IP-based protocol that acts like a JTAG cable.
|
||||||
|
URL: https://github.com/Xilinx/XilinxVirtualCable
|
||||||
|
|
|
||||||
51
src/main.cpp
51
src/main.cpp
|
|
@ -30,6 +30,7 @@
|
||||||
#include "spiFlash.hpp"
|
#include "spiFlash.hpp"
|
||||||
#include "rawParser.hpp"
|
#include "rawParser.hpp"
|
||||||
#include "xilinx.hpp"
|
#include "xilinx.hpp"
|
||||||
|
#include "xvc_server.hpp"
|
||||||
|
|
||||||
#define DEFAULT_FREQ 6000000
|
#define DEFAULT_FREQ 6000000
|
||||||
|
|
||||||
|
|
@ -71,8 +72,15 @@ struct arguments {
|
||||||
string flash_sector;
|
string flash_sector;
|
||||||
bool skip_load_bridge;
|
bool skip_load_bridge;
|
||||||
bool skip_reset;
|
bool skip_reset;
|
||||||
|
/* xvc server */
|
||||||
|
bool xvc;
|
||||||
|
int port;
|
||||||
|
string interface;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int run_xvc_server(const struct arguments &args, const cable_t &cable,
|
||||||
|
const jtag_pins_conf_t *pins_config);
|
||||||
|
|
||||||
int parse_opt(int argc, char **argv, struct arguments *args, jtag_pins_conf_t *pins_config);
|
int parse_opt(int argc, char **argv, struct arguments *args, jtag_pins_conf_t *pins_config);
|
||||||
|
|
||||||
void displaySupported(const struct arguments &args);
|
void displaySupported(const struct arguments &args);
|
||||||
|
|
@ -87,7 +95,10 @@ int main(int argc, char **argv)
|
||||||
struct arguments args = {0, false, false, false, 0, "", "", "-", "", -1,
|
struct arguments args = {0, false, false, false, 0, "", "", "-", "", -1,
|
||||||
0, false, "-", false, false, false, false, Device::PRG_NONE, false,
|
0, false, "-", false, false, false, false, Device::PRG_NONE, false,
|
||||||
false, false, "", "", "", -1, 0, false, -1, 0, 0, 0, "127.0.0.1",
|
false, false, "", "", "", -1, 0, false, -1, 0, 0, 0, "127.0.0.1",
|
||||||
0, false, "", false, false};
|
0, false, "", false, false,
|
||||||
|
/* xvc server */
|
||||||
|
false, 3721, "-",
|
||||||
|
};
|
||||||
/* parse arguments */
|
/* parse arguments */
|
||||||
try {
|
try {
|
||||||
if (parse_opt(argc, argv, &args, &pins_config))
|
if (parse_opt(argc, argv, &args, &pins_config))
|
||||||
|
|
@ -370,8 +381,16 @@ int main(int argc, char **argv)
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ------------------- */
|
||||||
|
/* XVC server */
|
||||||
|
/* ------------------- */
|
||||||
|
if (args.xvc) {
|
||||||
|
return run_xvc_server(args, cable, &pins_config);
|
||||||
|
}
|
||||||
|
|
||||||
/* jtag base */
|
/* jtag base */
|
||||||
|
|
||||||
|
|
||||||
/* if no instruction from user -> select load */
|
/* if no instruction from user -> select load */
|
||||||
if (args.prg_type == Device::PRG_NONE)
|
if (args.prg_type == Device::PRG_NONE)
|
||||||
args.prg_type = Device::WR_SRAM;
|
args.prg_type = Device::WR_SRAM;
|
||||||
|
|
@ -466,6 +485,7 @@ int main(int argc, char **argv)
|
||||||
|
|
||||||
string fab = fpga_list[idcode].manufacturer;
|
string fab = fpga_list[idcode].manufacturer;
|
||||||
|
|
||||||
|
|
||||||
Device *fpga;
|
Device *fpga;
|
||||||
try {
|
try {
|
||||||
if (fab == "xilinx") {
|
if (fab == "xilinx") {
|
||||||
|
|
@ -538,6 +558,30 @@ int main(int argc, char **argv)
|
||||||
delete(jtag);
|
delete(jtag);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int run_xvc_server(const struct arguments &args, const cable_t &cable,
|
||||||
|
const jtag_pins_conf_t *pins_config)
|
||||||
|
{
|
||||||
|
//create XVC instance
|
||||||
|
try {
|
||||||
|
XVC_server *xvc = NULL;
|
||||||
|
xvc = new XVC_server(args.port, cable, pins_config, args.device,
|
||||||
|
args.ftdi_serial, args.freq, args.verbose, args.ip_adr,
|
||||||
|
args.invert_read_edge, args.probe_firmware);
|
||||||
|
/* create connection */
|
||||||
|
xvc->open_connection();
|
||||||
|
/* start loop */
|
||||||
|
xvc->listen_loop();
|
||||||
|
/* close connection */
|
||||||
|
xvc->close_connection();
|
||||||
|
delete xvc;
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
printError("XVC_server failed with " + string(e.what()));
|
||||||
|
return EXIT_FAILURE;
|
||||||
|
}
|
||||||
|
printInfo("Xilinx Virtual Cable Stopped! ");
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
// parse double from string in engineering notation
|
// parse double from string in engineering notation
|
||||||
// can deal with postfixes k and m, add more when required
|
// can deal with postfixes k and m, add more when required
|
||||||
static int parse_eng(string arg, double *dst) {
|
static int parse_eng(string arg, double *dst) {
|
||||||
|
|
@ -657,6 +701,10 @@ int parse_opt(int argc, char **argv, struct arguments *args, jtag_pins_conf_t *p
|
||||||
("h,help", "Give this help list")
|
("h,help", "Give this help list")
|
||||||
("verify", "Verify write operation (SPI Flash only)",
|
("verify", "Verify write operation (SPI Flash only)",
|
||||||
cxxopts::value<bool>(args->verify))
|
cxxopts::value<bool>(args->verify))
|
||||||
|
("xvc", "Xilinx Virtual Cable Functions",
|
||||||
|
cxxopts::value<bool>(args->xvc))
|
||||||
|
("port", "Xilinx Virtual Cable Port (default 3721)",
|
||||||
|
cxxopts::value<int>(args->port))
|
||||||
("V,Version", "Print program version");
|
("V,Version", "Print program version");
|
||||||
|
|
||||||
options.parse_positional({"bitstream"});
|
options.parse_positional({"bitstream"});
|
||||||
|
|
@ -786,6 +834,7 @@ int parse_opt(int argc, char **argv, struct arguments *args, jtag_pins_conf_t *p
|
||||||
!args->detect &&
|
!args->detect &&
|
||||||
!args->protect_flash &&
|
!args->protect_flash &&
|
||||||
!args->unprotect_flash &&
|
!args->unprotect_flash &&
|
||||||
|
!args->xvc &&
|
||||||
!args->reset) {
|
!args->reset) {
|
||||||
printError("Error: bitfile not specified");
|
printError("Error: bitfile not specified");
|
||||||
cout << options.help() << endl;
|
cout << options.help() << endl;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue