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

Rework cbuf to use FreeRTOS Ringbuffer #7860

Merged
merged 12 commits into from
Feb 7, 2024
Merged

Rework cbuf to use FreeRTOS Ringbuffer #7860

merged 12 commits into from
Feb 7, 2024

Conversation

me-no-dev
Copy link
Member

@me-no-dev me-no-dev commented Feb 17, 2023

  • Implement cbuf::peek

@VojtechBartoska VojtechBartoska added this to the 3.0.0 milestone Feb 20, 2023
@mrengineer7777
Copy link
Collaborator

Closes #7853

@VojtechBartoska
Copy link
Contributor

@me-no-dev is this ready for review?

@lucasssvaz
Copy link
Collaborator

@VojtechBartoska I think cbuf::peek is still missing

@me-no-dev
Copy link
Member Author

yes. pending because only ugly ideas on how to implement it at the moment. Maybe worth checking if anything that uses it, actually calls peek

@VojtechBartoska VojtechBartoska modified the milestones: 3.0.0-Aplha3, 3.1.0 Nov 29, 2023
@VojtechBartoska VojtechBartoska added the Status: In Progress Issue is in progress label Nov 29, 2023
@lucasssvaz
Copy link
Collaborator

lucasssvaz commented Nov 29, 2023

@me-no-dev From what I saw it is only used by the WiFiUdp and there's no use of the peek() method. I think it can be left as it is for now.

@lucasssvaz
Copy link
Collaborator

Crashing in cbuf::write(). Tested using the BasicOTA example.

Decoding stack results
0x4002f7fb: vListInsert at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/list.c line 171
0x4002e519: vTaskPlaceOnEventList at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c line 3799
0x4002d7ce: xQueueSemaphoreTake at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c line 1839
0x4002d854: xQueueTakeMutexRecursive at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c line 783
0x40087bc1: cbuf::write(char const*, unsigned int) at /home/lucassvaz/Arduino/hardware/espressif/esp32/cores/esp32/cbuf.cpp line 227
0x400847ff: WiFiUDP::parsePacket() at /home/lucassvaz/Arduino/hardware/espressif/esp32/libraries/WiFi/src/WiFiUdp.cpp line 228
0x40085822: ArduinoOTAClass::handle() at /home/lucassvaz/Arduino/hardware/espressif/esp32/libraries/ArduinoOTA/src/ArduinoOTA.cpp line 379
0x40082bfa: loop() at /home/lucassvaz/Arduino/sketches/test/test.ino line 67
0x40087c88: loopTask(void*) at /home/lucassvaz/Arduino/hardware/espressif/esp32/cores/esp32/main.cpp line 74

@me-no-dev
Copy link
Member Author

@lucasssvaz i kinda wonder why it's calling recursive api... can you try without?

@lucasssvaz
Copy link
Collaborator

@me-no-dev same result:

0x4002f72f: vListInsert at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/list.c line 171
0x4002e449: vTaskPlaceOnEventList at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c line 3911
0x4002d6fe: xQueueSemaphoreTake at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/FreeRTOS-Kernel/queue.c line 1839
0x40087ba5: cbuf::write(char const*, unsigned int) at /home/lucassvaz/Arduino/hardware/espressif/esp32/cores/esp32/cbuf.cpp line 227
0x400847c7: WiFiUDP::parsePacket() at /home/lucassvaz/Arduino/hardware/espressif/esp32/libraries/WiFi/src/WiFiUdp.cpp line 228
0x400857ea: ArduinoOTAClass::handle() at /home/lucassvaz/Arduino/hardware/espressif/esp32/libraries/ArduinoOTA/src/ArduinoOTA.cpp line 379
0x40082bc2: loop() at /home/lucassvaz/Arduino/sketches/test/test.ino line 67
0x40087c7c: loopTask(void*) at /home/lucassvaz/Arduino/hardware/espressif/esp32/cores/esp32/main.cpp line 74

@me-no-dev
Copy link
Member Author

and what does it give as reason?

@lucasssvaz
Copy link
Collaborator

and what does it give as reason?

Ready
IP address: 192.168.15.79
Guru Meditation Error: Core  0 panic'ed (LoadProhibited). Exception was unhandled.

