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
arch/risc-v/espressif: Add full GPIO support #9586
Conversation
GPIO interrupts used to be enabled by a specific Kconfig option, disabled by default: nuttx/arch/xtensa/src/esp32/Kconfig Lines 811 to 815 in 5e7ce13
This PR seems to change this behavior. Please confirm whether this is indeed an intended move. |
Yes, it is. From now on we will follow the same approach as the other chips/boards. |
0814ba3
to
bf36fe9
Compare
Ok, but besides that is there any stronger reason for doing so? nuttx/sched/irq/irq_initialize.c Line 52 in 5e7ce13
Lines 57 to 71 in 5e7ce13
So, considering that ESP32-C3 contains 22 IRQ-capable pins, this move may increase RAM usage by at least 176 bytes. |
besides the RAM overhead (2023).
|
@gustavonihei Me, @tmedicci and @acassis debated about this and decided that there weren't many applications where disabling the GPIO IRQs would be beneficial. So, for the sake of simplicity and consistency, we decided to remove it. |
Is there any application on NuttX that use GPIO by polling? Particularly, I don't see any benefits of keeping GPIO support without IRQs. |
@gustavonihei I think the "overhead" is too small and normally people will need to use GPIO with interrupt. Another alternative could be to keep the Kconfig entry but enable it by default because normally it will be needed 99% of the time when people are using GPIO. |
There is one trivial scenario that you (@tmedicci @lucasssvaz @acassis) seem to ignore is that there are many applications that don't work with the processor pins in general-purpose function at all. Take a look at how many defconfigs define
At the driver level any overhead should be minimized. It is up to the application developer to quantify the size of the overhead and decide whether the price is worth paying. |
You're right about the applications that don't use GPIOs at all... So, let's re-think the problem: considering GPIO is being used, should we provide an option to not use the GPIO with IRQs just for the sake of saving a couple of bytes? Are there any practical applications that could be built relying on that? I agree that this PR doesn't consider this and should be fixed. |
e7bc50c
to
6696896
Compare
I've added the toggle back. |
6696896
to
4112458
Compare
4112458
to
ef63d95
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good in general
ef63d95
to
0b99e68
Compare
Full GPIO support using Espressif's HAL
0b99e68
to
6ef41ef
Compare
Summary
Add full GPIO and Buttons support for ESP32-C3/C6/H2 using the Espressif HAL.
Impact
None on existing code. Support for new peripherals when using the Espressif HAL.
Testing
Tested on ESP32-C3-DevKitC.