Skip to content

Commit

Permalink
Try to fix board issues ZedBoard vs ZYBO
Browse files Browse the repository at this point in the history
  • Loading branch information
atraber committed Aug 21, 2016
1 parent 1419888 commit 3baeebd
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 4 deletions.
25 changes: 24 additions & 1 deletion fpga/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# FPGA

This folder contains everything needed to synthesize and run PULPino on a ZedBoard.
This folder contains everything needed to synthesize and run PULPino on a ZedBoard or ZYBO.

To select board for the ZYBO board instead of the ZedBoard, set the environment
variable `BOARD`. In the tcsh this means

setenv BOARD "zybo"

or

setenv BOARD "zedboard"

Note that if `BOARD` is not set, it defaults to zedboard.


This environment variable has to be set during compilation of all FPGA related
components. If you accidentally forget to set the environment variable during
part of the compilation process, you may end up with a mixed zedboard/zybo
build which will not work correctly.

The components that are affected by the BOARD variable are:
* pulpemu
* u-boot
* devicetree
* spiloader


## Requirements
Expand Down
12 changes: 9 additions & 3 deletions fpga/sw/apps/spiload/Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
CC=arm-xilinx-linux-gnueabi-gcc
CC = arm-xilinx-linux-gnueabi-gcc
CFLAGS =

ifeq ($(BOARD),zybo)
CFLAGS += -DZYBO
endif

all: spiload

spiload: main.c arg_parsing.c console_read.c
$(CC) -pthread -o $@ $^

$(CC) $(CFLAGS) -pthread -o $@ $^

push: spiload
scp ./spiload $(FPGA_HOSTNAME):/root/

clean:
@rm -f ./*.o spiload
7 changes: 7 additions & 0 deletions fpga/sw/apps/spiload/console_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,17 @@ void read_port()
int n;
char c;

#ifdef ZYBO
if ((fd = open("/dev/ttyPS1", O_RDONLY | O_NOCTTY) ) < 0) {
perror("open_port: Unable to open /dev/ttyPS0");
return;
}
#else
if ((fd = open("/dev/ttyPS0", O_RDONLY | O_NOCTTY) ) < 0) {
perror("open_port: Unable to open /dev/ttyPS0");
return;
}
#endif

// set baudrate
ioctl(fd, TCGETS2, &tio);
Expand Down

0 comments on commit 3baeebd

Please sign in to comment.