Skip to content

Commit 44b669b

Browse files
committed
removed xc3sprog
1 parent 215bc60 commit 44b669b

27 files changed

+2372
-210
lines changed

install

+6-16
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,20 @@ echo -e '-------------------------------------------'
99
sudo apt -y update
1010
sudo apt -y install build-essential libusb-dev libftdi-dev libgpiod-dev wiringpi git cmake
1111

12-
#install XC3SPROG
13-
echo -e '-----------------------'
14-
echo -e '\n INSTALLING XC3SPROG\n'
15-
echo -e '-----------------------'
16-
git clone https://github.com/matrix-io/xc3sprog
17-
mkdir xc3sprog/build
18-
cd xc3sprog/build
19-
cmake ..
20-
make
21-
sudo make install
22-
cd ../..
23-
2412
# make and install xenium-flash to bin
25-
echo -e '-----------------------------------------------'
26-
echo -e '\n BUILDING AND INSTALLING XENIUM-FLASH TOOL\n'
27-
echo -e '-----------------------------------------------'
13+
echo -e '----------------------------------------------------------'
14+
echo -e '\n BUILDING AND INSTALLING XENIUM JTAG AND FLASH TOOLS\n'
15+
echo -e '----------------------------------------------------------'
2816
cd xenium-flash
2917
make
30-
cp bin/xenium-flash /usr/local/bin
18+
sudo cp bin/xenium-jtag /usr/local/bin
19+
sudo cp bin/xenium-flash /usr/local/bin
3120
cd ..
3221

3322
chmod +x xenium-programmer
3423

3524
echo -e '\n** INSTALL COMPLETE **\n'
3625

26+
echo -e '\nTo program your Xenium, just run:\n\t ./xenium-programmer xenium-bin/xenium_blue.bin \n'
3727

3828

xenium-flash/Makefile

+32-10
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,36 @@
1-
APP=xenium-flash
1+
APP_FLASH=xenium-flash
2+
APP_JTAG=xenium-jtag
23
SRC_MAIN=src
34
OUT_DIR=bin
45

6+
#extras
7+
FLASH=$(SRC_MAIN)/flash
8+
JTAG=$(SRC_MAIN)/jtag
9+
510
#G++ options (-g = debug)
611
CXX=g++
712
CFLAGS=-g -Wall -ansi
813
CPP_STD=c++17
914

1015
#extra include paths
11-
I1=
12-
I2=
13-
I3=
16+
I1=$(SRC_MAIN)
17+
I2=$(FLASH)
18+
I3=$(JTAG)
1419
I4=
1520
#include folders
1621
INC=$(I1) $(I2) $(I3) $(I4)
1722
INCLUDES=$(foreach d, $(INC), -I$d)
1823

1924
#additional sources files (add extras if needed)
20-
S1= $(SRC_MAIN)/BitBus.cpp
21-
S2= $(SRC_MAIN)/Flash.cpp
25+
S1= $(FLASH)/BitBus.cpp
26+
S2= $(FLASH)/Flash.cpp
2227
S3=
23-
S4=
24-
SOURCES=$(S1) $(S2) $(S3) $(S4)
28+
S4=$(JTAG)/IOBase.cpp
29+
S5=$(JTAG)/IOWiringPi.cpp
30+
S6=$(JTAG)/Jtag.cpp
31+
S7=$(JTAG)/JedecFile.cpp
32+
S8=$(JTAG)/ProgAlgXC95X.cpp
33+
SOURCES=$(S1) $(S2) $(S3) $(S4) $(S5) $(S6) $(S7) $(S8)
2534

2635
#lib paths (add extras if needed)
2736
LP1=
@@ -51,10 +60,23 @@ PKG_LIBS=$(shell pkg-config --libs $(PKGS))
5160
endif
5261

5362
#compile (-g = debug mode)
54-
$(APP): $(SRC_MAIN)/$(APP).cpp
63+
64+
MAKE_FLASH = $(CXX) $(CFLAGS) -std=$(CPP_STD) $(SRC_MAIN)/$(APP_FLASH).cpp $(SOURCES) -o $(OUT_DIR)/$(APP_FLASH) $(INCLUDES) $(PKG_INCS) $(LIB_PATHS) $(LIBS) $(PKG_LIBS)
65+
MAKE_JTAG = $(CXX) $(CFLAGS) -std=$(CPP_STD) $(SRC_MAIN)/$(APP_JTAG).cpp $(SOURCES) -o $(OUT_DIR)/$(APP_JTAG) $(INCLUDES) $(PKG_INCS) $(LIB_PATHS) $(LIBS) $(PKG_LIBS)
66+
67+
all:
5568
test -d bin || mkdir -p bin
56-
$(CXX) $(CFLAGS) -std=$(CPP_STD) $(SRC_MAIN)/$(APP).cpp $(SOURCES) -o $(OUT_DIR)/$(APP) $(INCLUDES) $(PKG_INCS) $(LIB_PATHS) $(LIBS) $(PKG_LIBS)
69+
$(MAKE_JTAG)
70+
$(MAKE_FLASH)
5771

