Not quite sure what's going on here - using "stable", v4.2. The esp32s2 only has 4 PCNT units - but I'm not building for the esp32s2, I'm building for the regular old esp32, which has 8 units.
Test case: build examples/peripherals/pcnt
Builds fine, presumably works (haven't tested that far)
Now edit pcnt/main/pcnt_example_main.c to switch from PCNT_UNIT_0 to PCNT_UNIT_4 (or 5, 6, 7) and try to compile.
Compile fails. (If you use hard-coded numbers, then it fails at runtime instead.)
Clearly components/soc/include/hal/pcnt_hal.h is intended to switch between 4 and 8 units. It makes the switch based on a value from components/soc/soc/esp32/include/soc/pcnt_caps.h (or components/soc/soc/esp32s2/include/soc/pcnt_caps.h).
I can't find any other header file that includes pcnt_caps.h, so it must be included independently? The documentation doesn't mention this, so I'm guessing it's an error?
The driver file components/driver/pcnt.c includes pcnt_caps.h, but only after pcnt_hal.h... so it has no effect.
So... is this a bug?
PCNT units 4-7 cause compile/runtime errors on esp32
- TinkerBearNZ
- Posts: 9
- Joined: Mon Jun 17, 2019 11:20 pm
-
- Posts: 74
- Joined: Wed Oct 23, 2019 1:49 am
Re: PCNT units 4-7 cause compile/runtime errors on esp32
Yup, seems like a bug, I'll make a MR for it.
Seems like the issue is present on master as well, but it doesnt manifest itself due to the include order of the headers.
Thanks for reporting this!
Seems like the issue is present on master as well, but it doesnt manifest itself due to the include order of the headers.
Thanks for reporting this!
Who is online
Users browsing this forum: Baidu [Spider] and 158 guests