Skip to content

Commit

Permalink
Merge branch 'main' into onewire_update_fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stnolting authored Dec 3, 2024
2 parents 4525d7d + 66a702d commit f929000
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/datasheet/software.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,12 @@ USER_FLAGS += -Wl,--defsym,__neorv32_ram_size=8k
# Adjust maximum heap size
USER_FLAGS += -Wl,--defsym,__neorv32_heap_size=1k
# Reduce library footprint when no UART is synthesized
#USER_FLAGS += -DUART_DISABLED
# Enable link-time-optimization
#USER_FLAGS += -flto
# Additional compiler flags (append to this variable)
#USER_FLAGS += ...
Expand Down
25 changes: 25 additions & 0 deletions sw/lib/source/neorv32_uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,29 @@
#include <stdarg.h>
#include <ctype.h>

// Drastically reduces the footprint, when knowing that uart is not synthesized anyway.
#ifdef UART_DISABLED
int neorv32_uart_available(neorv32_uart_t *UARTx) { return 0; }
int neorv32_uart_get_rx_fifo_depth(neorv32_uart_t *UARTx) { return 0; }
int neorv32_uart_get_tx_fifo_depth(neorv32_uart_t *UARTx) { return 0; }
void neorv32_uart_setup(neorv32_uart_t *UARTx, uint32_t baudrate, uint32_t irq_mask) {}
void neorv32_uart_enable(neorv32_uart_t *UARTx) {}
void neorv32_uart_disable(neorv32_uart_t *UARTx) {}
void neorv32_uart_rtscts_enable(neorv32_uart_t *UARTx) {}
void neorv32_uart_rtscts_disable(neorv32_uart_t *UARTx) {}
void neorv32_uart_putc(neorv32_uart_t *UARTx, char c) {}
void neorv32_uart_rx_clear(neorv32_uart_t *UARTx) {}
void neorv32_uart_tx_clear(neorv32_uart_t *UARTx) {}
int neorv32_uart_tx_busy(neorv32_uart_t *UARTx) { return 0; }
char neorv32_uart_getc(neorv32_uart_t *UARTx) {return 0; }
int neorv32_uart_char_received(neorv32_uart_t *UARTx) { return 0; }
char neorv32_uart_char_received_get(neorv32_uart_t *UARTx) { return 0; }
void neorv32_uart_puts(neorv32_uart_t *UARTx, const char *s) {}
void neorv32_uart_vprintf(neorv32_uart_t *UARTx, const char *format, va_list args) {}
void neorv32_uart_printf(neorv32_uart_t *UARTx, const char *format, ...) {}
int neorv32_uart_scan(neorv32_uart_t *UARTx, char *buffer, int max_size, int echo) { return 0; }
#else


/**********************************************************************//**
* Check if UART unit was synthesized.
Expand Down Expand Up @@ -433,3 +456,5 @@ int neorv32_uart_scan(neorv32_uart_t *UARTx, char *buffer, int max_size, int ech

return length;
}

#endif //UART_DISABLED

0 comments on commit f929000

Please sign in to comment.