add some logging

ll
Ondřej Hruška 2 years ago
parent 5143ce6bfe
commit 1bdf8d241c
  1. 3
      Core/Inc/FreeRTOSConfig.h
  2. 4
      Core/Src/app_main.c
  3. 2
      Core/Src/freertos.c
  4. 6
      Core/Src/main.c
  5. 3
      Core/Src/stm32f1xx_it.c
  6. 2
      Core/Src/usart.c

@ -133,7 +133,8 @@ See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */
/* Normal assert() semantics without relying on the provision of an assert.h
header file. */
/* USER CODE BEGIN 1 */
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; );}
#include <stdio.h>
#define configASSERT( x ) if ((x) == 0) {taskDISABLE_INTERRUPTS(); printf("configASSERT "__FILE__":%d\r\n",__LINE__); for( ;; );}
/* USER CODE END 1 */
/* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS

@ -83,6 +83,7 @@ static void redraw_display() {
void app_task_main(void *argument)
{
printf("Main task\r\n");
app_analog_init();
app_buzzer_init();
app_knob_init();
@ -97,6 +98,7 @@ void app_task_main(void *argument)
bool any_change = true;
uint32_t last_redraw = osKernelGetTickCount();
printf("Loop\r\n");
for (;;) {
// sampling is done in the heater loop
@ -144,7 +146,7 @@ void app_task_main(void *argument)
any_change = false;
// Blink
HAL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
LL_GPIO_TogglePin(LED_GPIO_Port, LED_Pin);
}
vTaskDelay(pdMS_TO_TICKS(10));

@ -135,6 +135,7 @@ void vApplicationMallocFailedHook(void);
/* USER CODE BEGIN 4 */
void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName)
{
printf("vApplicationStackOverflowHook\r\n");
/* Run time stack overflow checking is performed if
configCHECK_FOR_STACK_OVERFLOW is defined to 1 or 2. This hook function is
called if a stack overflow is detected. */
@ -144,6 +145,7 @@ void vApplicationStackOverflowHook(xTaskHandle xTask, signed char *pcTaskName)
/* USER CODE BEGIN 5 */
void vApplicationMallocFailedHook(void)
{
printf("vApplicationMallocFailedHook\r\n");
/* vApplicationMallocFailedHook() will only be called if
configUSE_MALLOC_FAILED_HOOK is set to 1 in FreeRTOSConfig.h. It is a hook
function that will get called if a call to pvPortMalloc() fails.

@ -100,7 +100,7 @@ int main(void)
MX_IWDG_Init();
MX_USART1_UART_Init();
MX_ADC1_Init();
MX_DMA_Init();
// MX_DMA_Init();
MX_TIM4_Init();
MX_TIM2_Init();
MX_TIM3_Init();
@ -110,6 +110,7 @@ int main(void)
// this ensures SysTick runs at 1000Hz - used for LL delays
LL_Init1msTick(SystemCoreClock);
printf("Start.\r\n");
/* USER CODE END 2 */
/* Init scheduler */
@ -117,6 +118,7 @@ int main(void)
MX_FREERTOS_Init();
/* Start scheduler */
printf("a\r\n");
osKernelStart();
/* We should never get here as control is now taken by the scheduler */
@ -218,6 +220,7 @@ void Error_Handler(void)
/* USER CODE BEGIN Error_Handler_Debug */
/* User can add his own implementation to report the HAL error return state */
__disable_irq();
printf("Error_Handler\r\n");
while (1)
{
}
@ -234,6 +237,7 @@ void Error_Handler(void)
*/
void assert_failed(uint8_t *file, uint32_t line)
{
printf("assert_failed\r\n");
/* USER CODE BEGIN 6 */
/* User can add his own implementation to report the file name and line number,
ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */

@ -103,6 +103,7 @@ void HardFault_Handler(void)
void MemManage_Handler(void)
{
/* USER CODE BEGIN MemoryManagement_IRQn 0 */
printf("MemManage_Handler\r\n");
/* USER CODE END MemoryManagement_IRQn 0 */
while (1)
@ -118,6 +119,7 @@ void MemManage_Handler(void)
void BusFault_Handler(void)
{
/* USER CODE BEGIN BusFault_IRQn 0 */
printf("BusFault_Handler\r\n");
/* USER CODE END BusFault_IRQn 0 */
while (1)
@ -133,6 +135,7 @@ void BusFault_Handler(void)
void UsageFault_Handler(void)
{
/* USER CODE BEGIN UsageFault_IRQn 0 */
printf("UsageFault_Handler\r\n");
/* USER CODE END UsageFault_IRQn 0 */
while (1)

@ -83,8 +83,8 @@ void MX_USART1_UART_Init(void)
int _write(int fd, const char *pcBuffer, const int iLength) {
int cnt = iLength;
while (cnt-- > 0) {
LL_USART_TransmitData8(USART_DEBUG, *pcBuffer++);
while (!LL_USART_IsActiveFlag_TXE(USART_DEBUG)) {}
LL_USART_TransmitData8(USART_DEBUG, *pcBuffer++);
}
return iLength;
}

Loading…
Cancel
Save