BBSRAM: add another partition and store the last ulog path

This commit is contained in:
Beat Küng
2017-07-03 18:02:27 +02:00
committed by Lorenz Meier
parent 18ea5ec1f8
commit 1be089cf0c
15 changed files with 102 additions and 33 deletions
+33 -7
View File
@@ -37,20 +37,25 @@
****************************************************************************/
#include <systemlib/px4_macros.h>
#include <stm32_bbsram.h>
#include <board_config.h>
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define HARDFAULT_FILENO 3
#define HARDFAULT_PATH BBSRAM_PATH""STRINGIFY(HARDFAULT_FILENO)
#define HARDFAULT_REBOOT_FILENO 0
#define HARDFAULT_REBOOT_PATH BBSRAM_PATH""STRINGIFY(HARDFAULT_REBOOT_FILENO)
#define HARDFAULT_REBOOT_PATH BBSRAM_PATH "" STRINGIFY(HARDFAULT_REBOOT_FILENO)
#define HARDFAULT_ULOG_FILENO 3
#define HARDFAULT_ULOG_PATH BBSRAM_PATH "" STRINGIFY(HARDFAULT_ULOG_FILENO)
#define HARDFAULT_FILENO 4
#define HARDFAULT_PATH BBSRAM_PATH "" STRINGIFY(HARDFAULT_FILENO)
#define HARDFAULT_MAX_ULOG_FILE_LEN 64 /* must be large enough to store the full path to the log file */
#define BBSRAM_SIZE_FN0 (sizeof(int))
#define BBSRAM_SIZE_FN1 384 /* greater then 2.5 times the size of vehicle_status_s */
#define BBSRAM_SIZE_FN2 384 /* greater then 2.5 times the size of vehicle_status_s */
#define BBSRAM_SIZE_FN3 -1
#define BBSRAM_SIZE_FN3 HARDFAULT_MAX_ULOG_FILE_LEN
#define BBSRAM_SIZE_FN4 -1
/* The following guides in the amount of the user and interrupt stack
* data we can save. The amount of storage left will dictate the actual
@@ -58,7 +63,7 @@
* It will be truncated by the call to stm32_bbsram_savepanic
*/
#define BBSRAM_HEADER_SIZE 20 /* This is an assumption */
#define BBSRAM_USED ((4*BBSRAM_HEADER_SIZE)+(BBSRAM_SIZE_FN0+BBSRAM_SIZE_FN1+BBSRAM_SIZE_FN2))
#define BBSRAM_USED ((4*BBSRAM_HEADER_SIZE)+(BBSRAM_SIZE_FN0+BBSRAM_SIZE_FN1+BBSRAM_SIZE_FN2+BBSRAM_SIZE_FN3))
#define BBSRAM_REAMINING (PX4_BBSRAM_SIZE-BBSRAM_USED)
#if CONFIG_ARCH_INTERRUPTSTACK <= 3
# define BBSRAM_NUMBER_STACKS 1
@@ -77,8 +82,9 @@
#define BSRAM_FILE_SIZES { \
BBSRAM_SIZE_FN0, /* For Time stamp only */ \
BBSRAM_SIZE_FN1, /* For Current Flight Parameters Copy A */ \
BBSRAM_SIZE_FN2, /* For Current Flight Parameters Copy B*/ \
BBSRAM_SIZE_FN3, /* For the Panic Log use rest of space */ \
BBSRAM_SIZE_FN2, /* For Current Flight Parameters Copy B */ \
BBSRAM_SIZE_FN3, /* For the latest ULog file path */ \
BBSRAM_SIZE_FN4, /* For the Panic Log use rest of space */ \
0 /* End of table marker */ \
}
@@ -350,4 +356,24 @@ int hardfault_rearm(char *caller) weak_function;
****************************************************************************/
int hardfault_increment_reboot(char *caller, bool reset) weak_function;
/****************************************************************************
* Name: hardfault_store_ulog_filename
*
* Description:
* Permanently store the current ulog file name. A crash dump will
* be appended to this file (must be ULog).
*
*
* Inputs:
* - log_file: full path to the log file
*
* Returned Value:
*
* OK or errno
*
*
****************************************************************************/
int hardfault_store_ulog_filename(const char *log_file);
__END_DECLS