Toshaan Bharvani
1 year ago
commit
067a855e51
3 changed files with 227 additions and 0 deletions
@ -0,0 +1,148 @@
@@ -0,0 +1,148 @@
|
||||
diff -u a/bitfile.cpp b/bitfile.cpp |
||||
--- a/bitfile.cpp 2017-08-16 23:18:43.000000000 +1000 |
||||
+++ b/bitfile.cpp 2021-09-05 13:54:41.982983499 +1000 |
||||
@@ -96,7 +96,7 @@ |
||||
length = ftell(fp); /* Fix at end */ |
||||
fseek(fp, 0, SEEK_SET); |
||||
if(buffer) delete [] buffer; |
||||
- buffer= new byte[length]; |
||||
+ buffer= new ::byte[length]; |
||||
if (buffer == 0) |
||||
return 1; |
||||
fread(buffer,1, length, fp); |
||||
@@ -128,7 +128,7 @@ |
||||
length >>= 1; /* We read two Hex nibbles for each byte*/ |
||||
fseek(fp, 0, SEEK_SET); |
||||
if(buffer) delete [] buffer; |
||||
- buffer= new byte[length]; |
||||
+ buffer= new ::byte[length]; |
||||
|
||||
/* FIXME: generate a dummy header*/ |
||||
if (buffer == 0) |
||||
@@ -176,7 +176,7 @@ |
||||
/* FIXME: Fill in dtime and date from the input file */ |
||||
|
||||
if(buffer) delete [] buffer; |
||||
- buffer=new byte[length]; |
||||
+ buffer=new ::byte[length]; |
||||
while ((fgets(buf, 1024, fp)) != 0) |
||||
{ |
||||
uint32_t count; |
||||
@@ -333,13 +333,13 @@ |
||||
|
||||
void BitFile::processData(FILE *fp) |
||||
{ |
||||
- byte t[4]; |
||||
+ ::byte t[4]; |
||||
fread(t,1,4,fp); |
||||
length=(t[0]<<24)+(t[1]<<16)+(t[2]<<8)+t[3]; |
||||
if(buffer) delete [] buffer; |
||||
- buffer=new byte[length]; |
||||
+ buffer=new ::byte[length]; |
||||
for(unsigned int i=0; i<length&&!feof(fp); i++){ |
||||
- byte b; |
||||
+ ::byte b; |
||||
fread(&b,1,1,fp); |
||||
buffer[i]=bitRevTable[b]; // Reverse the bit order. |
||||
} |
||||
@@ -351,7 +351,7 @@ |
||||
|
||||
void BitFile::append(uint32_t val, unsigned cnt) { |
||||
size_t const nlen = length + 4*cnt; |
||||
- byte *const nbuf = new byte[nlen]; |
||||
+ ::byte *const nbuf = new ::byte[nlen]; |
||||
|
||||
// copy old part |
||||
for(size_t i = 0; i < length; i++) nbuf[i] = buffer[i]; |
||||
@@ -378,7 +378,7 @@ |
||||
stat(fname, &stats); |
||||
|
||||
size_t const nlen = length + stats.st_size; |
||||
- byte *const nbuf = new byte[nlen]; |
||||
+ ::byte *const nbuf = new ::byte[nlen]; |
||||
|
||||
// copy old part |
||||
for(size_t i = 0; i < length; i++) nbuf[i] = buffer[i]; |
||||
@@ -389,7 +389,7 @@ |
||||
for(size_t i = length; i < nlen; i++) { |
||||
if(feof(fp)) throw io_exception("Unexpected end of file"); |
||||
|
||||
- byte b; |
||||
+ ::byte b; |
||||
fread(&b, 1, 1, fp); |
||||
buffer[i] = bitRevTable[b]; // Reverse the bit order. |
||||
} |
||||
@@ -407,7 +407,7 @@ |
||||
{ |
||||
length = size/8 + ((size%8)?1:0); |
||||
if(buffer) delete [] buffer; |
||||
- buffer=new byte[length]; |
||||
+ buffer=new ::byte[length]; |
||||
memset(buffer, 0xff, length); |
||||
} |
||||
|
||||
@@ -529,7 +529,7 @@ |
||||
} |
||||
for(i=0; i<clip; i++) |
||||
{ |
||||
- byte b; |
||||
+ ::byte b; |
||||
if (style != STYLE_BPI) |
||||
b = bitRevTable[buffer[i]]; // Reverse bit order |
||||
else |
||||
@@ -540,7 +540,7 @@ |
||||
case STYLE_HEX: |
||||
for(i=0; i<clip; i++) |
||||
{ |
||||
- byte b=bitRevTable[buffer[i]]; // Reverse bit order |
||||
+ ::byte b=bitRevTable[buffer[i]]; // Reverse bit order |
||||
if ( i%16 == 0) |
||||
fprintf(fp,"%7d: ", i); |
||||
fprintf(fp,"%02x ", b); |
||||
@@ -553,7 +553,7 @@ |
||||
case STYLE_HEX_RAW: |
||||
for(i=0; i<clip; i++) |
||||
{ |
||||
- byte b=bitRevTable[buffer[i]]; // Reverse bit order |
||||
+ ::byte b=bitRevTable[buffer[i]]; // Reverse bit order |
||||
fprintf(fp,"%02x", b); |
||||
if ( i%4 == 3) |
||||
fprintf(fp,"\n"); |
||||
@@ -569,7 +569,7 @@ |
||||
int len = 0; |
||||
for(i=0; i<clip; i++) |
||||
{ |
||||
- byte b = buffer[i]; |
||||
+ ::byte b = buffer[i]; |
||||
if (style == STYLE_MCS) |
||||
b = bitRevTable[b]; |
||||
if (base != i>>16) |
||||
@@ -616,11 +616,11 @@ |
||||
|
||||
void BitFile::readField(string &field, FILE *fp) |
||||
{ |
||||
- byte t[2]; |
||||
+ ::byte t[2]; |
||||
fread(t,1,2,fp); |
||||
unsigned short len=(t[0]<<8)+t[1]; |
||||
for(int i=0; i<len; i++){ |
||||
- byte b; |
||||
+ ::byte b; |
||||
fread(&b,1,1,fp); |
||||
field+=(char)b; |
||||
} |
||||
|
||||
diff -u a/srecfile.cpp b/srecfile.cpp |
||||
--- a/srecfile.cpp 2017-08-16 23:18:43.000000000 +1000 |
||||
+++ b/srecfile.cpp 2021-09-05 13:56:28.075150711 +1000 |
||||
@@ -255,7 +255,7 @@ |
||||
if (bufsize == 0) |
||||
bufsize = 1024*1024; /* Defaule size if no size given*/ |
||||
|
||||
- buffer = (byte*)malloc(bufsize); |
||||
+ buffer = (::byte*)malloc(bufsize); |
||||
if(!buffer) |
||||
{ |
||||
fprintf(stderr, "Cannot allocate buffer\n"); |
||||
|
||||
Diff finished. Sun Sep 5 13:54:48 2021 |
@ -0,0 +1,11 @@
@@ -0,0 +1,11 @@
|
||||
--- a/CMakeLists.txt 2017-03-04 16:40:12.180902990 +1100 |
||||
+++ b/CMakeLists.txt 2017-03-04 16:39:07.544523347 +1100 |
||||
@@ -4,7 +4,7 @@ |
||||
set(xc3sprog_VERSION_MINOR 0) |
||||
|
||||
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}") |
||||
-set(CMAKE_CXX_FLAGS "-g -Wall") |
||||
+set(CMAKE_CXX_FLAGS "-g -Wall $ENV{CXXFLAGS}") |
||||
cmake_minimum_required(VERSION 2.6) |
||||
|
||||
find_package(PkgConfig REQUIRED) |
@ -0,0 +1,68 @@
@@ -0,0 +1,68 @@
|
||||
Name: xc3sprog |
||||
Version: 795 |
||||
Release: 3%{?dist} |
||||
Summary: A suite of utilities for programming Xilinx FPGAs, CPLDs and EEPROMs |
||||
|
||||
License: GPLv2 |
||||
URL: https://xc3sprog.sourceforge.net |
||||
Source0: https://sourceforge.net/code-snapshots/svn/x/xc/xc3sprog/code/xc3sprog-code-r%{version}-trunk.zip |
||||
Patch0: xc3sprog-cxx-environment.patch |
||||
Patch1: xc3sprog-ambiguous-byte.patch |
||||
|
||||
BuildRequires: /usr/bin/c++ |
||||
BuildRequires: cmake |
||||
BuildRequires: libftdi-devel |
||||
%if 0%{?fedora} >= 37 |
||||
BuildRequires: libusb-compat-0.1-devel |
||||
%else |
||||
BuildRequires: libusb-devel |
||||
%endif |
||||
|
||||
%description |
||||
xc3sprog is a suite of utilities for programming Xilinx FPGAs, CPLDs, and |
||||
EEPROMs with the Xilinx Parallel Cable and other JTAG adapters under Linux. |
||||
|
||||
|
||||
%prep |
||||
%autosetup -n %{name}-code-r%{version}-trunk |
||||
|
||||
|
||||
%build |
||||
%cmake |
||||
%cmake_build |
||||
|
||||
|
||||
%install |
||||
%cmake_install |
||||
|
||||
install -p -m 644 -D -t $RPM_BUILD_ROOT%{_datadir}/xc3sprog \ |
||||
cablelist.txt \ |
||||
devlist.txt |
||||
|
||||
install -p -m 644 -D -t $RPM_BUILD_ROOT%{_datadir}/xc3sprog/bscan_spi \ |
||||
bscan_spi/README.txt \ |
||||
bscan_spi/*.vhd \ |
||||
bscan_spi/*.v \ |
||||
bscan_spi/*.ucf \ |
||||
bscan_spi/*.bit |
||||
|
||||
install -p -m 644 -D -t $RPM_BUILD_ROOT%{_datadir}/xc3sprog/multiboot \ |
||||
multiboot/README \ |
||||
multiboot/*.bit \ |
||||
multiboot/*.hex |
||||
|
||||
|
||||
%files |
||||
%license COPYING LICENSE |
||||
%doc byte-order.txt Contributors PERFORMANCE README Readme.Cmake Readme.Darwin |
||||
%doc Readme.DLC10 Readme.JTAG_Timing README.Win32 ToDo |
||||
%dir %{_datadir}/xc3sprog |
||||
%{_bindir}/bitparse |
||||
%{_bindir}/detectchain |
||||
%{_bindir}/javr |
||||
%{_bindir}/jedecparse |
||||
%{_bindir}/readdna |
||||
%{_bindir}/srecparse |
||||
%{_bindir}/xc2c_warp |
||||
%{_bindir}/xc3sprog |
||||
%{_datadir}/xc3sprog |
Loading…
Reference in new issue