/*
 * SPDX-License-Identifier: Apache-2.0
 * Copyright (c) 2026 Embedya.
 *
 * TraxProbe porting layer (reference port). Licensed under the Apache License,
 * Version 2.0 (see LICENSE-Apache-2.0.txt). You may copy and modify this file
 * to support additional hardware or RTOS targets.
 *
 * This file depends on TraxProbe core headers, which remain licensed under the
 * TraxProbe Commercial License and are NOT relicensed by this notice.
 */

#include "trax_config_default.h"
#if (TRAX_CFG_RTOS_TYPE == TRAX_RTOS_NONE) && (TRAX_ENABLE)

/**
 ******************************************************************************
 * @file           : trax_baremetal_memory.c
 * @brief          : Bare-metal stub for trax_memory_monitor_process()
 * @version        : 1.0.0
 ******************************************************************************
 * @attention
 *
 * Bare-metal builds have a single stack and no task table to enumerate,
 * so the periodic memory monitor is intentionally a no-op. The symbol
 * is provided so trax_process() in src/trax_core.c can call it
 * unconditionally without per-RTOS guards leaking into the core.
 *
 * Heap-related events (TRAX_TID_HEAP_USAGE / malloc-failed) are not produced
 * by this function in any port — they are emitted from the per-RTOS
 * traceMALLOC / traceFREE hooks (see os/FreeRTOS/trax_rtos_port.h) or
 * from a user-supplied hook in bare-metal builds.
 *
 ******************************************************************************
 */

#include "internal/trax_memory.h"

void trax_memory_monitor_process(void)
{
}

/*
 * trax_report_stack_overflow() — bare-metal stub.
 *
 * Bare-metal builds have no kernel-side stack-overflow detection (no
 * canary checks, no per-task stacks), so this function is a no-op.  The
 * symbol is provided for source-portability so user code that calls
 * trax_report_stack_overflow() from a generic fault handler (e.g. a
 * Cortex-M HardFault_Handler that suspects a stack push past SP_main)
 * still links cleanly when the build is later switched to a bare-metal
 * target.  If you want to surface a fault diagnostic in bare-metal,
 * use a TRAX_TID_USER_* event from the fault handler instead.
 */
void trax_report_stack_overflow(uint32_t task_handle)
{
    (void)task_handle;
}

#endif /* TRAX_CFG_RTOS_TYPE == TRAX_RTOS_NONE */
