Ken Van Hoeylandt a94baf0d00
Support for PC platform (#12)
* improvements for cross-platform compiling

* moved tactility-core to libs/

* splitup improvements

* remove git/gitmodules from freertos

* better platformbetter platform checks

* added build scripts

* delete mbedtls

* re-add mbedtls

* fixes and improvements

* added pc build

* simplify build scripts

* revert build scrpit

* updated builds

* fix for pc

* fix for pc

* fix for build
2024-01-19 17:39:30 +01:00

45 lines
1.4 KiB
C

#include "check.h"
#include "core_defines.h"
#include "log.h"
#ifdef ESP_TARGET
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#else
#include "FreeRTOS.h"
#include "task.h"
#endif
#define TAG "kernel"
static void tt_print_memory_info() {
#ifdef ESP_PLATFORM
TT_LOG_E(TAG, "default caps:");
TT_LOG_E(TAG, " total: %u", heap_caps_get_total_size(MALLOC_CAP_DEFAULT));
TT_LOG_E(TAG, " free: %u", heap_caps_get_free_size(MALLOC_CAP_DEFAULT));
TT_LOG_E(TAG, " min free: %u", heap_caps_get_minimum_free_size(MALLOC_CAP_DEFAULT));
TT_LOG_E(TAG, "internal caps:");
TT_LOG_E(TAG, " total: %u", heap_caps_get_total_size(MALLOC_CAP_INTERNAL));
TT_LOG_E(TAG, " free: %u", heap_caps_get_free_size(MALLOC_CAP_INTERNAL));
TT_LOG_E(TAG, " min free: %u", heap_caps_get_minimum_free_size(MALLOC_CAP_INTERNAL));
#endif
}
static void tt_print_task_info() {
const char* name = pcTaskGetName(NULL);
const char* safe_name = name ? name : "main";
TT_LOG_E(TAG, "Task: %s", safe_name);
TT_LOG_E(TAG, "Stack watermark: %u", uxTaskGetStackHighWaterMark(NULL) * 4);
}
TT_NORETURN void tt_crash_implementation() {
tt_print_task_info();
tt_print_memory_info();
// TODO: Add breakpoint when debugger is attached.
#ifdef ESP_TARGET
esp_system_abort("System halted. Connect debugger for more info.");
#endif
__builtin_unreachable();
}