add option to bypass reset in SPI write mode. Adapt altera accordingly
This commit is contained in:
parent
e066c7f5b0
commit
051e2ecbfb
|
|
@ -26,9 +26,10 @@
|
|||
Altera::Altera(Jtag *jtag, const std::string &filename,
|
||||
const std::string &file_type, Device::prog_type_t prg_type,
|
||||
const std::string &device_package, bool verify, int8_t verbose,
|
||||
bool skip_load_bridge):
|
||||
bool skip_load_bridge, bool skip_reset):
|
||||
Device(jtag, filename, file_type, verify, verbose),
|
||||
SPIInterface(filename, verbose, 256, verify, skip_load_bridge),
|
||||
SPIInterface(filename, verbose, 256, verify, skip_load_bridge,
|
||||
skip_reset),
|
||||
_svf(_jtag, _verbose), _device_package(device_package),
|
||||
_vir_addr(0x1000), _vir_length(14)
|
||||
{
|
||||
|
|
@ -149,6 +150,14 @@ void Altera::programMem(RawParser &_bit)
|
|||
_jtag->set_state(Jtag::RUN_TEST_IDLE);
|
||||
}
|
||||
|
||||
bool Altera::post_flash_access()
|
||||
{
|
||||
if (_skip_reset)
|
||||
printInfo("Skip resetting device");
|
||||
else
|
||||
reset();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Altera::prepare_flash_access()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class Altera: public Device, SPIInterface {
|
|||
Device::prog_type_t prg_type,
|
||||
const std::string &device_package,
|
||||
bool verify, int8_t verbose,
|
||||
bool skip_load_bridge);
|
||||
bool skip_load_bridge, bool skip_reset);
|
||||
~Altera();
|
||||
|
||||
void programMem(RawParser &_bit);
|
||||
|
|
@ -66,7 +66,7 @@ class Altera: public Device, SPIInterface {
|
|||
|
||||
protected:
|
||||
bool prepare_flash_access() override;
|
||||
bool post_flash_access() override {reset(); return true;}
|
||||
bool post_flash_access() override;
|
||||
|
||||
private:
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ struct arguments {
|
|||
bool unprotect_flash;
|
||||
string flash_sector;
|
||||
bool skip_load_bridge;
|
||||
bool skip_reset;
|
||||
};
|
||||
|
||||
int parse_opt(int argc, char **argv, struct arguments *args, jtag_pins_conf_t *pins_config);
|
||||
|
|
@ -85,7 +86,7 @@ int main(int argc, char **argv)
|
|||
struct arguments args = {0, false, false, false, 0, "", "", "-", "", -1,
|
||||
0, false, "-", false, false, false, false, Device::PRG_NONE, false,
|
||||
false, false, "", "", "", -1, 0, false, -1, 0, 0, "127.0.0.1",
|
||||
0, false, "", false};
|
||||
0, false, "", false, false};
|
||||
/* parse arguments */
|
||||
try {
|
||||
if (parse_opt(argc, argv, &args, &pins_config))
|
||||
|
|
@ -468,7 +469,7 @@ int main(int argc, char **argv)
|
|||
} else if (fab == "altera") {
|
||||
fpga = new Altera(jtag, args.bit_file, args.file_type,
|
||||
args.prg_type, args.fpga_part, args.verify, args.verbose,
|
||||
args.skip_load_bridge);
|
||||
args.skip_load_bridge, args.skip_reset);
|
||||
} else if (fab == "anlogic") {
|
||||
fpga = new Anlogic(jtag, args.bit_file, args.file_type,
|
||||
args.prg_type, args.verify, args.verbose);
|
||||
|
|
@ -638,6 +639,8 @@ int parse_opt(int argc, char **argv, struct arguments *args, jtag_pins_conf_t *p
|
|||
cxxopts::value<bool>(args->reset))
|
||||
("skip-load-bridge", "skip writing bridge to SRAM when in write-flash mode",
|
||||
cxxopts::value<bool>(args->skip_load_bridge))
|
||||
("skip-reset", "skip resetting the device when in write-flash mode",
|
||||
cxxopts::value<bool>(args->skip_load_bridge))
|
||||
("spi", "SPI mode (only for FTDI in serial mode)",
|
||||
cxxopts::value<bool>(args->spi))
|
||||
("unprotect-flash", "Unprotect flash blocks",
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@ SPIInterface::SPIInterface():_spif_verbose(0), _spif_rd_burst(0),
|
|||
{}
|
||||
|
||||
SPIInterface::SPIInterface(const std::string &filename, uint8_t verbose,
|
||||
uint32_t rd_burst, bool verify, bool skip_load_bridge):
|
||||
uint32_t rd_burst, bool verify, bool skip_load_bridge,
|
||||
bool skip_reset):
|
||||
_spif_verbose(verbose), _spif_rd_burst(rd_burst),
|
||||
_spif_verify(verify), _skip_load_bridge(skip_load_bridge),
|
||||
_spif_filename(filename)
|
||||
_skip_reset(skip_reset), _spif_filename(filename)
|
||||
{}
|
||||
|
||||
/* spiFlash generic acces */
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ class SPIInterface {
|
|||
public:
|
||||
SPIInterface();
|
||||
SPIInterface(const std::string &filename, uint8_t verbose,
|
||||
uint32_t rd_burst, bool verify, bool skip_load_bridge = false);
|
||||
uint32_t rd_burst, bool verify, bool skip_load_bridge = false,
|
||||
bool skip_reset = false);
|
||||
virtual ~SPIInterface() {}
|
||||
|
||||
bool protect_flash(uint32_t len);
|
||||
|
|
@ -98,6 +99,7 @@ class SPIInterface {
|
|||
uint32_t _spif_rd_burst;
|
||||
bool _spif_verify;
|
||||
bool _skip_load_bridge;
|
||||
bool _skip_reset; /*!< don't reset the device after write */
|
||||
private:
|
||||
std::string _spif_filename;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue