mirror of https://github.com/ArduPilot/ardupilot
AP_Filesystem: added option @SYS/flash.bin
useful for speed tests
This commit is contained in:
parent
0f0aed66b7
commit
11ea2cf5c1
|
@ -52,6 +52,9 @@ static const SysFileList sysfs_file_list[] = {
|
|||
#endif
|
||||
{"crash_dump.bin"},
|
||||
{"storage.bin"},
|
||||
#if AP_FILESYSTEM_SYS_FLASH_ENABLED
|
||||
{"flash.bin"},
|
||||
#endif
|
||||
};
|
||||
|
||||
int8_t AP_Filesystem_Sys::file_in_sysfs(const char *fname) {
|
||||
|
@ -152,6 +155,13 @@ int AP_Filesystem_Sys::open(const char *fname, int flags, bool allow_absolute_pa
|
|||
r.str->set_buffer((char*)ptr, size, size);
|
||||
}
|
||||
}
|
||||
#if AP_FILESYSTEM_SYS_FLASH_ENABLED
|
||||
if (strcmp(fname, "flash.bin") == 0) {
|
||||
void *ptr = (void*)0x08000000;
|
||||
const size_t size = BOARD_FLASH_SIZE*1024;
|
||||
r.str->set_buffer((char*)ptr, size, size);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (r.str->get_length() == 0) {
|
||||
errno = r.str->has_failed_allocation()?ENOMEM:ENOENT;
|
||||
|
|
|
@ -50,3 +50,6 @@
|
|||
#define AP_FILESYSTEM_FILE_READING_ENABLED (AP_FILESYSTEM_FILE_WRITING_ENABLED || AP_FILESYSTEM_ROMFS_ENABLED)
|
||||
#endif
|
||||
|
||||
#ifndef AP_FILESYSTEM_SYS_FLASH_ENABLED
|
||||
#define AP_FILESYSTEM_SYS_FLASH_ENABLED CONFIG_HAL_BOARD == HAL_BOARD_CHIBIOS
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue