mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
boards: px4_fmu-v5 print RCC reset flags on boot
This commit is contained in:
@@ -163,20 +163,31 @@ stm32_boardinitialize(void)
|
|||||||
{
|
{
|
||||||
board_on_reset(-1); /* Reset PWM first thing */
|
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();
|
board_autoled_initialize();
|
||||||
|
|
||||||
/* configure pins */
|
/* configure pins */
|
||||||
|
|
||||||
const uint32_t gpio[] = PX4_GPIO_INIT_LIST;
|
const uint32_t gpio[] = PX4_GPIO_INIT_LIST;
|
||||||
px4_gpio_init(gpio, arraySize(gpio));
|
px4_gpio_init(gpio, arraySize(gpio));
|
||||||
board_control_spi_sensors_power_configgpio();
|
board_control_spi_sensors_power_configgpio();
|
||||||
|
|
||||||
/* configure USB interfaces */
|
/* configure USB interfaces */
|
||||||
|
|
||||||
stm32_usbinitialize();
|
stm32_usbinitialize();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
|
|||||||
@@ -62,61 +62,25 @@
|
|||||||
|
|
||||||
#include "chip.h"
|
#include "chip.h"
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Public Function Prototypes
|
|
||||||
****************************************************************************/
|
|
||||||
__EXPORT int hardfault_log_main(int argc, char *argv[]);
|
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Pre-processor Definitions
|
|
||||||
****************************************************************************/
|
|
||||||
#define OUT_BUFFER_LEN 200
|
#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)
|
static int genfault(int fault)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Pointer to System Control Block's System Control Register */
|
/* Pointer to System Control Block's System Control Register */
|
||||||
|
|
||||||
uint32_t *pCCR = (uint32_t *)0xE000ED14;
|
uint32_t *pCCR = (uint32_t *)0xE000ED14;
|
||||||
|
|
||||||
static volatile int k = 0;
|
static volatile int k = 0;
|
||||||
|
|
||||||
switch (fault) {
|
switch (fault) {
|
||||||
case 0:
|
case 0:
|
||||||
|
|
||||||
/* Enable divide by 0 fault generation */
|
/* Enable divide by 0 fault generation */
|
||||||
|
|
||||||
*pCCR |= 0x10;
|
*pCCR |= 0x10;
|
||||||
|
|
||||||
k = 1 / fault;
|
k = 1 / fault;
|
||||||
|
|
||||||
/* This is not going to happen
|
/* This is not going to happen
|
||||||
* Disable divide by 0 fault generation
|
* Disable divide by 0 fault generation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
*pCCR &= ~0x10;
|
*pCCR &= ~0x10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -141,7 +105,7 @@ bool verify_ram_address(uint32_t bot, uint32_t size)
|
|||||||
{
|
{
|
||||||
bool ret = true;
|
bool ret = true;
|
||||||
#if defined STM32_IS_SRAM
|
#if defined STM32_IS_SRAM
|
||||||
ret = STM32_IS_SRAM(bot) && STM32_IS_SRAM(bot + size);
|
ret = STM32_IS_SRAM(bot) && STM32_IS_SRAM(bot + size);
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -182,7 +146,6 @@ static int format_fault_file_name(struct timespec *ts, char *buffer, unsigned in
|
|||||||
int ret = -EINVAL;
|
int ret = -EINVAL;
|
||||||
|
|
||||||
if (buffer) {
|
if (buffer) {
|
||||||
|
|
||||||
ret = -ENOMEM;
|
ret = -ENOMEM;
|
||||||
unsigned int plen = LOG_PATH_BASE_LEN;
|
unsigned int plen = LOG_PATH_BASE_LEN;
|
||||||
|
|
||||||
@@ -214,7 +177,6 @@ static void identify(const char *caller)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* hardfault_get_desc
|
* hardfault_get_desc
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
@@ -1220,9 +1182,6 @@ static void print_usage(void)
|
|||||||
PRINT_MODULE_USAGE_COMMAND_DESCR("reset", "Reset the reboot counter");
|
PRINT_MODULE_USAGE_COMMAND_DESCR("reset", "Reset the reboot counter");
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
|
||||||
* Name: hardfault_log_main
|
|
||||||
****************************************************************************/
|
|
||||||
__EXPORT int hardfault_log_main(int argc, char *argv[])
|
__EXPORT int hardfault_log_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *self = "hardfault_log";
|
char *self = "hardfault_log";
|
||||||
|
|||||||
Reference in New Issue
Block a user