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

Protecting parameters from eeprom from copying after reinstalling the firmware #26336

Closed
NotShittyProgrammer opened this issue Feb 27, 2024 · 16 comments
Labels

Comments

@NotShittyProgrammer
Copy link

Good afternoon, I am facing a problem - I wrote a custom firmware that does not display values ​​from the eeprom in the mission planner. But when I install the official firmware, the params list appears. I can block it in theory, here's a link on how to do it:

https://ardupilot.org/dev/docs/secure-firmware.html

However, if I install the official firmware through the stm32cubeprogrammer, I will still see the values ​​from the eeprom. Is there any way I can block this or reset the values ​​to default every time someone tries to install a new firmware version?

@rmackay9
Copy link
Contributor

rmackay9 commented Feb 28, 2024

Hi @NotShittyProgrammer,

I think if your special firmware was modified so that it used a different FORMAT_VERSION then when the standard firmware is uploaded the parameters will be reset

Let's close this issue if you're happy with this solution 'cuz really this is a question so it shouldn't be here on our to-do list.

@NotShittyProgrammer
Copy link
Author

Sorry for spamming in this section. Yes, it should be, but when I change this param in my plane’s firmware, build it and then upload - FORMAT_VERSION is the same as it was before and eeprom did not resets

@rmackay9
Copy link
Contributor

@NotShittyProgrammer,

So I guess you changed this line in Copter? .. or this line in Plane?

@NotShittyProgrammer
Copy link
Author

NotShittyProgrammer commented Feb 28, 2024

Yep, this line for plane and built a plane firmware

@rmackay9
Copy link
Contributor

rmackay9 commented Feb 28, 2024

Thanks @NotShittyProgrammer,

I may have reproduced the problem in SITL by doing the following:

  1. cd ardupilot/ArduCopter
  2. rm eeprom.bin (to clear all parameters)
  3. start SITL (sim_vehicle.py --map --console)
  4. param set MNT1_TYPE 8
  5. reboot the autopilot and confirm the parameter MNT1_TYPE is still 8
  6. update k_format_version to 121 (currently 120 for Copter)
  7. start SITL and confirm that MNT1_TYPE has not been reset to 0 as it should have been

If the above procedure is followed for the Copter-4.5 branch the parameter is reset correctly. If it is done for "master" (aka "latest") the parameter is not reset. It remains at 8.

@NotShittyProgrammer
Copy link
Author

I did not understand you well. My goal is to erase eeprom parameters when I install new firmware after mine, so no one could see my previous eeprom params list. So I changed format_version to 14 for plane so it would remove old eeprom values. But when I install my new firmware eeprom params did not erased and format_version is still 13.

@rmackay9
Copy link
Contributor

@NotShittyProgrammer,

Are you using a very recent version of master (aka "latest")? I think the issue may be due to a recent change..

@NotShittyProgrammer
Copy link
Author

Yes, I am using the latest version. Should I switch to another branch or previos commits?

@rmackay9
Copy link
Contributor

@NotShittyProgrammer,

I'm not sure, I was able to reproduce the issue once but now I'm unable to. I've added the issue to the Copter-4.5 issues list although I suspect it only affects master. I've also alerted @peterbarker who I think is most familiar with this area.

You might want to try following the procedure I've mentioned above for reproducing the issue in SITL. Basically we need to be able to reproduce the issue in order to narrow down how to fix it.

@NotShittyProgrammer
Copy link
Author

Thanks, I will be waiting for further details🫡

@rmackay9
Copy link
Contributor

Hi @NotShittyProgrammer,

I've tested further and I think changing k_format_version does actually work. The issues that I was facing were, I think, caused by unrelated mission planner problems to do with support for the dual CPU CubeRed.

Which autopilot are you using? I'm happy to create two binaries with only the format_version changed and I think you'll find that loading one of them clears out the autopilot's parameters.

@NotShittyProgrammer
Copy link
Author

I am using current ArduPilot repository and I build firmware for CUAV-X7. But I really need to build it on different controllers. I will try to find older version where this trick with k_format_version work

@rmackay9
Copy link
Contributor

@NotShittyProgrammer,

OK, although I find that even with master it works.

@NotShittyProgrammer
Copy link
Author

photo_2024-02-28 14 15 08
photo_2024-02-28 14 15 11
Still get the same FORMAT_VERSION

@rmackay9
Copy link
Contributor

@NotShittyProgrammer,

I've created two binaries here built on master. One has the format-version of 13, the other 14. Could you try these two?
https://www.dropbox.com/scl/fi/qb5u4z5s66sl3l40ufs3z/arduplane-460dev-cuavx7.zip?rlkey=881sgccw9zijq573vfwug7t22&dl=0

@rmackay9
Copy link
Contributor

rmackay9 commented Mar 5, 2024

Hi @NotShittyProgrammer,

I'm going to go ahead and close this issue now. Please tell me if the above binaries don't work for you.

@rmackay9 rmackay9 closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants