flipperzero-rs / flipperzero

Rust on the Flipper Zero
MIT License
518 stars 34 forks source link

Creating new app with template gives error after deploy to FZ #133

Closed ASoldo closed 8 months ago

ASoldo commented 8 months ago

Hi, after updating FZ to latest development branch and created demo app i get this error (that ApiTooOld). Firmware Api Version: 58. Anybody know what to do here? image

JarvisCraft commented 8 months ago

@ASoldo, hi there! I've just opened the PR to update to the lastest SDK version: #134.

Please try using its branch and test if it fixes the issue.

ASoldo commented 8 months ago

This is what I did but I get the same error message after moving .fap to FZ and running it.

[dependencies]
flipperzero = { git = "https://github.com/flipperzero-rs/flipperzero", branch = "sdk-0.99.1" }
flipperzero-sys = { version = "0.11.0" }
flipperzero-rt = { version = "0.11.0" }
JarvisCraft commented 8 months ago

You should also update -sys and rt references to the same repo (especially, -sys since it holds the binding to the specific API version)

ASoldo commented 8 months ago

I did try that but it gives me this error when cargo build

[dependencies]
flipperzero = { git = "https://github.com/flipperzero-rs/flipperzero", branch = "sdk-0.99.1" }
flipperzero-sys = { git = "https://github.com/flipperzero-rs/flipperzero", branch = "sdk-0.99.1" }
flipperzero-rt = { git = "https://github.com/flipperzero-rs/flipperzero", branch = "sdk-0.99.1" }

image

JarvisCraft commented 8 months ago

Hmm, that's strange; I will take a look at it

JarvisCraft commented 8 months ago

Oh, I get it now.

We haven't updated the template repository yet, but the signature of the main function has changed recently. Now it accepts an Option<&CStr> instead of the raw *mut u8.

You just have to update it in your application as done in #125.

JarvisCraft commented 8 months ago

Oh, I get it now.

We haven't updated the template repository yet, but the signature of the main function had changed recently. Now it accepts an Option<CStr> instead of the raw *const u8.

You just have to update it in your application as done in #125.

JarvisCraft commented 8 months ago

Also, the above PR with API version bump has been merged so you can now use main branch.

ASoldo commented 8 months ago

Yes, now it works, I have switched to main and manually update main function.

ASoldo commented 8 months ago

After today's FZ firmware update I face the same (ApiTooOld) after successful build and run on device.

dcoles commented 8 months ago

Hi @ASoldo,

Any time there is a major revision to the Flipper API, we gave to regenerate the bindings since the Flipper API is only compatible across minor API changes. Unfortunately this happens every few firmware updates (any ABI breakage triggers a new major SDK version).

One option is to manually regenerate the bindings. Typically the actual changes are pretty minor, so don't require any changes on the Rust side. The other is just sticking on the last supported SDK/firmware.

We have #41 as an issue to automate the generation of the bindings. I'd personally like to move away from bundling the bindings in the repository and have them generated at Rust build time, but we might also be able to add some better automation so someone doesn't have to manually check-in an updated version of the bindings.

I'm going to close this issue for the moment, since this will keep happening any time there's a major SDK version jump. However I'll see if I can come up with a better solution going forward.