vedderb / bldc

The VESC motor control firmware
2.1k stars 1.32k forks source link

Adds vesc_c_if nvm access #588

Closed Blevruz closed 1 year ago

Blevruz commented 1 year ago

Adds a way for packages to edit sector 8 of flash memory. The reasoning for choosing sector 8 is that this sector seems to only be used when downloading a new app, in which case it is probably fine to wipe a package's memory.

TODO:

vedderb commented 1 year ago

I would prefer to move the code to flash_helper and reuse the write_data function for the writing. Also, it would be better to write an array than writing one byte at a time, you can make the same range checks then too. Also, new functions should be added to the end of vesc_c_if - if you add them in the middle you break binary compatibility with all existing packages.

Blevruz commented 1 year ago

I think this should address those concerns; code compiles, so I'll be trying to test it now.

Blevruz commented 1 year ago

Cursory testing was satisfactory enough (could do the read, write and wipe operations). Going to check style then squash commits, probably.

vedderb commented 1 year ago

Looks better now! Only thing now is that the functions in flash_helper should be prefixed with flashhelper and not if_.