Core  0 register dump:
PC      : 0x4002d601  PS      : 0x00060a30  A0      : 0x80089000  A1      : 0x3fffe820  
A2      : 0x00300030  A3      : 0xffffffff  A4      : 0x3ffdfb94  A5      : 0x3ffdfc14  
A6      : 0x00000000  A7      : 0x00000030  A8      : 0x8002c809  A9      : 0x3fffe810  
A10     : 0x00000000  A11     : 0x00000002  A12     : 0x3ffdfb94  A13     : 0x3ffdfc14  
A14     : 0x3fffe848  A15     : 0x3ffc7ec8  SAR     : 0x00000011  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00300070  LBEG    : 0x3ffdfb94  LEND    : 0x3ffdfc14  LCOUNT  : 0x40027aa4  


Backtrace: 0x4002d5fe:0x3fffe820 0x40088ffd:0x3fffe860 0x40085cb1:0x3fffe880 0x4008723a:0x3fffe8d0 0x40082f26:0x3fffe8f0 0x4008b3a4:0x3fffe910

@lucasssvaz lucasssvaz added Status: Needs investigation We need to do some research before taking next steps on this issue and removed Status: In Progress Issue is in progress labels Jan 24, 2024
@me-no-dev me-no-dev modified the milestones: 3.1.0, 3.0.0-RC1 Jan 31, 2024
@me-no-dev
Copy link
Member Author

@lucasssvaz can you make WiFiUdp not use cbuf, so we can delete the class altogether?

@lucasssvaz
Copy link
Collaborator

@lucasssvaz can you make WiFiUdp not use cbuf, so we can delete the class altogether?

I'll take a look

Copy link
Contributor

github-actions bot commented Feb 2, 2024

Warnings
⚠️

Some issues found for the commit messages in this PR:

  • the commit message "Add initializer":
    • summary looks empty
    • type/action looks empty
  • the commit message "Fix typo":
    • summary looks empty
    • type/action looks empty
  • the commit message "Implement peek method":
    • summary looks empty
    • type/action looks empty
  • the commit message "Initialize with NULL":
    • summary looks empty
    • type/action looks empty
  • the commit message "Rework cbuf to use FreeRTOS Ringbuffer":
    • summary looks empty
    • type/action looks empty
  • the commit message "Update cbuf.cpp":
    • summary looks empty
    • type/action looks empty

Please fix these commit messages - here are some basic tips:

  • follow Conventional Commits style
  • correct format of commit message should be: <type/action>(<scope/component>): <summary>, for example fix(esp32): Fixed startup timeout issue
  • allowed types are: change,ci,docs,feat,fix,refactor,remove,revert,test
  • sufficiently descriptive message summary should be between 20 to 72 characters and start with upper case letter
  • avoid Jira references in commit messages (unavailable/irrelevant for our customers)

TIP: Install pre-commit hooks and run this check when committing (uses the Conventional Precommit Linter).

⚠️ Please consider squashing your 12 commits (simplifying branch history).
⚠️ The Pull Request description looks very brief, please check if more details can be added.

👋 Hello me-no-dev, we appreciate your contribution to this project!


Click to see more instructions ...


This automated output is generated by the PR linter DangerJS, which checks if your Pull Request meets the project's requirements and helps you fix potential issues.

DangerJS is triggered with each push event to a Pull Request and modify the contents of this comment.

Please consider the following:
- Danger mainly focuses on the PR structure and formatting and can't understand the meaning behind your code or changes.
- Danger is not a substitute for human code reviews; it's still important to request a code review from your colleagues.
- Resolve all warnings (⚠️ ) before requesting a review from human reviewers - they will appreciate it.
- To manually retry these Danger checks, please navigate to the Actions tab and re-run last Danger workflow.

Review and merge process you can expect ...


We do welcome contributions in the form of bug reports, feature requests and pull requests.

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 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.
4. If the change is approved and passes the tests it is merged into the default branch.

Generated by 🚫 dangerJS against de6dd62

@lucasssvaz lucasssvaz added Status: Review needed Issue or PR is awaiting review and removed Status: Needs investigation We need to do some research before taking next steps on this issue labels Feb 2, 2024
@lucasssvaz
Copy link
Collaborator

@me-no-dev Properly implemented as we discussed.

@lucasssvaz
Copy link
Collaborator

@P-R-O-C-H-Y Please take a look later to see if there's anything else that needs to be changed.

@me-no-dev me-no-dev merged commit d59efdc into master Feb 7, 2024
39 checks passed
@me-no-dev me-no-dev deleted the feature/rtos-cbuf branch February 7, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Review needed Issue or PR is awaiting review
Projects
Development

Successfully merging this pull request may close these issues.

4 participants