72+
$(APP_FLASH): $(SRC_MAIN)/$(APP_FLASH).cpp
73+
test -d bin || mkdir -p bin
74+
$(MAKE_FLASH)
75+
76+
$(APP_JTAG): $(SRC_MAIN)/$(APP_JTAG).cpp
77+
test -d bin || mkdir -p bin
78+
$(MAKE_JTAG)
79+
5880
clean:
5981
rm bin -fr
6082

xenium-flash/bin/xenium-flash

388 KB
Binary file not shown.

xenium-flash/bin/xenium-jtag

393 KB
Binary file not shown.

xenium-flash/src/PiPinMap.h

-32
This file was deleted.

xenium-flash/src/XeniumDefines.h

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* #defines for Xenium JTAG and FLASH GPIO pinouts
2+
3+
Copyright (C) 2019-2020 Koos du Preez ([email protected])
4+
5+
This program is free software; you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation; either version 2 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program; if not, write to the Free Software
17+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18+
*/
19+
20+
// JTAG Pins
21+
#define XENIUM_TMS 4
22+
#define XENIUM_TCK 17
23+
#define XENIUM_TDI 22
24+
#define XENIUM_TDO 27
25+
26+
// BitBus pins connected to LPC Header
27+
// BITBUS D0 => LPC LAD0
28+
#define BITBUS_D0 16
29+
// BITBUS D1 => LPC LAD1
30+
#define BITBUS_D1 21
31+
// BITBUS D2 => LPC LAD2
32+
#define BITBUS_D2 18
33+
// BITBUS D3 => LPC LAD3
34+
#define BITBUS_D3 20
35+
// BITBUS CLK => LPC LCLK
36+
#define BITBUS_CLK 24
37+
// BITBUS DIR => LPC RST
38+
#define BITBUS_DIR 23
39+

xenium-flash/src/BitBus.cpp xenium-flash/src/flash/BitBus.cpp

+1-15
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,7 @@
55

66
#include "wiringPi.h"
77

8-
#include "PiPinMap.h"
9-
10-
//BitBus pins connected to LPC Header
11-
// BITBUS D0 => LPC LAD0
12-
#define BITBUS_D0 GPIO_16
13-
// BITBUS D1 => LPC LAD1
14-
#define BITBUS_D1 GPIO_21
15-
// BITBUS D2 => LPC LAD2
16-
#define BITBUS_D2 GPIO_18
17-
// BITBUS D3 => LPC LAD3
18-
#define BITBUS_D3 GPIO_20
19-
// BITBUS CLK => LPC LCLK
20-
#define BITBUS_CLK GPIO_24
21-
// BITBUS DIR => LPC RST
22-
#define BITBUS_DIR GPIO_23
8+
#include "XeniumDefines.h"
239

