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

[Console] more secondary output choices (try 2) (IDFGH-8688) #10132

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

chipweinberger
Copy link
Contributor

@chipweinberger chipweinberger commented Nov 8, 2022

Update Sept 29, 2023 (1 year later): to explain the motivation of this PR to the best of my memory

Console & logging are very limiting. Supported outputs must be chosen at compile time instead of runtime

and esp-idf only supports uart primary w/ usb serial jtag secondary. that's very limiting

this PR makes all logging outputs first class citizens, and also manages to simplify code


In addition to USB Serial/JTAG, add UART and USB CDC as "Secondary Console" options to kConfig.

🥳🥳🥳🥳

original PR: #9979

Okay. @igrr Made some big changes to the diff. I combined the primary & secondary UART, like you suggested. It's a good change.

For clarity, I added internal KConfigs for when either primary or secondary is enabled, i.e. ESP_CONSOLE_IS_USB_CDC_ENABLED

I've tested:

  • building S2, all 6-ish permutations
  • building S3, all 14-ish permutations (CDC does not support dual core yet)
  • Running the Console Example for S2, UART, UART + CDC, (I don't have a USB port to test CDC alone)
  • Running the Console Example for S3, UART, Serial JTAG, UART + Serial JTAG, Serial JTAG + UART

It should be good to merge.

@espressif-bot espressif-bot added the Status: Opened Issue is new label Nov 8, 2022
@github-actions github-actions bot changed the title [Console] more secondary output choices (try 2) [Console] more secondary output choices (try 2) (IDFGH-8688) Nov 8, 2022
Copy link
Member

@igrr igrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment, and please check the pre-commit as well (docs), it is still failing.

#if CONFIG_ESP_CONSOLE_IS_USB_SERIAL_JTAG_ENABLED
bootloader_console_init_usb_serial_jtag();
#endif
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like here we may end up calling esp_rom_install_channel_putc (for redirecting ets_printf/esp_rom_printf) multiple times, and it will get redirected to the most recent destination. Is that the expected behavior?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which 2 functions both call esp_rom_install_channel_putc()?

To be honest, I'm not familiar with what "redirecting ets_printf" means.

Regardless, I only see thatbootloader_console_init_none() and bootloader_console_init_usb_cdc() call esp_rom_install_channel_putc(), but NONE is only true when the others are NOT enabled, so it is not a problem

@chipweinberger chipweinberger force-pushed the user/chip/more-secondary-console-choices-try-2 branch from 3b90fdb to 84be4db Compare November 8, 2022 10:11
@chipweinberger chipweinberger reopened this Nov 8, 2022
@chipweinberger
Copy link
Contributor Author

chipweinberger commented Nov 8, 2022

not having much luck with the precommit. lots of errors.

Edit: I'm failing locally but it worked on github?....

charlesweinberger@Chips-Macbook-Pro-2 esp-idf % tools/ci/check_executables.py --action list
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/ci/executable-list.txt:1 .gitlab/ci/dependencies/generate_rules.py not exists. Please remove it manually
Click me
# Please combine this with the original one
#
# Notes:
# - please keep in mind to avoid duplicated folders as yaml keys
# - please use parentheses to group conditions, the "or" and "and" operators could only accept two operands
components/esp_system/test_apps/rtc_8md256:
  enable:
    - if: IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32s2", "esp32s3"]
      temporary: true
      reason: <why only enable build jobs for these targets>
check_enable_build failed for app: (cmake) App components/esp_system/test_apps/rtc_8md256, target esp32, sdkconfig (default), build in /Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/components/esp_system/test_apps/rtc_8md256/build
--------------------------------------------------------------------------------
Modified README file: components/esp_system/test_apps/rtc_8md256/README.md
--------------------------------------------------------------------------------
components/esp_system/test_apps/rtc_power_modes:
- enable build targets according to the manifest file: ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']
- enable build targets according to the old Supported Targets table under readme "components/esp_system/test_apps/rtc_power_modes/README.md": ['esp32s3']

If you want to disable some targets, please use the following snippet:

# Please combine this with the original one
#
# Notes:
# - please keep in mind to avoid duplicated folders as yaml keys
# - please use parentheses to group conditions, the "or" and "and" operators could only accept two operands
components/esp_system/test_apps/rtc_power_modes:
  enable:
    - if: IDF_TARGET in ["esp32s3"]
      temporary: true
      reason: <why only enable build jobs for these targets>
check_enable_build failed for app: (cmake) App components/esp_system/test_apps/rtc_power_modes, target esp32, sdkconfig (default), build in /Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/components/esp_system/test_apps/rtc_power_modes/build
--------------------------------------------------------------------------------
Modified README file: components/esp_system/test_apps/rtc_power_modes/README.md
--------------------------------------------------------------------------------

sort .build-test-rules.yml files.............................................................................(no files to check)Skipped
File Contents Sorter.........................................................................................(no files to check)Skipped
Check copyright notices..........................................................................................................Passed
charlesweinberger@Chips-Macbook-Pro-2 esp-idf % git commit -m "[Console] more secondary output choices"
[WARNING] Unstaged files detected.
[INFO] Stashing unstaged files to /Users/charlesweinberger/.cache/pre-commit/patch1667903318-74132.
Trim Trailing Whitespace.........................................................................................................Passed
Fix End of Files.................................................................................................................Passed
Check that executables have shebangs.........................................................................(no files to check)Skipped
Mixed line ending................................................................................................................Passed
Fix double quoted strings....................................................................................(no files to check)Skipped
flake8.......................................................................................................(no files to check)Skipped
isort (python)...............................................................................................(no files to check)Skipped
Check File Permissions.......................................................................................(no files to check)Skipped
Validate executable-list.txt.....................................................................................................Failed
- hook id: check-executable-list
- exit code: 1

/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/tools/ci/executable-list.txt:1 .gitlab/ci/dependencies/generate_rules.py not exists. Please remove it manually

Validate Kconfig files...........................................................................................................Passed
Check if any Kconfig Options Deprecated......................................................................(no files to check)Skipped
Check CMake Files Format.........................................................................................................Passed
Validate Codeowner File..........................................................................................................Failed
- hook id: check-codeowners
- exit code: 1

Errors found!
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:56: no files matched by pattern /CONTRIBUTING.md
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:61: no files matched by pattern /conftest.py
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:64: no files matched by pattern /pytest.ini
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:73: no files matched by pattern /components/bootloader_support/bootloader_flash/
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:80: no files matched by pattern /components/esp_adc/
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:81: no files matched by pattern /components/esp_app_format/
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:97: no files matched by pattern /components/esp_psram/
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:107: no files matched by pattern /components/fatfs/**/*.py
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:111: no files matched by pattern /components/http_parser/
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:153: no files matched by pattern /docs/**/migration-guides/
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:176: no files matched by pattern /examples/zigbee/
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:199: no files matched by pattern /tools/test_build_system/
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:208: no files matched by pattern /tools/ci/check_copyright_config.yaml
/Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/.gitlab/CODEOWNERS:209: no files matched by pattern /tools/ci/check_copyright_ignore.txt

Check rules.yml all rules have at lease one job applied, all rules needed exist..............................(no files to check)Skipped
Check rules are generated (based on .gitlab/ci/dependencies/dependencies.yml)................................(no files to check)Skipped
Check type annotations in python files.......................................................................(no files to check)Skipped
Check requirement files......................................................................................(no files to check)Skipped
Check tools dir files patterns...............................................................................(no files to check)Skipped
Check soc caps kconfig files are generated (based on components/soc/IDF_TARGET/include/soc/soc_caps.h).......(no files to check)Skipped
Check if all apps readme files match given .build-test-rules.yml files. Modify the supported target tables.......................Failed
- hook id: check-all-apps-readmes
- exit code: 1
- files were modified by this hook

components/console/test_apps/console:
- enable build targets according to the manifest file: ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']
- enable build targets according to the old Supported Targets table under readme "components/console/test_apps/console/README.md": ['esp32', 'esp32c2', 'esp32c3', 'esp32c6', 'esp32s2', 'esp32s3']

If you want to disable some targets, please use the following snippet:

# Please combine this with the original one
#
# Notes:
# - please keep in mind to avoid duplicated folders as yaml keys
# - please use parentheses to group conditions, the "or" and "and" operators could only accept two operands
components/console/test_apps/console:
  enable:
    - if: IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32c6", "esp32s2", "esp32s3"]
      temporary: true
      reason: <why only enable build jobs for these targets>
check_enable_build failed for app: (cmake) App components/console/test_apps/console, target esp32, sdkconfig (default), build in /Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/components/console/test_apps/console/build
--------------------------------------------------------------------------------
Modified README file: components/console/test_apps/console/README.md
--------------------------------------------------------------------------------
components/esp_system/test_apps/rtc_8md256:
- enable build targets according to the manifest file: ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']
- enable build targets according to the old Supported Targets table under readme "components/esp_system/test_apps/rtc_8md256/README.md": ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']

If you want to disable some targets, please use the following snippet:

# Please combine this with the original one
#
# Notes:
# - please keep in mind to avoid duplicated folders as yaml keys
# - please use parentheses to group conditions, the "or" and "and" operators could only accept two operands
components/esp_system/test_apps/rtc_8md256:
  enable:
    - if: IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32c6", "esp32s2", "esp32s3"]
      temporary: true
      reason: <why only enable build jobs for these targets>
check_enable_build failed for app: (cmake) App components/esp_system/test_apps/rtc_8md256, target esp32, sdkconfig (default), build in /Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/components/esp_system/test_apps/rtc_8md256/build
--------------------------------------------------------------------------------
components/esp_system/test_apps/rtc_power_modes:
- enable build targets according to the manifest file: ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']
- enable build targets according to the old Supported Targets table under readme "components/esp_system/test_apps/rtc_power_modes/README.md": ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']

If you want to disable some targets, please use the following snippet:

# Please combine this with the original one
#
# Notes:
# - please keep in mind to avoid duplicated folders as yaml keys
# - please use parentheses to group conditions, the "or" and "and" operators could only accept two operands
components/esp_system/test_apps/rtc_power_modes:
  enable:
    - if: IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32c6", "esp32s2", "esp32s3"]
      temporary: true
      reason: <why only enable build jobs for these targets>
check_enable_build failed for app: (cmake) App components/esp_system/test_apps/rtc_power_modes, target esp32, sdkconfig (default), build in /Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/components/esp_system/test_apps/rtc_power_modes/build
--------------------------------------------------------------------------------
components/esp_system/test_apps/rtc_8md256:
- enable build targets according to the manifest file: ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']
- enable build targets according to the old Supported Targets table under readme "components/esp_system/test_apps/rtc_8md256/README.md": ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']

If you want to disable some targets, please use the following snippet:

# Please combine this with the original one
#
# Notes:
# - please keep in mind to avoid duplicated folders as yaml keys
# - please use parentheses to group conditions, the "or" and "and" operators could only accept two operands
components/esp_system/test_apps/rtc_8md256:
  enable:
    - if: IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32c6", "esp32s2", "esp32s3"]
      temporary: true
      reason: <why only enable build jobs for these targets>
check_enable_build failed for app: (cmake) App components/esp_system/test_apps/rtc_8md256, target esp32, sdkconfig (default), build in /Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/components/esp_system/test_apps/rtc_8md256/build
--------------------------------------------------------------------------------
components/esp_system/test_apps/rtc_power_modes:
- enable build targets according to the manifest file: ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']
- enable build targets according to the old Supported Targets table under readme "components/esp_system/test_apps/rtc_power_modes/README.md": ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']

If you want to disable some targets, please use the following snippet:

# Please combine this with the original one
#
# Notes:
# - please keep in mind to avoid duplicated folders as yaml keys
# - please use parentheses to group conditions, the "or" and "and" operators could only accept two operands
components/esp_system/test_apps/rtc_power_modes:
  enable:
    - if: IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32c6", "esp32s2", "esp32s3"]
      temporary: true
      reason: <why only enable build jobs for these targets>
check_enable_build failed for app: (cmake) App components/esp_system/test_apps/rtc_power_modes, target esp32, sdkconfig (default), build in /Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/components/esp_system/test_apps/rtc_power_modes/build
--------------------------------------------------------------------------------
components/console/test_apps/console:
- enable build targets according to the manifest file: ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']
- enable build targets according to the old Supported Targets table under readme "components/console/test_apps/console/README.md": ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']

If you want to disable some targets, please use the following snippet:

# Please combine this with the original one
#
# Notes:
# - please keep in mind to avoid duplicated folders as yaml keys
# - please use parentheses to group conditions, the "or" and "and" operators could only accept two operands
components/console/test_apps/console:
  enable:
    - if: IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32c6", "esp32s2", "esp32s3"]
      temporary: true
      reason: <why only enable build jobs for these targets>
check_enable_build failed for app: (cmake) App components/console/test_apps/console, target esp32, sdkconfig (default), build in /Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/components/console/test_apps/console/build
--------------------------------------------------------------------------------
components/esp_system/test_apps/rtc_8md256:
- enable build targets according to the manifest file: ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']
- enable build targets according to the old Supported Targets table under readme "components/esp_system/test_apps/rtc_8md256/README.md": ['esp32', 'esp32c2', 'esp32c3', 'esp32s2', 'esp32s3']

If you want to disable some targets, please use the following snippet:

# Please combine this with the original one
#
# Notes:
# - please keep in mind to avoid duplicated folders as yaml keys
# - please use parentheses to group conditions, the "or" and "and" operators could only accept two operands
components/esp_system/test_apps/rtc_8md256:
  enable:
    - if: IDF_TARGET in ["esp32", "esp32c2", "esp32c3", "esp32s2", "esp32s3"]
      temporary: true
      reason: <why only enable build jobs for these targets>
check_enable_build failed for app: (cmake) App components/esp_system/test_apps/rtc_8md256, target esp32, sdkconfig (default), build in /Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/components/esp_system/test_apps/rtc_8md256/build
--------------------------------------------------------------------------------
Modified README file: components/esp_system/test_apps/rtc_8md256/README.md
--------------------------------------------------------------------------------
components/esp_system/test_apps/rtc_power_modes:
- enable build targets according to the manifest file: ['esp32', 'esp32s2', 'esp32c3', 'esp32s3', 'esp32c2', 'esp32c6']
- enable build targets according to the old Supported Targets table under readme "components/esp_system/test_apps/rtc_power_modes/README.md": ['esp32s3']

If you want to disable some targets, please use the following snippet:

# Please combine this with the original one
#
# Notes:
# - please keep in mind to avoid duplicated folders as yaml keys
# - please use parentheses to group conditions, the "or" and "and" operators could only accept two operands
components/esp_system/test_apps/rtc_power_modes:
  enable:
    - if: IDF_TARGET in ["esp32s3"]
      temporary: true
      reason: <why only enable build jobs for these targets>
check_enable_build failed for app: (cmake) App components/esp_system/test_apps/rtc_power_modes, target esp32, sdkconfig (default), build in /Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/components/esp_system/test_apps/rtc_power_modes/build
--------------------------------------------------------------------------------
Modified README file: components/esp_system/test_apps/rtc_power_modes/README.md
--------------------------------------------------------------------------------

sort .build-test-rules.yml files.............................................................................(no files to check)Skipped
File Contents Sorter.........................................................................................(no files to check)Skipped
Check copyright notices..........................................................................................................Passed
[WARNING] Stashed changes conflicted with hook auto-fixes... Rolling back fixes...
[INFO] Restored changes from /Users/charlesweinberger/.cache/pre-commit/patch1667903318-74132.
charlesweinberger@Chips-Macbook-Pro-2 esp-idf % git status
On branch user/chip/more-secondary-console-choices-try-2
Your branch is ahead of 'origin/user/chip/more-secondary-console-choices-try-2' by 35 commits.
  (use "git push" to publish your local commits)

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
	modified:   components/app_trace/Kconfig
	modified:   components/bootloader_support/src/bootloader_console.c
	modified:   components/bootloader_support/src/bootloader_console_loader.c
	modified:   components/console/esp_console.h
	modified:   components/console/esp_console_repl.c
	modified:   components/esp_gdbstub/esp32c3/gdbstub_esp32c3.c
	modified:   components/esp_gdbstub/esp32c6/gdbstub_esp32c6.c
	modified:   components/esp_gdbstub/esp32h2/gdbstub_esp32h2.c
	modified:   components/esp_pm/pm_impl.c
	modified:   components/esp_system/Kconfig
	modified:   components/esp_system/include/esp_private/usb_console.h
	modified:   components/esp_system/panic.c
	modified:   components/esp_system/port/cpu_start.c
	modified:   components/esp_system/port/soc/esp32s2/CMakeLists.txt
	modified:   components/esp_system/port/soc/esp32s2/usb_console.c
	modified:   components/esp_system/port/soc/esp32s3/CMakeLists.txt
	modified:   components/esp_system/port/soc/esp32s3/usb_console.c
	modified:   components/esp_system/startup.c
	modified:   components/vfs/CMakeLists.txt
	modified:   components/vfs/vfs_console.c
	modified:   examples/system/console/advanced/main/console_example_main.c

@chipweinberger chipweinberger force-pushed the user/chip/more-secondary-console-choices-try-2 branch from 385b1c9 to c55ff9f Compare November 8, 2022 10:43
@chipweinberger
Copy link
Contributor Author

chipweinberger commented Nov 8, 2022

I just cloned a fresh esp-idf and am still failing pre-commit locally, even on master branch.

Validate executable-list.txt.....................................................................................................Failed
- hook id: check-executable-list
- exit code: 1

Validate Codeowner File..........................................................................................................Failed
- hook id: check-codeowners
- exit code: 1

Check if all apps readme files match given .build-test-rules.yml files. Modify the supported target tables.......................Failed
- hook id: check-all-apps-readmes
- exit code: 1
- files were modified by this hook

trying to get more details:

charlesweinberger@Chips-Macbook-Pro-2 esp-idf % /Volumes/User/MBP-Google-Drive/jamcorder/firmware/.espressif/python_env/idf5.1_py3.9_env/bin/python tools/ci/check_build_test_rules.py check-readmes tools/test_apps/.
Traceback (most recent call last):
  File "/Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/tools/ci/check_build_test_rules.py", line 485, in <module>
    check_readme(
  File "/Users/charlesweinberger/Desktop/esp-idf-v5/esp-idf/tools/ci/check_build_test_rules.py", line 62, in check_readme
    from idf_build_apps import App, find_apps
ModuleNotFoundError: No module named 'idf_build_apps'
charlesweinberger@Chips-Macbook-Pro-2 esp-idf % 

@igrr igrr added the PR-Sync-Merge Pull request sync as merge commit label Nov 8, 2022
@igrr
Copy link
Member

igrr commented Nov 8, 2022

sha=c55ff9f2c824555c21be9d338066b63d0dcd6366

@igrr
Copy link
Member

igrr commented Nov 8, 2022

Thank you for the contribution @chipweinberger! I will take it from here and add CI checks for this new feature. If there are any significant issue identified in the internal review, I will get back to you. Otherwise you should get a notification when the PR is merged.

@chipweinberger
Copy link
Contributor Author

thanks for the review! ESP-IDF is very high quality code.

@igrr
Copy link
Member

igrr commented Dec 8, 2022

Status update: this got stuck a bit because we needed to add new test environments where both UART and USB are connected to the host, to verify that console output is indeed coming to both destinations.

@chipweinberger
Copy link
Contributor Author

Bump. Hoping the testing environment gets setup soon.

@chipweinberger
Copy link
Contributor Author

We used to have a Secondary Usb Serial JTAG output without having a test environment.

Maybe skip the new environment if it is difficult.

@igrr
Copy link
Member

igrr commented Jan 20, 2023

The test environment has now been set up, what remains is to write the tests.

We used to have a Secondary Usb Serial JTAG output without having a test environment.

Exactly the reason I want to avoid repeating this mistake. You have probably seen how many issue reports are raised about USB_SERIAL_JTAG.

@chipweinberger
Copy link
Contributor Author

any hope of getting into v5.1? It's been awhile

@espressif-bot espressif-bot added Status: Selected for Development Issue is selected for development and removed Status: Opened Issue is new labels Apr 13, 2023
@CLAassistant
Copy link

CLAassistant commented Apr 20, 2023

CLA assistant check
All committers have signed the CLA.

@chipweinberger
Copy link
Contributor Author

chipweinberger commented May 9, 2023

@zikalino, I've rebased the change. You might want to re-test it before merge, mainly to make sure it compiles.

@chipweinberger chipweinberger force-pushed the user/chip/more-secondary-console-choices-try-2 branch 3 times, most recently from ab15902 to 78426e6 Compare May 9, 2023 03:23
@chipweinberger chipweinberger force-pushed the user/chip/more-secondary-console-choices-try-2 branch 4 times, most recently from 372fe03 to de0c7d6 Compare May 9, 2023 03:32
@chipweinberger
Copy link
Contributor Author

chipweinberger commented Jul 8, 2023

@igrr, hoping we can clear out some of these PRs.

This PR is useful for 2 reasons:

  • when USB Serial/JTAG is primary we should be able to mirror output to UART, like we can with USB Serial/JTAG
  • the new ESP_CONSOLE_IS_USB_CDC_ENABLED style configs simplify code.

@chipweinberger
Copy link
Contributor Author

@igrr will we ever be able to get this in hah =)

It is more of a simplifying change than anything.

@github-actions
Copy link

github-actions bot commented Sep 30, 2023

Messages
📖 Good Job! All checks are passing!

👋 Welcome chipweinberger, thank you for your first contribution to espressif/esp-idf project!

📘 Please check Contributions Guide for the contribution checklist, information regarding code and documentation style, testing and other topics.

🖊️ Please also make sure you have read and signed the Contributor License Agreement for espressif/esp-idf project.

Pull request review and merge process you can expect

Espressif develops the ESP-IDF project in an internal repository (Gitlab). We do welcome contributions in the form of bug reports, feature requests and pull requests via this public GitHub repository.

  1. An internal issue has been created for the PR, we assign it to the relevant engineer
  2. They review the PR and either approve it or ask you for changes or clarifications
  3. Once the Github PR is approved, we synchronize it into our internal git repository
  4. In the internal git repository we do the final review, collect approvals from core owners and make sure all the automated tests are passing
    • At this point we may do some adjustments to the proposed change, or extend it by adding tests or documentation.
  5. If the change is approved and passes the tests it is merged into the master branch
  6. On next sync from the internal git repository merged change will appear in this public Github repository

Generated by 🚫 dangerJS against c1764b0

@chipweinberger chipweinberger force-pushed the user/chip/more-secondary-console-choices-try-2 branch 2 times, most recently from 02b428f to 1c66960 Compare September 30, 2023 20:03
@chipweinberger
Copy link
Contributor Author

rebased again

@chipweinberger
Copy link
Contributor Author

chipweinberger commented Oct 1, 2023

to explain the benefit of this PR to the best of my memory

Console & logging are very limiting. Supported outputs must be chosen at compile time instead of runtime

and esp-idf only supports uart primary w/ usb serial jtag secondary. that's very limiting

this PR makes all logging outputs first class citizens, and also manages to simplify code

@espressif-bot espressif-bot assigned igrr and unassigned zikalino Oct 2, 2023
@espressif-bot espressif-bot added Status: In Progress Work is in progress and removed Status: Selected for Development Issue is selected for development labels Oct 2, 2023
@igrr
Copy link
Member

igrr commented Oct 2, 2023

@chipweinberger Thanks for patiently keeping this PR alive! I have now added an app to test some of the secondary output options. It should be closer to being merged now.

@chipweinberger chipweinberger force-pushed the user/chip/more-secondary-console-choices-try-2 branch from 1c66960 to d5a0fd2 Compare October 2, 2023 21:17
@igrr
Copy link
Member

igrr commented Oct 3, 2023

@chipweinberger Thanks for fixing that typo. I ran into two more issues while testing this:

  • A build error when CDC is selected as secondary output:
    libesp_system.a(panic.c.obj): in function `panic_print_char_usb_cdc':
        components/esp_system/panic.c:220: undefined reference to `esp_usb_console_write_buf'
    
  • Bootloader size has increased after these changes, overflowing the 0x8000 max size for a couple of test apps on the ESP32. This is a bit annoying, since the feature doesn't bring much benefit for the ESP32 (it has neither USB CDC nor USB_SERIAL_JTAG), so the fact that the code size has increased is harder to justify. This is not a hard blocker, though, we can probably find a way around this.

@chipweinberger
Copy link
Contributor Author

chipweinberger commented Oct 3, 2023

@igrr thanks for testing

A build error when CDC is selected as secondary output:
libesp_system.a(panic.c.obj): in function panic_print_char_usb_cdc': components/esp_system/panic.c:220: undefined reference to esp_usb_console_write_buf'

It seems like CDC has changed a lot since this commit was made. I've pushed new changes as a new commit so you can see.

Bootloader size has increased after these changes, overflowing the 0x8000 max size for a couple of test apps on the ESP32. This is a bit annoying, since the feature doesn't bring much benefit for the ESP32 (it has neither USB CDC nor USB_SERIAL_JTAG), so the fact that the code size has increased is harder to justify. This is not a hard blocker, though, we can probably find a way around this.

Even if you leave secondary disabled? I'm not sure why that would be.

@ammaree
Copy link

ammaree commented Mar 14, 2024

Can I add +99 here please.
The current kconfig options does not allow UART to be combined with CDC....

@igrr
Copy link
Member

igrr commented Mar 14, 2024

Sure! We haven't forgotten about this. In fact, we just merged a refactoring which should help us simplify how the console devices are managed, without having to add a whole bunch of ifdefs around the codebase. We will definitely revisit this topic once a few other vfs-related refactorings are done (e.g. extracting the CDC driver out of the vfs component). Sorry to keep you all waiting!

@mickeyl
Copy link
Contributor

mickeyl commented Mar 25, 2024

This looks great, I'd really like this to land in preparation of better console support. Good work, @chipweinberger!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Sync-Merge Pull request sync as merge commit Status: In Progress Work is in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants