gmpack: add bootaddr parameter for secondary bitstreams
This commit is contained in:
parent
72bc122449
commit
4597d1de96
|
|
@ -43,7 +43,7 @@ static constexpr const uint8_t CMD_FRAM = 0xd2;
|
||||||
static constexpr const uint8_t CMD_SERDES = 0xd7; //
|
static constexpr const uint8_t CMD_SERDES = 0xd7; //
|
||||||
static constexpr const uint8_t CMD_D2D = 0xd8; //
|
static constexpr const uint8_t CMD_D2D = 0xd8; //
|
||||||
static constexpr const uint8_t CMD_PATH = 0xd9;
|
static constexpr const uint8_t CMD_PATH = 0xd9;
|
||||||
static constexpr const uint8_t CMD_JUMP = 0xda; //
|
static constexpr const uint8_t CMD_JUMP = 0xda;
|
||||||
static constexpr const uint8_t CMD_CHG_STATUS = 0xdb;
|
static constexpr const uint8_t CMD_CHG_STATUS = 0xdb;
|
||||||
static constexpr const uint8_t CMD_WAIT_PLL = 0xdc; //
|
static constexpr const uint8_t CMD_WAIT_PLL = 0xdc; //
|
||||||
static constexpr const uint8_t CMD_SPLL = 0xdd;
|
static constexpr const uint8_t CMD_SPLL = 0xdd;
|
||||||
|
|
@ -266,6 +266,17 @@ class BitstreamReadWriter
|
||||||
write_nops(4);
|
write_nops(4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void write_cmd_jump(uint32_t addr)
|
||||||
|
{
|
||||||
|
write_header(CMD_JUMP, 4);
|
||||||
|
write_byte(uint8_t(addr & 0xFF));
|
||||||
|
write_byte(uint8_t((addr >> 8UL) & 0xFF));
|
||||||
|
write_byte(uint8_t((addr >> 16UL) & 0xFF));
|
||||||
|
write_byte(uint8_t((addr >> 24UL) & 0xFF));
|
||||||
|
insert_crc16();
|
||||||
|
write_nops(2);
|
||||||
|
}
|
||||||
|
|
||||||
void write_cmd_cfgmode(uint8_t crcmode, std::vector<uint8_t> spimode)
|
void write_cmd_cfgmode(uint8_t crcmode, std::vector<uint8_t> spimode)
|
||||||
{
|
{
|
||||||
write_header(CMD_CFGMODE, spimode.size() > 0 ? 6 : 2);
|
write_header(CMD_CFGMODE, spimode.size() > 0 ? 6 : 2);
|
||||||
|
|
@ -1005,7 +1016,10 @@ Bitstream Bitstream::serialise_chip(const Chip &chip, const std::map<std::string
|
||||||
|
|
||||||
cfg_stat |= CFG_STOP | CFG_DONE;
|
cfg_stat |= CFG_STOP | CFG_DONE;
|
||||||
if (options.count("reconfig")) {
|
if (options.count("reconfig")) {
|
||||||
cfg_stat |= CFG_RECONFIG | CFG_CPE_CFG;
|
cfg_stat |= CFG_RECONFIG;
|
||||||
|
}
|
||||||
|
if (options.count("cpeconfig")) {
|
||||||
|
cfg_stat |= CFG_CPE_CFG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!die.is_serdes_cfg_empty()) {
|
if (!die.is_serdes_cfg_empty()) {
|
||||||
|
|
@ -1016,6 +1030,13 @@ Bitstream Bitstream::serialise_chip(const Chip &chip, const std::map<std::string
|
||||||
}
|
}
|
||||||
|
|
||||||
wr.write_cmd_chg_status(cfg_stat, die_config);
|
wr.write_cmd_chg_status(cfg_stat, die_config);
|
||||||
|
|
||||||
|
if (d == 0) {
|
||||||
|
if (options.count("bootaddr")) {
|
||||||
|
uint32_t bootaddr = std::strtoul(options.at("bootaddr").c_str(), nullptr, 0);
|
||||||
|
wr.write_cmd_jump(bootaddr);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return Bitstream(wr.get());
|
return Bitstream(wr.get());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -37,10 +37,12 @@ int main(int argc, char *argv[])
|
||||||
po::options_description options("Allowed options");
|
po::options_description options("Allowed options");
|
||||||
options.add_options()("help,h", "show help");
|
options.add_options()("help,h", "show help");
|
||||||
options.add_options()("verbose,v", "verbose output");
|
options.add_options()("verbose,v", "verbose output");
|
||||||
options.add_options()("reset", "Reset all configuration latches with CMD_CFGRST");
|
options.add_options()("reset", "reset all configuration latches with CMD_CFGRST");
|
||||||
options.add_options()("crcmode", po::value<std::string>(), "CRC error behaviour (check, ignore, unused)");
|
options.add_options()("crcmode", po::value<std::string>(), "CRC error behaviour (check, ignore, unused)");
|
||||||
options.add_options()("spimode", po::value<std::string>(), "SPI Mode to use (single, dual, quad)");
|
options.add_options()("spimode", po::value<std::string>(), "SPI Mode to use (single, dual, quad)");
|
||||||
options.add_options()("reconfig", "enable reconfiguration in bitstream");
|
options.add_options()("reconfig", "enable reconfiguration in bitstream");
|
||||||
|
options.add_options()("cpeconfig", "enable CPE configuration interface");
|
||||||
|
options.add_options()("bootaddr", po::value<int>(), "boot address for secondary bitstream");
|
||||||
po::positional_options_description pos;
|
po::positional_options_description pos;
|
||||||
options.add_options()("input", po::value<std::string>()->required(), "input textual configuration");
|
options.add_options()("input", po::value<std::string>()->required(), "input textual configuration");
|
||||||
pos.add("input", 1);
|
pos.add("input", 1);
|
||||||
|
|
@ -99,6 +101,14 @@ int main(int argc, char *argv[])
|
||||||
bitopts["reconfig"] = "yes";
|
bitopts["reconfig"] = "yes";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vm.count("cpeconfig")) {
|
||||||
|
bitopts["cpeconfig"] = "yes";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vm.count("bootaddr")) {
|
||||||
|
bitopts["bootaddr"] = std::to_string(vm["bootaddr"].as<int>());
|
||||||
|
}
|
||||||
|
|
||||||
std::string textcfg((std::istreambuf_iterator<char>(config_file)), std::istreambuf_iterator<char>());
|
std::string textcfg((std::istreambuf_iterator<char>(config_file)), std::istreambuf_iterator<char>());
|
||||||
|
|
||||||
ChipConfig cc;
|
ChipConfig cc;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue