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

Support hardware revB & SDK v2.0.1 #42

Merged
merged 4 commits into from
Jul 15, 2023
Merged

Support hardware revB & SDK v2.0.1 #42

merged 4 commits into from
Jul 15, 2023

Conversation

boozook
Copy link
Member

@boozook boozook commented Jun 27, 2023

related issue: crankstart #45

Note: This is MVP, highly need testing and reviewing. 🙄

@boozook
Copy link
Member Author

boozook commented Jun 27, 2023

There's missed new list icon for Crank.toml. I'll add it.

@boozook
Copy link
Member Author

boozook commented Jul 4, 2023

I need feedback to merge it.

@boozook boozook marked this pull request as ready for review July 4, 2023 08:54
@tjkirch
Copy link
Contributor

tjkirch commented Jul 7, 2023

I gave this a test, using all combinations just out of curiosity.

  • With simulator 1.x: OK
  • With simulator 2.0: OK
  • With device 1.x: After compilation, it prints "Cross Reference Table" and 1,385 lines of a symbol/file table, seemingly listing every symbol in the game; hopefully this can be hidden. When the game goes to start, the device crashes with "CAPI handler function wasn't located in loaded data", which I believe is incorrect - I think it should say "Updated Needed" for a 2.0 build that 1.x firmware knows not to launch.
  • With device 2.0: I get the same Cross Reference Table spam, then the device hard freezes in a way I haven't seen before. Eventually an error pops up and links to https://help.play.date/e0/

I can't actually review the code changes in this PR; I'm hoping someone else understands them to give a proper review.

@adamsoutar
Copy link

Hey, maintainer of https://github.com/adamsoutar/playboy here 👋

This patch hasn't quite worked for me (but thanks for working on it!). It builds+runs successfully on Simulator, but when building with crank build --device, compilation fails like so:

warning: dropping unsupported crate type `cdylib` for target `thumbv7em-none-eabihf`

warning: `playboy` (lib) generated 1 warning
    Finished dev [optimized + debuginfo] target(s) in 0.03s
/usr/local/playdate/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld: /Users/adam/Projects/playboy/target/thumbv7em-none-eabihf/debug/libplayboy.a(compiler_builtins-9c4f4ae0d9c39fb0.compiler_builtins.d1210c5e9d2346bd-cgu.1.rcgu.o): in function `compiler_builtins::mem::impls::copy_forward::copy_forward_misaligned_words':
/Users/adam/.cargo/registry/src/index.crates.io-6f17d22bba15001f/compiler_builtins-0.1.95/src/mem/impls.rs:76: undefined reference to `core::panicking::panic'
collect2: error: ld returned 1 exit status
Error: gcc failed with error ExitStatus(unix_wait_status(256))

crank package doesn't hard-fail, but it produces a PDX that crashes to e0 as described by @tjkirch

@CarlosMendonca
Copy link

CarlosMendonca commented Jul 9, 2023

Hi. Thanks for working on this patch. I tested this on Windows 11. Works on simulator 2.0, but I get an e0 crash on device 2.0 similar to @tjkirch above when I try to run something as simple as the hello_world.rs from the crankstart repo. I'll try some other things and report back, but let me know if there's any information that can help you here.

Same e0 error was reported here, suggesting a fix coming soon, but I have no idea if it has anything to do with what we're seeing here.

I tried the hard-coded ARM compiler v9-2019-q4-major and v10 2021.10, I think. Same issue.

Edit: building on a Mac, which uses the same v9-2019-q4-major compiler from the SDK (installed to /usr/local/playdate) resulted in the same issue. On Windows, compiler v12.2.mpacbti-rel1 (the latest right now) also resulted in the same issue. I checked and this version compiles the Hello World C example from the SDK (on PlaydateSDK/C_API/Examples/Hello World) with no issues.

@boozook boozook marked this pull request as draft July 11, 2023 19:55
@boozook
Copy link
Member Author

boozook commented Jul 11, 2023

Test Requirements

  • PATCHED PDC
  • nightly rust toolchain

Place the patched pdc to replace the existing one in the SDK. The patched pdc must be at $PLAYDATE_SDK_PATH/bin/pdc.

@tjkirch

Cross Reference Table

It will be hidden, thanks for remind 👍

the device crashes with "CAPI handler function wasn't located in loaded data"
and
device hard freezes in a way I haven't seen before ... error e0

Please read Test Requirements few lines above. PDC in SDK 2.0 have issues with sections and reloc-table. Try to use patched pdc.

@adamsoutar, @CarlosMendonca What version of pdc did you use?


Sorry for inconvenience and missed instructions for testing.

Thanks to all so much for feedback! ❤️‍🔥 It absolutely necessary.

This PR still need tests and feedback, as well as pathed pdc will released in the SDK.

@boozook
Copy link
Member Author

boozook commented Jul 11, 2023

Also, a little bit of good secret news

Currently I'm working on "crank2.0". That's my private private project, currently private but I want to open source it. That's not a fork of crank, but initially highly inspired by crank. That's almost year of lazy work. It will probably be published in a separate repository in the near future, or in the crank repository here. Exactly how will be a joint decision of all maintainers of the org.

@tjkirch
Copy link
Contributor

tjkirch commented Jul 11, 2023

I tested your change with SDK 2.0.1, which has the pdc segment fix, and it does now launch on device.

@boozook
Copy link
Member Author

boozook commented Jul 12, 2023

Well, SDK2.0.1 just released with fixed pdc as I hope.

pdc: fixed processing of pdex.elf files with more than one segment

@CarlosMendonca
Copy link

Confirmed it works with the patched pdc.exe (2.0.0-dev.156439) on Windows 11 with the latest ARM compiler ("12.2.MPACBTI-Rel1 (Build arm-12-mpacbti.34)) 12.2.1 20230214"). Thanks, @boozook! It should work with SDK 2.0.1 binaries that were released today.

For Windows users, SDK 2.0.1 is not yet available on Winget, but people can install it manually. I'll probably submit a PR to the Winget package repo later.

@boozook
Copy link
Member Author

boozook commented Jul 14, 2023

For Windows users, SDK 2.0.1 is not yet available on Winget, but people can install it manually. I'll probably submit a PR to the Winget package repo later.

Look at how implemented "latest" in the get-playdate-sdk action.
That's already works!

@boozook
Copy link
Member Author

boozook commented Jul 14, 2023

So, I'll update CI here and then will merge this pr.

@boozook boozook marked this pull request as ready for review July 15, 2023 18:47
@boozook
Copy link
Member Author

boozook commented Jul 15, 2023

Cross Reference Table spam fixed.
Ready to merge.

@boozook boozook merged commit 6a7b1ac into main Jul 15, 2023
@boozook boozook deleted the revB-sdk2.0 branch July 15, 2023 18:52
@boozook boozook changed the title Support hardware revB & SDK v2.0 Support hardware revB & SDK v2.0.1 Jul 15, 2023
@boozook
Copy link
Member Author

boozook commented Sep 15, 2023

@adamsoutar, is that problem steel exist?

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