From 982bef67050af8bd3533d65885a8005c24fbbcf6 Mon Sep 17 00:00:00 2001 From: n-hutton Date: Thu, 20 Feb 2025 15:55:43 +0000 Subject: [PATCH] fix build failure on linux machines with fwd decl --- fpga/fpga_icopyx_hf.bit | Bin 72749 -> 72749 bytes fpga/fpga_pm3_felica.bit | Bin 42176 -> 42176 bytes fpga/fpga_pm3_hf.bit | Bin 42172 -> 42172 bytes fpga/fpga_pm3_hf_15.bit | Bin 42175 -> 42175 bytes fpga/fpga_pm3_lf.bit | Bin 42172 -> 42172 bytes fpga/strip_date_time_from_binary.py | 13 ++++++------- tools/fpga_compress/fpga_compress.c | 4 ++++ 7 files changed, 10 insertions(+), 7 deletions(-) diff --git a/fpga/fpga_icopyx_hf.bit b/fpga/fpga_icopyx_hf.bit index 77d436c59aea22951de6630419eb22e532a03267..a7824dd7466bff3e48074d9a3463301d0c6de14d 100644 GIT binary patch delta 65 zcmZ3xgJtaw7A^)({tpm1keju30Wvc0x!ocYU1E~y*(xGVv42%p64D1Gs2?|J{F=cBC<4I`% D(T)wM diff --git a/fpga/fpga_pm3_felica.bit b/fpga/fpga_pm3_felica.bit index b8f8e80cc20bd4fab9dcb9b29b0158e300ec32a1..38663847852f0ef934a04c61b3f553bf415a61e9 100644 GIT binary patch delta 63 zcmX?blIg%nCN2g}{tpm1k66eju30WuoPl!ocYU1E~xQ1)*sM42%p64D1Gs35*IzU}H+m5&+Fh B4RZhh diff --git a/fpga/fpga_pm3_hf.bit b/fpga/fpga_pm3_hf.bit index fdd4bb33305a996ef5de8d90075bc1e49a576146..1c159a6129b8d66e077a1a652f2ae83924c8d731 100644 GIT binary patch delta 67 zcmdmUl4;LLCN2g}{tpm1k)u56@mZ& delta 67 zcmdmUl4;LLCN>66eju30WuWJl!ocYU1E~xQ1)*sM42%p64D1Gs2_Tw70SRnOiC6*v D^D_-^ diff --git a/fpga/fpga_pm3_hf_15.bit b/fpga/fpga_pm3_hf_15.bit index f6ee54ecba5cfdde0c58b585fe0e5d6214cf0be3..055615e712c43a20698267dbd42fbe529c388fd4 100644 GIT binary patch delta 64 zcmdmgl4<`*CN2g}{tpm1k66eju30WvuO%!ocYU1E~xQ1)*sM42%p64D1Gs35*O1NMK`1^b!Ep CsSR)d diff --git a/fpga/fpga_pm3_lf.bit b/fpga/fpga_pm3_lf.bit index 862b3148e58c107427150588d7e2960149acc3c5..79485cac164a31399ca0a04e2ff485f67b97ddf7 100644 GIT binary patch delta 67 zcmdmUl4;LLCN2g}{tpm1k)u56@mZ& delta 67 zcmdmUl4;LLCN>66eju30WuWJl!ocYU1E~xQ1)*sM42%p64D1Gs2_Tw70SRnOiC6*v D^D_-^ diff --git a/fpga/strip_date_time_from_binary.py b/fpga/strip_date_time_from_binary.py index 12e34c9dd..cc469ca72 100644 --- a/fpga/strip_date_time_from_binary.py +++ b/fpga/strip_date_time_from_binary.py @@ -15,20 +15,20 @@ def parse_and_split_file(filename): with open(filename, 'rb') as f: # Read as binary to handle non-text files data = f.read(100) # Read first 100 bytes which should contain all information - decoded_data = list(data.decode(errors='ignore')) + decoded_data = bytearray(data) for i in range(len(decoded_data) - 3): # subsequent two bytes after marker are null and the length - next_byte = ord(decoded_data[i+1]) - data_length = ord(decoded_data[i+2]) + next_byte = decoded_data[i+1] + data_length = decoded_data[i+2] - 1 # Don't overwrite terminating char - if decoded_data[i] == split_chars[0] and next_byte == 0x0: + if decoded_data[i] == ord(split_chars[0]) and next_byte == 0x0: start = i+3 - extracted_data.append(''.join(decoded_data[start:start+data_length])) + extracted_data.append(decoded_data[start:start+data_length]) # time, date if split_chars[0] == 'c' or split_chars[0] == 'd': - decoded_data[start:start+data_length] = 'F' * data_length + decoded_data[start:start+data_length] = bytes('F', encoding='ascii') * data_length split_chars.pop(0) @@ -36,7 +36,6 @@ def parse_and_split_file(filename): break print("Extracted data from bitfile: {}".format(extracted_data)) - decoded_data = ''.join(decoded_data).encode() with open(filename, 'r+b') as f: # Write back modified bytes f.seek(0) diff --git a/tools/fpga_compress/fpga_compress.c b/tools/fpga_compress/fpga_compress.c index a623b0b32..a24b035df 100644 --- a/tools/fpga_compress/fpga_compress.c +++ b/tools/fpga_compress/fpga_compress.c @@ -23,6 +23,8 @@ #include "fpga.h" #include "lz4hc.h" +int fileno(FILE *); + #ifndef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) #endif @@ -356,6 +358,8 @@ static int FpgaGatherVersion(FILE *infile, char *infile_name, char *dst, int len for (uint16_t i = 0; i < FPGA_BITSTREAM_FIXED_HEADER_SIZE; i++) { if (fgetc(infile) != bitparse_fixed_header[i]) { fprintf(stderr, "Invalid FPGA file. Aborting...\n\n"); + fprintf(stderr, "File: %s\n", infile_name); + return (EXIT_FAILURE); } }