emosenkis / esp-rs

Script for installing/running toolchain for building ESP8266 firmware in Rust
MIT License
329 stars 19 forks source link

ESP32 support? #9

Open blanham opened 6 years ago

blanham commented 6 years ago

Would it be possible to support the ESP32 in addition to the ESP8266?

emosenkis commented 6 years ago

Yes, it should be possible to support both, but it would need some sort of configuration to allow it to use different toolchains, flags, etc. for different target chips/boards. If you're interested in working on it, I can give you some pointers. Otherwise, I'm thinking about rewriting the project in Rust since it's gotten quite complex for a shell script. If that happens, I'll try to build that sort of configurability in from the start.

blanham commented 6 years ago

I'd be willing to try my hand at it. How would you advise me to start?

emosenkis commented 6 years ago

I would start by trying to rebase @Eroc33's changes to support ESP32: https://github.com/Eroc33/esp-rs/commit/f3cdaf88c4369441de645e7ed0718777e1099a11 on top of HEAD.

I don't know if they work, but they seem to make changes in all the right places.

TheDan64 commented 6 years ago

@blanham were you able to make any progress with this? I would also love to see ESP32 support

jcard0na commented 5 years ago

I have started to work on this and I think I'm very close. You can see my progress here: https://github.com/jcard0na/esp-rs/branches

At the moment the ESP32 build fails when running bindgen:

End of search list.
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:47:9: error: unknown type name 'pthread_t'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:48:9: error: unknown type name 'pthread_key_t'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:49:9: error: unknown type name 'pthread_once_t'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:50:9: error: unknown type name 'pthread_mutex_t'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:51:9: error: unknown type name 'pthread_mutex_t'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:52:9: error: unknown type name 'pthread_cond_t'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:662:19: error: use of undeclared identifier 'pthread_create'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:668:19: error: use of undeclared identifier 'pthread_join'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:674:19: error: use of undeclared identifier 'pthread_detach'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:680:19: error: use of undeclared identifier 'pthread_equal'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:686:19: error: use of undeclared identifier 'pthread_self'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:692:19: error: use of undeclared identifier 'sched_yield'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:699:21: error: use of undeclared identifier 'pthread_once'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:707:19: error: use of undeclared identifier 'pthread_key_create'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:713:19: error: use of undeclared identifier 'pthread_key_delete'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:719:19: error: use of undeclared identifier 'pthread_getspecific'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:725:19: error: use of undeclared identifier 'pthread_setspecific'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:732:14: error: use of undeclared identifier 'pthread_mutex_init'
/root/.platformio/packages/toolchain-xtensa32/xtensa-esp32-elf/include/c++/5.2.0/xtensa-esp32-elf/bits/gthr-default.h:739:21: error: use of undeclared identifier 'pthread_mutex_destroy'
fatal error: too many errors emitted, stopping now [-ferror-limit=]

I have little time to work on this and I'm a complete n00b with rust toolchain, so it may take me some time. Suggestions welcome.

emosenkis commented 5 years ago

This project is now deprecated. Please see http://quickhack.net/nom/blog/2019-05-14-build-rust-environment-for-esp32.html for a more direct approach to compiling Rust for Xtensa targets.