Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bootloader: fix build with CONFIG_CONSOLE_UART_NONE (GIT8266O-824) #1247

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

f00b4r0
Copy link

@f00b4r0 f00b4r0 commented Aug 9, 2023

Setting CONFIG_CONSOLE_UART_NONE would trigger the following error:

ESP8266_RTOS_SDK/components/bootloader_support/src/bootloader_init.c: In function 'uart_console_configure':
ESP8266_RTOS_SDK/components/bootloader_support/src/bootloader_init.c:628:80:
  error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared (first use in this function); did you mean 'CONFIG_ESP_CONSOLE_UART_NUM'?
     uart_div_modify(CONFIG_ESP_CONSOLE_UART_NUM, BOOTLOADER_CONSOLE_CLK_FREQ / CONFIG_ESP_CONSOLE_UART_BAUDRATE);
                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                CONFIG_ESP_CONSOLE_UART_NUM

This is because ESP8266_MODIFY_UART_BAUDRATE is unconditionally defined, even when CONFIG_CONSOLE_UART_NONE is set.

This commit fixes this.

Setting CONFIG_CONSOLE_UART_NONE would trigger the following error:

ESP8266_RTOS_SDK/components/bootloader_support/src/bootloader_init.c: In function 'uart_console_configure':
ESP8266_RTOS_SDK/components/bootloader_support/src/bootloader_init.c:628:80:
  error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared (first use in this function); did you mean 'CONFIG_ESP_CONSOLE_UART_NUM'?
     uart_div_modify(CONFIG_ESP_CONSOLE_UART_NUM, BOOTLOADER_CONSOLE_CLK_FREQ / CONFIG_ESP_CONSOLE_UART_BAUDRATE);
                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                                                CONFIG_ESP_CONSOLE_UART_NUM

This is because ESP8266_MODIFY_UART_BAUDRATE is unconditionally defined,
even when CONFIG_CONSOLE_UART_NONE is set. This commit fixes this.
@CLAassistant
Copy link

CLAassistant commented Aug 9, 2023

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot changed the title bootloader: fix build with CONFIG_CONSOLE_UART_NONE bootloader: fix build with CONFIG_CONSOLE_UART_NONE (GIT8266O-824) Aug 9, 2023
@f00b4r0
Copy link
Author

f00b4r0 commented Aug 9, 2023

FWIW even with CONFIG_CONSOLE_UART_NONE there's still output on UART0, probably related to the fact that components/esp_common/Kconfig defines ESP_CONSOLE_UART_NUM=0 when CONFIG_CONSOLE_UART_NONE is selected. Removing the symbol breaks build in gdbstub:

In file included from 
ESP8266_RTOS_SDK/components/esp8266/include/esp8266/uart_register.h:18,
                 from ESP8266_RTOS_SDK/components/esp_gdbstub/esp8266/gdbstub_esp8266.c:15:
ESP8266_RTOS_SDK/components/esp_gdbstub/esp8266/gdbstub_esp8266.c: In function 'esp_gdbstub_getchar':
ESP8266_RTOS_SDK/components/esp_gdbstub/esp8266/gdbstub_esp8266.c:20:18: error: 'CONFIG_ESP_CONSOLE_UART_NUM' undeclared (first use in this function); did you mean 'CONFIG_ESP_CONSOLE_UART_NONE'?
 #define UART_NUM CONFIG_ESP_CONSOLE_UART_NUM
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~

And that, even though GDB stub is not enabled:

grep GDB sdkconfig
# CONFIG_ESP_PANIC_GDBSTUB is not set

It seems completely disabling serial output isn't supported and would need more work; not sure if there's interest for this?

@Sonic-Amiga
Copy link

CONFIG_CONSOLE_UART_NONE there's still output on UART0

Could be output from wifi code using early boot-time console. I had to "plug" it with #1253

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants