enjoy-digital / litepcie

Small footprint and configurable PCIe core
Other
451 stars 111 forks source link

Building userspace software without a crossover UART #40

Closed daveshah1 closed 3 years ago

daveshah1 commented 3 years ago

I found while working on the Alveo U250 that the user software build fails when a normal, non-crossover UART is used; as CSR_UART_BASE is defined but CSR_UART_XOVER_RXEMPTY_ADDR isn't:

gcc -c -O2 -Wall -g -I../kernel -MMD -o litepcie_util.o litepcie_util.c
litepcie_util.c: In function ‘uart_test’:
litepcie_util.c:458:33: error: CSR_UART_XOVER_RXEMPTY_ADDR’ undeclared (first use in this function); did you mean ‘CSR_UART_RXEMPTY_ADDR’?
  458 |         if ((litepcie_readl(fd, CSR_UART_XOVER_RXEMPTY_ADDR) & 0x1) == 0) {
      |                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                 CSR_UART_RXEMPTY_ADDR
litepcie_util.c:458:33: note: each undeclared identifier is reported only once for each function it appears in
litepcie_util.c:459:45: error: CSR_UART_XOVER_RXTX_ADDR’ undeclared (first use in this function); did you mean ‘CSR_UART_RXTX_ADDR’?
  459 |             printf("%c", litepcie_readl(fd, CSR_UART_XOVER_RXTX_ADDR) & 0xff);
      |                                             ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                             CSR_UART_RXTX_ADDR
make: *** [Makefile:20: litepcie_util.o] Error 1

I think the #ifdef needs to be changed to something more specific.

enjoy-digital commented 3 years ago

Thanks for reporting, fixed with https://github.com/enjoy-digital/litepcie/commit/00927a2f702aed4c3e99d5aa8a5cc0e058c6840b.