2410
namespace XK
2511
{
File renamed without changes.
File renamed without changes.
File renamed without changes.

xenium-flash/src/jtag/IOBase.cpp

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/* JTAG low level functions and base class for cables
2+
3+
Copyright (C) 2004 Andrew Rogers
4+
Copyright (C) 2005-2013 Uwe Bonnes [email protected]
5+
Copyright (C) 2019-2020 Koos du Preez ([email protected])
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; either version 2 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program; if not, write to the Free Software
19+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+
21+
Changes:
22+
Koos du Preez [[email protected]] Jan 1 2019
23+
Removed everything not needed for Raspberry PI and Xilinx xc9572xl
24+
*/
25+
26+
#include "IOBase.h"
27+
28+
#include <unistd.h>
29+
#include <stdio.h>
30+
#include <string.h>
31+
32+
using namespace std;
33+
IOBase::IOBase()
34+
{
35+
verbose = false;
36+
memset( ones,0xff,CHUNK_SIZE);
37+
memset(zeros, 0,CHUNK_SIZE);
38+
memset(tms_buf, 0,CHUNK_SIZE);
39+
tms_len = 0;
40+
}
41+
42+
void IOBase::flush_tms(int force)
43+
{
44+
if (tms_len)
45+
tx_tms(tms_buf, tms_len, force);
46+
memset(tms_buf, 0,CHUNK_SIZE);
47+
tms_len = 0;
48+
}
49+
50+
void IOBase::set_tms(bool val)
51+
{
52+
if( tms_len + 1 > CHUNK_SIZE*8)
53+
flush_tms(false);
54+
if(val)
55+
tms_buf[tms_len/8] |= (1 <<(tms_len &0x7));
56+
tms_len++;
57+
}
58+
59+
void IOBase::shiftTDITDO(const unsigned char *tdi, unsigned char *tdo,
60+
int length, bool last)
61+
{
62+
if(length==0) return;
63+
flush_tms(false);
64+
txrx_block(tdi, tdo, length,last);
65+
return;
66+
}
67+
68+
void IOBase::shiftTDI(const unsigned char *tdi, int length, bool last)
69+
{
70+
shiftTDITDO(tdi, NULL, length,last);
71+
}
72+
73+
// TDI gets a load of zeros, we just record TDO.
74+
void IOBase::shiftTDO(unsigned char *tdo, int length, bool last)
75+
{
76+
shiftTDITDO(NULL, tdo, length,last);
77+
}
78+
79+
// TDI gets a load of zeros or ones, and we ignore TDO
80+
void IOBase::shift(bool tdi, int length, bool last)
81+
{
82+
int len = length;
83+
unsigned char *block = (tdi)?ones:zeros;
84+
flush_tms(false);
85+
while (len > CHUNK_SIZE*8)
86+
{
87+
txrx_block(block, NULL, CHUNK_SIZE*8, false);
88+
len -= (CHUNK_SIZE*8);
89+
}
90+
shiftTDITDO(block, NULL, len, last);
91+
}
92+
93+
94+
void IOBase::Usleep(unsigned int usec)
95+
{
96+
flush_tms(false);
97+
flush();
98+
99+
usleep(usec);
100+
}
101+

xenium-flash/src/jtag/IOBase.h

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/* JTAG low level functions and base class for cables
2+
3+
Copyright (C) 2004 Andrew Rogers
4+
Copyright (C) 2005-2013 Uwe Bonnes [email protected]
5+
Copyright (C) 2019-2020 Koos du Preez ([email protected])
6+
7+
This program is free software; you can redistribute it and/or modify
8+
it under the terms of the GNU General Public License as published by
9+
the Free Software Foundation; either version 2 of the License, or
10+
(at your option) any later version.
11+
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
17+
You should have received a copy of the GNU General Public License
18+
along with this program; if not, write to the Free Software
19+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20+
21+
Changes:
22+
Koos du Preez [[email protected]] Jan 1 2019
23+
Removed everything not needed for Raspberry PI and Xilinx xc9572xl
24+
Renamed files to match class names - a pet peeve of mine :)
25+
*/
26+
27+
#ifndef IOBASE_H
28+
#define IOBASE_H
29+
30+
#define BLOCK_SIZE 65536
31+
#define CHUNK_SIZE 128
32+
#define TICK_COUNT 2048
33+
34+
#include <sys/time.h>
35+
36+
class IOBase
37+
{
38+
39+
protected:
40+
bool verbose;
41+
unsigned char ones[CHUNK_SIZE], zeros[CHUNK_SIZE];
42+
unsigned char tms_buf[CHUNK_SIZE];
43+
unsigned int tms_len; /* in Bits*/
44+
45+
protected:
46+
IOBase();
47+
public:
48+
virtual ~IOBase() {}
49+
50+
public:
51+
virtual void flush() {}
52+
virtual void Usleep(unsigned int usec);
53+
54+
public:
55+
void setVerbose(bool v) { verbose = v; }
56+
void shiftTDITDO(const unsigned char *tdi, unsigned char *tdo, int length, bool last=true);
57+
void shiftTDI(const unsigned char *tdi, int length, bool last=true);
58+
void shiftTDO(unsigned char *tdo, int length, bool last=true);
59+
void shift(bool tdi, int length, bool last=true);
60+
void set_tms(bool value);
61+
void flush_tms(int force);
62+
63+
protected:
64+
virtual void txrx_block(const unsigned char *tdi, unsigned char *tdo, int length, bool last)=0;
65+
virtual void tx_tms(unsigned char *pat, int length, int force)=0;
66+
virtual void settype(int subtype) {}
67+
68+
private:
69+
void nextTapState(bool tms);
70+
};
71+
#endif // IOBASE_H

0 commit comments

Comments
 (0)