Files
hsb/S - Software/0 - HSB MRTS Kathode-MCP/3 - Implementation/0 - Code/hsb-mrts/src/freeRTOSFixes.c
mmi 1bcb4809db - added IODevice support
- fixed some issues with the logger and stack sizes

git-svn-id: https://svn.vbchaos.nl/svn/hsb/trunk@216 05563f52-14a8-4384-a975-3d1654cca0fa
2017-09-26 11:11:33 +00:00

113 lines
3.2 KiB
C

// -----------------------------------------------------------------------------
/// @file freeRTOSFixes.c
/// @brief Description
// -----------------------------------------------------------------------------
// Micro-Key bv
// Industrieweg 28, 9804 TG Noordhorn
// Postbus 92, 9800 AB Zuidhorn
// The Netherlands
// Tel: +31 594 503020
// Fax: +31 594 505825
// Email: support@microkey.nl
// Web: www.microkey.nl
// -----------------------------------------------------------------------------
/// $Revision$
/// $Author$
/// $Date$
// (c) 2017 Micro-Key bv
// -----------------------------------------------------------------------------
/// @file freeRTOSFixes.c
/// @ingroup {group_name}
// -----------------------------------------------------------------------------
// Include files
// -----------------------------------------------------------------------------
#include <FreeRTOSFixes.h>
#include <unistd.h>
#include <stdint.h>
#include <stdio.h>
#include "Logger.h"
#include "led.h"
// -----------------------------------------------------------------------------
// Constant and macro definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Type definitions
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// File-scope variables
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function declarations
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
// Function definitions
// -----------------------------------------------------------------------------
void _init(void) {return;}
void OS_logTaskInfo(xTaskHandle taskHandle)
{
unsigned portBASE_TYPE highWaterMark;
char text[128];
snprintf(text, sizeof(text), "***** Task %s", pcTaskGetTaskName(taskHandle));
LOGGER_INFO(text);
highWaterMark = uxTaskGetStackHighWaterMark(taskHandle);
snprintf(text, sizeof(text), "***** Stack high water mark : %lu long words", highWaterMark);
LOGGER_INFO(text);
}
// Implementation for libc, needed for printf related functions.
caddr_t _sbrk(int incr)
{
extern char _end;
static char* heap_end;
char* prev_heap_end;
if(heap_end == 0)
{
heap_end = &_end;
}
prev_heap_end = heap_end;
heap_end += incr;
return (caddr_t)prev_heap_end;
}
// Stack overflow hook
void vApplicationStackOverflowHook(xTaskHandle xTask, signed portCHAR* pcTaskName)
{
LED_turnOn(ledGreen);
LOGGER_ERROR("STACK OVERFLOW IN TASK %s", pcTaskName);
}
// Malloc failed hook
void vApplicationMallocFailedHook(void)
{
// Logger_fatal(FATALCODE_MALLOCFAILED);
}
// Assert for StdPeriph library
void assert_failed(uint8_t* file, uint32_t line)
{
// Logger_log((char*)file, "", line, LOGTYPE_ERROR, "assert failed");
}