mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-04-08 00:53:48 +02:00
OP-557: Add a UAVO access method to erase the entire flash chip. Normally not
needed by users because if too much changes I change the FS magic and trigger a wipe. Possibly the erase should require a particular "magic" object id value to execute? This would make it harder to do manually through UAVOs though.
This commit is contained in:
parent
2f7f920ef3
commit
35eef66bfe
@ -230,6 +230,11 @@ static void objectUpdatedCb(UAVObjEvent * ev)
|
|||||||
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
|
|| objper.Selection == OBJECTPERSISTENCE_SELECTION_ALLOBJECTS) {
|
||||||
retval = UAVObjDeleteMetaobjects();
|
retval = UAVObjDeleteMetaobjects();
|
||||||
}
|
}
|
||||||
|
} else if (objper.Operation == OBJECTPERSISTENCE_OPERATION_FULLERASE) {
|
||||||
|
retval = -1;
|
||||||
|
#if defined(PIOS_INCLUDE_FLASH_SECTOR_SETTINGS)
|
||||||
|
retval = PIOS_FLASHFS_Format();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if(retval == 0) {
|
if(retval == 0) {
|
||||||
objper.Operation = OBJECTPERSISTENCE_OPERATION_COMPLETED;
|
objper.Operation = OBJECTPERSISTENCE_OPERATION_COMPLETED;
|
||||||
|
@ -116,6 +116,19 @@ int32_t PIOS_FLASHFS_Init()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Erase the whole flash chip and create the file system
|
||||||
|
* @return 0 if successful, -1 if not
|
||||||
|
*/
|
||||||
|
int32_t PIOS_FLASHFS_Format()
|
||||||
|
{
|
||||||
|
if(PIOS_Flash_W25X_EraseChip() != 0)
|
||||||
|
return -1;
|
||||||
|
if(PIOS_FLASHFS_ClearObjectTableHeader() != 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Erase the headers for all objects in the flash chip
|
* @brief Erase the headers for all objects in the flash chip
|
||||||
* @return 0 if successful, -1 if not
|
* @return 0 if successful, -1 if not
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include "uavobjectmanager.h"
|
#include "uavobjectmanager.h"
|
||||||
|
|
||||||
int32_t PIOS_FLASHFS_Init();
|
int32_t PIOS_FLASHFS_Init();
|
||||||
|
int32_t PIOS_FLASHFS_Format();
|
||||||
int32_t PIOS_FLASHFS_ObjSave(UAVObjHandle obj, uint16_t instId, uint8_t * data);
|
int32_t PIOS_FLASHFS_ObjSave(UAVObjHandle obj, uint16_t instId, uint8_t * data);
|
||||||
int32_t PIOS_FLASHFS_ObjLoad(UAVObjHandle obj, uint16_t instId, uint8_t * data);
|
int32_t PIOS_FLASHFS_ObjLoad(UAVObjHandle obj, uint16_t instId, uint8_t * data);
|
||||||
int32_t PIOS_FLASHFS_ObjDelete(UAVObjHandle obj, uint16_t instId);
|
int32_t PIOS_FLASHFS_ObjDelete(UAVObjHandle obj, uint16_t instId);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<xml>
|
<xml>
|
||||||
<object name="ObjectPersistence" singleinstance="true" settings="false">
|
<object name="ObjectPersistence" singleinstance="true" settings="false">
|
||||||
<description>Someone who knows please enter this</description>
|
<description>Someone who knows please enter this</description>
|
||||||
<field name="Operation" units="" type="enum" elements="1" options="NOP,Load,Save,Delete,Completed"/>
|
<field name="Operation" units="" type="enum" elements="1" options="NOP,Load,Save,Delete,FullErase,Completed"/>
|
||||||
<field name="Selection" units="" type="enum" elements="1" options="SingleObject,AllSettings,AllMetaObjects,AllObjects"/>
|
<field name="Selection" units="" type="enum" elements="1" options="SingleObject,AllSettings,AllMetaObjects,AllObjects"/>
|
||||||
<field name="ObjectID" units="" type="uint32" elements="1"/>
|
<field name="ObjectID" units="" type="uint32" elements="1"/>
|
||||||
<field name="InstanceID" units="" type="uint32" elements="1"/>
|
<field name="InstanceID" units="" type="uint32" elements="1"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user