pd-rs / crank

A wrapper for cargo to use creating games for the Playdate handheld gaming system.
MIT License
83 stars 16 forks source link

Support hardware revB & SDK v2.0.1 #42

Closed boozook closed 11 months ago

boozook commented 1 year ago

related issue: crankstart #45

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

boozook commented 1 year ago

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

boozook commented 12 months ago

I need feedback to merge it.

tjkirch commented 12 months ago

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

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

adamsoutar commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

Test Requirements

_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 commented 11 months ago

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 commented 11 months ago

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

boozook commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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 commented 11 months ago

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

boozook commented 11 months ago

Cross Reference Table spam fixed. Ready to merge.

boozook commented 9 months ago

@adamsoutar, is that problem steel exist?