esp8266: Add configuration option for redirecting the built-in OS output
This commit is contained in:
parent
40c6d57804
commit
1c132c8587
@ -22,12 +22,15 @@ INC += -I../lib/timeutils
|
||||
INC += -I$(BUILD)
|
||||
INC += -I$(ESP_SDK)/include
|
||||
|
||||
UART_OS = 1
|
||||
|
||||
CFLAGS_XTENSA = -fsingle-precision-constant -Wdouble-promotion \
|
||||
-D__ets__ -DICACHE_FLASH \
|
||||
-fno-inline-functions \
|
||||
-Wl,-EL -mlongcalls -mtext-section-literals \
|
||||
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -nostdlib $(CFLAGS_XTENSA) $(COPT)
|
||||
CFLAGS = $(INC) -Wall -Wpointer-arith -Werror -ansi -std=gnu99 -nostdlib -DUART_OS=$(UART_OS) \
|
||||
$(CFLAGS_XTENSA) $(COPT)
|
||||
|
||||
LDFLAGS = -nostdlib -T esp8266.ld -Map=$(@:.elf=.map) --cref
|
||||
LIBS = -L$(ESP_SDK)/lib -lmain -ljson -llwip -lpp -lnet80211 -lwpa -lphy -lnet80211
|
||||
@ -85,16 +88,18 @@ OBJ += $(addprefix $(BUILD)/, $(LIB_SRC_C:.c=.o))
|
||||
|
||||
all: $(BUILD)/firmware-combined.bin
|
||||
|
||||
SCRIPTDIR_FILE = $(BUILD)/scriptdir
|
||||
CONFVARS_FILE = $(BUILD)/confvars
|
||||
|
||||
ifeq ($(wildcard $(SCRIPTDIR_FILE)),)
|
||||
ifeq ($(wildcard $(CONFVARS_FILE)),)
|
||||
$(shell $(MKDIR) -p $(BUILD))
|
||||
$(shell echo $(SCRIPTDIR) > $(SCRIPTDIR_FILE))
|
||||
else ifneq ($(shell cat $(SCRIPTDIR_FILE)), $(SCRIPTDIR))
|
||||
$(shell echo $(SCRIPTDIR) > $(SCRIPTDIR_FILE))
|
||||
$(shell echo $(SCRIPTDIR) $(UART_OS) > $(CONFVARS_FILE))
|
||||
else ifneq ($(shell cat $(CONFVARS_FILE)), $(SCRIPTDIR) $(UART_OS))
|
||||
$(shell echo $(SCRIPTDIR) $(UART_OS) > $(CONFVARS_FILE))
|
||||
endif
|
||||
|
||||
$(BUILD)/frozen.c: $(wildcard $(SCRIPTDIR)/*) $(SCRIPTDIR_FILE)
|
||||
$(BUILD)/uart.o: $(CONFVARS_FILE)
|
||||
|
||||
$(BUILD)/frozen.c: $(wildcard $(SCRIPTDIR)/*) $(CONFVARS_FILE)
|
||||
$(ECHO) "Generating $@"
|
||||
$(Q)$(MAKE_FROZEN) $(SCRIPTDIR) > $@
|
||||
|
||||
|
@ -112,13 +112,13 @@ void uart_tx_one_char(uint8 uart, uint8 TxChar) {
|
||||
* Returns : NONE
|
||||
*******************************************************************************/
|
||||
static void ICACHE_FLASH_ATTR
|
||||
uart1_write_char(char c) {
|
||||
uart_os_write_char(char c) {
|
||||
if (c == '\n') {
|
||||
uart_tx_one_char(UART1, '\r');
|
||||
uart_tx_one_char(UART1, '\n');
|
||||
uart_tx_one_char(UART_OS, '\r');
|
||||
uart_tx_one_char(UART_OS, '\n');
|
||||
} else if (c == '\r') {
|
||||
} else {
|
||||
uart_tx_one_char(UART1, c);
|
||||
uart_tx_one_char(UART_OS, c);
|
||||
}
|
||||
}
|
||||
|
||||
@ -191,7 +191,7 @@ void ICACHE_FLASH_ATTR uart_init(UartBautRate uart0_br, UartBautRate uart1_br) {
|
||||
ETS_UART_INTR_ENABLE();
|
||||
|
||||
// install uart1 putc callback
|
||||
os_install_putc1((void *)uart1_write_char);
|
||||
os_install_putc1((void *)uart_os_write_char);
|
||||
}
|
||||
|
||||
void ICACHE_FLASH_ATTR uart_reattach() {
|
||||
|
Loading…
Reference in New Issue
Block a user