forked from Archive/PX4-Autopilot
boards: px4_fmu-v5 print RCC reset flags on boot
This commit is contained in:
parent
e9a21ee911
commit
6bef2bdeb1
|
@ -163,20 +163,31 @@ stm32_boardinitialize(void)
|
|||
{
|
||||
board_on_reset(-1); /* Reset PWM first thing */
|
||||
|
||||
/* configure LEDs */
|
||||
|
||||
const uint32_t RCC_CSR = getreg32(STM32_RCC_CSR);
|
||||
|
||||
syslog(LOG_INFO, "[boot] Reset Flags: LSION:%d LSIRDY:%d BOR:%d PIN:%d POR/PDR:%d SFT:%d IWDG:%d WWDG:%d LPWR:%d \n",
|
||||
(RCC_CSR & RCC_CSR_LSION) != 0,
|
||||
(RCC_CSR & RCC_CSR_LSIRDY) != 0,
|
||||
(RCC_CSR & RCC_CSR_BORRSTF) != 0,
|
||||
(RCC_CSR & RCC_CSR_PINRSTF) != 0,
|
||||
(RCC_CSR & RCC_CSR_PORRSTF) != 0,
|
||||
(RCC_CSR & RCC_CSR_SFTRSTF) != 0,
|
||||
(RCC_CSR & RCC_CSR_IWDGRSTF) != 0,
|
||||
(RCC_CSR & RCC_CSR_WWDGRSTF) != 0,
|
||||
(RCC_CSR & RCC_CSR_LPWRRSTF) != 0
|
||||
);
|
||||
|
||||
/* configure LEDs */
|
||||
board_autoled_initialize();
|
||||
|
||||
/* configure pins */
|
||||
|
||||
const uint32_t gpio[] = PX4_GPIO_INIT_LIST;
|
||||
px4_gpio_init(gpio, arraySize(gpio));
|
||||
board_control_spi_sensors_power_configgpio();
|
||||
|
||||
/* configure USB interfaces */
|
||||
|
||||
stm32_usbinitialize();
|
||||
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
|
|
|
@ -62,53 +62,18 @@
|
|||
|
||||
#include "chip.h"
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
__EXPORT int hardfault_log_main(int argc, char *argv[]);
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
#define OUT_BUFFER_LEN 200
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Function Prototypes
|
||||
****************************************************************************/
|
||||
static int genfault(int fault);
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Private Functions
|
||||
****************************************************************************/
|
||||
/****************************************************************************
|
||||
* genfault
|
||||
****************************************************************************/
|
||||
|
||||
static int genfault(int fault)
|
||||
{
|
||||
|
||||
/* Pointer to System Control Block's System Control Register */
|
||||
|
||||
uint32_t *pCCR = (uint32_t *)0xE000ED14;
|
||||
|
||||
static volatile int k = 0;
|
||||
|
||||
switch (fault) {
|
||||
case 0:
|
||||
|
||||
/* Enable divide by 0 fault generation */
|
||||
|
||||
*pCCR |= 0x10;
|
||||
|
||||
k = 1 / fault;
|
||||
|
@ -116,7 +81,6 @@ static int genfault(int fault)
|
|||
/* This is not going to happen
|
||||
* Disable divide by 0 fault generation
|
||||
*/
|
||||
|
||||
*pCCR &= ~0x10;
|
||||
break;
|
||||
|
||||
|
@ -182,7 +146,6 @@ static int format_fault_file_name(struct timespec *ts, char *buffer, unsigned in
|
|||
int ret = -EINVAL;
|
||||
|
||||
if (buffer) {
|
||||
|
||||
ret = -ENOMEM;
|
||||
unsigned int plen = LOG_PATH_BASE_LEN;
|
||||
|
||||
|
@ -214,7 +177,6 @@ static void identify(const char *caller)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************
|
||||
* hardfault_get_desc
|
||||
****************************************************************************/
|
||||
|
@ -1220,9 +1182,6 @@ static void print_usage(void)
|
|||
PRINT_MODULE_USAGE_COMMAND_DESCR("reset", "Reset the reboot counter");
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* Name: hardfault_log_main
|
||||
****************************************************************************/
|
||||
__EXPORT int hardfault_log_main(int argc, char *argv[])
|
||||
{
|
||||
char *self = "hardfault_log";
|
||||
|
|
Loading…
Reference in New Issue