Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated ESP32-C6 valid targets #402

Closed
wants to merge 2 commits into from
Closed

Updated ESP32-C6 valid targets #402

wants to merge 2 commits into from

Conversation

Nassiel
Copy link

@Nassiel Nassiel commented May 8, 2023

Removed incompatible targets of ESP32-C6 and added only IMAC ones
Updated to RC5

Removed uncompatible targets of ESP32-C6 and added IMAC ones
Copy link
Member

@MabezDev MabezDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you run rustfmt to fix the CI, and also revert the version change, we haven't actually released rc4 yet. Other than that, looks good to me!

Reverted to rc.4
"riscv32imc-esp-espidf",
"riscv32imc-unknown-none-elf",
]
&["riscv32imac-unknown-none-elf", "riscv32imac-esp-espidf"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is riscv32imc really "invalid"? I'm not sure why you'd want to build without the atomic extension but it's perfectly valid to do so. I don't really understand the motivation behind removing it.

If we are removing it, then the ESP32-H2 needs to be updated as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not invalid, but almost certainly a mistake. Tbh, I've never really liked that we hard error here on a target mismatch. I think it should be a warning instead, but we can discuss that another time :D.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It wasn't a mistake, it was to be consistent with the other RISC-V chips. The C2 and C3 both have riscv32imac listed as supported, which they do not technically support either. But I guess it doesn't really matter that much.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not saying using riscv32imac for C2/C3 is a mistake, I'm saying using riscv32imc on a target that has native support for atomics would be a mistake, there isn't a reason not to use that target for the C6.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For IDF, the std launches a huge linker error trying to find the functions for "A" for std unsuccessfully. So there, it is "invalid". I'll try imc for no_std, but I believe It'll fail for the same reason but core this time instead of std.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested the riscv32imc on the C6. If you don't try to use core::sync::atomic, it compiles.

But, and this is my opinion: This is a new release of hardware, where among other things, the nice thing is the atomic support and no backward compatibility breaks by changing the target to imac. So, if you prefer to support riscv32imac-unknown-none-elf and riscv32imc-unknown-none-elf, let me know to add it too.

On the other hand, if you're already deciding to migrate to this hardware, and that "forces" you to change to imac the only work you have to do is move out from polyfill, and most of the embedded libs out there already have automatic detection and start using native support if it's available.

But for sure, if you try to use riscv32imc-esp-espidf, it doesn't compile. I opened an issue with the whole detail

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, for whatever reason GitHub doesn't let you control which lines are shown in the preview (kind of defeats the purpose, doesn't it?).

I was referring only to the bare-metal targets; I don't use the IDF stuff and frankly don't really care about it, you can do whatever you want with those targets.

Regardless, my opinion seems to be controversial for whatever reason, so as I requested earlier can we just update the H2 as well please so we can get this wrapped up?

@seanaye
Copy link

seanaye commented May 16, 2023

I installed this branch locally but I'm unable to successfully flash. I copied the target config riscv32imac-esp-espidf.json to the root and run

cargo -Z unstable-options  espflash flash --release --monitor --target riscv32imac-esp-espidf
[2023-05-16T21:54:58Z INFO ] Detected 8 serial ports
[2023-05-16T21:54:58Z INFO ] Ports which match a known common dev board are highlighted
[2023-05-16T21:54:58Z INFO ] Please select a port
[2023-05-16T21:55:00Z INFO ] Serial port: '/dev/cu.usbserial-110'
[2023-05-16T21:55:00Z INFO ] Connecting...
[2023-05-16T21:55:01Z INFO ] Using flash stub
   Compiling core v0.0.0 (/Users/seanaye/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core)
   Compiling regex-syntax v0.7.1
   Compiling quote v1.0.27
   Compiling libc v0.2.144
   Compiling memchr v2.5.0
   Compiling log v0.4.17
   Compiling syn v1.0.109
   Compiling glob v0.3.1
   Compiling io-lifetimes v1.0.10
   Compiling lazy_static v1.4.0
error: could not compile `core` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
error: Error loading target specification: Could not find specification for target "riscv32imac-esp-espidf". Run `rustc --print target-list` for a list of built-in targets

@MabezDev
Copy link
Member

I installed this branch locally but I'm unable to successfully flash. I copied the target config riscv32imac-esp-espidf.json to the root and run

cargo -Z unstable-options  espflash flash --release --monitor --target riscv32imac-esp-espidf
[2023-05-16T21:54:58Z INFO ] Detected 8 serial ports
[2023-05-16T21:54:58Z INFO ] Ports which match a known common dev board are highlighted
[2023-05-16T21:54:58Z INFO ] Please select a port
[2023-05-16T21:55:00Z INFO ] Serial port: '/dev/cu.usbserial-110'
[2023-05-16T21:55:00Z INFO ] Connecting...
[2023-05-16T21:55:01Z INFO ] Using flash stub
   Compiling core v0.0.0 (/Users/seanaye/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core)
   Compiling regex-syntax v0.7.1
   Compiling quote v1.0.27
   Compiling libc v0.2.144
   Compiling memchr v2.5.0
   Compiling log v0.4.17
   Compiling syn v1.0.109
   Compiling glob v0.3.1
   Compiling io-lifetimes v1.0.10
   Compiling lazy_static v1.4.0
error: could not compile `core` (lib) due to previous error
warning: build failed, waiting for other jobs to finish...
error: Error loading target specification: Could not find specification for target "riscv32imac-esp-espidf". Run `rustc --print target-list` for a list of built-in targets

Yeah this is the downside of it being an error when the target mismatches (see here: #402 (comment)) I often run custom targets via json files and always run into this. The work around is to use espflash via cargo run instead of cargo espflash e.g: https://github.com/esp-rs/esp-hal/blob/ffe167e64c157199fa37eb10a1097b7c52b85839/esp32c6-hal/.cargo/config.toml#L2

@jessebraham
Copy link
Member

Since the requested changes have not yet been made and I'm making a push to get a release out, I've opened #424 which supersedes this PR. Thanks for you contribution regardless, though!

@jessebraham jessebraham closed this Jun 7, 2023
@Nassiel
Copy link
Author

Nassiel commented Jul 13, 2023

Since the requested changes have not yet been made and I'm making a push to get a release out, I've opened #424 which supersedes this PR. Thanks for you contribution regardless, though!

You're welcome, but sorry to ask, what changes where requested? Formating was done and I'm not aware of any other ones.

In the end now it doesn't matter anymore but I'd like to know for the next time :)

Anyhow, sorry that I didn't make them and you have to do it again!

@jessebraham
Copy link
Member

jessebraham commented Jul 13, 2023

The ESP32-C6 was updated but the ESP32-H2 never was. Sorry, I guess I wasn't very clear about that in hindsight. No big deal, I'm just impatient 😁

@Nassiel
Copy link
Author

Nassiel commented Jul 15, 2023

The ESP32-C6 was updated but the ESP32-H2 never was. Sorry, I guess I wasn't very clear about that in hindsight. No big deal, I'm just impatient 😁

Fair enough! Truth being told, I didn't understand I should add that and on the other hand, I wasn't capable to test it. I don't have an H2 in my hands (yet) so it's ok.

Thanks @jessebraham !

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

Successfully merging this pull request may close these issues.

4 participants