Open maaamcube opened 1 month ago
Hi @maaamcube
The requirement for packet buffer size seems to come from the cherry-usb itself:
This is not configurable on IDF side, as the default LWIP size is used instead.
You can override this option from the project (but also from the cherry-usb component) makefile placing:
idf_component_get_property(lwip lwip COMPONENT_LIB)
target_compile_definitions(${lwip} PRIVATE "-DPBUF_POOL_BUFSIZE=1600")
after idf_component_register()
.
PS: Documented in https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/lwip.html#customized-lwip-options-from-esp-idf-build-system
@david-cermak thanks for your reply. I added the lines but i still have the error.
@maaamcube Do you have a branch with the actual changes? I recall that I had to fix some other refs, includes and other minor stuff to get it compiled besides the lwip defines? Maybe if you post your updates, I'll check if I can share a fixing commit.
@david-cermak No, sorry. I did those changes locally during my tests.
To make it work, i put comment to those lines :
"#if LWIP_TCPIP_CORE_LOCKING_INPUT != 1
I changed those lines : "
ip_addr_t g_ipaddr; ip_addr_t g_netmask; ip_addr_t g_gateway;"
by : "
ip4_addr_t g_ipaddr; ip4_addr_t g_netmask; ip4_addr_t g_gateway;"
I used CherryUSB V1.4.0
Just FYI, there is an ORIG_INCLUDE_PATH
property of FreeRTOS component which could be used to make includes like FreeRTOS.h
work. Here is an example in tinyusb component:
https://github.com/espressif/tinyusb/blob/4b4c984c04e686954a35b3d552dd4cccaa008034/CMakeLists.txt#L18-L30
By adding the two lines in CMake you can keep the includes unchanged.
...and about the ip_addr_t -> ip4_addr_t
change, it should be enough to disable IPv6 in LWIP component config
Here're my changes to make the host example compilable:
diff --git a/examples/host/main/CMakeLists.txt b/examples/host/main/CMakeLists.txt
index 7524c18..1d69647 100644
--- a/examples/host/main/CMakeLists.txt
+++ b/examples/host/main/CMakeLists.txt
@@ -1,3 +1,6 @@
idf_component_register(SRCS "main.c"
INCLUDE_DIRS ".")
+
+idf_component_get_property(lwip lwip COMPONENT_LIB)
+target_compile_definitions(${lwip} PRIVATE "-DPBUF_POOL_BUFSIZE=1600")
\ No newline at end of file
diff --git a/examples/host/main/idf_component.yml b/examples/host/main/idf_component.yml
index aa668de..8060976 100644
--- a/examples/host/main/idf_component.yml
+++ b/examples/host/main/idf_component.yml
@@ -1,6 +1,8 @@
## IDF Component Manager Manifest File
dependencies:
- cherry-embedded/cherryusb: "^1.4.0~1"
+ cherry-embedded/cherryusb:
+ version: "^1.4.0~1"
+# override_path: ../../..
## Required IDF version
idf:
version: ">=4.1.0"
(changes against https://github.com/CherryUSB/cherryusb_esp32/commit/a0e15d45225c4731921dcf53dbdea985d03ba413)
To update the freertos include dirs and lwip IPv4 only config, it's probably better to update the component makefile (rather then project one)
@igrr @david-cermak Thank you for your suggestions, i will add these into cherryusb cmakelist.
Answers checklist.
IDF version.
v5.2
Operating System used.
Windows
How did you build your project?
Command line with Make
If you are using Windows, please specify command line type.
None
What is the expected behavior?
I'm trying to compile cherryusb from menuconfig with my esp idf v5.2, i got this error :
C:/cherryusb_esp32/examples/host/managed_components/cherry-embedded__cherryusb/platform/none/usbh_lwip.c:31:2: error: #error PBUF_POOL_BUFSIZE must be larger than 1600 31 | #error PBUF_POOL_BUFSIZE must be larger than 1600
How can i correct it ?
Thanks.
What is the actual behavior?
C:/cherryusb_esp32/examples/host/managed_components/cherry-embedded__cherryusb/platform/none/usbh_lwip.c:31:2: error: #error PBUF_POOL_BUFSIZE must be larger than 1600 31 | #error PBUF_POOL_BUFSIZE must be larger than 1600
Steps to reproduce.
Build or installation Logs.
No response
More Information.
No response