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

[esp32c3] build error when primary console is JTAG (IDFGH-9327) #10707

Closed
3 tasks done
chegewara opened this issue Feb 6, 2023 · 11 comments
Closed
3 tasks done

[esp32c3] build error when primary console is JTAG (IDFGH-9327) #10707

chegewara opened this issue Feb 6, 2023 · 11 comments
Assignees
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF

Comments

@chegewara
Copy link
Contributor

chegewara commented Feb 6, 2023

Answers checklist.

  • I have read the documentation ESP-IDF Programming Guide and the issue is not addressed there.
  • I have updated my IDF branch (master or release) to the latest version and checked that the issue is present there.
  • I have searched the issue tracker for a similar issue and not found a similar issue.

IDF version.

d29e53d
EDIT: the same situation with v4.4.3

Operating System used.

Linux

How did you build your project?

Command line with idf.py

If you are using Windows, please specify command line type.

None

What is the expected behavior?

Build success.

What is the actual behavior?

Build fail.

Steps to reproduce.

Build with example wifi/ftm with menuconfig option:

Channel for console output (USB Serial/JTAG Controller)

Build or installation Logs.

/media/chegewara/upwork/esp/master/components/console/esp_console.h:91:18: error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared (first use in this function); did you mean 'CONFIG_ESP_CONSOLE_UART_NUM'?
   91 |     .baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE

PS when i "fix" esp-idf and i can build and flash, then console over JTAG/CDC is crazy, but im not sure if its problem with my board or with esp-idf, since i have only 1 C3 i can test with (M5 stamp - Chip is ESP32-C3 (revision 3))

Thanks

@chegewara chegewara added the Type: Bug bugs in IDF label Feb 6, 2023
@espressif-bot espressif-bot added the Status: Opened Issue is new label Feb 6, 2023
@github-actions github-actions bot changed the title [esp32c3] build error when primary console is JTAG [esp32c3] build error when primary console is JTAG (IDFGH-9327) Feb 6, 2023
@deepaknairrpf
Copy link

I am facing the same issue on my Adafruit Feather esp32 s2 device. When I change the "channel for console output" to USB CDC, I get the above mentioned build error. With UART, I don't get the ftm> console.

Is there any known hardware on which I can successfully run this example to calculate distances between two devices?

As I'm a complete beginner trying to understand WiFi FTM, any help is highly appreciated.

Thanks

@deepaknairrpf
Copy link

My bad.
I was able to change the code in main to use the esp_console_dev_usb_cdc_config_t data-type and the esp_console_new_repl_usb_cdc function. I'm able to now run the FTM code on esp32-s2 target.

@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development Status: In Progress Work is in progress and removed Status: Opened Issue is new Status: Selected for Development Issue is selected for development labels Apr 13, 2023
@SoucheSouche
Copy link
Collaborator

Hi @chegewara, I just fixed the issue in esp_console.h. Thanks for reporting it :)

Also, I see that the example wifi/ftm has been written to work only when CONFIG_CONSOLE_UART_DEFAULT is enabled. I updated the example to be able to run it with CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG or CONFIG_ESP_CONSOLE_USB_CDC as well.

@espressif-bot espressif-bot added Status: Done Issue is done internally Resolution: NA Issue resolution is unavailable and removed Status: In Progress Work is in progress labels May 4, 2023
@Massimiliano-solutiontech
Copy link

Massimiliano-solutiontech commented Sep 27, 2023

Hi,
I'm facing the same issue using ESP-IDF v5.1.1 on a ESP32-C6

esp-idf/components/esp_hw_support/sleep_modes.c:153:61: error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared (first use in this function); did you mean 'CONFIG_ESP_CONSOLE_UART_NUM'?
  153 | #define UART_FLUSH_US_PER_CHAR              (10*1000*1000 / CONFIG_ESP_CONSOLE_UART_BAUDRATE)

@baylf2000
Copy link

Hi, I'm facing the same issue using ESP-IDF v5.1.1 on a ESP32-C6

esp-idf/components/esp_hw_support/sleep_modes.c:153:61: error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared (first use in this function); did you mean 'CONFIG_ESP_CONSOLE_UART_NUM'?
  153 | #define UART_FLUSH_US_PER_CHAR              (10*1000*1000 / CONFIG_ESP_CONSOLE_UART_BAUDRATE)

Also facing this same issue with V5.1.1 and an ESP32-C6.

@marciogranzotto
Copy link

marciogranzotto commented Oct 4, 2023

same issue on master (272b409) and ESP32-C6

