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

[Enhancement] firmware: Support reporting the current version of Katapult. #87

Closed
Laikulo opened this issue Sep 7, 2023 · 8 comments
Closed

Comments

@Laikulo
Copy link

Laikulo commented Sep 7, 2023

Add a command (or extend CONNECT) to report the version of canboot (possibly from git describe or a .version file if not in a git repo at build time). This would allow for software to query and update canboot (via deployer or other methods) conditionally.

@gpread
Copy link

gpread commented Sep 10, 2023

The ability to receive Katapult version info as well as UUID in a query response would be very helpful. With multiple versions and since AFAIK there is currently no easy automatic Katapult version updater (and perhaps people would not be easily convinced to use one for updates anyway) it is valuable to know definitively if you need to update and how many revisions you may be skipping when deploying the most current one and/or which version you would be wanting to revert to if you found an incompatibility/problem with newer one.

@krautech
Copy link

This functionality would also be greatly appreciate for everything already mentioned. I'll look into this myself but no guarantees. @Arksine anywhere I should be looking in specific to pulling the current Katapult version on the device?

@kdomanski
Copy link

kdomanski commented Aug 3, 2024

Hey, I've been looking into this a while ago and the update to the thread reminded me to write down the takeaways.

The only workable solution IMO seems to be passing data to the Klipper payload similar to how bootloaders pass parameters (so-called "atags") to the Linux kernel. It seems to work by reserving a small piece of memory above the stack and passing its address through a register before jumping to the kernel. The address contains a list of structs. Then Klipper would have to pick up the address, validate the data and read it.

See:


EDIT: Nevermind. I just realized this issue is about getting the Katapult version from Katapult, not from Klipper.

@Arksine
Copy link
Owner

Arksine commented Aug 6, 2024

FWIW, I have an implementation of this that I intend to push soon. As requested, it uses git describe and falls back on a .version file in the katapult folder if its not a git repo.

There are several approaches that can be taken to accomplish this, I used Kconfig. By doing so the version is defined in autoconf.h, making the change minimal. This means that its a good idea to clean before building a new version, since we need to make sure that autoconf.h is regenerated before the build. Failing to do so could result in a build containing stale version info.

@krautech
Copy link

krautech commented Aug 6, 2024

Excellent news!

That's roughly what I came up with temporarily but my version involved using json and having version information hosted somewhere (git etc)

Yours is much more elegant 👍🏻

@Arksine
Copy link
Owner

Arksine commented Aug 6, 2024

I have added this commit to PR #126. If some of you want to test it before I merge feel free to do so.

The flashtool script should still work for devices flashed with previous versions of Katapult, the software version should return as "?". I have done some initial testing, but would still like to test all of the interfaces before I merge.

The output should look like the following:

Flashing Serial Device /dev/ttyACM0, baud 250000
Attempting to connect to bootloader
Katapult Connected
Software Version: v0.0.1-68-gb768c12
Protocol Version: 1.1.0
Block Size: 64 bytes
Application Start: 0x8002000
MCU type: stm32f103xe
Flashing '/home/eric/klipper/out/klipper.bin'...

@krautech
Copy link

krautech commented Aug 7, 2024

Ill run through this a bunch today and tomorrow and provide feedback 👍🏻

@krautech
Copy link

krautech commented Aug 7, 2024

I have added this commit to PR #126. If some of you want to test it before I merge feel free to do so.

The flashtool script should still work for devices flashed with previous versions of Katapult, the software version should return as "?". I have done some initial testing, but would still like to test all of the interfaces before I merge.

The output should look like the following:

Flashing Serial Device /dev/ttyACM0, baud 250000
Attempting to connect to bootloader
Katapult Connected
Software Version: v0.0.1-68-gb768c12
Protocol Version: 1.1.0
Block Size: 64 bytes
Application Start: 0x8002000
MCU type: stm32f103xe
Flashing '/home/eric/klipper/out/klipper.bin'...

Is working for me so far :D
Flashed via USB using flashtool works as described.

@Arksine Arksine closed this as completed Sep 3, 2024
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

No branches or pull requests

5 participants