chegewara / esp32s2-tinyusb-arduino-as-component

8 stars 1 forks source link

Cannot compile #1

Closed meltdown03 closed 4 years ago

meltdown03 commented 4 years ago

I'm trying to build this example, I've cloned the esp32s2 branch of arduino-esp32 into components/arduino and tinyusb into components/EspTinyUSB/tinyusb. I first get an error that semphr.h, queue.h, and task.h cannot be found. I resolved that by changing the CMakeLists.txt file to have tinyusb/lib/FreeRTOS/FreeRTOS/Source/include as an includeddir

Now I get these errors regarding wifi/mbedtls

../components/arduino/libraries/WiFiClientSecure/src/ssl_client.cpp:23:4: error: #error "Please configure IDF framework to include mbedTLS -> Enable pre-shared-key ciphersuites and activate at least one cipher"
 #  error "Please configure IDF framework to include mbedTLS -> Enable pre-shared-key ciphersuites and activate at least one cipher"
    ^~~~~
../components/arduino/libraries/WiFiClientSecure/src/ssl_client.cpp: In function 'int start_ssl_client(sslclient_context*, const char*, uint32_t, int, const char*, const char*, const char*, const char*, const char*)':
../components/arduino/libraries/WiFiClientSecure/src/ssl_client.cpp:151:15: error: 'mbedtls_ssl_conf_psk' was not declared in this scope
         ret = mbedtls_ssl_conf_psk(&ssl_client->ssl_conf, psk, psk_len,
               ^~~~~~~~~~~~~~~~~~~~
../components/arduino/libraries/WiFiClientSecure/src/ssl_client.cpp:151:15: note: suggested alternative: 'mbedtls_ssl_conf_sni'
         ret = mbedtls_ssl_conf_psk(&ssl_client->ssl_conf, psk, psk_len,
               ^~~~~~~~~~~~~~~~~~~~
               mbedtls_ssl_conf_sni

Could you also include an sdkconfig.defaults file, maybe I have Arduino setup incorrectly in menuconfig?

meltdown03 commented 4 years ago

I found the menuconfig option to correct that error but I get about 2,600 errors such as /home/neal/esp/xtensa-esp32s2-elf/xtensa-esp32s2-elf/include/c++/8.2.0/bits/basic_string.h:6627:3: error: template specialization with C linkage

/home/neal/esp/xtensa-esp32s2-elf/xtensa-esp32s2-elf/include/c++/8.2.0/bits/basic_string.h:6590:3: error: conflicting declaration of C function 'std::__cxx11::wst ring std::__cxx11::to_wstring(double)'

../components/EspTinyUSB/tinyusb/src/osal/osal_freertos.h:56:10: error: 'xSemaphoreCreateBinaryStatic' was not declared in this scope

/home/neal/esp/xtensa-esp32s2-elf/xtensa-esp32s2-elf/include/c++/8.2.0/bits/basic_string.tcc:130:3: error: template with C linkage

chegewara commented 4 years ago

https://github.com/chegewara/esp32s2-tinyusb-arduino-as-component/blob/master/README.md

Because of some dependency i had to modify 1 file in tinyusb to make it works: https://github.com/hathach/tinyusb/blob/master/src/osal/osal_freertos.h#L31-L34

// FreeRTOS Headers 
#include "freertos/FreeRTOS.h" 
#include "freertos/semphr.h" 
#include "freertos/queue.h" 
#include "freertos/task.h"

This is all you need to do, no CMake Lists modify, no menuconfig changes.

meltdown03 commented 4 years ago

Ok, did that but still get a few errors:


In file included from ../components/EspTinyUSB/tinyusb/src/osal/osal.h:53,
                 from ../components/EspTinyUSB/tinyusb/src/tusb.h:38,
                 from ../main/msc_disk.cpp:27:
../components/EspTinyUSB/tinyusb/src/osal/osal_freertos.h: In function 'void* osal_semaphore_create(osal_semaphore_def_t*)':
../components/EspTinyUSB/tinyusb/src/osal/osal_freertos.h:56:10: error: 'xSemaphoreCreateBinaryStatic' was not declared in this scope
   return xSemaphoreCreateBinaryStatic(semdef);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
../components/EspTinyUSB/tinyusb/src/osal/osal_freertos.h:56:10: note: suggested alternative: 'xSemaphoreCreateBinary'
   return xSemaphoreCreateBinaryStatic(semdef);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
          xSemaphoreCreateBinary
../components/EspTinyUSB/tinyusb/src/osal/osal_freertos.h: In function 'void* osal_mutex_create(osal_mutex_def_t*)':
../components/EspTinyUSB/tinyusb/src/osal/osal_freertos.h:83:10: error: 'xSemaphoreCreateMutexStatic' was not declared in this scope
   return xSemaphoreCreateMutexStatic(mdef);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
../components/EspTinyUSB/tinyusb/src/osal/osal_freertos.h:83:10: note: suggested alternative: 'xSemaphoreCreateMutex'
   return xSemaphoreCreateMutexStatic(mdef);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~
          xSemaphoreCreateMutex
../components/EspTinyUSB/tinyusb/src/osal/osal_freertos.h: In function 'void* osal_queue_create(osal_queue_def_t*)':
../components/EspTinyUSB/tinyusb/src/osal/osal_freertos.h:118:10: error: 'xQueueCreateStatic' was not declared in this scope                                                           return xQueueCreateStatic(qdef->depth, qdef->item_sz, (uint8_t*) qdef->buf, &qdef->sq);          ^~~~~~~~~~~~~~~~~~                                                              ../components/EspTinyUSB/tinyusb/src/osal/osal_freertos.h:118:10: note: suggested alternative: 'xQueueCreateSet'                                                                       return xQueueCreateStatic(qdef->depth, qdef->item_sz, (uint8_t*) qdef->buf, &qdef->sq);          ^~~~~~~~~~~~~~~~~~                                                                        xQueueCreateSet
[11/134] Building CXX object esp-idf/arduin...no.dir/libraries/Update/src/Updater.cpp.obj ninja: build stopped: subcommand failed.                                                  ninja failed with exit code 1
chegewara commented 4 years ago

Please try tinyusb with this commit: d9496256cf5979f4bf2a6eb915e098861a459394

and try idf.py fullclean or delete old build directory. Its possible your sdkconfig is keeping changes you did.

meltdown03 commented 4 years ago

I tried that, still same errors, I also deleted everything and recloned it all and still get the same thing. It's almost like the functions are not declared first and some includes are happening in the wrong order.

On Sat, Jun 13, 2020, 8:07 AM chegewara notifications@github.com wrote:

Please try tinyusb with this commit: d9496256cf5979f4bf2a6eb915e098861a459394

and try idf.py fullclean or delete old build directory. Its possible your sdkconfig is keeping changes you did.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chegewara/esp32s2-tinyusb-arduino-as-component/issues/1#issuecomment-643621439, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPBQCGUDHHG5RCX7N3H2I3RWN22PANCNFSM4N47A5GQ .

chegewara commented 4 years ago

What version of esp-idf are you using?

To me it looks like you have disabled 1 FreeRTOS option in menuconfig: FREERTOS_SUPPORT_STATIC_ALLOCATION

chegewara commented 4 years ago

Ok, the sdkconfig is missing.

sdkconfig.txt

meltdown03 commented 4 years ago

I'm using the latest commit of the master branch, that option is normally disabled. I enabled it, then I got the mbedtls error, so I had to enable PSK ciphersuites and finally got it to build. Thanks so much for the help!

On Sat, Jun 13, 2020, 8:31 AM chegewara notifications@github.com wrote:

What version of esp-idf are you using?

To me it looks like you have disabled 1 FreeRTOS option in menuconfig: FREERTOS_SUPPORT_STATIC_ALLOCATION

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chegewara/esp32s2-tinyusb-arduino-as-component/issues/1#issuecomment-643624285, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPBQCCDS2XQL7NXI67VVE3RWN5TDANCNFSM4N47A5GQ .

chegewara commented 4 years ago

Yes, i tested with fresh git clone and you have to use that sdkconfig, because normally you aare using sdkconfig from arduino when work as component. Now it will works.

meltdown03 commented 4 years ago

Yes, it works now. Thank you for all your help and your contributions to the esp32-s2 development.

On Sat, Jun 13, 2020, 8:46 AM chegewara notifications@github.com wrote:

Yes, i tested with fresh git clone and you have to use that sdkconfig, because normally you aare using sdkconfig from arduino when work as component. Now it will works.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/chegewara/esp32s2-tinyusb-arduino-as-component/issues/1#issuecomment-643626114, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPBQCCGAXJY6ASBRDN3JSDRWN7MTANCNFSM4N47A5GQ .