diff --git a/CMakeLists.txt b/CMakeLists.txt index 5a3a291..bcffc80 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.13) # Project Name -project(freeRTOS C CXX ASM) +project(romeo-obsw C CXX ASM) # ############################################################################## @@ -30,7 +30,12 @@ set (LWIP_DIR contrib/lwip) # Configuration # ############################################################################## +set(ZYNQ_UART UART1 CACHE STRING "Which PS UART to use for stdout") +set_property(CACHE ZYNQ_UART PROPERTY STRINGS UART0 UART1) +if(${ZYNQ_UART} STREQUAL UART0) + add_compile_definitions(ZYNQ_USE_UART0) +endif() # ############################################################################## diff --git a/bsp_z7/ps7_cortexa9_0/include/xparameters.h b/bsp_z7/ps7_cortexa9_0/include/xparameters.h index 8b0d2fa..485bbc9 100644 --- a/bsp_z7/ps7_cortexa9_0/include/xparameters.h +++ b/bsp_z7/ps7_cortexa9_0/include/xparameters.h @@ -23,9 +23,16 @@ #include "xparameters_ps.h" - +// Default is for Zedboard +#ifndef ZYNQ_USE_UART0 +#define STDIN_BASEADDRESS XPS_UART1_BASEADDR +#define STDIN_INT_NR XPAR_XUARTPS_1_INTR +#define STDOUT_BASEADDRESS XPS_UART1_BASEADDR +#else #define STDIN_BASEADDRESS XPS_UART0_BASEADDR +#define STDIN_INT_NR XPAR_XUARTPS_0_INTR #define STDOUT_BASEADDRESS XPS_UART0_BASEADDR +#endif /******************************************************************/ diff --git a/mission/testIp.c b/mission/testIp.c index bfcb02a..786918b 100644 --- a/mission/testIp.c +++ b/mission/testIp.c @@ -17,7 +17,7 @@ #define XUARTPS_IXR_RXOVR 0x00000020U /**< Rx Overrun error interrupt */ #define XUARTPS_IXR_RTRIG 0x00000001U /**< RX FIFO trigger interrupt. */ -#define UART_INT_NR XPAR_XUARTPS_0_INTR + // #include @@ -195,7 +195,7 @@ void testIp() { /* Install the UART Interrupt handler. */ BaseType_t xStatus = - XScuGic_Connect(&xInterruptController, UART_INT_NR, + XScuGic_Connect(&xInterruptController, STDIN_INT_NR, (Xil_ExceptionHandler)handleUARTInt, NULL); configASSERT(xStatus == XST_SUCCESS); (void)xStatus; /* Remove compiler warning if configASSERT() is not defined. */ @@ -215,7 +215,7 @@ void testIp() { XUartPs_WriteReg(STDIN_BASEADDRESS, XUARTPS_IDR_OFFSET, (~mask)); /* Enable the interrupt for the UART1 in the interrupt controller. */ - XScuGic_Enable(&xInterruptController, UART_INT_NR); + XScuGic_Enable(&xInterruptController, STDIN_INT_NR); // Start lwip task xTaskCreateStatic(