/*!
 * @file        main.c
 *
 * @brief       Main program body
 *
 * @version     V1.0.1
 *
 * @date        2023-03-31
 *
 * @attention
 *
 *  Copyright (C) 2023 Geehy Semiconductor
 *
 *  You may not use this file except in compliance with the
 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
 *
 *  The program is only for reference, which is distributed in the hope
 *  that it will be useful and instructional for customers to develop
 *  their software. Unless required by applicable law or agreed to in
 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
 *  and limitations under the License.
 */

/* Includes */
#include "main.h"

/** @addtogroup Examples
  @{
*/

/** @addtogroup Application2
  @{
*/

/** @defgroup Application2_Enumerations Enumerations
  @{
*/

/**
 * @brief   INTERRUPT_VECTOR_STATE_T
 */
typedef enum
{
    IAP_INTERRUPT_VECTOR    = ((uint8_t)0), //!< IAP interrupt vector
    APP1_INTERRUPT_VECTOR   = ((uint8_t)1), //!< APP1 interrupt vector
    APP2_INTERRUPT_VECTOR   = ((uint8_t)2), //!< APP2 interrupt vector
} INTERRUPT_VECTOR_STATE_T;

/**@} end of group Application2_Enumerations */

/** @defgroup Application2_Variables Variables
  @{
*/

#if defined (__CC_ARM)
/* Indicates that the current interrupt vector*/
volatile INTERRUPT_VECTOR_STATE_T FLASH_interrupt_vector __attribute__((at(0x20000004)));

#elif defined (__ICCARM__)
#pragma location = 0x20000004
__root volatile uint32_t FLASH_interrupt_vector = APP1_INTERRUPT_VECTOR;

#else
/* Indicates that the current interrupt vector */
uint32_t FLASH_interrupt_vector __attribute__((section(".my_data"))) = APP2_INTERRUPT_VECTOR;

#endif

/**@} end of group Application2_Variables */

/** @defgroup Application2_Functions Functions
  @{
*/

/*!
 * @brief       Main program
 *
 * @param       None
 *
 * @retval      None
 */
int main(void)
{
    FLASH_interrupt_vector = APP2_INTERRUPT_VECTOR;

    APM_MINI_LEDInit(LED3);
    APM_DelayInit(APM_DELAY_MS);

    while(1)
    {
        APM_Delay(500);
        APM_MINI_LEDToggle(LED3);
    }
}

/**@} end of group Application2_Functions */
/**@} end of group Application2 */
/**@} end of group Examples */
