Skip to content
This repository has been archived by the owner on Apr 11, 2022. It is now read-only.

Issue with undefined reference to .L #1

Closed
lexxvir opened this issue Mar 20, 2019 · 5 comments
Closed

Issue with undefined reference to .L #1

lexxvir opened this issue Mar 20, 2019 · 5 comments

Comments

@lexxvir
Copy link

lexxvir commented Mar 20, 2019

Hi @MabezDev,

Thank you for your effort to bring xtensa arch to Rust!

I am in process to port our bare-metal SW written in Rust+C mix from Cortex-M device to ESP32.

Currently I able to blink by LED on the board :)

Now I trying to output some text (&str) into UART. I encountered to following error on linking:

target/xtensa-none-elf/release/deps/esp32_hello-53491af6071c1b49.esp32_hello.wtaa4xj7-cgu.0.rcgu.o:(.literal._ZN11esp32_hello10rust_blink17he8ce6b3bf0257d54E+0x8): undefined reference to `.L'
          collect2: error: ld returned 1 exit status

But, I fixed it (occasionally) by adding "-C", "save-temps" to rustflags table in .cargo/config.

So, I think it will be useful, if you add comment about such trick somewhere in Readme file.

@MabezDev
Copy link
Owner

Thanks! I haven't personally run into this issue but I'll add it to the FAQ asap.

Currently I able to blink by LED on the board :)

Do you mean you have an ESP32 blinking with Rust?

@lexxvir
Copy link
Author

lexxvir commented Mar 24, 2019

I use bindings to ESP-IDF that do all work. I've upload my project to github: https://github.com/lexxvir/esp32-hello

@MabezDev
Copy link
Owner

That's awesome thanks for sharing! I haven't had the time to test whether my custom rustc actually built proper xtensa binaries, glad to see it's working for you! If you don't mind, I'd like to link your project in the readme too?

Also if you are interested, in the next few weeks when my workload dies down a bit I will be starting work on proper runtime crates https://github.com/esp-rs . I had the same idea of using the IDF intially for the runtime and building the rust application on top. It would be cool if we could work together on this :).

@lexxvir
Copy link
Author

lexxvir commented Mar 24, 2019

Yes, link please my repo. I think ESP required significant efforts to be usable in Rust (as Cortex-M is). So if people see that there is quickstart (template) project, it can help to attract attention to development.

My plan is to write shims/wrappers around ESP-IDF, because I need to port existed SW from Cortex-M device ASAP. I think writing runtime/foundation crates in pure Rust from scratch is too complicated task for me.
So we can join efforts to write wrappers around ESP-IDF.

@lexxvir
Copy link
Author

lexxvir commented Apr 9, 2019

I've investigated it slightly further, it seems enough --emit llvm-bc,link to workaround this issue. -C save-temps annoyed with "warning: -C save-temps might not produce all requested temporary products when incremental compilation is enabled.". Also see https://github.com/espressif/llvm-xtensa/issues/4.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants