lattice,xilinx: new try to fix (again) uint64_t print format

This commit is contained in:
Gwenhael Goavec-Merou 2024-03-18 06:57:59 +01:00
parent 1d276ebb9d
commit 02c33271e0
2 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,8 @@
* Copyright (C) 2019 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> * Copyright (C) 2019 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
*/ */
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
@ -1048,7 +1050,7 @@ void Lattice::displayReadReg(uint64_t dev)
uint8_t err; uint8_t err;
printf("displayReadReg\n"); printf("displayReadReg\n");
if (dev & 1<<0) printf("\tTRAN Mode\n"); if (dev & 1<<0) printf("\tTRAN Mode\n");
printf("\tConfig Target Selection : %llx\n", (dev >> 1) & 0x07); printf("\tConfig Target Selection : %" PRIx64 "\n", (dev >> 1) & 0x07);
if (dev & 1<<4) printf("\tJTAG Active\n"); if (dev & 1<<4) printf("\tJTAG Active\n");
if (dev & 1<<5) printf("\tPWD Protect\n"); if (dev & 1<<5) printf("\tPWD Protect\n");
if (dev & 1<<6) printf("\tOTP\n"); if (dev & 1<<6) printf("\tOTP\n");

View File

@ -3,6 +3,8 @@
* Copyright (C) 2019 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com> * Copyright (C) 2019 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
*/ */
#define __STDC_FORMAT_MACROS
#include <inttypes.h>
#include <unistd.h> #include <unistd.h>
#include <cstring> #include <cstring>
@ -385,7 +387,7 @@ Xilinx::Xilinx(Jtag *jtag, const std::string &filename,
if (read_dna) { if (read_dna) {
if (_fpga_family == ARTIX_FAMILY || _fpga_family == KINTEXUS_FAMILY) { if (_fpga_family == ARTIX_FAMILY || _fpga_family == KINTEXUS_FAMILY) {
uint64_t dna = Xilinx::fuse_dna_read(); uint64_t dna = Xilinx::fuse_dna_read();
printf("{\"dna\": \"0x%016llx\"}\n", dna); printf("{\"dna\": \"0x%016" PRIx64 "\"}\n", dna);
} else { } else {
throw std::runtime_error("Error: read_xadc only supported for Artix 7"); throw std::runtime_error("Error: read_xadc only supported for Artix 7");
} }