implemented printf logging

This commit is contained in:
2016-09-03 13:30:52 +02:00
parent 3fd42eb41a
commit 7e539708b9
9 changed files with 286 additions and 62 deletions
+6 -5
View File
@@ -36,8 +36,7 @@
#include "stm32f1xx_it.h"
/* USER CODE BEGIN 0 */
#include "utils.h"
#include "debug.h"
/* USER CODE END 0 */
/* External variables --------------------------------------------------------*/
@@ -94,6 +93,8 @@ prvGetRegistersFromStack(uint32_t *pulFaultStackAddress)
pc = pulFaultStackAddress[ 6 ];
psr = pulFaultStackAddress[ 7 ];
error("Hard fault.");
/* When the following line is hit, the variables contain the register values. */
for (;;);
}
@@ -131,7 +132,7 @@ void HardFault_Handler(void)
void MemManage_Handler(void)
{
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
uart_print("MemManage fault.\n");
error("MemManage fault.\n");
/* USER CODE END MemoryManagement_IRQn 0 */
while (1)
@@ -148,7 +149,7 @@ void MemManage_Handler(void)
void BusFault_Handler(void)
{
/* USER CODE BEGIN BusFault_IRQn 0 */
uart_print("Bus fault.\n");
error("Bus fault.\n");
/* USER CODE END BusFault_IRQn 0 */
while (1)
@@ -165,7 +166,7 @@ void BusFault_Handler(void)
void UsageFault_Handler(void)
{
/* USER CODE BEGIN UsageFault_IRQn 0 */
uart_print("Usage fault.\n");
error("Usage fault.\n");
/* USER CODE END UsageFault_IRQn 0 */
while (1)
-19
View File
@@ -1,19 +0,0 @@
//
// Created by MightyPork on 2.9.16.
//
#include <string.h>
#include "stm32f1xx_hal_conf.h"
#include "adc.h"
#include "tim.h"
#include "usart.h"
#include "utils.h"
void uart_print(const char *string)
{
HAL_UART_Transmit(&huart1, (char*)string, (uint16_t) strlen(string), 10);
// Stop ADC and the timer
HAL_ADC_Stop(&hadc1);
HAL_TIM_Base_Stop(&htim3);
}