# -*- coding: utf-8 -*-
"""
    Implementation of U-boot Awareness gdb commands
    
Copyright 2015-2016 Freescale Semiconductor, Inc.
Copyright 2015-2019, 2025 NXP.

SPDX-License-Identifier: BSD-3-Clause

"""
import os
import sys

FLASH_EXT_INSTALL_DIR = ''.join([os.path.dirname(os.path.realpath(__file__)), '/../'])
GDB_EXT_INSTALL_DIR =''.join([FLASH_EXT_INSTALL_DIR, '../'])

#add gdb_extensions to system path
sys.path.insert(0, GDB_EXT_INSTALL_DIR)

from flash.scripts.remote import set_execute_mode
from flash.gdbcommands import write_command
from flash.gdbcommands import erase_command
from flash.gdbcommands import erase_all_command
from flash.gdbcommands import dump_command
from flash.gdbcommands import protect_command
from flash.gdbcommands import unprotect_command
from flash.gdbcommands import current_command
from flash.gdbcommands import info_command
from flash.gdbcommands import blankcheck_command
from flash.gdbcommands import write_elf_command
from flash.gdbcommands import close_command

def create_commands(HSE_limits = None, is_MRAM = False, is_crc_implemented = False):
    """
        Instantiate all supported flash programmer commands
    """

    #set async mode off
    set_execute_mode(False)

    write_command.create_command(HSE_limits, is_crc_implemented, is_MRAM)
    erase_command.create_command(HSE_limits)
    erase_all_command.create_command(HSE_limits)
    dump_command.create_command(HSE_limits)
    protect_command.create_command()
    unprotect_command.create_command()
    current_command.create_command()
    info_command.create_command(HSE_limits, is_MRAM, is_crc_implemented)
    blankcheck_command.create_command()
    write_elf_command.create_command(HSE_limits, is_crc_implemented, is_MRAM)
    close_command.create_command()

if __name__ == '__main__':
    create_commands()