esp-idf/components/esp_hw_support/sleep_modes.c:148:61: error: 'CONFIG_ESP_CONSOLE_UART_BAUDRATE' undeclared (first use in this function); did you mean 'CONFIG_ESP_CONSOLE_UART_NUM'?
  148 | #define UART_FLUSH_US_PER_CHAR              (10*1000*1000 / CONFIG_ESP_CONSOLE_UART_BAUDRATE)
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marciorodrigues/Olibra/code/matter/esp-idf/components/esp_hw_support/sleep_modes.c:497:113: note: in expansion of macro 'UART_FLUSH_US_PER_CHAR'
  497 |             (sleep_duration < (int64_t)((UART_LL_FIFO_DEF_LEN - uart_ll_get_txfifo_len(CONSOLE_UART_DEV) + 1) * UART_FLUSH_US_PER_CHAR) + SLEEP_UART_FLUSH_DONE_TO_SLEEP_US)) {
      |                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~
/Users/marciorodrigues/Olibra/code/matter/esp-idf/components/esp_hw_support/sleep_modes.c:148:61: note: each undeclared identifier is reported only once for each function it appears in
  148 | #define UART_FLUSH_US_PER_CHAR              (10*1000*1000 / CONFIG_ESP_CONSOLE_UART_BAUDRATE)
      |                                                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/marciorodrigues/Olibra/code/matter/esp-idf/components/esp_hw_support/sleep_modes.c:497:113: note: in expansion of macro 'UART_FLUSH_US_PER_CHAR'
  497 |             (sleep_duration < (int64_t)((UART_LL_FIFO_DEF_LEN - uart_ll_get_txfifo_len(CONSOLE_UART_DEV) + 1) * UART_FLUSH_US_PER_CHAR) + SLEEP_UART_FLUSH_DONE_TO_SLEEP_US)) {
      |                                                                                                                 ^~~~~~~~~~~~~~~~~~~~~~
[0/1] Re-running CMake...

@KonstantinKondrashov
Copy link
Collaborator

Hi @baylf2000 @Massimiliano-solutiontech @marciogranzotto!
Yes, I confirm that there is a build issue happening on V5.1 and master branches for ESP32-C6.

There is a fix already in this commit 8545f85, but it has not been released to GitHub yet. This commit closes #11924 issue. I give the changes that fix this issue here. Backport for 5.1 will be done too.

--- a/components/esp_hw_support/sleep_modes.c
+++ b/components/esp_hw_support/sleep_modes.c
@@ -488,12 +488,12 @@ FORCE_INLINE_ATTR void resume_uarts(void)
 FORCE_INLINE_ATTR bool light_sleep_uart_prepare(uint32_t pd_flags, int64_t sleep_duration)
 {
     bool should_skip_sleep = false;
-#if !SOC_PM_SUPPORT_TOP_PD
+#if !SOC_PM_SUPPORT_TOP_PD || !CONFIG_ESP_CONSOLE_UART
     suspend_uarts();
 #else
     if (pd_flags & PMU_SLEEP_PD_TOP) {
         if ((s_config.wakeup_triggers & RTC_TIMER_TRIG_EN) &&
             // +1 is for cover the last charactor flush time
             (sleep_duration < (int64_t)((UART_LL_FIFO_DEF_LEN - uart_ll_get_txfifo_len(CONSOLE_UART_DEV) + 1) * UART_FLUSH_US_PER_CHAR) + SLEEP_UART_FLUSH_DONE_TO_SLEEP_US)) {

@marciogranzotto
Copy link

@KonstantinKondrashov I think that it's already merged on master, but not on release/v5.1. Can you check that?

@igrr
Copy link
Member

igrr commented Dec 6, 2023

This is now fixed on release/v5.1 as well, along with re-enabling of console examples: a803c84

@jeroen79
Copy link

jeroen79 commented Jan 9, 2024

Has anybody tested this with the ot_rcp example?, if if apply this fix to 5.1.2 and configure ot_rcp to use USB uart it build, but it goes into a reboot loop:

I (199) boot: Disabling RNG early entropy source...
ESP-ROM:esp32c6-20220919
Build:Sep 19 2022
rst:0xc (SW_CPU),boot:0xc (SPI_FAST_FLASH_BOOT)
Saved PC:0x4001975a
0x4001975a: software_reset_cpu in ROM

SPIWP:0xee
mode:DIO, clock div:2
load:0x4086c410,len:0xcb4
load:0x4086e610,len:0x29b8
load:0x40875728,len:0x1318
entry 0x4086c410
I (26) boot: ESP-IDF v5.1.2-dirty 2nd stage bootloader

@cwbyun
Copy link

cwbyun commented May 22, 2024

Hi,
I'm facing the same issue using ESP-IDF v5.2.1 on a ESP32-C6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Resolution: NA Issue resolution is unavailable Status: Done Issue is done internally Type: Bug bugs in IDF
Projects
None yet
Development

No branches or pull requests