Compare commits

...

1 Commits

Author SHA1 Message Date
Daniel Agar 6bef2bdeb1
boards: px4_fmu-v5 print RCC reset flags on boot 2021-08-09 23:40:48 -04:00
2 changed files with 17 additions and 47 deletions

View File

@ -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();
}
/****************************************************************************

View File

@ -62,61 +62,25 @@
#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;
k = 1 / fault;
/* This is not going to happen
* Disable divide by 0 fault generation
*/
*pCCR &= ~0x10;
break;
@ -141,7 +105,7 @@ bool verify_ram_address(uint32_t bot, uint32_t size)
{
bool ret = true;
#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
return ret;
}
@ -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";