/*
 * Copyright 2016-2025 NXP
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

/**
 * @file    test_MASTER.c
 * @brief   Application entry point.
 */
#include <stdio.h>
#include "board.h"
#include "peripherals.h"
#include "pin_mux.h"
#include "clock_config.h"
#include "fsl_debug_console.h"
#include "boot_multicore_slave.h"
/* TODO: insert other include files here. */

/* TODO: insert other definitions and declarations here. */

/*
 * @brief   Application entry point.
 */
int main(void) {

    /* Init board hardware. */
    BOARD_InitBootPins();
    BOARD_InitBootClocks();
    BOARD_InitBootPeripherals();
#ifndef BOARD_INIT_DEBUG_CONSOLE_PERIPHERAL
    /* Init FSL debug console. */
    BOARD_InitDebugConsole();
#endif

    #define GPIO0_PCNS      (*(volatile uint32_t*)(0x40096010))
    #define GPIO1_PCNS      (*(volatile uint32_t*)(0x40098010))

    // GPIO0_PCNS = GPIO0_PCNS|(1<<10)|(1<<27);
    GPIO1_PCNS = GPIO1_PCNS|(1<<2);

    /* Start slave CPU. */
    boot_multicore_slave();

    PRINTF("Hello World from MASTER\r\n");

    void knl_start_mtkernel(void);
    knl_start_mtkernel();   

    /* Force the counter to be placed into memory. */
    volatile static int i = 0 ;
    /* Enter an infinite loop, just incrementing a counter. */
    while(1) {
        i++ ;
        /* 'Dummy' NOP to allow source level single stepping of
            tight while() loop */
        __asm volatile ("nop");
    }
    return 0 ;
}
