jtag,main,xilinx: fix warnings, lint

This commit is contained in:
Gwenhael Goavec-Merou 2024-03-09 10:21:21 +01:00
parent 899dc931c8
commit f1bf4fdf57
3 changed files with 15 additions and 14 deletions

View File

@ -3,8 +3,8 @@
* Copyright (C) 2020 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
*/
#ifndef JTAG_H
#define JTAG_H
#ifndef SRC_JTAG_HPP_
#define SRC_JTAG_HPP_
#include <cstdint>
#include <iostream>
@ -65,7 +65,7 @@ class Jtag {
* \brief return list of devices in the chain
* \return list of devices
*/
std::vector<int> get_devices_list() {return _devices_list;}
std::vector<uint32_t> get_devices_list() {return _devices_list;}
/*!
* \brief return device index in list
@ -169,8 +169,8 @@ class Jtag {
unsigned _ir_bits_before, _ir_bits_after;
std::vector<uint8_t> _ir_bits;
std::vector<int32_t> _devices_list; /*!< ordered list of devices idcode */
std::vector<uint32_t> _devices_list; /*!< ordered list of devices idcode */
std::vector<int16_t> _irlength_list; /*!< ordered list of irlength */
uint8_t _curr_tdi;
};
#endif
#endif // SRC_JTAG_HPP_

View File

@ -458,9 +458,10 @@ int main(int argc, char **argv)
}
/* chain detection */
vector<int> listDev = jtag->get_devices_list();
int found = listDev.size();
int idcode = -1, index = 0;
vector<uint32_t> listDev = jtag->get_devices_list();
size_t found = listDev.size();
int idcode = -1;
size_t index = 0;
if (args.verbose > 0)
cout << "found " << std::to_string(found) << " devices" << endl;
@ -469,9 +470,9 @@ int main(int argc, char **argv)
* display full chain with details
*/
if (args.verbose > 0 || args.detect) {
for (int i = 0; i < found; i++) {
int t = listDev[i];
printf("index %d:\n", i);
for (size_t i = 0; i < found; i++) {
uint32_t t = listDev[i];
printf("index %zu:\n", i);
if (fpga_list.find(t) != fpga_list.end()) {
printf("\tidcode 0x%x\n\tmanufacturer %s\n\tfamily %s\n\tmodel %s\n",
t,
@ -499,13 +500,13 @@ int main(int argc, char **argv)
if (found != 0) {
if (args.index_chain == -1) {
for (int i = 0; i < found; i++) {
for (size_t i = 0; i < found; i++) {
if (fpga_list.find(listDev[i]) != fpga_list.end()) {
index = i;
if (idcode != -1) {
printError("Error: more than one FPGA found");
printError("Use --index-chain to force selection");
for (int i = 0; i < found; i++)
for (size_t i = 0; i < found; i++)
printf("0x%08x\n", listDev[i]);
delete(jtag);
return EXIT_FAILURE;

View File

@ -465,7 +465,7 @@ bool Xilinx::zynqmp_init(const std::string &family)
* ARM at position 1
*/
char mess[256];
std::vector<int> listDev = _jtag->get_devices_list();
std::vector<uint32_t> listDev = _jtag->get_devices_list();
if (listDev.size() != 2) {
snprintf(mess, sizeof(mess), "ZynqMP error: wrong"
" JTAG length: %zu instead of 2\n",