1
0
Эх сурвалжийг харах

[Nuvoton] Update drivers (#5501)

* Update drivers.

1. Improve LVGL avg FPS.
2. Sync configuration to 4.1.0.

* [Nuvoton] Update drivers.

1. Fix open-control order issue in CAN driver.
2. [N9H30] Improve N9H30 I2C busy-wait implementation.
3. [N9H30] Support 1024x600x32b LCD panel.
4. Move nu_packages menu into sub-menu of board.

* Update menu-option.

1. Set BOARD_USING_LCM is on by default.
2. Fix default value setting in choice-option.

* Fix control function in I2C driver.

* Add sdk_dist.py and ADC touching calibration function.

Co-authored-by: Wayne Lin <wclin@nuvoton.com>
Wayne 3 жил өмнө
parent
commit
446bde64c8
82 өөрчлөгдсөн 3696 нэмэгдсэн , 11955 устгасан
  1. 1 1
      bsp/nuvoton/libraries/m031/rtt_port/drv_i2c.c
  2. 226 201
      bsp/nuvoton/libraries/m2354/rtt_port/drv_can.c
  3. 1 1
      bsp/nuvoton/libraries/m2354/rtt_port/drv_i2c.c
  4. 4 4
      bsp/nuvoton/libraries/m480/Device/Nuvoton/M480/Include/can_reg.h
  5. 233 210
      bsp/nuvoton/libraries/m480/rtt_port/drv_can.c
  6. 1 1
      bsp/nuvoton/libraries/m480/rtt_port/drv_i2c.c
  7. 2 2
      bsp/nuvoton/libraries/n9h30/Driver/Include/nu_can.h
  8. 11 5
      bsp/nuvoton/libraries/n9h30/Driver/Include/nu_lcd.h
  9. 4 0
      bsp/nuvoton/libraries/n9h30/Driver/Include/nu_uart.h
  10. 74 1
      bsp/nuvoton/libraries/n9h30/Driver/Source/nu_lcd.c
  11. 7 0
      bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig
  12. 104 91
      bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc.c
  13. 26 6
      bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc.h
  14. 464 73
      bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c
  15. 189 178
      bsp/nuvoton/libraries/n9h30/rtt_port/drv_can.c
  16. 81 27
      bsp/nuvoton/libraries/n9h30/rtt_port/drv_i2c.c
  17. 20 0
      bsp/nuvoton/libraries/n9h30/rtt_port/drv_vpost.c
  18. 2 1
      bsp/nuvoton/libraries/nu_packages/ILI9341/lcd_ili9341.c
  19. 15 3
      bsp/nuvoton/libraries/nu_packages/Kconfig
  20. 106 15
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_adc.h
  21. 2 2
      bsp/nuvoton/libraries/nuc980/Driver/Include/nu_can.h
  22. 32 19
      bsp/nuvoton/libraries/nuc980/Driver/Include/nuc980.h
  23. 2 2
      bsp/nuvoton/libraries/nuc980/Driver/Source/nu_emac.c
  24. 7 0
      bsp/nuvoton/libraries/nuc980/rtt_port/Kconfig
  25. 469 14
      bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc.c
  26. 84 0
      bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc.h
  27. 681 0
      bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc_touch.c
  28. 189 178
      bsp/nuvoton/libraries/nuc980/rtt_port/drv_can.c
  29. 1 1
      bsp/nuvoton/libraries/nuc980/rtt_port/drv_emac.c
  30. 1 1
      bsp/nuvoton/libraries/nuc980/rtt_port/drv_i2c.c
  31. 26 33
      bsp/nuvoton/nk-980iot/.config
  32. 0 6
      bsp/nuvoton/nk-980iot/Kconfig
  33. 2 0
      bsp/nuvoton/nk-980iot/board/Kconfig
  34. 2 0
      bsp/nuvoton/nk-980iot/board/nu_pin_init.c
  35. 0 350
      bsp/nuvoton/nk-980iot/project.uvproj
  36. 0 334
      bsp/nuvoton/nk-980iot/project.uvprojx
  37. 0 459
      bsp/nuvoton/nk-980iot/rtconfig.h
  38. 7 1
      bsp/nuvoton/nk-980iot/rtconfig.py
  39. 299 106
      bsp/nuvoton/nk-980iot/spinor.config
  40. 23 14
      bsp/nuvoton/nk-n9h30/.config
  41. 0 6
      bsp/nuvoton/nk-n9h30/Kconfig
  42. 45 16
      bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_disp.c
  43. 54 6
      bsp/nuvoton/nk-n9h30/board/Kconfig
  44. 52 10
      bsp/nuvoton/nk-n9h30/board/board_dev.c
  45. 0 350
      bsp/nuvoton/nk-n9h30/project.uvproj
  46. 0 334
      bsp/nuvoton/nk-n9h30/project.uvprojx
  47. 0 422
      bsp/nuvoton/nk-n9h30/rtconfig.h
  48. 7 1
      bsp/nuvoton/nk-n9h30/rtconfig.py
  49. 2 0
      bsp/nuvoton/nk-rtu980/.config
  50. 0 6
      bsp/nuvoton/nk-rtu980/Kconfig
  51. 1 0
      bsp/nuvoton/nk-rtu980/board/Kconfig
  52. 0 1774
      bsp/nuvoton/nk-rtu980/project.uvproj
  53. 0 1766
      bsp/nuvoton/nk-rtu980/project.uvprojx
  54. 0 431
      bsp/nuvoton/nk-rtu980/rtconfig.h
  55. 7 1
      bsp/nuvoton/nk-rtu980/rtconfig.py
  56. 2 0
      bsp/nuvoton/numaker-iot-m487/.config
  57. 0 6
      bsp/nuvoton/numaker-iot-m487/Kconfig
  58. 1 0
      bsp/nuvoton/numaker-iot-m487/board/Kconfig
  59. 0 356
      bsp/nuvoton/numaker-iot-m487/project.uvproj
  60. 0 336
      bsp/nuvoton/numaker-iot-m487/project.uvprojx
  61. 0 400
      bsp/nuvoton/numaker-iot-m487/rtconfig.h
  62. 8 0
      bsp/nuvoton/numaker-iot-m487/rtconfig.py
  63. 2 0
      bsp/nuvoton/numaker-m032ki/.config
  64. 0 6
      bsp/nuvoton/numaker-m032ki/Kconfig
  65. 1 0
      bsp/nuvoton/numaker-m032ki/board/Kconfig
  66. 0 1228
      bsp/nuvoton/numaker-m032ki/project.uvprojx
  67. 0 286
      bsp/nuvoton/numaker-m032ki/rtconfig.h
  68. 8 0
      bsp/nuvoton/numaker-m032ki/rtconfig.py
  69. 24 18
      bsp/nuvoton/numaker-m2354/.config
  70. 1 7
      bsp/nuvoton/numaker-m2354/Kconfig
  71. 2 0
      bsp/nuvoton/numaker-m2354/board/Kconfig
  72. 0 337
      bsp/nuvoton/numaker-m2354/project.uvprojx
  73. 0 383
      bsp/nuvoton/numaker-m2354/rtconfig.h
  74. 8 0
      bsp/nuvoton/numaker-m2354/rtconfig.py
  75. 24 18
      bsp/nuvoton/numaker-pfm-m487/.config
  76. 0 6
      bsp/nuvoton/numaker-pfm-m487/Kconfig
  77. 2 0
      bsp/nuvoton/numaker-pfm-m487/board/Kconfig
  78. 0 356
      bsp/nuvoton/numaker-pfm-m487/project.uvproj
  79. 0 336
      bsp/nuvoton/numaker-pfm-m487/project.uvprojx
  80. 0 413
      bsp/nuvoton/numaker-pfm-m487/rtconfig.h
  81. 8 0
      bsp/nuvoton/numaker-pfm-m487/rtconfig.py
  82. 39 0
      bsp/nuvoton/tools/sdk_dist.py

+ 1 - 1
bsp/nuvoton/libraries/m031/rtt_port/drv_i2c.c

@@ -90,7 +90,7 @@ static rt_err_t nu_i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t u3
     RT_ASSERT(bus != RT_NULL);
     nu_i2c = (nu_i2c_bus_t *) bus;
 
-    switch (RT_I2C_DEV_CTRL_CLK)
+    switch (u32Cmd)
     {
     case RT_I2C_DEV_CTRL_CLK:
         I2C_SetBusClockFreq(nu_i2c->I2C, u32Value);

+ 226 - 201
bsp/nuvoton/libraries/m2354/rtt_port/drv_can.c

@@ -7,6 +7,7 @@
 * Change Logs:
 * Date            Author       Notes
 * 2020-6-22       ChingI       First version
+* 2022-1-8        Wayne        Fix IE issue
 *
 ******************************************************************************/
 
@@ -42,7 +43,7 @@ enum
 #if defined(BSP_USING_CAN0)
     CAN0_IDX,
 #endif
-    CAN_CNT,
+    CAN_CNT
 };
 
 /* Private Typedef --------------------------------------------------------------*/
@@ -50,9 +51,10 @@ struct nu_can
 {
     struct rt_can_device dev;
     char *name;
-    CAN_T *can_base;
-    uint32_t can_rst;
-    IRQn_Type can_irq_n;
+    CAN_T *base;
+    IRQn_Type irqn;
+    uint32_t rstidx;
+    uint32_t int_flag;
 };
 typedef struct nu_can *nu_can_t;
 
@@ -68,12 +70,11 @@ static struct nu_can nu_can_arr[] =
 #if defined(BSP_USING_CAN0)
     {
         .name = "can0",
-        .can_base = CAN0,
-        .can_rst = CAN0_RST,
-        .can_irq_n =  CAN0_IRQn,
+        .base = CAN0,
+        .rstidx = CAN0_RST,
+        .irqn =  CAN0_IRQn,
     },
 #endif
-    {0}
 }; /* struct nu_can */
 
 /* Public functions ------------------------------------------------------------*/
@@ -106,266 +107,271 @@ void CAN0_IRQHandler(void)
 
 /* Private Variables ------------------------------------------------------------*/
 
-static void nu_can_isr(nu_can_t can)
+static void nu_can_isr(nu_can_t psNuCAN)
 {
-    uint32_t u32IIDRstatus;
     /* Get base address of CAN register */
-    CAN_T *can_base = ((nu_can_t)can)->can_base;
+    CAN_T *base = psNuCAN->base;
 
     /* Get interrupt event */
-    u32IIDRstatus = CAN_GET_INT_PENDING_STATUS(can_base);
+    uint32_t u32IIDRstatus = CAN_GET_INT_PENDING_STATUS(base) & CAN_IIDR_INTID_Msk;
 
-    if (u32IIDRstatus == 0x00008000)       /* Check Status Interrupt Flag (Error status Int and Status change Int) */
+    /* Check Status Interrupt Flag (Error status Int and Status change Int) */
+    if (u32IIDRstatus == 0x00008000)
     {
         /**************************/
         /* Status Change interrupt*/
         /**************************/
-        if (can_base->STATUS & CAN_STATUS_TXOK_Msk)
+        if (base->STATUS & CAN_STATUS_TXOK_Msk)
         {
-            can_base->STATUS &= ~CAN_STATUS_TXOK_Msk;    /* Clear Tx Ok status*/
+            base->STATUS &= ~CAN_STATUS_TXOK_Msk;    /* Clear Tx Ok status*/
 #ifndef RT_CAN_USING_HDR
-            /* Using as Lisen,Loopback,Loopback+Lisen mode*/
-            rt_hw_can_isr(&can->dev, RT_CAN_EVENT_TX_DONE);
+            if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_TX)
+            {
+                /*Using as Lisen,Loopback,Loopback+Lisen mode*/
+                rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_TX_DONE);
+            }
 #endif
-            //rt_kprintf("[%s]TX OK INT\n", can->name) ;
         }
 
-        if (can_base->STATUS & CAN_STATUS_RXOK_Msk)
+        if (base->STATUS & CAN_STATUS_RXOK_Msk)
         {
-            can_base->STATUS &= ~CAN_STATUS_RXOK_Msk;   /* Clear Rx Ok status*/
+            base->STATUS &= ~CAN_STATUS_RXOK_Msk;   /* Clear Rx Ok status*/
 #ifndef RT_CAN_USING_HDR
-            /* Using as Lisen,Loopback,Loopback+Lisen mode*/
-            rt_hw_can_isr(&can->dev, RT_CAN_EVENT_RX_IND);
+            if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_RX)
+            {
+                /*Using as Lisen,Loopback,Loopback+Lisen mode*/
+                rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_RX_IND);
+            }
 #endif
-            //rt_kprintf("[%s]RX OK INT\n", can->name) ;
         }
 
         /**************************/
         /* Error Status interrupt */
         /**************************/
-        if (can_base->STATUS & CAN_STATUS_EWARN_Msk)
+        if (base->STATUS & CAN_STATUS_EWARN_Msk)
         {
-            rt_kprintf("[%s]EWARN INT\n", can->name) ;
+            rt_kprintf("[%s]EWARN INT\n", psNuCAN->name) ;
         }
 
-        if (can_base->STATUS & CAN_STATUS_BOFF_Msk)
+        if (base->STATUS & CAN_STATUS_BOFF_Msk)
         {
-            rt_kprintf("[%s]BUSOFF INT\n", can->name) ;
+            rt_kprintf("[%s]BUSOFF INT\n", psNuCAN->name) ;
 
-            /* Do Init to release busoff pin */
-            can_base->CON = (CAN_CON_INIT_Msk | CAN_CON_CCE_Msk);
-            can_base->CON &= (~(CAN_CON_INIT_Msk | CAN_CON_CCE_Msk));
-            while (can_base->CON & CAN_CON_INIT_Msk);
+            /* To release busoff pin */
+            CAN_EnterInitMode(base, CAN_CON_INIT_Msk | CAN_CON_CCE_Msk);
+            CAN_LeaveInitMode(base);
         }
+
+        if (base->STATUS & CAN_STATUS_LEC_Msk)
+        {
+            rt_kprintf("[%s] Last Error Code %03x\n", psNuCAN->name, base->STATUS & CAN_STATUS_LEC_Msk) ;
+        }
+
     }
 #ifdef RT_CAN_USING_HDR
     /*IntId: 0x0001-0x0020, Number of Message Object which caused the interrupt.*/
     else if (u32IIDRstatus > 0 && u32IIDRstatus <= 32)
     {
-        /*Message RAM 0~RX_MSG_ID_INDEX for CAN Tx using*/
-        if (u32IIDRstatus <= RX_MSG_ID_INDEX)
+        if ((psNuCAN->int_flag & RT_DEVICE_FLAG_INT_TX) &&
+                (u32IIDRstatus <= RX_MSG_ID_INDEX))
         {
-            //rt_kprintf("[%s-Tx]IntId = %d\n", can->name, u32IIDRstatus);
-            rt_hw_can_isr(&can->dev, RT_CAN_EVENT_TX_DONE);
+            /*Message RAM 0~RX_MSG_ID_INDEX for CAN Tx using*/
+            rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_TX_DONE);
         }
-        else /*Message RAM RX_MSG_ID_INDEX~31 for CAN Rx using*/
+        else if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_RX)
         {
-            //rt_kprintf("[%s-Rx]IntId = %d\n", can->name, u32IIDRstatus);
-            rt_hw_can_isr(&can->dev, (RT_CAN_EVENT_RX_IND | ((u32IIDRstatus - 1) << 8)));
+            /*Message RAM RX_MSG_ID_INDEX~31 for CAN Rx using*/
+            rt_hw_can_isr(&psNuCAN->dev, (RT_CAN_EVENT_RX_IND | ((u32IIDRstatus - 1) << 8)));
         }
-        CAN_CLR_INT_PENDING_BIT(can_base, (u32IIDRstatus - 1));     /* Clear Interrupt Pending */
+        CAN_CLR_INT_PENDING_BIT(base, (u32IIDRstatus - 1));     /* Clear Interrupt Pending */
     }
 #endif
-
 }
 
+static void nu_can_ie(nu_can_t psNuCAN)
+{
+    uint32_t u32CanIE = CAN_CON_IE_Msk;
+
+    if (psNuCAN->int_flag & (RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX))
+    {
+        u32CanIE |= CAN_CON_SIE_Msk;
+    }
+    else
+    {
+        u32CanIE &= ~CAN_CON_SIE_Msk;
+    }
+
+    if (psNuCAN->int_flag & RT_DEVICE_CAN_INT_ERR)
+    {
+        u32CanIE |= CAN_CON_EIE_Msk;
+    }
+    else
+    {
+        u32CanIE &= ~CAN_CON_EIE_Msk;
+    }
+
+    if (u32CanIE & (CAN_CON_SIE_Msk | CAN_CON_EIE_Msk))
+    {
+        CAN_EnableInt(psNuCAN->base, u32CanIE);
+
+        /* Enable interrupt. */
+        NVIC_EnableIRQ(psNuCAN->irqn);
+    }
+    else
+    {
+        u32CanIE |= (CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
+        CAN_DisableInt(psNuCAN->base, u32CanIE);
+
+        /* Disable interrupt. */
+        NVIC_DisableIRQ(psNuCAN->irqn);
+    }
+}
 
 static rt_err_t nu_can_configure(struct rt_can_device *can, struct can_configure *cfg)
 {
+    nu_can_t psNuCAN  = (nu_can_t)can;
+    uint32_t u32CANMode;
 
-    RT_ASSERT(can != RT_NULL);
-    RT_ASSERT(cfg != RT_NULL);
+    RT_ASSERT(can);
+    RT_ASSERT(cfg);
 
     /* Get base address of CAN register */
-    CAN_T *can_base = ((nu_can_t)can)->can_base;
-
-    RT_ASSERT(can_base != RT_NULL);
+    CAN_T *base = psNuCAN->base;
 
     /* Reset this module */
-    SYS_ResetModule(((nu_can_t)can)->can_rst);
+    SYS_ResetModule(psNuCAN->rstidx);
 
-    switch (cfg->mode)
-    {
-    /* CAN default Normal mode */
-    case RT_CAN_MODE_NORMAL:
-        can->config.mode = CAN_NORMAL_MODE;
-        break;
-    case RT_CAN_MODE_LISEN:
-        can->config.mode = RT_CAN_MODE_LISEN;
-        break;
-    case RT_CAN_MODE_LOOPBACK:
-        can->config.mode = RT_CAN_MODE_LOOPBACK;
-        break;
-    case RT_CAN_MODE_LOOPBACKANLISEN:
-        can->config.mode = RT_CAN_MODE_LOOPBACKANLISEN;
-        break;
-    default:
-        rt_kprintf("Unsupported Operating mode");
-        goto exit_nu_can_configure;
-    }
+    u32CANMode = (cfg->mode == RT_CAN_MODE_NORMAL) ? CAN_NORMAL_MODE : CAN_BASIC_MODE;
 
     /*Set the CAN Bit Rate and Operating mode*/
-    if (CAN_Open(can_base, can->config.baud_rate, can->config.mode) < 1)
-        return -(RT_ERROR);
-
+    if (CAN_Open(base, cfg->baud_rate, u32CANMode) != cfg->baud_rate)
+        goto exit_nu_can_configure;
 
     switch (cfg->mode)
     {
-    /* CAN default Normal mode */
     case RT_CAN_MODE_NORMAL:
 #ifdef RT_CAN_USING_HDR
-        CAN_LeaveTestMode(can_base);
+        CAN_LeaveTestMode(base);
 #else
-        CAN_EnterTestMode(can_base, CAN_TEST_BASIC_Msk);
+        CAN_EnterTestMode(base, CAN_TEST_BASIC_Msk);
 #endif
         break;
     case RT_CAN_MODE_LISEN:
-        CAN_EnterTestMode(can_base, CAN_TEST_BASIC_Msk | CAN_TEST_SILENT_Msk);
+        CAN_EnterTestMode(base, CAN_TEST_BASIC_Msk | CAN_TEST_SILENT_Msk);
         break;
     case RT_CAN_MODE_LOOPBACK:
-        CAN_EnterTestMode(can_base, CAN_TEST_BASIC_Msk | CAN_TEST_LBACK_Msk);
+        CAN_EnterTestMode(base, CAN_TEST_BASIC_Msk | CAN_TEST_LBACK_Msk);
         break;
     case RT_CAN_MODE_LOOPBACKANLISEN:
-        CAN_EnterTestMode(can_base, CAN_TEST_BASIC_Msk | CAN_TEST_SILENT_Msk | CAN_TEST_LBACK_Msk);
+        CAN_EnterTestMode(base, CAN_TEST_BASIC_Msk | CAN_TEST_SILENT_Msk | CAN_TEST_LBACK_Msk);
         break;
     default:
         rt_kprintf("Unsupported Operating mode");
         goto exit_nu_can_configure;
     }
 
+    nu_can_ie(psNuCAN);
 
     return RT_EOK;
 
 exit_nu_can_configure:
 
-    CAN_Close(can_base);
+    CAN_Close(base);
 
     return -(RT_ERROR);
 }
 
 static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 {
-    rt_uint32_t argval;
+    rt_uint32_t argval = (rt_uint32_t)arg;
+    nu_can_t psNuCAN = (nu_can_t)can;
 
-#ifdef RT_CAN_USING_HDR
-    struct rt_can_filter_config *filter_cfg;
-#endif
-    /* Get base address of CAN register */
-    CAN_T *can_base = ((nu_can_t)can)->can_base;
-
-    RT_ASSERT(can_base != RT_NULL);
-    /* Check baud rate */
-    RT_ASSERT(can->config.baud_rate != 0);
+    RT_ASSERT(can);
 
     switch (cmd)
     {
-    case RT_DEVICE_CTRL_CLR_INT:
-        argval = (rt_uint32_t) arg;
-        if ((argval == RT_DEVICE_FLAG_INT_RX) || (argval == RT_DEVICE_FLAG_INT_TX))
-        {
-            /* Disable NVIC interrupt. */
-            NVIC_DisableIRQ(((nu_can_t)can)->can_irq_n);
-            /* Disable Status Change Interrupt  */
-            CAN_DisableInt(can_base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
-
-        }
-        else if (argval == RT_DEVICE_CAN_INT_ERR)
-        {
-            /* Disable NVIC interrupt. */
-            NVIC_DisableIRQ(((nu_can_t)can)->can_irq_n);
-            /* Disable Error Interrupt */
-            CAN_DisableInt(can_base, CAN_CON_EIE_Msk);
-        }
-        break;
-
     case RT_DEVICE_CTRL_SET_INT:
-        argval = (rt_uint32_t) arg;
-        if (argval == RT_DEVICE_FLAG_INT_RX || (argval == RT_DEVICE_FLAG_INT_TX))
-        {
-            /* Enable Status Change Interrupt  */
-            CAN_EnableInt(can_base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
-            /* Enable NVIC interrupt. */
-            NVIC_EnableIRQ(((nu_can_t)can)->can_irq_n);
+        psNuCAN->int_flag |= argval;
+        nu_can_ie(psNuCAN);
+        break;
 
-        }
-        else if (argval == RT_DEVICE_CAN_INT_ERR)
-        {
-            /* Enable Error Status and Status Change Interrupt  */
-            CAN_EnableInt(can_base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk | CAN_CON_EIE_Msk);
-            /* Enable NVIC interrupt. */
-            NVIC_EnableIRQ(((nu_can_t)can)->can_irq_n);
-        }
+    case RT_DEVICE_CTRL_CLR_INT:
+        psNuCAN->int_flag &= ~argval;
+        nu_can_ie(psNuCAN);
         break;
 
-#ifdef RT_CAN_USING_HDR
     case RT_CAN_CMD_SET_FILTER:
-        filter_cfg = (struct rt_can_filter_config *)arg;
+    {
+        struct rt_can_filter_config *filter_cfg = (struct rt_can_filter_config *)arg;
 
         for (int i = 0; i < filter_cfg->count; i++)
         {
-
             /*set the filter message object*/
             if (filter_cfg->items[i].mode == 1)
             {
-                if (CAN_SetRxMsgObjAndMsk(can_base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask, FALSE) == FALSE)
+                if (CAN_SetRxMsgObjAndMsk(psNuCAN->base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask, FALSE) == FALSE)
                 {
                     return -(RT_ERROR);
                 }
             }
             else
-
             {
                 /*set the filter message object*/
-                if (CAN_SetRxMsgAndMsk(can_base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask) == FALSE)
+                if (CAN_SetRxMsgAndMsk(psNuCAN->base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask) == FALSE)
                 {
                     return -(RT_ERROR);
                 }
             }
         }
-        break;
-#endif
+    }
+    break;
 
     case RT_CAN_CMD_SET_MODE:
-        argval = (rt_uint32_t) arg;
-        if (argval != RT_CAN_MODE_NORMAL && argval != RT_CAN_MODE_LISEN &&
-                argval != RT_CAN_MODE_LOOPBACK && argval != RT_CAN_MODE_LOOPBACKANLISEN)
+        if ((argval == RT_CAN_MODE_NORMAL) ||
+                (argval == RT_CAN_MODE_LISEN) ||
+                (argval == RT_CAN_MODE_LOOPBACK) ||
+                (argval == RT_CAN_MODE_LOOPBACKANLISEN))
         {
-            return -(RT_ERROR);
+            if (argval != can->config.mode)
+            {
+                can->config.mode = argval;
+                return nu_can_configure(can, &can->config);
+            }
         }
-        if (argval != can->config.mode)
+        else
         {
-            can->config.mode = argval;
-            return nu_can_configure(can, &can->config);
+            return -(RT_ERROR);
         }
         break;
 
     case RT_CAN_CMD_SET_BAUD:
-        argval = (rt_uint32_t) arg;
-        if (argval != CAN1MBaud && argval != CAN800kBaud && argval != CAN500kBaud && argval != CAN250kBaud &&
-                argval != CAN125kBaud && argval != CAN100kBaud && argval != CAN50kBaud  && argval != CAN20kBaud  && argval != CAN10kBaud)
+    {
+        if ((argval == CAN1MBaud) ||
+                (argval == CAN800kBaud) ||
+                (argval == CAN500kBaud) ||
+                (argval == CAN250kBaud) ||
+                (argval == CAN125kBaud) ||
+                (argval == CAN100kBaud) ||
+                (argval == CAN50kBaud) ||
+                (argval == CAN20kBaud) ||
+                (argval == CAN10kBaud))
         {
-            return -(RT_ERROR);
+            if (argval != can->config.baud_rate)
+            {
+                can->config.baud_rate = argval;
+                return nu_can_configure(can, &can->config);
+            }
         }
-        if (argval != can->config.baud_rate)
+        else
         {
-            can->config.baud_rate = argval;
-            return nu_can_configure(can, &can->config);
+            return -(RT_ERROR);
         }
-        break;
+    }
+    break;
 
     case RT_CAN_CMD_SET_PRIV:
-        argval = (rt_uint32_t) arg;
-        if (argval != RT_CAN_MODE_PRIV && argval != RT_CAN_MODE_NOPRIV)
+        if (argval != RT_CAN_MODE_PRIV &&
+                argval != RT_CAN_MODE_NOPRIV)
         {
             return -(RT_ERROR);
         }
@@ -375,20 +381,29 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
             return nu_can_configure(can, &can->config);
         }
         break;
+
     case RT_CAN_CMD_GET_STATUS:
     {
-        rt_uint32_t errtype;
-        errtype = can_base->ERR;
-        /*Receive Error Counter*/
+        rt_uint32_t errtype = psNuCAN->base->ERR;
+
+        RT_ASSERT(arg);
+
+        /*Receive Error Counter, return value is with Receive Error Passive.*/
         can->status.rcverrcnt = (errtype >> 8);
+
         /*Transmit Error Counter*/
-        can->status.snderrcnt = ((errtype >> 24) & 0xFF);
-        can->status.lasterrtype = CAN_GET_INT_STATUS(can_base) & 0x8000;
-        /*status error code*/
-        can->status.errcode = CAN_GET_INT_STATUS(can_base) & 0x07;
-        rt_memcpy(arg, &can->status, sizeof(can->status));
+        can->status.snderrcnt = (errtype & 0xFF);
+
+        /*Last Error Type*/
+        can->status.lasterrtype = CAN_GET_INT_STATUS(psNuCAN->base) & 0x8000;
+
+        /*Status error code*/
+        can->status.errcode = CAN_GET_INT_STATUS(psNuCAN->base) & 0x07;
+
+        rt_memcpy(arg, &can->status, sizeof(struct rt_can_status));
     }
     break;
+
     default:
         return -(RT_EINVAL);
 
@@ -400,61 +415,91 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 static int nu_can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t boxno)
 {
     STR_CANMSG_T tMsg;
-    struct rt_can_msg *pmsg = (struct rt_can_msg *) buf;
-    /* Get base address of CAN register */
-    CAN_T *can_base = ((nu_can_t)can)->can_base;
+    struct rt_can_msg *pmsg;
+    nu_can_t psNuCAN = (nu_can_t)can;
 
-    RT_ASSERT(can_base != RT_NULL);
-    RT_ASSERT(buf != RT_NULL);
-    /* Check the parameters */
-    RT_ASSERT(IS_CAN_DLC(pmsg->len));
-    /* Standard ID (11 bits)*/
-    if (pmsg->ide == RT_CAN_STDID)
+    RT_ASSERT(can);
+    RT_ASSERT(buf);
+
+    pmsg = (struct rt_can_msg *) buf;
+
+    if (pmsg->ide == RT_CAN_STDID && IS_CAN_STDID(pmsg->id))
     {
+        /* Standard ID (11 bits)*/
         tMsg.IdType = CAN_STD_ID;
-        RT_ASSERT(IS_CAN_STDID(pmsg->id))
         tMsg.Id  = pmsg->id ;
     }
-    else
+    else if (pmsg->ide == RT_CAN_EXTID && IS_CAN_EXTID(pmsg->id))
     {
         /* Extended ID (29 bits)*/
         tMsg.IdType = CAN_EXT_ID;
-        RT_ASSERT(IS_CAN_EXTID(pmsg->id));
         tMsg.Id = pmsg->id ;
     }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
 
     if (pmsg->rtr == RT_CAN_DTR)
     {
         /* Data frame */
         tMsg.FrameType = CAN_DATA_FRAME;
     }
-    else
+    else if (pmsg->rtr == RT_CAN_RTR)
     {
         /* Remote frame */
         tMsg.FrameType = CAN_REMOTE_FRAME;
     }
-    tMsg.DLC = pmsg->len;
-    rt_memcpy(tMsg.Data, pmsg->data, pmsg->len);
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
 
-    if (CAN_Transmit(can_base, MSG(boxno), &tMsg) == FALSE) // Configure Msg RAM and send the Msg in the RAM
+    /* Check the parameters */
+    if (IS_CAN_DLC(pmsg->len))
     {
-        return -(RT_ERROR);
+        tMsg.DLC = pmsg->len;
+    }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
+
+    if (pmsg->data && pmsg->len)
+    {
+        rt_memcpy(&tMsg.Data[0], pmsg->data, pmsg->len);
+    }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
+
+    /* Configure Msg RAM and send the Msg in the RAM. */
+    if (CAN_Transmit(psNuCAN->base, MSG(boxno), &tMsg) == FALSE)
+    {
+        goto exit_nu_can_sendmsg;
     }
 
     return RT_EOK;
+
+exit_nu_can_sendmsg:
+
+    return -(RT_ERROR);
 }
+
 static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxno)
 {
     STR_CANMSG_T tMsg;
-    struct rt_can_msg *pmsg = (struct rt_can_msg *) buf;
-    /* Get base address of CAN register */
-    CAN_T *can_base = ((nu_can_t)can)->can_base;
+    struct rt_can_msg *pmsg;
+    nu_can_t psNuCAN = (nu_can_t)can;
+
+    RT_ASSERT(can);
+    RT_ASSERT(buf);
 
-    RT_ASSERT(can_base != RT_NULL);
-    RT_ASSERT(buf != RT_NULL);
+    pmsg = (struct rt_can_msg *) buf;
 
     /* get data */
-    if (CAN_Receive(can_base, boxno, &tMsg) == FALSE)
+    if (CAN_Receive(psNuCAN->base, boxno, &tMsg) == FALSE)
     {
         rt_kprintf("No available RX Msg.\n");
         return -(RT_ERROR);
@@ -466,32 +511,13 @@ static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxn
     can->hdr[pmsg->hdr].connected = 1;
 #endif
 
-    /* Standard ID (11 bits)*/
-    if (tMsg.IdType == CAN_STD_ID)
-    {
-        pmsg->ide = RT_CAN_STDID;
-        pmsg->id  = tMsg.Id;
-    }
-    else /* Extended ID (29 bits)*/
-    {
-        pmsg->ide = RT_CAN_EXTID;
-        pmsg->id  = tMsg.Id;
-    }
-
-    if (tMsg.FrameType == CAN_DATA_FRAME)
-    {
-        /* Data frame */
-        pmsg->rtr = RT_CAN_DTR;
-    }
-    else
-    {
-        /* Remote frame */
-        pmsg->rtr = RT_CAN_RTR;
-    }
-
+    pmsg->ide = (tMsg.IdType == CAN_STD_ID) ? RT_CAN_STDID : RT_CAN_EXTID;
+    pmsg->rtr = (tMsg.FrameType == CAN_DATA_FRAME) ? RT_CAN_DTR : RT_CAN_RTR;
+    pmsg->id  = tMsg.Id;
     pmsg->len = tMsg.DLC ;
 
-    rt_memcpy(pmsg->data, tMsg.Data, pmsg->len);
+    if (pmsg->data && pmsg->len)
+        rt_memcpy(pmsg->data, &tMsg.Data[0], pmsg->len);
 
     return RT_EOK;
 }
@@ -506,13 +532,12 @@ static int rt_hw_can_init(void)
 
     for (i = (CAN_START + 1); i < CAN_CNT; i++)
     {
-
-        nu_can_arr[i].dev.ops = &nu_can_ops;
         nu_can_arr[i].dev.config = nu_can_default_config;
 
 #ifdef RT_CAN_USING_HDR
         nu_can_arr[i].dev.config.maxhdr = RT_CANMSG_BOX_SZ;
 #endif
+        /* Register can device */
         ret = rt_hw_can_register(&nu_can_arr[i].dev, nu_can_arr[i].name, &nu_can_ops, NULL);
         RT_ASSERT(ret == RT_EOK);
     }

+ 1 - 1
bsp/nuvoton/libraries/m2354/rtt_port/drv_i2c.c

@@ -99,7 +99,7 @@ static rt_err_t nu_i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t u3
     RT_ASSERT(bus != RT_NULL);
     nu_i2c = (nu_i2c_bus_t *) bus;
 
-    switch (RT_I2C_DEV_CTRL_CLK)
+    switch (u32Cmd)
     {
     case RT_I2C_DEV_CTRL_CLK:
         I2C_SetBusClockFreq(nu_i2c->I2C, u32Value);

+ 4 - 4
bsp/nuvoton/libraries/m480/Device/Nuvoton/M480/Include/can_reg.h

@@ -10,7 +10,7 @@
 #define __CAN_REG_H__
 
 #if defined ( __CC_ARM   )
-#pragma anon_unions
+    #pragma anon_unions
 #endif
 
 /**
@@ -586,8 +586,8 @@ typedef struct
 #define CAN_BTIME_TSEG2_Pos              (12)                                              /*!< CAN_T::BTIME: TSeg2 Position           */
 #define CAN_BTIME_TSEG2_Msk              (0x7ul << CAN_BTIME_TSEG2_Pos)                    /*!< CAN_T::BTIME: TSeg2 Mask               */
 
-#define CAN_IIDR_IntId_Pos               (0)                                               /*!< CAN_T::IIDR: IntId Position            */
-#define CAN_IIDR_IntId_Msk               (0xfffful << CAN_IIDR_IntId_Pos)                  /*!< CAN_T::IIDR: IntId Mask                */
+#define CAN_IIDR_INTID_Pos               (0)                                               /*!< CAN_T::IIDR: IntId Position            */
+#define CAN_IIDR_INTID_Msk               (0xfffful << CAN_IIDR_INTID_Pos)                  /*!< CAN_T::IIDR: IntId Mask                */
 
 #define CAN_TEST_BASIC_Pos               (2)                                               /*!< CAN_T::TEST: Basic Position            */
 #define CAN_TEST_BASIC_Msk               (0x1ul << CAN_TEST_BASIC_Pos)                     /*!< CAN_T::TEST: Basic Mask                */
@@ -753,7 +753,7 @@ typedef struct
 /**@}*/ /* end of REGISTER group */
 
 #if defined ( __CC_ARM   )
-#pragma no_anon_unions
+    #pragma no_anon_unions
 #endif
 
 #endif /* __CAN_REG_H__ */

+ 233 - 210
bsp/nuvoton/libraries/m480/rtt_port/drv_can.c

@@ -1,12 +1,13 @@
 /**************************************************************************//**
 *
-* @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
+* @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date            Author       Notes
-* 2020-2-07       ChingI       First version
+* 2020-6-22       ChingI       First version
+* 2022-1-8        Wayne        Fix IE issue
 *
 ******************************************************************************/
 
@@ -56,9 +57,10 @@ struct nu_can
 {
     struct rt_can_device dev;
     char *name;
-    CAN_T *can_base;
-    uint32_t can_rst;
-    IRQn_Type can_irq_n;
+    CAN_T *base;
+    IRQn_Type irqn;
+    uint32_t rstidx;
+    uint32_t int_flag;
 };
 typedef struct nu_can *nu_can_t;
 
@@ -74,29 +76,27 @@ static struct nu_can nu_can_arr[] =
 #if defined(BSP_USING_CAN0)
     {
         .name = "can0",
-        .can_base = CAN0,
-        .can_rst = CAN0_RST,
-        .can_irq_n =  CAN0_IRQn,
+        .base = CAN0,
+        .rstidx = CAN0_RST,
+        .irqn =  CAN0_IRQn,
     },
 #endif
 #if defined(BSP_USING_CAN1)
     {
         .name = "can1",
-        .can_base = CAN1,
-        .can_rst = CAN1_RST,
-        .can_irq_n =  CAN1_IRQn,
+        .base = CAN1,
+        .rstidx = CAN1_RST,
+        .irqn =  CAN1_IRQn,
     },
 #endif
-
 #if defined(BSP_USING_CAN2)
     {
         .name = "can2",
-        .can_base = CAN2,
-        .can_rst = CAN2_RST,
-        .can_irq_n =  CAN2_IRQn,
+        .base = CAN2,
+        .rstidx = CAN2_RST,
+        .irqn =  CAN2_IRQn,
     },
 #endif
-    {0}
 }; /* struct nu_can */
 
 /* Public functions ------------------------------------------------------------*/
@@ -158,267 +158,271 @@ void CAN2_IRQHandler(void)
 
 /* Private Variables ------------------------------------------------------------*/
 
-
-static void nu_can_isr(nu_can_t can)
+static void nu_can_isr(nu_can_t psNuCAN)
 {
-    uint32_t u32IIDRstatus;
     /* Get base address of CAN register */
-    CAN_T *can_base = ((nu_can_t)can)->can_base;
+    CAN_T *base = psNuCAN->base;
 
     /* Get interrupt event */
-    u32IIDRstatus = CAN_GET_INT_PENDING_STATUS(can_base);
+    uint32_t u32IIDRstatus = CAN_GET_INT_PENDING_STATUS(base) & CAN_IIDR_INTID_Msk;
 
-    if (u32IIDRstatus == 0x00008000)       /* Check Status Interrupt Flag (Error status Int and Status change Int) */
+    /* Check Status Interrupt Flag (Error status Int and Status change Int) */
+    if (u32IIDRstatus == 0x00008000)
     {
         /**************************/
         /* Status Change interrupt*/
         /**************************/
-        if (can_base->STATUS & CAN_STATUS_TXOK_Msk)
+        if (base->STATUS & CAN_STATUS_TXOK_Msk)
         {
-            can_base->STATUS &= ~CAN_STATUS_TXOK_Msk;    /* Clear Tx Ok status*/
+            base->STATUS &= ~CAN_STATUS_TXOK_Msk;    /* Clear Tx Ok status*/
 #ifndef RT_CAN_USING_HDR
-            /* Using as Lisen,Loopback,Loopback+Lisen mode*/
-            rt_hw_can_isr(&can->dev, RT_CAN_EVENT_TX_DONE);
+            if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_TX)
+            {
+                /*Using as Lisen,Loopback,Loopback+Lisen mode*/
+                rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_TX_DONE);
+            }
 #endif
-            //rt_kprintf("[%s]TX OK INT\n", can->name) ;
         }
 
-        if (can_base->STATUS & CAN_STATUS_RXOK_Msk)
+        if (base->STATUS & CAN_STATUS_RXOK_Msk)
         {
-            can_base->STATUS &= ~CAN_STATUS_RXOK_Msk;   /* Clear Rx Ok status*/
+            base->STATUS &= ~CAN_STATUS_RXOK_Msk;   /* Clear Rx Ok status*/
 #ifndef RT_CAN_USING_HDR
-            /* Using as Lisen,Loopback,Loopback+Lisen mode*/
-            rt_hw_can_isr(&can->dev, RT_CAN_EVENT_RX_IND);
+            if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_RX)
+            {
+                /*Using as Lisen,Loopback,Loopback+Lisen mode*/
+                rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_RX_IND);
+            }
 #endif
-            //rt_kprintf("[%s]RX OK INT\n", can->name) ;
         }
 
         /**************************/
         /* Error Status interrupt */
         /**************************/
-        if (can_base->STATUS & CAN_STATUS_EWARN_Msk)
+        if (base->STATUS & CAN_STATUS_EWARN_Msk)
         {
-            rt_kprintf("[%s]EWARN INT\n", can->name) ;
+            rt_kprintf("[%s]EWARN INT\n", psNuCAN->name) ;
         }
 
-        if (can_base->STATUS & CAN_STATUS_BOFF_Msk)
+        if (base->STATUS & CAN_STATUS_BOFF_Msk)
         {
-            rt_kprintf("[%s]BUSOFF INT\n", can->name) ;
+            rt_kprintf("[%s]BUSOFF INT\n", psNuCAN->name) ;
 
-            /* Do Init to release busoff pin */
-            can_base->CON = (CAN_CON_INIT_Msk | CAN_CON_CCE_Msk);
-            can_base->CON &= (~(CAN_CON_INIT_Msk | CAN_CON_CCE_Msk));
-            while (can_base->CON & CAN_CON_INIT_Msk);
+            /* To release busoff pin */
+            CAN_EnterInitMode(base, CAN_CON_INIT_Msk | CAN_CON_CCE_Msk);
+            CAN_LeaveInitMode(base);
         }
+
+        if (base->STATUS & CAN_STATUS_LEC_Msk)
+        {
+            rt_kprintf("[%s] Last Error Code %03x\n", psNuCAN->name, base->STATUS & CAN_STATUS_LEC_Msk) ;
+        }
+
     }
 #ifdef RT_CAN_USING_HDR
     /*IntId: 0x0001-0x0020, Number of Message Object which caused the interrupt.*/
     else if (u32IIDRstatus > 0 && u32IIDRstatus <= 32)
     {
-        /*Message RAM 0~RX_MSG_ID_INDEX for CAN Tx using*/
-        if (u32IIDRstatus <= RX_MSG_ID_INDEX)
+        if ((psNuCAN->int_flag & RT_DEVICE_FLAG_INT_TX) &&
+                (u32IIDRstatus <= RX_MSG_ID_INDEX))
         {
-            //rt_kprintf("[%s-Tx]IntId = %d\n", can->name, u32IIDRstatus);
-            rt_hw_can_isr(&can->dev, RT_CAN_EVENT_TX_DONE);
+            /*Message RAM 0~RX_MSG_ID_INDEX for CAN Tx using*/
+            rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_TX_DONE);
         }
-        else /*Message RAM RX_MSG_ID_INDEX~31 for CAN Rx using*/
+        else if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_RX)
         {
-            //rt_kprintf("[%s-Rx]IntId = %d\n", can->name, u32IIDRstatus);
-            rt_hw_can_isr(&can->dev, (RT_CAN_EVENT_RX_IND | ((u32IIDRstatus - 1) << 8)));
+            /*Message RAM RX_MSG_ID_INDEX~31 for CAN Rx using*/
+            rt_hw_can_isr(&psNuCAN->dev, (RT_CAN_EVENT_RX_IND | ((u32IIDRstatus - 1) << 8)));
         }
-        CAN_CLR_INT_PENDING_BIT(can_base, (u32IIDRstatus - 1));     /* Clear Interrupt Pending */
+        CAN_CLR_INT_PENDING_BIT(base, (u32IIDRstatus - 1));     /* Clear Interrupt Pending */
     }
 #endif
-
 }
 
+static void nu_can_ie(nu_can_t psNuCAN)
+{
+    uint32_t u32CanIE = CAN_CON_IE_Msk;
+
+    if (psNuCAN->int_flag & (RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX))
+    {
+        u32CanIE |= CAN_CON_SIE_Msk;
+    }
+    else
+    {
+        u32CanIE &= ~CAN_CON_SIE_Msk;
+    }
+
+    if (psNuCAN->int_flag & RT_DEVICE_CAN_INT_ERR)
+    {
+        u32CanIE |= CAN_CON_EIE_Msk;
+    }
+    else
+    {
+        u32CanIE &= ~CAN_CON_EIE_Msk;
+    }
+
+    if (u32CanIE & (CAN_CON_SIE_Msk | CAN_CON_EIE_Msk))
+    {
+        CAN_EnableInt(psNuCAN->base, u32CanIE);
+
+        /* Enable interrupt. */
+        NVIC_EnableIRQ(psNuCAN->irqn);
+    }
+    else
+    {
+        u32CanIE |= (CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
+        CAN_DisableInt(psNuCAN->base, u32CanIE);
+
+        /* Disable interrupt. */
+        NVIC_DisableIRQ(psNuCAN->irqn);
+    }
+}
 
 static rt_err_t nu_can_configure(struct rt_can_device *can, struct can_configure *cfg)
 {
+    nu_can_t psNuCAN  = (nu_can_t)can;
+    uint32_t u32CANMode;
 
-    RT_ASSERT(can != RT_NULL);
-    RT_ASSERT(cfg != RT_NULL);
+    RT_ASSERT(can);
+    RT_ASSERT(cfg);
 
     /* Get base address of CAN register */
-    CAN_T *can_base = ((nu_can_t)can)->can_base;
-
-    RT_ASSERT(can_base != RT_NULL);
+    CAN_T *base = psNuCAN->base;
 
     /* Reset this module */
-    SYS_ResetModule(((nu_can_t)can)->can_rst);
+    SYS_ResetModule(psNuCAN->rstidx);
 
-    switch (cfg->mode)
-    {
-    /* CAN default Normal mode */
-    case RT_CAN_MODE_NORMAL:
-        can->config.mode = CAN_NORMAL_MODE;
-        break;
-    case RT_CAN_MODE_LISEN:
-        can->config.mode = RT_CAN_MODE_LISEN;
-        break;
-    case RT_CAN_MODE_LOOPBACK:
-        can->config.mode = RT_CAN_MODE_LOOPBACK;
-        break;
-    case RT_CAN_MODE_LOOPBACKANLISEN:
-        can->config.mode = RT_CAN_MODE_LOOPBACKANLISEN;
-        break;
-    default:
-        rt_kprintf("Unsupported Operating mode");
-        goto exit_nu_can_configure;
-    }
+    u32CANMode = (cfg->mode == RT_CAN_MODE_NORMAL) ? CAN_NORMAL_MODE : CAN_BASIC_MODE;
 
     /*Set the CAN Bit Rate and Operating mode*/
-    if (CAN_Open(can_base, can->config.baud_rate, can->config.mode) < 1)
-        return -(RT_ERROR);
-
+    if (CAN_Open(base, cfg->baud_rate, u32CANMode) != cfg->baud_rate)
+        goto exit_nu_can_configure;
 
     switch (cfg->mode)
     {
-    /* CAN default Normal mode */
     case RT_CAN_MODE_NORMAL:
 #ifdef RT_CAN_USING_HDR
-        CAN_LeaveTestMode(can_base);
+        CAN_LeaveTestMode(base);
 #else
-        CAN_EnterTestMode(can_base, CAN_TEST_BASIC_Msk);
+        CAN_EnterTestMode(base, CAN_TEST_BASIC_Msk);
 #endif
         break;
     case RT_CAN_MODE_LISEN:
-        CAN_EnterTestMode(can_base, CAN_TEST_BASIC_Msk | CAN_TEST_SILENT_Msk);
+        CAN_EnterTestMode(base, CAN_TEST_BASIC_Msk | CAN_TEST_SILENT_Msk);
         break;
     case RT_CAN_MODE_LOOPBACK:
-        CAN_EnterTestMode(can_base, CAN_TEST_BASIC_Msk | CAN_TEST_LBACK_Msk);
+        CAN_EnterTestMode(base, CAN_TEST_BASIC_Msk | CAN_TEST_LBACK_Msk);
         break;
     case RT_CAN_MODE_LOOPBACKANLISEN:
-        CAN_EnterTestMode(can_base, CAN_TEST_BASIC_Msk | CAN_TEST_SILENT_Msk | CAN_TEST_LBACK_Msk);
+        CAN_EnterTestMode(base, CAN_TEST_BASIC_Msk | CAN_TEST_SILENT_Msk | CAN_TEST_LBACK_Msk);
         break;
     default:
         rt_kprintf("Unsupported Operating mode");
         goto exit_nu_can_configure;
     }
 
+    nu_can_ie(psNuCAN);
 
     return RT_EOK;
 
 exit_nu_can_configure:
 
-    CAN_Close(can_base);
+    CAN_Close(base);
 
     return -(RT_ERROR);
 }
 
 static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 {
-    rt_uint32_t argval;
-
-#ifdef RT_CAN_USING_HDR
-    struct rt_can_filter_config *filter_cfg;
-#endif
-    /* Get base address of CAN register */
-    CAN_T *can_base = ((nu_can_t)can)->can_base;
+    rt_uint32_t argval = (rt_uint32_t)arg;
+    nu_can_t psNuCAN = (nu_can_t)can;
 
-    RT_ASSERT(can_base != RT_NULL);
-    /* Check baud rate */
-    RT_ASSERT(can->config.baud_rate != 0);
+    RT_ASSERT(can);
 
     switch (cmd)
     {
-    case RT_DEVICE_CTRL_CLR_INT:
-        argval = (rt_uint32_t) arg;
-        if ((argval == RT_DEVICE_FLAG_INT_RX) || (argval == RT_DEVICE_FLAG_INT_TX))
-        {
-            /* Disable NVIC interrupt. */
-            NVIC_DisableIRQ(((nu_can_t)can)->can_irq_n);
-            /* Disable Status Change Interrupt  */
-            CAN_DisableInt(can_base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
-
-        }
-        else if (argval == RT_DEVICE_CAN_INT_ERR)
-        {
-            /* Disable NVIC interrupt. */
-            NVIC_DisableIRQ(((nu_can_t)can)->can_irq_n);
-            /* Disable Error Interrupt */
-            CAN_DisableInt(can_base, CAN_CON_EIE_Msk);
-        }
-        break;
-
     case RT_DEVICE_CTRL_SET_INT:
-        argval = (rt_uint32_t) arg;
-        if (argval == RT_DEVICE_FLAG_INT_RX || (argval == RT_DEVICE_FLAG_INT_TX))
-        {
-            /* Enable Status Change Interrupt  */
-            CAN_EnableInt(can_base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
-            /* Enable NVIC interrupt. */
-            NVIC_EnableIRQ(((nu_can_t)can)->can_irq_n);
+        psNuCAN->int_flag |= argval;
+        nu_can_ie(psNuCAN);
+        break;
 
-        }
-        else if (argval == RT_DEVICE_CAN_INT_ERR)
-        {
-            /* Enable Error Status and Status Change Interrupt  */
-            CAN_EnableInt(can_base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk | CAN_CON_EIE_Msk);
-            /* Enable NVIC interrupt. */
-            NVIC_EnableIRQ(((nu_can_t)can)->can_irq_n);
-        }
+    case RT_DEVICE_CTRL_CLR_INT:
+        psNuCAN->int_flag &= ~argval;
+        nu_can_ie(psNuCAN);
         break;
 
-#ifdef RT_CAN_USING_HDR
     case RT_CAN_CMD_SET_FILTER:
-        filter_cfg = (struct rt_can_filter_config *)arg;
+    {
+        struct rt_can_filter_config *filter_cfg = (struct rt_can_filter_config *)arg;
 
         for (int i = 0; i < filter_cfg->count; i++)
         {
-
             /*set the filter message object*/
             if (filter_cfg->items[i].mode == 1)
             {
-                if (CAN_SetRxMsgObjAndMsk(can_base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask, FALSE) == FALSE)
+                if (CAN_SetRxMsgObjAndMsk(psNuCAN->base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask, FALSE) == FALSE)
                 {
                     return -(RT_ERROR);
                 }
             }
             else
-
             {
                 /*set the filter message object*/
-                if (CAN_SetRxMsgAndMsk(can_base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask) == FALSE)
+                if (CAN_SetRxMsgAndMsk(psNuCAN->base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask) == FALSE)
                 {
                     return -(RT_ERROR);
                 }
             }
         }
-        break;
-#endif
+    }
+    break;
 
     case RT_CAN_CMD_SET_MODE:
-        argval = (rt_uint32_t) arg;
-        if (argval != RT_CAN_MODE_NORMAL && argval != RT_CAN_MODE_LISEN &&
-                argval != RT_CAN_MODE_LOOPBACK && argval != RT_CAN_MODE_LOOPBACKANLISEN)
+        if ((argval == RT_CAN_MODE_NORMAL) ||
+                (argval == RT_CAN_MODE_LISEN) ||
+                (argval == RT_CAN_MODE_LOOPBACK) ||
+                (argval == RT_CAN_MODE_LOOPBACKANLISEN))
         {
-            return -(RT_ERROR);
+            if (argval != can->config.mode)
+            {
+                can->config.mode = argval;
+                return nu_can_configure(can, &can->config);
+            }
         }
-        if (argval != can->config.mode)
+        else
         {
-            can->config.mode = argval;
-            return nu_can_configure(can, &can->config);
+            return -(RT_ERROR);
         }
         break;
 
     case RT_CAN_CMD_SET_BAUD:
-        argval = (rt_uint32_t) arg;
-        if (argval != CAN1MBaud && argval != CAN800kBaud && argval != CAN500kBaud && argval != CAN250kBaud &&
-                argval != CAN125kBaud && argval != CAN100kBaud && argval != CAN50kBaud  && argval != CAN20kBaud  && argval != CAN10kBaud)
+    {
+        if ((argval == CAN1MBaud) ||
+                (argval == CAN800kBaud) ||
+                (argval == CAN500kBaud) ||
+                (argval == CAN250kBaud) ||
+                (argval == CAN125kBaud) ||
+                (argval == CAN100kBaud) ||
+                (argval == CAN50kBaud) ||
+                (argval == CAN20kBaud) ||
+                (argval == CAN10kBaud))
         {
-            return -(RT_ERROR);
+            if (argval != can->config.baud_rate)
+            {
+                can->config.baud_rate = argval;
+                return nu_can_configure(can, &can->config);
+            }
         }
-        if (argval != can->config.baud_rate)
+        else
         {
-            can->config.baud_rate = argval;
-            return nu_can_configure(can, &can->config);
+            return -(RT_ERROR);
         }
-        break;
+    }
+    break;
 
     case RT_CAN_CMD_SET_PRIV:
-        argval = (rt_uint32_t) arg;
-        if (argval != RT_CAN_MODE_PRIV && argval != RT_CAN_MODE_NOPRIV)
+        if (argval != RT_CAN_MODE_PRIV &&
+                argval != RT_CAN_MODE_NOPRIV)
         {
             return -(RT_ERROR);
         }
@@ -428,20 +432,29 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
             return nu_can_configure(can, &can->config);
         }
         break;
+
     case RT_CAN_CMD_GET_STATUS:
     {
-        rt_uint32_t errtype;
-        errtype = can_base->ERR;
-        /*Receive Error Counter*/
+        rt_uint32_t errtype = psNuCAN->base->ERR;
+
+        RT_ASSERT(arg);
+
+        /*Receive Error Counter, return value is with Receive Error Passive.*/
         can->status.rcverrcnt = (errtype >> 8);
+
         /*Transmit Error Counter*/
-        can->status.snderrcnt = ((errtype >> 24) & 0xFF);
-        can->status.lasterrtype = CAN_GET_INT_STATUS(can_base) & 0x8000;
-        /*status error code*/
-        can->status.errcode = CAN_GET_INT_STATUS(can_base) & 0x07;
-        rt_memcpy(arg, &can->status, sizeof(can->status));
+        can->status.snderrcnt = (errtype & 0xFF);
+
+        /*Last Error Type*/
+        can->status.lasterrtype = CAN_GET_INT_STATUS(psNuCAN->base) & 0x8000;
+
+        /*Status error code*/
+        can->status.errcode = CAN_GET_INT_STATUS(psNuCAN->base) & 0x07;
+
+        rt_memcpy(arg, &can->status, sizeof(struct rt_can_status));
     }
     break;
+
     default:
         return -(RT_EINVAL);
 
@@ -453,61 +466,91 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 static int nu_can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t boxno)
 {
     STR_CANMSG_T tMsg;
-    struct rt_can_msg *pmsg = (struct rt_can_msg *) buf;
-    /* Get base address of CAN register */
-    CAN_T *can_base = ((nu_can_t)can)->can_base;
+    struct rt_can_msg *pmsg;
+    nu_can_t psNuCAN = (nu_can_t)can;
 
-    RT_ASSERT(can_base != RT_NULL);
-    RT_ASSERT(buf != RT_NULL);
-    /* Check the parameters */
-    RT_ASSERT(IS_CAN_DLC(pmsg->len));
-    /* Standard ID (11 bits)*/
-    if (pmsg->ide == RT_CAN_STDID)
+    RT_ASSERT(can);
+    RT_ASSERT(buf);
+
+    pmsg = (struct rt_can_msg *) buf;
+
+    if (pmsg->ide == RT_CAN_STDID && IS_CAN_STDID(pmsg->id))
     {
+        /* Standard ID (11 bits)*/
         tMsg.IdType = CAN_STD_ID;
-        RT_ASSERT(IS_CAN_STDID(pmsg->id))
         tMsg.Id  = pmsg->id ;
     }
-    else
+    else if (pmsg->ide == RT_CAN_EXTID && IS_CAN_EXTID(pmsg->id))
     {
         /* Extended ID (29 bits)*/
         tMsg.IdType = CAN_EXT_ID;
-        RT_ASSERT(IS_CAN_EXTID(pmsg->id));
         tMsg.Id = pmsg->id ;
     }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
 
     if (pmsg->rtr == RT_CAN_DTR)
     {
         /* Data frame */
         tMsg.FrameType = CAN_DATA_FRAME;
     }
-    else
+    else if (pmsg->rtr == RT_CAN_RTR)
     {
         /* Remote frame */
         tMsg.FrameType = CAN_REMOTE_FRAME;
     }
-    tMsg.DLC = pmsg->len;
-    rt_memcpy(tMsg.Data, pmsg->data, pmsg->len);
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
 
-    if (CAN_Transmit(can_base, MSG(boxno), &tMsg) == FALSE) // Configure Msg RAM and send the Msg in the RAM
+    /* Check the parameters */
+    if (IS_CAN_DLC(pmsg->len))
     {
-        return -(RT_ERROR);
+        tMsg.DLC = pmsg->len;
+    }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
+
+    if (pmsg->data && pmsg->len)
+    {
+        rt_memcpy(&tMsg.Data[0], pmsg->data, pmsg->len);
+    }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
+
+    /* Configure Msg RAM and send the Msg in the RAM. */
+    if (CAN_Transmit(psNuCAN->base, MSG(boxno), &tMsg) == FALSE)
+    {
+        goto exit_nu_can_sendmsg;
     }
 
     return RT_EOK;
+
+exit_nu_can_sendmsg:
+
+    return -(RT_ERROR);
 }
+
 static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxno)
 {
     STR_CANMSG_T tMsg;
-    struct rt_can_msg *pmsg = (struct rt_can_msg *) buf;
-    /* Get base address of CAN register */
-    CAN_T *can_base = ((nu_can_t)can)->can_base;
+    struct rt_can_msg *pmsg;
+    nu_can_t psNuCAN = (nu_can_t)can;
 
-    RT_ASSERT(can_base != RT_NULL);
-    RT_ASSERT(buf != RT_NULL);
+    RT_ASSERT(can);
+    RT_ASSERT(buf);
+
+    pmsg = (struct rt_can_msg *) buf;
 
     /* get data */
-    if (CAN_Receive(can_base, boxno, &tMsg) == FALSE)
+    if (CAN_Receive(psNuCAN->base, boxno, &tMsg) == FALSE)
     {
         rt_kprintf("No available RX Msg.\n");
         return -(RT_ERROR);
@@ -519,32 +562,13 @@ static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxn
     can->hdr[pmsg->hdr].connected = 1;
 #endif
 
-    /* Standard ID (11 bits)*/
-    if (tMsg.IdType == CAN_STD_ID)
-    {
-        pmsg->ide = RT_CAN_STDID;
-        pmsg->id  = tMsg.Id;
-    }
-    else /* Extended ID (29 bits)*/
-    {
-        pmsg->ide = RT_CAN_EXTID;
-        pmsg->id  = tMsg.Id;
-    }
-
-    if (tMsg.FrameType == CAN_DATA_FRAME)
-    {
-        /* Data frame */
-        pmsg->rtr = RT_CAN_DTR;
-    }
-    else
-    {
-        /* Remote frame */
-        pmsg->rtr = RT_CAN_RTR;
-    }
-
+    pmsg->ide = (tMsg.IdType == CAN_STD_ID) ? RT_CAN_STDID : RT_CAN_EXTID;
+    pmsg->rtr = (tMsg.FrameType == CAN_DATA_FRAME) ? RT_CAN_DTR : RT_CAN_RTR;
+    pmsg->id  = tMsg.Id;
     pmsg->len = tMsg.DLC ;
 
-    rt_memcpy(pmsg->data, tMsg.Data, pmsg->len);
+    if (pmsg->data && pmsg->len)
+        rt_memcpy(pmsg->data, &tMsg.Data[0], pmsg->len);
 
     return RT_EOK;
 }
@@ -559,13 +583,12 @@ static int rt_hw_can_init(void)
 
     for (i = (CAN_START + 1); i < CAN_CNT; i++)
     {
-
-        nu_can_arr[i].dev.ops = &nu_can_ops;
         nu_can_arr[i].dev.config = nu_can_default_config;
 
 #ifdef RT_CAN_USING_HDR
         nu_can_arr[i].dev.config.maxhdr = RT_CANMSG_BOX_SZ;
 #endif
+        /* Register can device */
         ret = rt_hw_can_register(&nu_can_arr[i].dev, nu_can_arr[i].name, &nu_can_ops, NULL);
         RT_ASSERT(ret == RT_EOK);
     }

+ 1 - 1
bsp/nuvoton/libraries/m480/rtt_port/drv_i2c.c

@@ -99,7 +99,7 @@ static rt_err_t nu_i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t u3
     RT_ASSERT(bus != RT_NULL);
     nu_i2c = (nu_i2c_bus_t *) bus;
 
-    switch (RT_I2C_DEV_CTRL_CLK)
+    switch (u32Cmd)
     {
     case RT_I2C_DEV_CTRL_CLK:
         I2C_SetBusClockFreq(nu_i2c->I2C, u32Value);

+ 2 - 2
bsp/nuvoton/libraries/n9h30/Driver/Include/nu_can.h

@@ -151,8 +151,8 @@ typedef struct
 #define CAN_BTIME_TSEG2_Pos              (12)                                              /*!< CAN_T::BTIME: TSeg2 Position           */
 #define CAN_BTIME_TSEG2_Msk              (0x7ul << CAN_BTIME_TSEG2_Pos)                    /*!< CAN_T::BTIME: TSeg2 Mask               */
 
-#define CAN_IIDR_IntId_Pos               (0)                                               /*!< CAN_T::IIDR: IntId Position            */
-#define CAN_IIDR_IntId_Msk               (0xfffful << CAN_IIDR_IntId_Pos)                  /*!< CAN_T::IIDR: IntId Mask                */
+#define CAN_IIDR_INTID_Pos               (0)                                               /*!< CAN_T::IIDR: IntId Position            */
+#define CAN_IIDR_INTID_Msk               (0xfffful << CAN_IIDR_INTID_Pos)                  /*!< CAN_T::IIDR: IntId Mask                */
 
 #define CAN_TEST_BASIC_Pos               (2)                                               /*!< CAN_T::TEST: Basic Position            */
 #define CAN_TEST_BASIC_Msk               (0x1ul << CAN_TEST_BASIC_Pos)                     /*!< CAN_T::TEST: Basic Mask                */

+ 11 - 5
bsp/nuvoton/libraries/n9h30/Driver/Include/nu_lcd.h

@@ -171,11 +171,17 @@ typedef struct
     uint32_t *pFrameBuffer;          /*!< User input, The address of OSD source image */
 } OSDFORMATEX;
 
-#define DIS_PANEL_E50A2V1       0
-#define DIS_PANEL_ILI9341_MPU80 1
-#define DIS_LSA40AT9001         2
-#define DIS_PANEL_FW070TFT      3
-#define DIS_PANEL_FW043TFT      4
+enum DIS_PANEL
+{
+    DIS_PANEL_E50A2V1 = 0,
+    DIS_PANEL_ILI9341_MPU80,
+    DIS_LSA40AT9001,
+    DIS_PANEL_FW070TFT,
+    DIS_PANEL_FW043TFT,
+    DIS_PANEL_FW070TFT_WSVGA,
+    DIS_PANEL_CNT
+};
+
 typedef struct
 {
     uint32_t u32DevWidth;           /*!< Panel width */

+ 4 - 0
bsp/nuvoton/libraries/n9h30/Driver/Include/nu_uart.h

@@ -770,4 +770,8 @@ void UART_SetLineConfig(UART_T *uart, uint32_t u32baudrate, uint32_t u32data_wid
 
 /*@}*/ /* end of group N9H30_Device_Driver */
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif

+ 74 - 1
bsp/nuvoton/libraries/n9h30/Driver/Source/nu_lcd.c

@@ -168,9 +168,82 @@ static VPOST_T DEF_FW043TFT =
     }
 };
 
+#define FW070TFT_WSVGA_WIDTH        1024  /*!< XRES */
+#define FW070TFT_WSVGA_HEIGHT       600   /*!< YRES */
+#define FW070TFT_WSVGA_MARGIN_LEFT  160   /*!< HBP (Horizontal Back Porch) */
+#define FW070TFT_WSVGA_MARGIN_RIGHT 160   /*!< HFP (Horizontal Front Porch) */
+#define FW070TFT_WSVGA_MARGIN_UPPER 12    /*!< VBP (Vertical Back Porch) */
+#define FW070TFT_WSVGA_MARGIN_LOWER 23    /*!< VFP (Vertical Front Porch) */
+#define FW070TFT_WSVGA_HSYNC_LEN    1     /*!< HPW (HSYNC plus width) */
+#define FW070TFT_WSVGA_VSYNC_LEN    1     /*!< VPW (VSYNC width) */
+static VPOST_T DEF_FW070TFT_WSVGA  =
+{
+    FW070TFT_WSVGA_WIDTH,                 /*!< Panel width */
+    FW070TFT_WSVGA_HEIGHT,                /*!< Panel height */
+    0,                              /*!< MPU command line low indicator */
+    0,                              /*!< MPU command width */
+    0,                              /*!< MPU bus width */
+    VPOSTB_DATA16or18,              /*!< Display bus width */
+    0,                              /*!< MPU mode */
+    VPOSTB_COLORTYPE_16M,           /*!< Display colors */
+    VPOSTB_DEVICE_SYNC_HIGHCOLOR,   /*!< Type of display panel */
+
+    .sCRTCSIZE =
+    {
+        /*!< Horizontal Total */
+        .HTT = FW070TFT_WSVGA_MARGIN_LEFT + FW070TFT_WSVGA_WIDTH + FW070TFT_WSVGA_MARGIN_RIGHT,
+
+        /*!< Vertical Total */
+        .VTT = FW070TFT_WSVGA_MARGIN_UPPER + FW070TFT_WSVGA_HEIGHT + FW070TFT_WSVGA_MARGIN_LOWER,
+    },
+    .sCRTCDEND =
+    {
+        /*!< Horizontal Display Enable End */
+        .HDEND = FW070TFT_WSVGA_WIDTH,
+
+        /*!< Vertical Display Enable End */
+        .VDEND = FW070TFT_WSVGA_HEIGHT,
+    },
+    .sCRTCHR =
+    {
+        /*!< Internal Horizontal Retrace Start Timing */
+        .HRS = FW070TFT_WSVGA_WIDTH + 1,
+
+        /*!< Internal Horizontal Retrace End Low */
+        .HRE = FW070TFT_WSVGA_WIDTH + 5,
+    },
+    .sCRTCHSYNC =
+    {
+        /*!< Horizontal Sync Start Timing */
+        .HSYNC_S = FW070TFT_WSVGA_WIDTH + FW070TFT_WSVGA_MARGIN_LEFT,
+
+        /*!< Horizontal Sync End Timing */
+        .HSYNC_E = FW070TFT_WSVGA_WIDTH + FW070TFT_WSVGA_MARGIN_LEFT + FW070TFT_WSVGA_HSYNC_LEN,
+
+        /*!< Hsync Signal Adjustment For Multi-Cycles Per Pixel Mode Of Sync-Based Unipac-LCD */
+        .HSYNC_SHIFT = 0,
+    },
+    .sCRTCVR =
+    {
+        /*!< Vertical Internal Retrace Start Timing */
+        .VRS = FW070TFT_WSVGA_HEIGHT + FW070TFT_WSVGA_MARGIN_UPPER,
+
+        /*!< Vertical Internal Retrace End Low */
+        .VRE = FW070TFT_WSVGA_HEIGHT + FW070TFT_WSVGA_MARGIN_UPPER + FW070TFT_WSVGA_VSYNC_LEN,
+    }
+};
 
 /* LCD build-in support list */
-static VPOST_T *DisplayDevList[5] = {&DEF_E50A2V1, &DEF_ILI9341_MPU80, &DEF_LSA40AT9001, &DEF_FW070TFT, &DEF_FW043TFT};
+static VPOST_T *DisplayDevList[DIS_PANEL_CNT] =
+{
+    &DEF_E50A2V1,
+    &DEF_ILI9341_MPU80,
+    &DEF_LSA40AT9001,
+    &DEF_FW070TFT,
+    &DEF_FW043TFT,
+    &DEF_FW070TFT_WSVGA
+};
+
 static VPOST_T curDisplayDev;
 static OSDFORMATEX curOSDDev = {0};
 static LCDFORMATEX curVADev = {0};

+ 7 - 0
bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig

@@ -475,6 +475,9 @@ config SOC_SERIES_N9H30
                 config LCM_USING_FW043TFT
                     bool "LCM_FW043TFT(480x272-RGB888)"
 
+                config LCM_USING_FW070TFT_WSVGA
+                    bool "LCM_USING_FW070TFT_WSVGA(1024x600-RGB888)"
+
             endchoice
 
             config VPOST_USING_LCD_IDX
@@ -483,6 +486,7 @@ config SOC_SERIES_N9H30
                 default 2    if LCM_USING_LSA40AT9001
                 default 3    if LCM_USING_FW070TFT
                 default 4    if LCM_USING_FW043TFT
+                default 5    if LCM_USING_FW070TFT_WSVGA
 
            config BSP_LCD_BPP
                 int
@@ -490,6 +494,7 @@ config SOC_SERIES_N9H30
                 default 16    if LCM_USING_LSA40AT9001
                 default 32    if LCM_USING_FW070TFT
                 default 32    if LCM_USING_FW043TFT
+                default 32    if LCM_USING_FW070TFT_WSVGA
 
            config BSP_LCD_WIDTH
                 int
@@ -497,6 +502,7 @@ config SOC_SERIES_N9H30
                 default 800    if LCM_USING_LSA40AT9001
                 default 800    if LCM_USING_FW070TFT
                 default 480    if LCM_USING_FW043TFT
+                default 1024   if LCM_USING_FW070TFT_WSVGA
 
            config BSP_LCD_HEIGHT
                 int
@@ -504,6 +510,7 @@ config SOC_SERIES_N9H30
                 default 600    if LCM_USING_LSA40AT9001
                 default 480    if LCM_USING_FW070TFT
                 default 272    if LCM_USING_FW043TFT
+                default 600    if LCM_USING_FW070TFT_WSVGA
 
            config BSP_USING_VPOST_OSD
                 bool "Enable VPOST OSD layer"

+ 104 - 91
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc.c

@@ -35,24 +35,27 @@ struct nu_adc
     uint32_t chn_mask;
     rt_sem_t m_psSem;
 
+#if defined(BSP_USING_ADC_TOUCH)
     rt_touch_t psRtTouch;
     rt_timer_t psRtTouchMenuTimer;
+    rt_mq_t m_pmqTouchXYZ;
+#endif
 
     nu_adc_cb m_isr[eAdc_ISR_CNT];
     nu_adc_cb m_wkisr[eAdc_WKISR_CNT];
-
-    rt_mq_t m_pmqTouchXYZ;
 };
 typedef struct nu_adc *nu_adc_t;
 
+#if defined(BSP_USING_ADC_TOUCH)
 struct nu_adc_touch_data
 {
-    uint16_t    u16X;
-    uint16_t    u16Y;
-    uint16_t    u16Z0;
-    uint16_t    u16Z1;
+    uint32_t    u32X;
+    uint32_t    u32Y;
+    uint32_t    u32Z0;
+    uint32_t    u32Z1;
 };
 typedef struct nu_adc_touch_data *nu_adc_touch_data_t;
+#endif
 
 /* Private functions ------------------------------------------------------------*/
 static rt_err_t nu_adc_enabled(struct rt_adc_device *device, rt_uint32_t channel, rt_bool_t enabled);
@@ -134,44 +137,30 @@ static rt_err_t _nu_adc_init(rt_device_t dev)
     return RT_EOK;
 }
 
-void nu_adc_touch_detect(rt_bool_t bStartDetect)
+static int32_t AdcMenuStartCallback(uint32_t status, uint32_t userData)
 {
-    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
+    nu_adc_t psNuAdc = (nu_adc_t)userData;
 
-    if (bStartDetect)
-    {
-        /* Start detect PenDown */
-        _nu_adc_control((rt_device_t)psNuAdc, PEPOWER_ON, RT_NULL);
-    }
-    else
-    {
-        /* Stop detect PenDown */
-        _nu_adc_control((rt_device_t)psNuAdc, PEPOWER_OFF, RT_NULL);
-    }
-}
+#if defined(BSP_USING_ADC_TOUCH)
 
-static int32_t AdcMenuStartCallback(uint32_t status, uint32_t userData)
-{
     static struct nu_adc_touch_data point;
     static rt_bool_t bDrop = RT_FALSE;
-    static uint16_t u16LastZ0 = 0xfffful;
-
-    nu_adc_t psNuAdc = (nu_adc_t)userData;
+    static uint32_t u32LastZ0 = 0xffffu;
 
     if (psNuAdc->psRtTouch != RT_NULL)
     {
         uint32_t value;
 
         value = inpw(REG_ADC_XYDATA);
-        point.u16X = (uint16_t)(value & 0x0ffful);
-        point.u16Y = (uint16_t)((value >> 16) & 0x0ffful);
+        point.u32X = (value & 0x0ffful);
+        point.u32Y = ((value >> 16) & 0x0ffful);
 
         value = inpw(REG_ADC_ZDATA);
-        point.u16Z0 = (uint16_t)(value & 0x0ffful);
-        point.u16Z1 = (uint16_t)((value >> 16) & 0x0ffful);
+        point.u32Z0 = (value & 0x0ffful);
+        point.u32Z1 = ((value >> 16) & 0x0ffful);
 
         /* Trigger next or not. */
-        if (point.u16Z0 == 0)
+        if (point.u32Z0 == 0)
         {
             /* Stop sampling procedure. */
             rt_timer_stop(g_sNuADC.psRtTouchMenuTimer);
@@ -187,14 +176,15 @@ static int32_t AdcMenuStartCallback(uint32_t status, uint32_t userData)
         }
 
         /* Notify upper layer. */
-        if ((!bDrop || (u16LastZ0 != 0)) && rt_mq_send(psNuAdc->m_pmqTouchXYZ, (const void *)&point, sizeof(struct nu_adc_touch_data)) == RT_EOK)
+        if ((!bDrop || (u32LastZ0 != 0)) && rt_mq_send(psNuAdc->m_pmqTouchXYZ, (const void *)&point, sizeof(struct nu_adc_touch_data)) == RT_EOK)
         {
             rt_hw_touch_isr(psNuAdc->psRtTouch);
         }
 
-        u16LastZ0 = point.u16Z0;
+        u32LastZ0 = point.u32Z0;
     }
     else
+#endif
     {
         rt_err_t result = rt_sem_release(psNuAdc->m_psSem);
         RT_ASSERT(result == RT_EOK);
@@ -203,6 +193,23 @@ static int32_t AdcMenuStartCallback(uint32_t status, uint32_t userData)
     return 0;
 }
 
+#if defined(BSP_USING_ADC_TOUCH)
+
+void nu_adc_touch_detect(rt_bool_t bStartDetect)
+{
+    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
+
+    if (bStartDetect)
+    {
+        /* Start detect PenDown */
+        _nu_adc_control((rt_device_t)psNuAdc, PEPOWER_ON, RT_NULL);
+    }
+    else
+    {
+        /* Stop detect PenDown */
+        _nu_adc_control((rt_device_t)psNuAdc, PEPOWER_OFF, RT_NULL);
+    }
+}
 
 static int32_t PenDownCallback(uint32_t status, uint32_t userData)
 {
@@ -213,7 +220,7 @@ static int32_t PenDownCallback(uint32_t status, uint32_t userData)
     return 0;
 }
 
-int32_t nu_adc_read_touch_xyz(uint16_t *bufX, uint16_t *bufY, uint16_t *bufZ0, uint16_t *bufZ1, int32_t dataCnt)
+int32_t nu_adc_touch_read_xyz(uint32_t *bufX, uint32_t *bufY, uint32_t *bufZ0, uint32_t *bufZ1, int32_t dataCnt)
 {
     int i;
     struct nu_adc_touch_data value;
@@ -223,14 +230,71 @@ int32_t nu_adc_read_touch_xyz(uint16_t *bufX, uint16_t *bufY, uint16_t *bufZ0, u
         if (rt_mq_recv(g_sNuADC.m_pmqTouchXYZ, (void *)&value, sizeof(struct nu_adc_touch_data), 0) == -RT_ETIMEOUT)
             break;
 
-        bufX[i]  = value.u16X;
-        bufY[i]  = value.u16Y;
-        bufZ0[i] = value.u16Z0;
-        bufZ1[i] = value.u16Z1;
+        bufX[i]  = value.u32X;
+        bufY[i]  = value.u32Y;
+        bufZ0[i] = value.u32Z0;
+        bufZ1[i] = value.u32Z1;
     }
     return i;
 }
 
+void nu_adc_touch_start_conv(void)
+{
+    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
+    _nu_adc_control((rt_device_t)psNuAdc, START_MST, RT_NULL);
+}
+
+rt_err_t nu_adc_touch_enable(rt_touch_t psRtTouch)
+{
+    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
+    nu_adc_cb sNuAdcCb;
+
+    rt_adc_enable((rt_adc_device_t)psNuAdc, 4);
+    rt_adc_enable((rt_adc_device_t)psNuAdc, 5);
+    rt_adc_enable((rt_adc_device_t)psNuAdc, 6);
+    rt_adc_enable((rt_adc_device_t)psNuAdc, 7);
+
+    outpw(REG_ADC_CONF, (inpw(REG_ADC_CONF) & ~(0xfful << 24)) | 0xfful << 24);
+
+    /* Register touch device. */
+    psNuAdc->psRtTouch = psRtTouch;
+
+    /* Enable TouchXY. */
+    _nu_adc_control((rt_device_t)psNuAdc, T_ON, RT_NULL);
+
+    /* Enable TouchZZ. */
+    _nu_adc_control((rt_device_t)psNuAdc, Z_ON, RT_NULL);
+
+    /* Register PenDown callback. */
+    sNuAdcCb.cbfunc = PenDownCallback;
+    sNuAdcCb.private_data = (rt_uint32_t)psRtTouch;
+    _nu_adc_control((rt_device_t)psNuAdc, PEDEF_ON, (void *)&sNuAdcCb);
+
+    nu_adc_touch_detect(RT_TRUE);
+
+    return RT_EOK;
+}
+
+rt_err_t nu_adc_touch_disable(void)
+{
+    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
+
+    nu_adc_touch_detect(RT_FALSE);
+
+    _nu_adc_control((rt_device_t)psNuAdc, T_OFF, RT_NULL);
+    _nu_adc_control((rt_device_t)psNuAdc, Z_OFF, RT_NULL);
+    _nu_adc_control((rt_device_t)psNuAdc, PEDEF_OFF, RT_NULL);
+
+    rt_adc_disable((rt_adc_device_t)psNuAdc, 4);
+    rt_adc_disable((rt_adc_device_t)psNuAdc, 5);
+    rt_adc_disable((rt_adc_device_t)psNuAdc, 6);
+    rt_adc_disable((rt_adc_device_t)psNuAdc, 7);
+
+    return RT_EOK;
+}
+
+#endif
+
 static rt_err_t _nu_adc_control(rt_device_t dev, int cmd, void *args)
 {
     rt_err_t ret = RT_EINVAL ;
@@ -443,7 +507,9 @@ static rt_err_t _nu_adc_control(rt_device_t dev, int cmd, void *args)
     case Z_OFF:   /* Disable Press measure function */
     {
         outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) & ~ADC_CONF_ZEN);
+#if defined(BSP_USING_ADC_TOUCH)
         rt_mq_control(psNuAdc->m_pmqTouchXYZ, RT_IPC_CMD_RESET, RT_NULL);
+#endif
     }
     break;
 
@@ -522,61 +588,6 @@ static rt_err_t _nu_adc_control(rt_device_t dev, int cmd, void *args)
     return RT_EOK;
 }
 
-void nu_adc_touch_start_conv(void)
-{
-    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
-    _nu_adc_control((rt_device_t)psNuAdc, START_MST, RT_NULL);
-}
-
-rt_err_t nu_adc_touch_enable(rt_touch_t psRtTouch)
-{
-    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
-    nu_adc_cb sNuAdcCb;
-
-    rt_adc_enable((rt_adc_device_t)psNuAdc, 4);
-    rt_adc_enable((rt_adc_device_t)psNuAdc, 5);
-    rt_adc_enable((rt_adc_device_t)psNuAdc, 6);
-    rt_adc_enable((rt_adc_device_t)psNuAdc, 7);
-
-    outpw(REG_ADC_CONF, (inpw(REG_ADC_CONF) & ~(0xfful << 24)) | 0xfful << 24);
-
-    /* Register touch device. */
-    psNuAdc->psRtTouch = psRtTouch;
-
-    /* Enable TouchXY. */
-    _nu_adc_control((rt_device_t)psNuAdc, T_ON, RT_NULL);
-
-    /* Enable TouchZZ. */
-    _nu_adc_control((rt_device_t)psNuAdc, Z_ON, RT_NULL);
-
-    /* Register PenDown callback. */
-    sNuAdcCb.cbfunc = PenDownCallback;
-    sNuAdcCb.private_data = (rt_uint32_t)psRtTouch;
-    _nu_adc_control((rt_device_t)psNuAdc, PEDEF_ON, (void *)&sNuAdcCb);
-
-    nu_adc_touch_detect(RT_TRUE);
-
-    return RT_EOK;
-}
-
-rt_err_t nu_adc_touch_disable(void)
-{
-    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
-
-    nu_adc_touch_detect(RT_FALSE);
-
-    _nu_adc_control((rt_device_t)psNuAdc, T_OFF, RT_NULL);
-    _nu_adc_control((rt_device_t)psNuAdc, Z_OFF, RT_NULL);
-    _nu_adc_control((rt_device_t)psNuAdc, PEDEF_OFF, RT_NULL);
-
-    rt_adc_disable((rt_adc_device_t)psNuAdc, 4);
-    rt_adc_disable((rt_adc_device_t)psNuAdc, 5);
-    rt_adc_disable((rt_adc_device_t)psNuAdc, 6);
-    rt_adc_disable((rt_adc_device_t)psNuAdc, 7);
-
-    return RT_EOK;
-}
-
 static rt_err_t _nu_adc_open(rt_device_t dev, rt_uint16_t oflag)
 {
     nu_adc_t psNuAdc = (nu_adc_t)dev;
@@ -709,11 +720,13 @@ int rt_hw_adc_init(void)
     g_sNuADC.m_psSem = rt_sem_create("adc_mst_sem", 0, RT_IPC_FLAG_FIFO);
     RT_ASSERT(g_sNuADC.m_psSem != RT_NULL);
 
+#if defined(BSP_USING_ADC_TOUCH)
     g_sNuADC.m_pmqTouchXYZ = rt_mq_create("ADC_TOUCH_XYZ", sizeof(struct nu_adc_touch_data), TOUCH_MQ_LENGTH, RT_IPC_FLAG_FIFO);
     RT_ASSERT(g_sNuADC.m_pmqTouchXYZ != RT_NULL);
 
     g_sNuADC.psRtTouchMenuTimer = rt_timer_create("TOUCH_SMPL_TIMER", nu_adc_touch_smpl, (void *)&g_sNuADC, DEF_ADC_TOUCH_SMPL_TICK, RT_TIMER_FLAG_PERIODIC);
     RT_ASSERT(g_sNuADC.psRtTouchMenuTimer != RT_NULL);
+#endif
 
     rt_memset(&g_sNuADC.m_isr, 0, sizeof(g_sNuADC.m_isr));
     rt_memset(&g_sNuADC.m_wkisr, 0, sizeof(g_sNuADC.m_wkisr));

+ 26 - 6
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc.h

@@ -15,9 +15,13 @@
 
 #include <rtthread.h>
 #include "nu_adc.h"
-#include "touch.h"
+#if defined(BSP_USING_ADC_TOUCH)
+    #include "touch.h"
+#endif
 
-#define TOUCH_MQ_LENGTH 128
+#define TOUCH_MQ_LENGTH      64
+
+#define DEF_CAL_POINT_NUM    5
 
 typedef enum
 {
@@ -52,13 +56,29 @@ typedef struct
 
 typedef nu_adc_cb *nu_adc_cb_t;
 
-int32_t nu_adc_read_touch_xyz(uint16_t *bufX, uint16_t *bufY, uint16_t *bufZ0, uint16_t *bufZ1, int32_t dataCnt);
+#if defined(BSP_USING_ADC_TOUCH)
+typedef struct
+{
+    int32_t   x;
+    int32_t   y;
+} S_COORDINATE_POINT;
+
+typedef struct
+{
+    int32_t   a;
+    int32_t   b;
+    int32_t   c;
+    int32_t   d;
+    int32_t   e;
+    int32_t   f;
+    int32_t   div;
+} S_CALIBRATION_MATRIX;
+
+int32_t nu_adc_touch_read_xyz(uint32_t *bufX, uint32_t *bufY, uint32_t *bufZ0, uint32_t *bufZ1, int32_t dataCnt);
 rt_err_t nu_adc_touch_enable(rt_touch_t psRtTouch);
 rt_err_t nu_adc_touch_disable(void);
 void nu_adc_touch_detect(rt_bool_t bStartDetect);
 void nu_adc_touch_start_conv(void);
-
-void nu_adc_touch_update_caldata(int *psi32NewValue);
-void nu_adc_touch_reset_caldata(int *psi32NewValue);
+#endif
 
 #endif /* __DRV_ADC_H__ */

+ 464 - 73
bsp/nuvoton/libraries/n9h30/rtt_port/drv_adc_touch.c

@@ -15,9 +15,15 @@
 
 #include "NuMicro.h"
 #include <rtdevice.h>
+#include <dfs_posix.h>
 #include "drv_adc.h"
 #include "touch.h"
 
+#if !defined(PATH_CALIBRATION_FILE)
+    #define PATH_CALIBRATION_FILE "/mnt/filesystem/ts_calibration"
+#endif
+
+
 typedef struct
 {
     struct rt_touch_device dev;
@@ -28,41 +34,135 @@ typedef nu_adc_touch *nu_adc_touch_t;
 
 static nu_adc_touch s_NuAdcTouch = {0};
 
-#define DEF_CALDATA_LENGTH 7
-
-#if defined(LCM_USING_FW043TFT)
-    #define LCM_WIDTH     480
-    #define LCM_HEIGHT    272
-    static int cal_data_a[DEF_CALDATA_LENGTH] = { 8824, -34, -2261272, -70, -6302, 21805816, 65536 };
+#if (BSP_LCD_WIDTH==480) && (BSP_LCD_HEIGHT==272)
+static S_CALIBRATION_MATRIX g_sCalMat = { 8824, -34, -2261272, -70, -6302, 21805816, 65536 };
+static volatile uint32_t g_u32Calibrated = 1;
+#elif (BSP_LCD_WIDTH==800) && (BSP_LCD_HEIGHT==480)
+static S_CALIBRATION_MATRIX g_sCalMat = { 13230, -66, -1161952, -85, 8600, -1636996, 65536 };
+static volatile uint32_t g_u32Calibrated = 1;
 #else
-    #define LCM_WIDTH     800
-    #define LCM_HEIGHT    480
-    #if defined(LCM_USING_FW070TFT)
-    static int cal_data_a[DEF_CALDATA_LENGTH] = { 13230, -66, -1161952, -85, 8600, -1636996, 65536 };
-    #else
-    static int cal_data_a[DEF_CALDATA_LENGTH] = { 1, 0, 0, 0, 1, 0, 1 };
-    #endif
+static S_CALIBRATION_MATRIX g_sCalMat = { 1, 0, 0, 0, 1, 0, 1 };
+static volatile uint32_t g_u32Calibrated = 0;
 #endif
 
-static const int cal_zero[DEF_CALDATA_LENGTH] = { 1, 0, 0, 0, 1, 0, 1 };
+static int nu_adc_touch_readfile(void);
 
-static void nu_adc_touch_cal(int *sumx, int *sumy)
+static const S_CALIBRATION_MATRIX g_sCalZero = { 1, 0, 0, 0, 1, 0, 1 };
+
+static int nu_adc_cal_mat_get(const S_COORDINATE_POINT *psDispCP, S_COORDINATE_POINT *psADCCP, S_CALIBRATION_MATRIX *psCM)
 {
-    int xtemp, ytemp;
+#if (DEF_CAL_POINT_NUM==3)
+
+    psCM->div = ((psADCCP[0].x - psADCCP[2].x) * (psADCCP[1].y - psADCCP[2].y)) -
+                ((psADCCP[1].x - psADCCP[2].x) * (psADCCP[0].y - psADCCP[2].y)) ;
+
+    if (psCM->div == 0)
+    {
+        return -1;
+    }
+    else
+    {
+        psCM->a = ((psDispCP[0].x - psDispCP[2].x) * (psADCCP[1].y - psADCCP[2].y)) -
+                  ((psDispCP[1].x - psDispCP[2].x) * (psADCCP[0].y - psADCCP[2].y)) ;
+
+        psCM->b = ((psADCCP[0].x - psADCCP[2].x) * (psDispCP[1].x - psDispCP[2].x)) -
+                  ((psDispCP[0].x - psDispCP[2].x) * (psADCCP[1].x - psADCCP[2].x)) ;
+
+        psCM->c = (psADCCP[2].x * psDispCP[1].x - psADCCP[1].x * psDispCP[2].x) * psADCCP[0].y +
+                  (psADCCP[0].x * psDispCP[2].x - psADCCP[2].x * psDispCP[0].x) * psADCCP[1].y +
+                  (psADCCP[1].x * psDispCP[0].x - psADCCP[0].x * psDispCP[1].x) * psADCCP[2].y ;
+
+        psCM->d = ((psDispCP[0].y - psDispCP[2].y) * (psADCCP[1].y - psADCCP[2].y)) -
+                  ((psDispCP[1].y - psDispCP[2].y) * (psADCCP[0].y - psADCCP[2].y)) ;
+
+        psCM->e = ((psADCCP[0].x - psADCCP[2].x) * (psDispCP[1].y - psDispCP[2].y)) -
+                  ((psDispCP[0].y - psDispCP[2].y) * (psADCCP[1].x - psADCCP[2].x)) ;
+
+        psCM->f = (psADCCP[2].x * psDispCP[1].y - psADCCP[1].x * psDispCP[2].y) * psADCCP[0].y +
+                  (psADCCP[0].x * psDispCP[2].y - psADCCP[2].x * psDispCP[0].y) * psADCCP[1].y +
+                  (psADCCP[1].x * psDispCP[0].y - psADCCP[0].x * psDispCP[1].y) * psADCCP[2].y ;
+    }
+
+#elif (DEF_CAL_POINT_NUM==5)
+
+    int i;
+    float n, x, y, xx, yy, xy, z, zx, zy;
+    float a, b, c, d, e, f, g;
+    float scaling = 65536.0f;
+
+    n = x = y = xx = yy = xy = 0;
+    for (i = 0; i < DEF_CAL_POINT_NUM; i++)
+    {
+        n  += 1.0;
+        x  += (float)psADCCP[i].x;
+        y  += (float)psADCCP[i].y;
+        xx += (float)psADCCP[i].x * psADCCP[i].x;
+        yy += (float)psADCCP[i].y * psADCCP[i].y;
+        xy += (float)psADCCP[i].x * psADCCP[i].y;
+    }
+
+    d = n * (xx * yy - xy * xy) + x * (xy * y - x * yy) + y * (x * xy - y * xx);
+    if (d < 0.1 && d > -0.1)
+    {
+        return -1;
+    }
+
+    a = (xx * yy - xy * xy) / d;
+    b = (xy * y  - x * yy)  / d;
+    c = (x * xy  - y * xx)  / d;
+    e = (n * yy  - y * y)   / d;
+    f = (x * y   - n * xy)  / d;
+    g = (n * xx  - x * x)   / d;
+
+    z = zx = zy = 0;
+    for (i = 0; i < DEF_CAL_POINT_NUM; i++)
+    {
+        z  += (float)psDispCP[i].x;
+        zx += (float)psDispCP[i].x * psADCCP[i].x;
+        zy += (float)psDispCP[i].x * psADCCP[i].y;
+    }
+
+    psCM->c = (int32_t)((a * z + b * zx + c * zy) * scaling);
+    psCM->a = (int32_t)((b * z + e * zx + f * zy) * scaling);
+    psCM->b = (int32_t)((c * z + f * zx + g * zy) * scaling);
+
+    z = zx = zy = 0;
+    for (i = 0; i < DEF_CAL_POINT_NUM; i++)
+    {
+        z  += (float)psDispCP[i].y;
+        zx += (float)psDispCP[i].y * psADCCP[i].x;
+        zy += (float)psDispCP[i].y * psADCCP[i].y;
+    }
+
+    psCM->f = (int32_t)((a * z + b * zx + c * zy) * scaling);
+    psCM->d = (int32_t)((b * z + e * zx + f * zy) * scaling);
+    psCM->e = (int32_t)((c * z + f * zx + g * zy) * scaling);
+
+    psCM->div = (int32_t)scaling;
+
+#else
+#error "Not supported calibration method"
+#endif
+    return 0;
+}
+
+static void nu_adc_touch_cal(int32_t *sumx, int32_t *sumy)
+{
+    int32_t xtemp, ytemp;
 
     xtemp = *sumx;
     ytemp = *sumy;
-    *sumx = (cal_data_a[2] +
-             cal_data_a[0] * xtemp +
-             cal_data_a[1] * ytemp) / cal_data_a[6];
-    *sumy = (cal_data_a[5] +
-             cal_data_a[3] * xtemp +
-             cal_data_a[4] * ytemp) / cal_data_a[6];
+    *sumx = (g_sCalMat.c +
+             g_sCalMat.a * xtemp +
+             g_sCalMat.b * ytemp) / g_sCalMat.div;
+    *sumy = (g_sCalMat.f +
+             g_sCalMat.d * xtemp +
+             g_sCalMat.e * ytemp) / g_sCalMat.div;
 }
 
 static rt_size_t nu_adc_touch_readpoint(struct rt_touch_device *device, void *buf, rt_size_t read_num)
 {
-    static int last_report_x = 0, last_report_y = 0;
+    static uint32_t last_report_x = 0, last_report_y = 0;
     struct rt_touch_data *pPoint = (struct rt_touch_data *)buf;
     nu_adc_touch_t psNuAdcTouch = (nu_adc_touch_t)device;
 
@@ -73,38 +173,44 @@ static rt_size_t nu_adc_touch_readpoint(struct rt_touch_device *device, void *bu
 
     for (i = 0; i < read_num; i++)
     {
-        int bufZ0 = 0, bufZ1 = 0;
-        int sumx = 0, sumy = 0;
+        uint32_t bufZ0 = 0, bufZ1 = 0;
+        int32_t sumx = 0, sumy = 0;
         pPoint[i].timestamp = rt_touch_get_ts();
         pPoint[i].track_id = 0;
 
-        if (nu_adc_read_touch_xyz((uint16_t *)&sumx, (uint16_t *)&sumy, (uint16_t *)&bufZ0, (uint16_t *)&bufZ1, 1) != 1)
+        if (nu_adc_touch_read_xyz((uint32_t *)&sumx, (uint32_t *)&sumy, &bufZ0, &bufZ1, 1) != 1)
             break;
 
         if (bufZ0 == 0)
         {
             /* Workaround: In this case, x, y values are unstable. so, report last point's coordinate.*/
             pPoint[i].event = RT_TOUCH_EVENT_UP;
-            pPoint[i].x_coordinate = last_report_x;
-            pPoint[i].y_coordinate = last_report_y;
+            pPoint[i].x_coordinate = (uint16_t)last_report_x;
+            pPoint[i].y_coordinate = (uint16_t)last_report_y;
         }
         else
         {
-            nu_adc_touch_cal(&sumx, &sumy);
-            pPoint[i].event = RT_TOUCH_EVENT_DOWN;
-            pPoint[i].x_coordinate = sumx;
-            pPoint[i].y_coordinate = sumy;
+            if (g_u32Calibrated)
+            {
+                nu_adc_touch_cal(&sumx, &sumy);
+            }
             last_report_x = sumx;
             last_report_y = sumy;
-        }
 
-        bufZ0 = bufZ0 >> 3;
+            pPoint[i].event = RT_TOUCH_EVENT_DOWN;
+            pPoint[i].x_coordinate = (uint16_t)sumx;
+            pPoint[i].y_coordinate = (uint16_t)sumy;
+        }
 
-        pPoint[i].width = (bufZ0 > 255) ? 255 : bufZ0;
+        if (g_u32Calibrated)
+        {
+            bufZ0 = bufZ0 >> 3;
+            pPoint[i].width = (bufZ0 > 255) ? 255 : bufZ0;
 
-        //Limit max x, y coordinate if value is over its range.
-        pPoint[i].x_coordinate = (pPoint[i].x_coordinate > psNuAdcTouch->x_range) ? psNuAdcTouch->x_range : pPoint[i].x_coordinate;
-        pPoint[i].y_coordinate = (pPoint[i].y_coordinate > psNuAdcTouch->y_range) ? psNuAdcTouch->y_range : pPoint[i].y_coordinate;
+            //Limit max x, y coordinate if value is over its range.
+            pPoint[i].x_coordinate = (pPoint[i].x_coordinate > psNuAdcTouch->x_range) ? psNuAdcTouch->x_range : pPoint[i].x_coordinate;
+            pPoint[i].y_coordinate = (pPoint[i].y_coordinate > psNuAdcTouch->y_range) ? psNuAdcTouch->y_range : pPoint[i].y_coordinate;
+        }
     }
     return (rt_size_t)i;
 }
@@ -150,14 +256,29 @@ static struct rt_touch_ops touch_ops =
     .touch_control = nu_adc_touch_control,
 };
 
-void nu_adc_touch_update_caldata(int *psi32NewValue)
+static void nu_adc_touch_update_calmat(S_CALIBRATION_MATRIX *psNewCalMat)
 {
-    rt_memcpy(&cal_data_a[0], &psi32NewValue[0], sizeof(cal_data_a));
+    if (psNewCalMat &&
+            psNewCalMat->div != 0)
+    {
+        rt_memcpy(&g_sCalMat, psNewCalMat, sizeof(S_CALIBRATION_MATRIX));
+        g_u32Calibrated = 1;
+        rt_kprintf("Applied calibration data: %d, %d, %d, %d, %d, %d, %d\n",
+                   g_sCalMat.a,
+                   g_sCalMat.b,
+                   g_sCalMat.c,
+                   g_sCalMat.d,
+                   g_sCalMat.e,
+                   g_sCalMat.f,
+                   g_sCalMat.div);
+
+    }
 }
 
-void nu_adc_touch_reset_caldata(int *psi32NewValue)
+static void nu_adc_touch_reset_calmat(void)
 {
-    rt_memcpy(&cal_data_a[0], &cal_zero[0], sizeof(cal_data_a));
+    rt_memcpy(&g_sCalMat, &g_sCalZero, sizeof(S_CALIBRATION_MATRIX));
+    g_u32Calibrated = 0;
 }
 
 int rt_hw_adc_touch_init(void)
@@ -166,8 +287,8 @@ int rt_hw_adc_touch_init(void)
     s_NuAdcTouch.dev.info.type = RT_TOUCH_TYPE_RESISTANCE;
     s_NuAdcTouch.dev.info.vendor = RT_TOUCH_VENDOR_UNKNOWN;
     s_NuAdcTouch.dev.info.point_num = 1;
-    s_NuAdcTouch.dev.info.range_x = LCM_WIDTH;
-    s_NuAdcTouch.dev.info.range_y = LCM_HEIGHT;
+    s_NuAdcTouch.dev.info.range_x = BSP_LCD_WIDTH;
+    s_NuAdcTouch.dev.info.range_y = BSP_LCD_HEIGHT;
 
     s_NuAdcTouch.dev.ops = &touch_ops;
 
@@ -179,10 +300,268 @@ INIT_DEVICE_EXPORT(rt_hw_adc_touch_init);
 static rt_thread_t  adc_touch_thread = RT_NULL;
 static rt_sem_t     adc_touch_sem = RT_NULL;
 static int          adc_touch_worker_run = 0;
+
 static rt_err_t adc_touch_rx_callback(rt_device_t dev, rt_size_t size)
 {
-    rt_sem_release(adc_touch_sem);
+    //rt_kprintf("[%s %d] %d\n", __func__, __LINE__, size);
+    return rt_sem_release(adc_touch_sem);
+}
+
+static rt_err_t adc_request_point(rt_device_t pdev, struct rt_touch_data *psTouchPoint)
+{
+    rt_err_t ret = -RT_ERROR;
+
+    if ((ret = rt_sem_take(adc_touch_sem, rt_tick_from_millisecond(500))) == RT_EOK)
+    {
+        rt_memset(psTouchPoint, 0, sizeof(struct rt_touch_data));
+
+        if (rt_device_read(pdev, 0, psTouchPoint, s_NuAdcTouch.dev.info.point_num) == s_NuAdcTouch.dev.info.point_num)
+        {
+            ret = RT_EOK;
+        }
+
+    }
+
+    return ret;
+}
+
+RT_WEAK void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t event)
+{
+}
+
+static rt_device_t lcd_device = 0;
+static struct rt_device_graphic_info info;
+
+static void lcd_cleanscreen(void)
+{
+    if (info.framebuffer != RT_NULL)
+    {
+        /* Rendering */
+        struct rt_device_rect_info rect;
+
+        rt_memset(info.framebuffer, 0, (info.pitch * info.height));
+        rect.x = 0;
+        rect.y = 0;
+        rect.width = info.width;
+        rect.height = info.height;
+        rt_device_control(lcd_device, RTGRAPHIC_CTRL_RECT_UPDATE, &rect);
+    }
+    else
+    {
+        // TODO
+    }
+}
+
+#define DEF_DOT_NUMBER    9
+#define DOTS_NUMBER       (DEF_DOT_NUMBER*DEF_DOT_NUMBER)
+static void nu_draw_bots(int x, int y)
+{
+    if (info.framebuffer != RT_NULL)
+    {
+        /* Rendering */
+        struct rt_device_rect_info rect;
+        int i, j;
+        int start_x = x - (DEF_DOT_NUMBER / 2);
+        int start_y = y - (DEF_DOT_NUMBER / 2);
+
+        if (info.pixel_format == RTGRAPHIC_PIXEL_FORMAT_RGB565)
+        {
+            uint16_t *pu16Start = (uint16_t *)((uint32_t)info.framebuffer + (start_y) * info.pitch + (start_x * 2));
+            for (j = 0; j < DEF_DOT_NUMBER; j++)
+            {
+                for (i = 0; i < DEF_DOT_NUMBER; i++)
+                    pu16Start[i] = 0x07E0; //Green, RGB
+                pu16Start += info.width;
+            }
+        }
+        else if (info.pixel_format == RTGRAPHIC_PIXEL_FORMAT_ARGB888)
+        {
+            uint32_t *pu32Start = (uint32_t *)((uint32_t)info.framebuffer + (start_y) * info.pitch + (start_x * 4));
+            for (j = 0; j < DEF_DOT_NUMBER; j++)
+            {
+                for (i = 0; i < DEF_DOT_NUMBER; i++)
+                    pu32Start[i] = 0xff00ff00; //Green, ARGB
+                pu32Start += info.width;
+            }
+        }
+        else
+        {
+            //Not supported
+        }
+
+        rect.x = 0;
+        rect.y = 0;
+        rect.width = info.width;
+        rect.height = info.height;
+        rt_device_control(lcd_device, RTGRAPHIC_CTRL_RECT_UPDATE, &rect);
+    }
+    else
+    {
+        // TODO
+    }
+}
+
+#if (DEF_CAL_POINT_NUM==3)
+const S_COORDINATE_POINT sDispPoints[DEF_CAL_POINT_NUM] =
+{
+    {BSP_LCD_WIDTH / 4, BSP_LCD_HEIGHT / 2},
+    {BSP_LCD_WIDTH - BSP_LCD_WIDTH / 4, BSP_LCD_HEIGHT / 4},
+    {BSP_LCD_WIDTH / 2, BSP_LCD_HEIGHT - BSP_LCD_HEIGHT / 4}
+};
+#elif (DEF_CAL_POINT_NUM==5)
+const static S_COORDINATE_POINT sDispPoints[DEF_CAL_POINT_NUM] =
+{
+#define DEF_CUT_PIECES 8
+    {BSP_LCD_WIDTH / DEF_CUT_PIECES, BSP_LCD_HEIGHT / DEF_CUT_PIECES},
+    {BSP_LCD_WIDTH - BSP_LCD_WIDTH / DEF_CUT_PIECES, BSP_LCD_HEIGHT / DEF_CUT_PIECES},
+    {BSP_LCD_WIDTH - BSP_LCD_WIDTH / DEF_CUT_PIECES, BSP_LCD_HEIGHT - BSP_LCD_HEIGHT / DEF_CUT_PIECES},
+    {BSP_LCD_WIDTH / DEF_CUT_PIECES, BSP_LCD_HEIGHT - BSP_LCD_HEIGHT / DEF_CUT_PIECES},
+
+    {BSP_LCD_WIDTH / 2, BSP_LCD_HEIGHT / 2}
+};
+#endif
+
+static int nu_adc_touch_readfile(void)
+{
+    int fd;
+
+    S_CALIBRATION_MATRIX sCalMat;
+
+    if ((fd = open(PATH_CALIBRATION_FILE, O_RDONLY, 0)) < 0)
+    {
+        goto exit_nu_adc_touch_readfile;
+    }
+    else if (read(fd, &sCalMat, sizeof(S_CALIBRATION_MATRIX)) == sizeof(S_CALIBRATION_MATRIX))
+    {
+        rt_kprintf("[%s] %s\n", __func__, PATH_CALIBRATION_FILE);
+    }
+
+    close(fd);
+
+    nu_adc_touch_update_calmat(&sCalMat);
+
+    return 0;
+
+exit_nu_adc_touch_readfile:
+
+    return -1;
+}
+
+static int nu_adc_touch_writefile(void *buf, int buf_len)
+{
+    int fd;
+
+    if ((fd = open(PATH_CALIBRATION_FILE, O_WRONLY | O_CREAT, 0)) < 0)
+    {
+        goto exit_nu_adc_touch_writefile;
+    }
+    else if (write(fd, buf, buf_len) == buf_len)
+    {
+        rt_kprintf("[%s] %s\n", __func__, PATH_CALIBRATION_FILE);
+    }
+
+    close(fd);
+
     return 0;
+
+exit_nu_adc_touch_writefile:
+
+    return -1;
+}
+
+static void nu_touch_do_calibration(rt_device_t pdev)
+{
+    int i;
+    rt_err_t result;
+
+    S_CALIBRATION_MATRIX sCalMat;
+    S_COORDINATE_POINT sADCPoints[DEF_CAL_POINT_NUM];
+
+    lcd_device = rt_device_find("lcd");
+    if (!lcd_device)
+    {
+        rt_kprintf("Not supported graphics ops\n");
+        return;
+    }
+
+    result = rt_device_control(lcd_device, RTGRAPHIC_CTRL_GET_INFO, &info);
+    if (result != RT_EOK)
+    {
+        rt_kprintf("error!");
+        return;
+    }
+
+    result = rt_device_open(lcd_device, 0);
+    if (result != RT_EOK)
+    {
+        rt_kprintf("opened?");
+    }
+
+    rt_device_control(lcd_device, RTGRAPHIC_CTRL_PAN_DISPLAY, info.framebuffer);
+    rt_device_control(lcd_device, RTGRAPHIC_CTRL_POWERON, RT_NULL);
+
+    for (i = 0; i < DEF_CAL_POINT_NUM; i++)
+    {
+        struct rt_touch_data sTouchPoint;
+        int count = 0;
+
+        lcd_cleanscreen();
+
+        /* Drain RX queue before doing calibrate. */
+        while (adc_request_point(pdev, &sTouchPoint) == RT_EOK);
+
+        rt_thread_mdelay(100);
+
+        /* Ready to calibrate */
+        nu_draw_bots(sDispPoints[i].x, sDispPoints[i].y);
+
+#define DEF_MAX_GET_POINT_NUM 5
+
+        sADCPoints[i].x = 0;
+        sADCPoints[i].y = 0;
+
+        while (count < DEF_MAX_GET_POINT_NUM)
+        {
+            if (adc_request_point(pdev, &sTouchPoint) == RT_EOK)
+            {
+                sADCPoints[i].x += (int32_t)sTouchPoint.x_coordinate;
+                sADCPoints[i].y += (int32_t)sTouchPoint.y_coordinate;
+                rt_kprintf("[%d %d] - Disp:[%d, %d] -> ADC:[%d, %d]\n", i, count, sDispPoints[i].x, sDispPoints[i].y, sADCPoints[i].x, sADCPoints[i].y);
+                count++;
+            }
+        }
+
+        sADCPoints[i].x = (int32_t)((float)sADCPoints[i].x / DEF_MAX_GET_POINT_NUM);
+        sADCPoints[i].y = (int32_t)((float)sADCPoints[i].y / DEF_MAX_GET_POINT_NUM);
+        rt_kprintf("[%d] - Disp:[%d, %d], ADC:[%d, %d]\n", i, sDispPoints[i].x, sDispPoints[i].y, sADCPoints[i].x, sADCPoints[i].y);
+
+        rt_thread_mdelay(300);
+    }
+
+    lcd_cleanscreen();
+
+    /* Get calibration matrix. */
+    if (nu_adc_cal_mat_get(&sDispPoints[0], &sADCPoints[0], &sCalMat) == 0)
+    {
+        /* Finally, update calibration matrix to drivers. */
+        nu_adc_touch_update_calmat(&sCalMat);
+
+        nu_adc_touch_writefile(&sCalMat, sizeof(sCalMat));
+
+        for (i = 0; i < DEF_CAL_POINT_NUM; i++)
+        {
+            rt_kprintf("[%d] - Disp:[%d, %d], ADC:[%d, %d]\n", i, sDispPoints[i].x, sDispPoints[i].y, sADCPoints[i].x, sADCPoints[i].y);
+        }
+    }
+    else
+    {
+        rt_kprintf("Failed to calibrate.\n");
+    }
+
+    rt_device_control(lcd_device, RTGRAPHIC_CTRL_POWEROFF, RT_NULL);
+    rt_device_close(lcd_device);
+
+    return;
 }
 
 static void adc_touch_entry(void *parameter)
@@ -190,66 +569,63 @@ static void adc_touch_entry(void *parameter)
     struct rt_touch_data touch_point;
 
     rt_err_t result;
-    rt_device_t pdev = &s_NuAdcTouch.dev.parent;
+    rt_device_t pdev;
 
     int max_range;
 
     adc_touch_sem = rt_sem_create("adc_touch_sem", 0, RT_IPC_FLAG_FIFO);
     RT_ASSERT(adc_touch_sem != RT_NULL);
 
+    pdev = rt_device_find("adc_touch");
+    if (!pdev)
+    {
+        rt_kprintf("Not found\n");
+        return ;
+    }
+
+    nu_adc_touch_readfile();
+
     result = rt_device_open(pdev, RT_DEVICE_FLAG_INT_RX);
     RT_ASSERT(result == RT_EOK);
 
     result = rt_device_set_rx_indicate(pdev, adc_touch_rx_callback);
     RT_ASSERT(result == RT_EOK);
 
-    max_range = LCM_WIDTH;
+    max_range = BSP_LCD_WIDTH;
     result = rt_device_control(pdev, RT_TOUCH_CTRL_SET_X_RANGE, (void *)&max_range);
     RT_ASSERT(result == RT_EOK);
 
-    max_range = LCM_HEIGHT;
+    max_range = BSP_LCD_HEIGHT;
     result = rt_device_control(pdev, RT_TOUCH_CTRL_SET_Y_RANGE, (void *)&max_range);
     RT_ASSERT(result == RT_EOK);
 
-    // nu_adc_touch_reset_caldata(int *psi32NewValue);
-    // nu_adc_touch_update_caldata(int *psi32NewValue);
-
     result = rt_device_control(pdev, RT_TOUCH_CTRL_POWER_ON, RT_NULL);
     RT_ASSERT(result == RT_EOK);
 
     while (adc_touch_worker_run)
     {
-        if ((-RT_ETIMEOUT == rt_sem_take(adc_touch_sem, rt_tick_from_millisecond(100))))
+        if (!g_u32Calibrated)
+        {
+            rt_kprintf("Start ADC touching calibration.\n");
+            nu_touch_do_calibration(pdev);
+            rt_kprintf("Stop ADC touching calibration.\n");
             continue;
+        }
 
-        rt_memset(&touch_point, 0, sizeof(struct rt_touch_data));
-
-        if (rt_device_read(pdev, 0, &touch_point, s_NuAdcTouch.dev.info.point_num) == s_NuAdcTouch.dev.info.point_num)
+        if (adc_request_point(pdev, &touch_point) == RT_EOK)
         {
             if (touch_point.event == RT_TOUCH_EVENT_DOWN
                     || touch_point.event == RT_TOUCH_EVENT_UP
                     || touch_point.event == RT_TOUCH_EVENT_MOVE)
             {
-
-#if defined(PKG_USING_LVGL)
-                extern void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state);
                 nu_touch_inputevent_cb(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);
-#elif defined(PKG_USING_LITTLEVGL2RTT)
-                extern void littlevgl2rtt_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state);
-                littlevgl2rtt_send_input_event(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);
-#endif
 
-#if defined(PKG_USING_NUEMWIN)
-                extern void nuemwin_send_input_event(rt_int16_t x, rt_int16_t y, rt_uint8_t state);
-                nuemwin_send_input_event(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);
-#endif
-                rt_kprintf("[%d-%d] id=%d width=%d x=%d y=%d\n",
-                           touch_point.timestamp,
-                           touch_point.event,
-                           touch_point.track_id,
-                           touch_point.width,
+                rt_kprintf("x=%d y=%d event=%s%s%s\n",
                            touch_point.x_coordinate,
-                           touch_point.y_coordinate);
+                           touch_point.y_coordinate,
+                           (touch_point.event == RT_TOUCH_EVENT_DOWN) ? "DOWN" : "",
+                           (touch_point.event == RT_TOUCH_EVENT_UP) ? "UP" : "",
+                           (touch_point.event == RT_TOUCH_EVENT_MOVE) ? "MOVE" : "");
             }
         }
     }
@@ -270,7 +646,7 @@ static rt_err_t nu_touch_start(int argc, char **argv)
         adc_touch_thread = rt_thread_create("adc_touch_thread",
                                             adc_touch_entry,
                                             RT_NULL,
-                                            1024,
+                                            4096,
                                             25,
                                             5);
         adc_touch_worker_run = 1;
@@ -290,4 +666,19 @@ static rt_err_t nu_touch_stop(int argc, char **argv)
 }
 MSH_CMD_EXPORT(nu_touch_stop, e.g: stop adc touch);
 
+static int nu_touch_autostart(void)
+{
+    return nu_touch_start(0, RT_NULL);
+}
+INIT_APP_EXPORT(nu_touch_autostart);
+
+static rt_err_t nu_touch_calibration(int argc, char **argv)
+{
+    /* Clean calibration matrix data for getting raw adc value. */
+    nu_adc_touch_reset_calmat();
+
+    return 0;
+}
+MSH_CMD_EXPORT(nu_touch_calibration, for adc touch);
+
 #endif //#if defined(BSP_USING_ADC_TOUCH)

+ 189 - 178
bsp/nuvoton/libraries/n9h30/rtt_port/drv_can.c

@@ -58,6 +58,7 @@ struct nu_can
     IRQn_Type irqn;
     E_SYS_IPRST rstidx;
     E_SYS_IPCLK clkidx;
+    uint32_t int_flag;
 };
 typedef struct nu_can *nu_can_t;
 
@@ -106,16 +107,16 @@ static const struct can_configure nu_can_default_config = NU_CAN_CONFIG_DEFAULT;
 /* Interrupt Handle Function  ----------------------------------------------------*/
 static void nu_can_isr(int vector, void *param)
 {
-    uint32_t u32IIDRstatus;
     nu_can_t psNuCAN  = (nu_can_t)param;
 
     /* Get base address of CAN register */
     CAN_T *base = psNuCAN->base;
 
     /* Get interrupt event */
-    u32IIDRstatus = CAN_GET_INT_PENDING_STATUS(base);
+    uint32_t u32IIDRstatus = CAN_GET_INT_PENDING_STATUS(base) & CAN_IIDR_INTID_Msk;
 
-    if (u32IIDRstatus == 0x00008000)       /* Check Status Interrupt Flag (Error status Int and Status change Int) */
+    /* Check Status Interrupt Flag (Error status Int and Status change Int) */
+    if (u32IIDRstatus == 0x00008000)
     {
         /**************************/
         /* Status Change interrupt*/
@@ -123,20 +124,24 @@ static void nu_can_isr(int vector, void *param)
         if (base->STATUS & CAN_STATUS_TXOK_Msk)
         {
             base->STATUS &= ~CAN_STATUS_TXOK_Msk;    /* Clear Tx Ok status*/
-            //rt_kprintf("%s: TX\n", psNuCAN->name) ;
 #ifndef RT_CAN_USING_HDR
-            /* Using as Lisen,Loopback,Loopback+Lisen mode*/
-            rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_TX_DONE);
+            if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_TX)
+            {
+                /*Using as Lisen,Loopback,Loopback+Lisen mode*/
+                rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_TX_DONE);
+            }
 #endif
         }
 
         if (base->STATUS & CAN_STATUS_RXOK_Msk)
         {
             base->STATUS &= ~CAN_STATUS_RXOK_Msk;   /* Clear Rx Ok status*/
-            //rt_kprintf("%s: RX\n", psNuCAN->name) ;
 #ifndef RT_CAN_USING_HDR
-            /* Using as Lisen,Loopback,Loopback+Lisen mode*/
-            rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_RX_IND);
+            if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_RX)
+            {
+                /*Using as Lisen,Loopback,Loopback+Lisen mode*/
+                rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_RX_IND);
+            }
 #endif
         }
 
@@ -145,17 +150,16 @@ static void nu_can_isr(int vector, void *param)
         /**************************/
         if (base->STATUS & CAN_STATUS_EWARN_Msk)
         {
-            rt_kprintf("%s: EWARN\n", psNuCAN->name) ;
+            rt_kprintf("[%s]EWARN INT\n", psNuCAN->name) ;
         }
 
         if (base->STATUS & CAN_STATUS_BOFF_Msk)
         {
-            rt_kprintf("%s: BUSOFF\n", psNuCAN->name) ;
+            rt_kprintf("[%s]BUSOFF INT\n", psNuCAN->name) ;
 
-            /* Do Init to release busoff pin */
-            base->CON = (CAN_CON_INIT_Msk | CAN_CON_CCE_Msk);
-            base->CON &= (~(CAN_CON_INIT_Msk | CAN_CON_CCE_Msk));
-            while (base->CON & CAN_CON_INIT_Msk);
+            /* To release busoff pin */
+            CAN_EnterInitMode(base, CAN_CON_INIT_Msk | CAN_CON_CCE_Msk);
+            CAN_LeaveInitMode(base);
         }
 
         if (base->STATUS & CAN_STATUS_LEC_Msk)
@@ -168,66 +172,83 @@ static void nu_can_isr(int vector, void *param)
     /*IntId: 0x0001-0x0020, Number of Message Object which caused the interrupt.*/
     else if (u32IIDRstatus > 0 && u32IIDRstatus <= 32)
     {
-        /*Message RAM 0~RX_MSG_ID_INDEX for CAN Tx using*/
-        if (u32IIDRstatus <= RX_MSG_ID_INDEX)
+        if ((psNuCAN->int_flag & RT_DEVICE_FLAG_INT_TX) &&
+                (u32IIDRstatus <= RX_MSG_ID_INDEX))
         {
-            //rt_kprintf("[%s-Tx]IntId = %d\n", psNuCAN->name, u32IIDRstatus);
+            /*Message RAM 0~RX_MSG_ID_INDEX for CAN Tx using*/
             rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_TX_DONE);
         }
-        else /*Message RAM RX_MSG_ID_INDEX~31 for CAN Rx using*/
+        else if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_RX)
         {
-            //rt_kprintf("[%s-Rx]IntId = %d\n",  psNuCAN->name, u32IIDRstatus);
+            /*Message RAM RX_MSG_ID_INDEX~31 for CAN Rx using*/
             rt_hw_can_isr(&psNuCAN->dev, (RT_CAN_EVENT_RX_IND | ((u32IIDRstatus - 1) << 8)));
         }
         CAN_CLR_INT_PENDING_BIT(base, (u32IIDRstatus - 1));     /* Clear Interrupt Pending */
     }
 #endif
-
 }
 
+static void nu_can_ie(nu_can_t psNuCAN)
+{
+    uint32_t u32CanIE = CAN_CON_IE_Msk;
+
+    if (psNuCAN->int_flag & (RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX))
+    {
+        u32CanIE |= CAN_CON_SIE_Msk;
+    }
+    else
+    {
+        u32CanIE &= ~CAN_CON_SIE_Msk;
+    }
+
+    if (psNuCAN->int_flag & RT_DEVICE_CAN_INT_ERR)
+    {
+        u32CanIE |= CAN_CON_EIE_Msk;
+    }
+    else
+    {
+        u32CanIE &= ~CAN_CON_EIE_Msk;
+    }
+
+    if (u32CanIE & (CAN_CON_SIE_Msk | CAN_CON_EIE_Msk))
+    {
+        CAN_EnableInt(psNuCAN->base, u32CanIE);
+
+        /* Enable interrupt. */
+        rt_hw_interrupt_umask(psNuCAN->irqn);
+    }
+    else
+    {
+        u32CanIE |= (CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
+        CAN_DisableInt(psNuCAN->base, u32CanIE);
+
+        /* Disable interrupt. */
+        rt_hw_interrupt_mask(psNuCAN->irqn);
+    }
+}
 
 static rt_err_t nu_can_configure(struct rt_can_device *can, struct can_configure *cfg)
 {
     nu_can_t psNuCAN  = (nu_can_t)can;
+    uint32_t u32CANMode;
 
-    RT_ASSERT(can != RT_NULL);
-    RT_ASSERT(cfg != RT_NULL);
+    RT_ASSERT(can);
+    RT_ASSERT(cfg);
 
     /* Get base address of CAN register */
     CAN_T *base = psNuCAN->base;
 
-    RT_ASSERT(base != RT_NULL);
-
-    switch (cfg->mode)
-    {
-    /* CAN default Normal mode */
-    case RT_CAN_MODE_NORMAL:
-        can->config.mode = CAN_NORMAL_MODE;
-        break;
-    case RT_CAN_MODE_LISEN:
-        can->config.mode = RT_CAN_MODE_LISEN;
-        break;
-    case RT_CAN_MODE_LOOPBACK:
-        can->config.mode = RT_CAN_MODE_LOOPBACK;
-        break;
-    case RT_CAN_MODE_LOOPBACKANLISEN:
-        can->config.mode = RT_CAN_MODE_LOOPBACKANLISEN;
-        break;
-    default:
-        rt_kprintf("Unsupported Operating mode");
-        goto exit_nu_can_configure;
-    }
-
+    /* Reset this module */
     nu_sys_ip_reset(psNuCAN->rstidx);
 
-    /*Set the CAN Bit Rate and Operating mode*/
-    if (CAN_Open(base, can->config.baud_rate, can->config.mode) < 1)
-        return -(RT_ERROR);
+    u32CANMode = (cfg->mode == RT_CAN_MODE_NORMAL) ? CAN_NORMAL_MODE : CAN_BASIC_MODE;
 
+    /*Set the CAN Bit Rate and Operating mode*/
+    if (CAN_Open(base, cfg->baud_rate, u32CANMode) != cfg->baud_rate)
+        goto exit_nu_can_configure;
 
     switch (cfg->mode)
     {
-    /* CAN default Normal mode */
     case RT_CAN_MODE_NORMAL:
 #ifdef RT_CAN_USING_HDR
         CAN_LeaveTestMode(base);
@@ -249,6 +270,7 @@ static rt_err_t nu_can_configure(struct rt_can_device *can, struct can_configure
         goto exit_nu_can_configure;
     }
 
+    nu_can_ie(psNuCAN);
 
     return RT_EOK;
 
@@ -261,73 +283,33 @@ exit_nu_can_configure:
 
 static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 {
-    rt_uint32_t argval;
-    nu_can_t psNuCAN  = (nu_can_t)can;
-
-#ifdef RT_CAN_USING_HDR
-    struct rt_can_filter_config *filter_cfg;
-#endif
-    /* Get base address of CAN register */
-    CAN_T *base = psNuCAN->base;
+    rt_uint32_t argval = (rt_uint32_t)arg;
+    nu_can_t psNuCAN = (nu_can_t)can;
 
-    RT_ASSERT(base != RT_NULL);
-    /* Check baud rate */
-    RT_ASSERT(can->config.baud_rate != 0);
+    RT_ASSERT(can);
 
     switch (cmd)
     {
-    case RT_DEVICE_CTRL_CLR_INT:
-        argval = (rt_uint32_t) arg;
-        if ((argval == RT_DEVICE_FLAG_INT_RX) || (argval == RT_DEVICE_FLAG_INT_TX))
-        {
-            /* Disable NVIC interrupt. */
-            rt_hw_interrupt_mask(psNuCAN->irqn);
-
-            /* Disable Status Change Interrupt  */
-            CAN_DisableInt(base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
-
-        }
-        else if (argval == RT_DEVICE_CAN_INT_ERR)
-        {
-            /* Disable interrupt. */
-            rt_hw_interrupt_mask(psNuCAN->irqn);
-
-            /* Disable Error Interrupt */
-            CAN_DisableInt(base, CAN_CON_EIE_Msk);
-        }
-        break;
-
     case RT_DEVICE_CTRL_SET_INT:
-        argval = (rt_uint32_t) arg;
-        if (argval == RT_DEVICE_FLAG_INT_RX || (argval == RT_DEVICE_FLAG_INT_TX))
-        {
-            /* Enable Status Change Interrupt  */
-            CAN_EnableInt(base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
-
-            /* Enable interrupt. */
-            rt_hw_interrupt_umask(psNuCAN->irqn);
-        }
-        else if (argval == RT_DEVICE_CAN_INT_ERR)
-        {
-            /* Enable Error Status and Status Change Interrupt  */
-            CAN_EnableInt(base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk | CAN_CON_EIE_Msk);
+        psNuCAN->int_flag |= argval;
+        nu_can_ie(psNuCAN);
+        break;
 
-            /* Enable interrupt. */
-            rt_hw_interrupt_umask(psNuCAN->irqn);
-        }
+    case RT_DEVICE_CTRL_CLR_INT:
+        psNuCAN->int_flag &= ~argval;
+        nu_can_ie(psNuCAN);
         break;
 
-#ifdef RT_CAN_USING_HDR
     case RT_CAN_CMD_SET_FILTER:
-        filter_cfg = (struct rt_can_filter_config *)arg;
+    {
+        struct rt_can_filter_config *filter_cfg = (struct rt_can_filter_config *)arg;
 
         for (int i = 0; i < filter_cfg->count; i++)
         {
-
             /*set the filter message object*/
             if (filter_cfg->items[i].mode == 1)
             {
-                if (CAN_SetRxMsgObjAndMsk(base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask, FALSE) == FALSE)
+                if (CAN_SetRxMsgObjAndMsk(psNuCAN->base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask, FALSE) == FALSE)
                 {
                     return -(RT_ERROR);
                 }
@@ -335,46 +317,61 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
             else
             {
                 /*set the filter message object*/
-                if (CAN_SetRxMsgAndMsk(base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask) == FALSE)
+                if (CAN_SetRxMsgAndMsk(psNuCAN->base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask) == FALSE)
                 {
                     return -(RT_ERROR);
                 }
             }
         }
-        break;
-#endif
+    }
+    break;
 
     case RT_CAN_CMD_SET_MODE:
-        argval = (rt_uint32_t) arg;
-        if (argval != RT_CAN_MODE_NORMAL && argval != RT_CAN_MODE_LISEN &&
-                argval != RT_CAN_MODE_LOOPBACK && argval != RT_CAN_MODE_LOOPBACKANLISEN)
+        if ((argval == RT_CAN_MODE_NORMAL) ||
+                (argval == RT_CAN_MODE_LISEN) ||
+                (argval == RT_CAN_MODE_LOOPBACK) ||
+                (argval == RT_CAN_MODE_LOOPBACKANLISEN))
         {
-            return -(RT_ERROR);
+            if (argval != can->config.mode)
+            {
+                can->config.mode = argval;
+                return nu_can_configure(can, &can->config);
+            }
         }
-        if (argval != can->config.mode)
+        else
         {
-            can->config.mode = argval;
-            return nu_can_configure(can, &can->config);
+            return -(RT_ERROR);
         }
         break;
 
     case RT_CAN_CMD_SET_BAUD:
-        argval = (rt_uint32_t) arg;
-        if (argval != CAN1MBaud && argval != CAN800kBaud && argval != CAN500kBaud && argval != CAN250kBaud &&
-                argval != CAN125kBaud && argval != CAN100kBaud && argval != CAN50kBaud  && argval != CAN20kBaud  && argval != CAN10kBaud)
+    {
+        if ((argval == CAN1MBaud) ||
+                (argval == CAN800kBaud) ||
+                (argval == CAN500kBaud) ||
+                (argval == CAN250kBaud) ||
+                (argval == CAN125kBaud) ||
+                (argval == CAN100kBaud) ||
+                (argval == CAN50kBaud) ||
+                (argval == CAN20kBaud) ||
+                (argval == CAN10kBaud))
         {
-            return -(RT_ERROR);
+            if (argval != can->config.baud_rate)
+            {
+                can->config.baud_rate = argval;
+                return nu_can_configure(can, &can->config);
+            }
         }
-        if (argval != can->config.baud_rate)
+        else
         {
-            can->config.baud_rate = argval;
-            return nu_can_configure(can, &can->config);
+            return -(RT_ERROR);
         }
-        break;
+    }
+    break;
 
     case RT_CAN_CMD_SET_PRIV:
-        argval = (rt_uint32_t) arg;
-        if (argval != RT_CAN_MODE_PRIV && argval != RT_CAN_MODE_NOPRIV)
+        if (argval != RT_CAN_MODE_PRIV &&
+                argval != RT_CAN_MODE_NOPRIV)
         {
             return -(RT_ERROR);
         }
@@ -387,16 +384,23 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 
     case RT_CAN_CMD_GET_STATUS:
     {
-        rt_uint32_t errtype;
-        errtype = base->ERR;
-        /*Receive Error Counter*/
+        rt_uint32_t errtype = psNuCAN->base->ERR;
+
+        RT_ASSERT(arg);
+
+        /*Receive Error Counter, return value is with Receive Error Passive.*/
         can->status.rcverrcnt = (errtype >> 8);
+
         /*Transmit Error Counter*/
-        can->status.snderrcnt = ((errtype >> 24) & 0xFF);
-        can->status.lasterrtype = CAN_GET_INT_STATUS(base) & 0x8000;
-        /*status error code*/
-        can->status.errcode = CAN_GET_INT_STATUS(base) & 0x07;
-        rt_memcpy(arg, &can->status, sizeof(can->status));
+        can->status.snderrcnt = (errtype & 0xFF);
+
+        /*Last Error Type*/
+        can->status.lasterrtype = CAN_GET_INT_STATUS(psNuCAN->base) & 0x8000;
+
+        /*Status error code*/
+        can->status.errcode = CAN_GET_INT_STATUS(psNuCAN->base) & 0x07;
+
+        rt_memcpy(arg, &can->status, sizeof(struct rt_can_status));
     }
     break;
 
@@ -411,64 +415,91 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 static int nu_can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t boxno)
 {
     STR_CANMSG_T tMsg;
-    struct rt_can_msg *pmsg = (struct rt_can_msg *) buf;
-
-    /* Get base address of CAN register */
-    CAN_T *base = ((nu_can_t)can)->base;
+    struct rt_can_msg *pmsg;
+    nu_can_t psNuCAN = (nu_can_t)can;
 
-    RT_ASSERT(base != RT_NULL);
-    RT_ASSERT(buf != RT_NULL);
+    RT_ASSERT(can);
+    RT_ASSERT(buf);
 
-    /* Check the parameters */
-    RT_ASSERT(IS_CAN_DLC(pmsg->len));
+    pmsg = (struct rt_can_msg *) buf;
 
-    /* Standard ID (11 bits)*/
-    if (pmsg->ide == RT_CAN_STDID)
+    if (pmsg->ide == RT_CAN_STDID && IS_CAN_STDID(pmsg->id))
     {
+        /* Standard ID (11 bits)*/
         tMsg.IdType = CAN_STD_ID;
-        RT_ASSERT(IS_CAN_STDID(pmsg->id))
         tMsg.Id  = pmsg->id ;
     }
-    else
+    else if (pmsg->ide == RT_CAN_EXTID && IS_CAN_EXTID(pmsg->id))
     {
         /* Extended ID (29 bits)*/
         tMsg.IdType = CAN_EXT_ID;
-        RT_ASSERT(IS_CAN_EXTID(pmsg->id));
         tMsg.Id = pmsg->id ;
     }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
 
     if (pmsg->rtr == RT_CAN_DTR)
     {
         /* Data frame */
         tMsg.FrameType = CAN_DATA_FRAME;
     }
-    else
+    else if (pmsg->rtr == RT_CAN_RTR)
     {
         /* Remote frame */
         tMsg.FrameType = CAN_REMOTE_FRAME;
     }
-    tMsg.DLC = pmsg->len;
-    rt_memcpy(tMsg.Data, pmsg->data, pmsg->len);
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
 
-    if (CAN_Transmit(base, MSG(boxno), &tMsg) == FALSE) // Configure Msg RAM and send the Msg in the RAM
+    /* Check the parameters */
+    if (IS_CAN_DLC(pmsg->len))
     {
-        return -(RT_ERROR);
+        tMsg.DLC = pmsg->len;
+    }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
+
+    if (pmsg->data && pmsg->len)
+    {
+        rt_memcpy(&tMsg.Data[0], pmsg->data, pmsg->len);
+    }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
+
+    /* Configure Msg RAM and send the Msg in the RAM. */
+    if (CAN_Transmit(psNuCAN->base, MSG(boxno), &tMsg) == FALSE)
+    {
+        goto exit_nu_can_sendmsg;
     }
 
     return RT_EOK;
+
+exit_nu_can_sendmsg:
+
+    return -(RT_ERROR);
 }
+
 static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxno)
 {
     STR_CANMSG_T tMsg;
-    struct rt_can_msg *pmsg = (struct rt_can_msg *) buf;
-    /* Get base address of CAN register */
-    CAN_T *base = ((nu_can_t)can)->base;
+    struct rt_can_msg *pmsg;
+    nu_can_t psNuCAN = (nu_can_t)can;
+
+    RT_ASSERT(can);
+    RT_ASSERT(buf);
 
-    RT_ASSERT(base != RT_NULL);
-    RT_ASSERT(buf != RT_NULL);
+    pmsg = (struct rt_can_msg *) buf;
 
     /* get data */
-    if (CAN_Receive(base, boxno, &tMsg) == FALSE)
+    if (CAN_Receive(psNuCAN->base, boxno, &tMsg) == FALSE)
     {
         rt_kprintf("No available RX Msg.\n");
         return -(RT_ERROR);
@@ -480,32 +511,13 @@ static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxn
     can->hdr[pmsg->hdr].connected = 1;
 #endif
 
-    /* Standard ID (11 bits)*/
-    if (tMsg.IdType == CAN_STD_ID)
-    {
-        pmsg->ide = RT_CAN_STDID;
-        pmsg->id  = tMsg.Id;
-    }
-    else /* Extended ID (29 bits)*/
-    {
-        pmsg->ide = RT_CAN_EXTID;
-        pmsg->id  = tMsg.Id;
-    }
-
-    if (tMsg.FrameType == CAN_DATA_FRAME)
-    {
-        /* Data frame */
-        pmsg->rtr = RT_CAN_DTR;
-    }
-    else
-    {
-        /* Remote frame */
-        pmsg->rtr = RT_CAN_RTR;
-    }
-
+    pmsg->ide = (tMsg.IdType == CAN_STD_ID) ? RT_CAN_STDID : RT_CAN_EXTID;
+    pmsg->rtr = (tMsg.FrameType == CAN_DATA_FRAME) ? RT_CAN_DTR : RT_CAN_RTR;
+    pmsg->id  = tMsg.Id;
     pmsg->len = tMsg.DLC ;
 
-    rt_memcpy(pmsg->data, tMsg.Data, pmsg->len);
+    if (pmsg->data && pmsg->len)
+        rt_memcpy(pmsg->data, &tMsg.Data[0], pmsg->len);
 
     return RT_EOK;
 }
@@ -540,5 +552,4 @@ static int rt_hw_can_init(void)
     return (int)ret;
 }
 INIT_DEVICE_EXPORT(rt_hw_can_init);
-
 #endif  //#if defined(BSP_USING_CAN)

+ 81 - 27
bsp/nuvoton/libraries/n9h30/rtt_port/drv_i2c.c

@@ -34,6 +34,8 @@
 #define I2C_ENABLE(dev)      I2C_REG_WRITE(dev, I2C_CSR, 0x3)    /* Enable i2c core and interrupt  */
 #define I2C_ISBUSFREE(dev)   (((I2C_REG_READ(dev, I2C_SWR) & 0x18) == 0x18 && (I2C_REG_READ(dev, I2C_CSR) & 0x0400) == 0) ? 1 : 0)
 
+#define I2C_SIGNAL_TIMEOUT   5000
+
 enum
 {
     I2C_START = -1,
@@ -50,7 +52,7 @@ enum
 typedef struct
 {
     int32_t base;       /* i2c bus number */
-    int32_t state;
+    volatile int32_t state;
     int32_t addr;
     uint32_t last_error;
     int32_t bNackValid;
@@ -58,9 +60,11 @@ typedef struct
     uint32_t subaddr;
     int32_t subaddr_len;
 
-    uint8_t buffer[I2C_MAX_BUF_LEN];
-    uint32_t pos, len;
+    volatile uint32_t pos;
+    volatile uint32_t len;
+    uint8_t *buffer;
 
+    struct rt_completion signal;
 } nu_i2c_dev;
 typedef nu_i2c_dev *nu_i2c_dev_t;
 
@@ -68,7 +72,6 @@ typedef struct
 {
     struct rt_i2c_bus_device parent;
     char *name;
-
     IRQn_Type irqn;
     E_SYS_IPRST rstidx;
     E_SYS_IPCLK clkidx;
@@ -113,13 +116,13 @@ static nu_i2c_bus nu_i2c_arr [ ] =
   * @brief  Set i2c interface speed
   * @param[in] dev i2c device structure pointer
   * @param[in] sp i2c speed
-  * @return always 0
+  * @return 0 or I2C_ERR_NOTTY
   */
 static int32_t nu_i2c_set_speed(nu_i2c_dev_t psNuI2cDev, int32_t sp)
 {
     uint32_t d;
 
-    if (sp != 100 && sp != 400)
+    if ((sp != 100) && (sp != 400))
         return (I2C_ERR_NOTTY);
 
     d = (sysGetClock(SYS_PCLK) * 1000) / (sp * 5) - 1;
@@ -205,6 +208,7 @@ static void nu_i2c_isr(int vector, void *param)
         psNuI2CDev->last_error = I2C_ERR_NACK;
         nu_i2c_command(psNuI2CDev, I2C_CMD_STOP);
         psNuI2CDev->state = I2C_STATE_NOP;
+        rt_completion_done(&psNuI2CDev->signal);
     }
     /* Arbitration lost */
     else if (csr & 0x200)
@@ -212,6 +216,7 @@ static void nu_i2c_isr(int vector, void *param)
         rt_kprintf("Arbitration lost\n");
         psNuI2CDev->last_error = I2C_ERR_LOSTARBITRATION;
         psNuI2CDev->state = I2C_STATE_NOP;
+        rt_completion_done(&psNuI2CDev->signal);
     }
     /* Transmit complete */
     else if (!(csr & 0x100))
@@ -225,6 +230,7 @@ static void nu_i2c_isr(int vector, void *param)
         }
         else if (psNuI2CDev->state == I2C_STATE_READ)
         {
+
             /* Sub-address send over, begin restart a read command */
             if (psNuI2CDev->pos == psNuI2CDev->subaddr_len + 1)
             {
@@ -246,6 +252,7 @@ static void nu_i2c_isr(int vector, void *param)
                 else
                 {
                     psNuI2CDev->state = I2C_STATE_NOP;
+                    rt_completion_done(&psNuI2CDev->signal);
                 }
             }
         }
@@ -270,12 +277,12 @@ static void nu_i2c_isr(int vector, void *param)
             else
             {
                 psNuI2CDev->state = I2C_STATE_NOP;
+                rt_completion_done(&psNuI2CDev->signal);
             }
         }
     }
-}
-
 
+}
 
 /**
   * @brief Read data from I2C slave.
@@ -294,6 +301,9 @@ static int32_t nu_i2c_read(nu_i2c_dev_t psNuI2cDev, struct rt_i2c_msg *pmsg)
     uint8_t *buf = pmsg->buf;
     uint32_t len = pmsg->len;
 
+    RT_ASSERT(len);
+    RT_ASSERT(buf);
+
     if (len > I2C_MAX_BUF_LEN - 10)
         len = I2C_MAX_BUF_LEN - 10;
 
@@ -317,9 +327,22 @@ static int32_t nu_i2c_read(nu_i2c_dev_t psNuI2cDev, struct rt_i2c_msg *pmsg)
     if (!I2C_ISBUSFREE(psNuI2cDev))
         return (I2C_ERR_BUSY);
 
+    rt_completion_init(&psNuI2cDev->signal);
+
     nu_i2c_command(psNuI2cDev, I2C_CMD_START | I2C_CMD_WRITE);
 
-    while (psNuI2cDev->state != I2C_STATE_NOP);
+    if ((RT_EOK == rt_completion_wait(&psNuI2cDev->signal, I2C_SIGNAL_TIMEOUT)))
+    {
+        rt_memcpy(buf, psNuI2cDev->buffer + psNuI2cDev->subaddr_len + 3, len);
+
+        psNuI2cDev->subaddr += len;
+    }
+    else
+    {
+        rt_kprintf("[%s]Wait signal timeout.\n", __func__);
+
+        len = 0;
+    }
 
     /* Disable I2C-EN */
     I2C_DISABLE(psNuI2cDev);
@@ -327,10 +350,6 @@ static int32_t nu_i2c_read(nu_i2c_dev_t psNuI2cDev, struct rt_i2c_msg *pmsg)
     if (psNuI2cDev->last_error)
         return (psNuI2cDev->last_error);
 
-    rt_memcpy(buf, psNuI2cDev->buffer + psNuI2cDev->subaddr_len + 3, len);
-
-    psNuI2cDev->subaddr += len;
-
     return len;
 }
 
@@ -351,6 +370,9 @@ static int32_t nu_i2c_write(nu_i2c_dev_t psNuI2cDev, struct rt_i2c_msg *pmsg)
     uint8_t *buf = pmsg->buf;
     uint32_t len = pmsg->len;
 
+    RT_ASSERT(len);
+    RT_ASSERT(buf);
+
     if (len > I2C_MAX_BUF_LEN - 10)
         len = I2C_MAX_BUF_LEN - 10;
 
@@ -373,9 +395,20 @@ static int32_t nu_i2c_write(nu_i2c_dev_t psNuI2cDev, struct rt_i2c_msg *pmsg)
     if (!I2C_ISBUSFREE(psNuI2cDev))
         return (I2C_ERR_BUSY);
 
+    rt_completion_init(&psNuI2cDev->signal);
+
     nu_i2c_command(psNuI2cDev, I2C_CMD_START | I2C_CMD_WRITE);
 
-    while (psNuI2cDev->state != I2C_STATE_NOP);
+    if ((RT_EOK == rt_completion_wait(&psNuI2cDev->signal, I2C_SIGNAL_TIMEOUT)))
+    {
+        psNuI2cDev->subaddr += len;
+    }
+    else
+    {
+        rt_kprintf("[%s]Wait signal timeout.\n", __func__);
+
+        len = 0;
+    }
 
     /* Disable I2C-EN */
     I2C_DISABLE(psNuI2cDev);
@@ -383,8 +416,6 @@ static int32_t nu_i2c_write(nu_i2c_dev_t psNuI2cDev, struct rt_i2c_msg *pmsg)
     if (psNuI2cDev->last_error)
         return (psNuI2cDev->last_error);
 
-    psNuI2cDev->subaddr += len;
-
     return len;
 }
 
@@ -405,16 +436,13 @@ static int32_t nu_i2c_ioctl(nu_i2c_dev_t psNuI2cDev, uint32_t cmd, uint32_t arg0
     switch (cmd)
     {
     case I2C_IOC_SET_DEV_ADDRESS:
-
         psNuI2cDev->addr = arg0;
         break;
 
     case I2C_IOC_SET_SPEED:
-
-        return (nu_i2c_set_speed(psNuI2cDev, (int32_t)arg0));
+        return nu_i2c_set_speed(psNuI2cDev, (int32_t)arg0);
 
     case I2C_IOC_SET_SUB_ADDRESS:
-
         if (arg1 > 4)
         {
             return (I2C_ERR_NOTTY);
@@ -441,7 +469,8 @@ static rt_size_t nu_i2c_mst_xfer(struct rt_i2c_bus_device *bus,
     rt_err_t ret;
     struct rt_i2c_msg *pmsg;
 
-    RT_ASSERT(bus != RT_NULL);
+    RT_ASSERT(bus);
+
     psNuI2cBus = (nu_i2c_bus_t) bus;
     psNuI2cDev = &psNuI2cBus->dev;
 
@@ -459,6 +488,7 @@ static rt_size_t nu_i2c_mst_xfer(struct rt_i2c_bus_device *bus,
 
         /* Set device address */
         nu_i2c_reset(psNuI2cDev);
+
         nu_i2c_ioctl(psNuI2cDev, I2C_IOC_SET_DEV_ADDRESS, pmsg->addr, 0);
 
         if (pmsg->flags & RT_I2C_RD)
@@ -470,18 +500,39 @@ static rt_size_t nu_i2c_mst_xfer(struct rt_i2c_bus_device *bus,
             ret = nu_i2c_write(psNuI2cDev, pmsg);
         }
 
-
         if (ret != pmsg->len) break;
     }
 
     return i;
 }
 
+static rt_err_t nu_i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t u32Cmd, rt_uint32_t u32Value)
+{
+    nu_i2c_bus_t psNuI2cBus;
+    nu_i2c_dev_t psNuI2cDev;
+
+    RT_ASSERT(bus);
+
+    psNuI2cBus = (nu_i2c_bus_t) bus;
+    psNuI2cDev = &psNuI2cBus->dev;
+
+    switch (u32Cmd)
+    {
+    case RT_I2C_DEV_CTRL_CLK:
+        nu_i2c_set_speed(psNuI2cDev, (int32_t)u32Value);
+        break;
+    default:
+        return -RT_EIO;
+    }
+
+    return RT_EOK;
+}
+
 static const struct rt_i2c_bus_device_ops nu_i2c_ops =
 {
     .master_xfer        = nu_i2c_mst_xfer,
     .slave_xfer         = NULL,
-    .i2c_bus_control    = NULL,
+    .i2c_bus_control    = nu_i2c_bus_control,
 };
 
 
@@ -489,17 +540,17 @@ static const struct rt_i2c_bus_device_ops nu_i2c_ops =
 int rt_hw_i2c_init(void)
 {
     int i;
-    rt_err_t ret = RT_EOK;
+    rt_err_t ret;
 
     for (i = (I2C_START + 1); i < I2C_CNT; i++)
     {
         nu_i2c_dev_t psNuI2cDev = &nu_i2c_arr[i].dev;
 
-        ret = rt_i2c_bus_device_register(&nu_i2c_arr[i].parent, nu_i2c_arr[i].name);
-        RT_ASSERT(RT_EOK == ret);
-
         nu_i2c_arr[i].parent.ops = &nu_i2c_ops;
 
+        psNuI2cDev->buffer = rt_malloc(I2C_MAX_BUF_LEN);
+        RT_ASSERT(psNuI2cDev->buffer);
+
         /* Enable I2C engine clock and reset. */
         nu_sys_ipclk_enable(nu_i2c_arr[i].clkidx);
         nu_sys_ip_reset(nu_i2c_arr[i].rstidx);
@@ -509,6 +560,9 @@ int rt_hw_i2c_init(void)
         /* Register ISR and Respond IRQ. */
         rt_hw_interrupt_install(nu_i2c_arr[i].irqn, nu_i2c_isr, &nu_i2c_arr[i], nu_i2c_arr[i].name);
         rt_hw_interrupt_umask(nu_i2c_arr[i].irqn);
+
+        ret = rt_i2c_bus_device_register(&nu_i2c_arr[i].parent, nu_i2c_arr[i].name);
+        RT_ASSERT(RT_EOK == ret);
     }
 
     return 0;

+ 20 - 0
bsp/nuvoton/libraries/n9h30/rtt_port/drv_vpost.c

@@ -69,6 +69,9 @@ static struct nu_vpost nu_fbdev[eVpost_Cnt] =
 #endif
 };
 
+RT_WEAK void nu_lcd_backlight_on(void) { }
+
+RT_WEAK void nu_lcd_backlight_off(void) { }
 static rt_err_t vpost_layer_open(rt_device_t dev, rt_uint16_t oflag)
 {
     nu_vpost_t psVpost = (nu_vpost_t)dev;
@@ -149,6 +152,18 @@ static rt_err_t vpost_layer_control(rt_device_t dev, int cmd, void *args)
 
     switch (cmd)
     {
+    case RTGRAPHIC_CTRL_POWERON:
+    {
+        nu_lcd_backlight_on();
+    }
+    break;
+
+    case RTGRAPHIC_CTRL_POWEROFF:
+    {
+        nu_lcd_backlight_off();
+    }
+    break;
+
     case RTGRAPHIC_CTRL_GET_INFO:
     {
         struct rt_device_graphic_info *info = (struct rt_device_graphic_info *) args;
@@ -324,6 +339,11 @@ int rt_hw_vpost_init(void)
             rt_kprintf("Fail to get VRAM buffer.\n");
             RT_ASSERT(0);
         }
+        else
+        {
+            uint32_t u32FBSize = psVpost->info.pitch * psVpostLcmInst->u32DevHeight;
+            rt_memset(psVpost->info.framebuffer, 0, u32FBSize);
+        }
 
         /* Register member functions of lcd device */
         psVpost->dev.type = RT_Device_Class_Graphic;

+ 2 - 1
bsp/nuvoton/libraries/nu_packages/ILI9341/lcd_ili9341.c

@@ -27,6 +27,7 @@ static struct rt_device_graphic_info g_Ili9341Info =
     .pixel_format = RTGRAPHIC_PIXEL_FORMAT_RGB565,
     .framebuffer = RT_NULL,
     .width = XSIZE_PHYS,
+    .pitch = XSIZE_PHYS * 2,
     .height = YSIZE_PHYS
 };
 
@@ -324,7 +325,7 @@ int rt_hw_lcd_ili9341_init(void)
     lcd_device.user_data = &ili9341_ops;
 
 #if defined(NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER)
-    g_Ili9341Info.framebuffer = rt_malloc_align((DEF_VRAM_BUFFER_NUMBER * g_Ili9341Info.width * g_Ili9341Info.height * (g_Ili9341Info.bits_per_pixel / 8)) + 32, 32);
+    g_Ili9341Info.framebuffer = rt_malloc_align((DEF_VRAM_BUFFER_NUMBER * g_Ili9341Info.pitch * g_Ili9341Info.height) + 32, 32);
     RT_ASSERT(g_Ili9341Info.framebuffer != RT_NULL);
 #endif
 

+ 15 - 3
bsp/nuvoton/libraries/nu_packages/Kconfig

@@ -38,7 +38,7 @@ menu "Nuvoton Packages Config"
         bool "ILI9341 LCD Panel"
         select BSP_USING_GPIO
         default n
-        
+
         if NU_PKG_USING_ILI9341
 
             choice
@@ -62,8 +62,20 @@ menu "Nuvoton Packages Config"
                 default n
 
             config NU_PKG_ILI9341_HORIZONTAL
-                bool "Set horizontal view. (320x240)"
-                default n
+                bool
+                default y
+
+            config BSP_LCD_BPP
+                int
+                default 16     if NU_PKG_USING_ILI9341
+
+            config BSP_LCD_WIDTH
+                int
+                default 320    if NU_PKG_ILI9341_HORIZONTAL
+
+            config BSP_LCD_HEIGHT
+                int
+                default 240    if NU_PKG_ILI9341_HORIZONTAL
 
         endif
 

+ 106 - 15
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_adc.h

@@ -35,51 +35,142 @@ extern "C"
 #define ADC_ERR_CMD             2   /*!< The command is wrong */
 
 /// @cond HIDDEN_SYMBOLS
-typedef INT32(*ADC_CALLBACK)(UINT32 status, UINT32 userData);
+typedef int32_t(*ADC_CALLBACK)(uint32_t status, uint32_t userData);
 /// @endcond HIDDEN_SYMBOLS
 /*---------------------------------------------------------------------------------------------------------*/
 /* ADC_CTL constant definitions                                                                            */
 /*---------------------------------------------------------------------------------------------------------*/
 #define ADC_CTL_ADEN            0x00000001  /*!< ADC Power Control */
-#define ADC_CTL_VBGEN           0x00000002  /*!< ADC Internal Bandgap Power Control */
+#define ADC_CTL_VBGEN       0x00000002  /*!< ADC Internal Bandgap Power Control */
+#define ADC_CTL_PWKPEN      0x00000004  /*!< ADC Keypad Power Enable Control */
 #define ADC_CTL_MST             0x00000100  /*!< Menu Start Conversion */
+#define ADC_CTL_PEDEEN      0x00000200  /*!< Pen Down Event Enable */
+#define ADC_CTL_WKPEN       0x00000400  /*!< Keypad Press Wake Up Enable */
+#define ADC_CTL_WKTEN       0x00000800  /*!< Touch Wake Up Enable */
+#define ADC_CTL_WMSWCH      0x00010000  /*!< Wire Mode Switch For 5-Wire/4-Wire Configuration */
 
 /*---------------------------------------------------------------------------------------------------------*/
 /* ADC_CONF constant definitions                                                                           */
 /*---------------------------------------------------------------------------------------------------------*/
+#define ADC_CONF_TEN                0x00000001  /*!< Touch Enable */
+#define ADC_CONF_ZEN                0x00000002  /*!< Press Enable */
 #define ADC_CONF_NACEN          0x00000004  /*!< Normal AD Conversion Enable */
+#define ADC_CONF_VBATEN         0x00000100  /*!< Voltage Battery Enable */
+#define ADC_CONF_KPCEN          0x00000200  /*!< Keypad Press Conversion Enable */
 #define ADC_CONF_SELFTEN        0x00000400  /*!< Selft Test Enable */
+#define ADC_CONF_DISTMAVEN  (1<<20)     /*!< Display T Mean Average Enable */
+#define ADC_CONF_DISZMAVEN  (1<<21)     /*!< Display Z Mean Average Enable */
 #define ADC_CONF_HSPEED         (1<<22)     /*!< High Speed Enable */
 
-#define ADC_CONF_CHSEL_Pos      12          /*!< Channel Selection Position */
-#define ADC_CONF_CHSEL_Msk      (0xF<<ADC_CONF_CHSEL_Pos)   /*!< Channel Selection Mask */
-
-#define ADC_CONF_REFSEL_Pos     6           /*!< Reference Selection Position */
-#define ADC_CONF_REFSEL_Msk     (3<<6)      /*!< Reference Selection Mask */
-#define ADC_CONF_REFSEL_VREF    (0<<6)      /*!< ADC reference select VREF input */
-#define ADC_CONF_REFSEL_AVDD33  (3<<6)      /*!< ADC reference select AGND33 vs AVDD33 */
+#define ADC_CONF_CHSEL_Pos  3            /*!< Channel Selection Position */
+#define ADC_CONF_CHSEL_Msk  (7<<3)       /*!< Channel Selection Mask */
+#define ADC_CONF_CHSEL_VBT  (0<<3)       /*!< ADC input channel select VBT */
+#define ADC_CONF_CHSEL_VHS  (1<<3)       /*!< ADC input channel select VHS */
+#define ADC_CONF_CHSEL_A2       (2<<3)       /*!< ADC input channel select A2 */
+#define ADC_CONF_CHSEL_A3       (3<<3)       /*!< ADC input channel select A3 */
+#define ADC_CONF_CHSEL_YM       (4<<3)       /*!< ADC input channel select YM */
+#define ADC_CONF_CHSEL_YP       (5<<3)       /*!< ADC input channel select YP */
+#define ADC_CONF_CHSEL_XM       (6<<3)       /*!< ADC input channel select XM */
+#define ADC_CONF_CHSEL_XP       (7<<3)       /*!< ADC input channel select XP */
+
+#define ADC_CONF_REFSEL_Pos  6             /*!< Reference Selection Position */
+#define ADC_CONF_REFSEL_Msk     (3<<6)     /*!< Reference Selection Mask */
+#define ADC_CONF_REFSEL_VREF    (0<<6)     /*!< ADC reference select VREF input or 2.5v buffer output */
+#define ADC_CONF_REFSEL_YMYP    (1<<6)     /*!< ADC reference select YM vs YP */
+#define ADC_CONF_REFSEL_XMXP    (2<<6)     /*!< ADC reference select XM vs XP */
+#define ADC_CONF_REFSEL_AVDD33  (3<<6)     /*!< ADC reference select AGND33 vs AVDD33 */
 
 /*---------------------------------------------------------------------------------------------------------*/
 /* ADC_IER constant definitions                                                                            */
 /*---------------------------------------------------------------------------------------------------------*/
-#define ADC_IER_MIEN            0x00000001  /*!< Menu Interrupt Enable */
+#define ADC_IER_MIEN                0x00000001  /*!< Menu Interrupt Enable */
+#define ADC_IER_KPEIEN          0x00000002  /*!< Keypad Press Event Interrupt Enable */
+#define ADC_IER_PEDEIEN         0x00000004  /*!< Pen Down Even Interrupt Enable */
+#define ADC_IER_WKTIEN          0x00000008  /*!< Wake Up Touch Interrupt Enable */
+#define ADC_IER_WKPIEN          0x00000010  /*!< Wake Up Keypad Press Interrupt Enable */
+#define ADC_IER_KPUEIEN         0x00000020  /*!< Keypad Press Up Event Interrupt Enable */
+#define ADC_IER_PEUEIEN         0x00000040  /*!< Pen Up Event Interrupt Enable */
 
 /*---------------------------------------------------------------------------------------------------------*/
 /* ADC_ISR constant definitions                                                                            */
 /*---------------------------------------------------------------------------------------------------------*/
 #define ADC_ISR_MF              0x00000001  /*!< Menu Complete Flag */
+#define ADC_ISR_KPEF            0x00000002  /*!< Keypad Press Event Flag */
+#define ADC_ISR_PEDEF           0x00000004  /*!< Pen Down Event Flag */
+#define ADC_ISR_KPUEF           0x00000008  /*!< Keypad Press Up Event Flag */
+#define ADC_ISR_PEUEF           0x00000010  /*!< Pen Up Event Flag */
+#define ADC_ISR_TF              0x00000100  /*!< Touch Conversion Finish */
+#define ADC_ISR_ZF              0x00000200  /*!< Press Conversion Finish */
 #define ADC_ISR_NACF            0x00000400  /*!< Normal AD Conversion Finish */
+#define ADC_ISR_VBF             0x00000800  /*!< Voltage Battery Conversion Finish */
+#define ADC_ISR_KPCF            0x00001000  /*!< Keypad Press Conversion Finish */
+#define ADC_ISR_SELFTF          0x00002000  /*!< Self-Test Conversion Finish */
+#define ADC_ISR_INTKP           0x00010000  /*!< Interrupt Signal For Keypad Detection */
+#define ADC_ISR_INTTC           0x00020000  /*!< Interrupt Signal For Touch Screen Touching Detection */
+
+/*---------------------------------------------------------------------------------------------------------*/
+/* ADC_WKISR constant definitions                                                                          */
+/*---------------------------------------------------------------------------------------------------------*/
+#define ADC_WKISR_WKPEF     0x00000001  /*!< Wake Up Pen Down Event Flag */
+#define ADC_WKISR_WPEDEF    0x00000002  /*!< Wake Up Keypad Press Event Flage */
 
+/** \brief  Structure type of ADC_CHAN
+ */
+typedef enum
+{
+    AIN0  = ADC_CONF_CHSEL_VBT,    /*!< ADC input channel select \ref ADC_CONF_CHSEL_VBT */
+    AIN1  = ADC_CONF_CHSEL_VHS,    /*!< ADC input channel select \ref ADC_CONF_CHSEL_VHS */
+    AIN2  = ADC_CONF_CHSEL_A2,     /*!< ADC input channel select \ref ADC_CONF_CHSEL_A2 */
+    AIN3  = ADC_CONF_CHSEL_A3,     /*!< ADC input channel select \ref ADC_CONF_CHSEL_A3 */
+    AIN4  = ADC_CONF_CHSEL_YM,     /*!< ADC input channel select \ref ADC_CONF_CHSEL_YM */
+    AIN5  = ADC_CONF_CHSEL_XP,     /*!< ADC input channel select \ref ADC_CONF_CHSEL_XP */
+    AIN6  = ADC_CONF_CHSEL_XM,     /*!< ADC input channel select \ref ADC_CONF_CHSEL_XM */
+    AIN7  = ADC_CONF_CHSEL_XP      /*!< ADC input channel select \ref ADC_CONF_CHSEL_XP */
+} ADC_CHAN;
 
 /** \brief  Structure type of ADC_CMD
  */
 typedef enum
 {
-    START_MST,                       /*!<Menu Start Conversion */
-    VBPOWER_ON,                      /*!<Enable ADC Internal Bandgap Power */
-    VBPOWER_OFF,                     /*!<Disable ADC Internal Bandgap Power */
-    NAC_ON,                          /*!<Enable Normal AD Conversion */
-    NAC_OFF,                         /*!<Disable Normal AD Conversion */
+    START_MST,                  /*!<Menu Start Conversion with interrupt */
+    START_MST_POLLING,          /*!<Menu Start Conversion with polling */
+    VBPOWER_ON,                 /*!<Enable ADC Internal Bandgap Power */
+    VBPOWER_OFF,                    /*!<Disable ADC Internal Bandgap Power */
+    VBAT_ON,                            /*!<Enable Voltage Battery conversion function */
+    VBAT_OFF,                       /*!<Disable Voltage Battery conversion function */
+
+    KPPOWER_ON,                 /*!<Enable ADC Keypad power */
+    KPPOWER_OFF,                    /*!<Disable ADC Keypad power */
+    KPCONV_ON,                      /*!<Enable Keypad conversion function */
+    KPCONV_OFF,                 /*!<Disable Keypad conversion function */
+    KPPRESS_ON,                 /*!<Enable Keypad press event */
+    KPPRESS_OFF,                    /*!<Disable Keypad press event */
+    KPUP_ON,                            /*!<Enable Keypad up event */
+    KPUP_OFF,                       /*!<Disable Keypad up event */
+
+    PEPOWER_ON,                 /*!<Enable Pen Down Power ,It can control pen down event */
+    PEPOWER_OFF,                    /*!<Disable Pen Power */
+    PEDEF_ON,                       /*!<Enable Pen Down Event Flag */
+    PEDEF_OFF,                      /*!<Disable Pen Down Event Flag */
+
+    WKP_ON,                         /*!<Enable Keypad Press Wake Up */
+    WKP_OFF,                            /*!<Disable Keypad Press Wake Up */
+    WKT_ON,                         /*!<Enable Pen Down Wake Up */
+    WKT_OFF,                        /*!<Disable Pen Down Wake Up */
+    SWITCH_5WIRE_ON,            /*!<Wire Mode Switch to 5-Wire Configuration */
+    SWITCH_5WIRE_OFF,       /*!<Wire Mode Switch to 4-Wire Configuration */
+
+    T_ON,                               /*!<Enable Touch detection function */
+    T_OFF,                              /*!<Disable Touch detection function */
+    TAVG_ON,                            /*!<Enable Touch Mean average for X and Y function */
+    TAVG_OFF,                       /*!<Disable Touch Mean average for X and Y function */
+    Z_ON,                               /*!<Enable Press measure function */
+    Z_OFF,                              /*!<Disable Press measure function */
+    TZAVG_ON,                       /*!<Enable Pressure Mean average for Z1 and Z2 function */
+    TZAVG_OFF,                      /*!<Disable Pressure Mean average for Z1 and Z2 function */
+
+    NAC_ON,                         /*!<Enable Normal AD Conversion */
+    NAC_OFF,                            /*!<Disable Normal AD Conversion */
     SWITCH_CH,                       /*!<Switch Channel */
 } ADC_CMD;
 

+ 2 - 2
bsp/nuvoton/libraries/nuc980/Driver/Include/nu_can.h

@@ -151,8 +151,8 @@ typedef struct
 #define CAN_BTIME_TSEG2_Pos              (12)                                              /*!< CAN_T::BTIME: TSeg2 Position           */
 #define CAN_BTIME_TSEG2_Msk              (0x7ul << CAN_BTIME_TSEG2_Pos)                    /*!< CAN_T::BTIME: TSeg2 Mask               */
 
-#define CAN_IIDR_IntId_Pos               (0)                                               /*!< CAN_T::IIDR: IntId Position            */
-#define CAN_IIDR_IntId_Msk               (0xfffful << CAN_IIDR_IntId_Pos)                  /*!< CAN_T::IIDR: IntId Mask                */
+#define CAN_IIDR_INTID_Pos               (0)                                               /*!< CAN_T::IIDR: IntId Position            */
+#define CAN_IIDR_INTID_Msk               (0xfffful << CAN_IIDR_INTID_Pos)                  /*!< CAN_T::IIDR: IntId Mask                */
 
 #define CAN_TEST_BASIC_Pos               (2)                                               /*!< CAN_T::TEST: Basic Position            */
 #define CAN_TEST_BASIC_Msk               (0x1ul << CAN_TEST_BASIC_Pos)                     /*!< CAN_T::TEST: Basic Mask                */

+ 32 - 19
bsp/nuvoton/libraries/nuc980/Driver/Include/nuc980.h

@@ -1295,25 +1295,38 @@
     #define     REG_PWM0_PIER    (PWM0_BA+0x3C)  /*!< PWM Timer Interrupt Enable Register */
     #define     REG_PWM0_PIIR    (PWM0_BA+0x40)  /*!< PWM Timer Interrupt Identification Register */
 
-    #define     REG_PWM1_PPR     (PWM1_BA+0x00)  /*!< PWM Pre-scale Register 0 */
-    #define     REG_PWM1_CSR     (PWM1_BA+0x04)  /*!< PWM Clock Select Register */
-    #define     REG_PWM1_PCR     (PWM1_BA+0x08)  /*!< PWM Control Register */
-    #define     REG_PWM1_CNR0    (PWM1_BA+0x0C)  /*!< PWM Counter Register 0 */
-    #define     REG_PWM1_CMR0    (PWM1_BA+0x10)  /*!< PWM Comparator Register 0 */
-    #define     REG_PWM1_PDR0    (PWM1_BA+0x14)  /*!< PWM Data Register 0 */
-    #define     REG_PWM1_CNR1    (PWM1_BA+0x18)  /*!< PWM Counter Register 1 */
-    #define     REG_PWM1_CMR1    (PWM1_BA+0x1C)  /*!< PWM Comparator Register 1 */
-    #define     REG_PWM1_PDR1    (PWM1_BA+0x20)  /*!< PWM Data Register 1 */
-    #define     REG_PWM1_CNR2    (PWM1_BA+0x24)  /*!< PWM Counter Register 2 */
-    #define     REG_PWM1_CMR2    (PWM1_BA+0x28)  /*!< PWM Comparator Register 2 */
-    #define     REG_PWM1_PDR2    (PWM1_BA+0x2C)  /*!< PWM Data Register 2 */
-    #define     REG_PWM1_CNR3    (PWM1_BA+0x30)  /*!< PWM Counter Register 3 */
-    #define     REG_PWM1_CMR3    (PWM1_BA+0x34)  /*!< PWM Comparator Register 3 */
-    #define     REG_PWM1_PDR3    (PWM1_BA+0x38)  /*!< PWM Data Register 3 */
-    #define     REG_PWM1_PIER    (PWM1_BA+0x3C)  /*!< PWM Timer Interrupt Enable Register */
-    #define     REG_PWM1_PIIR    (PWM1_BA+0x40)  /*!< PWM Timer Interrupt Identification Register */
-
-    /**@}*/ /* end of PWM register group */
+    /*---------------------- Analog to Digital Converter -------------------------*/
+    /**
+    @addtogroup ADC Analog to Digital Converter(ADC)
+    Memory Mapped Structure for ADC Controller
+    @{ */
+
+    #define REG_ADC_CTL       (ADC_BA+0x000) /*!< ADC Contrl */
+    #define REG_ADC_CONF      (ADC_BA+0x004) /*!< ADC Configure */
+    #define REG_ADC_IER       (ADC_BA+0x008) /*!< ADC Interrupt Enable Register */
+    #define REG_ADC_ISR       (ADC_BA+0x00C) /*!< ADC Interrupt Status Register */
+    #define REG_ADC_WKISR     (ADC_BA+0x010) /*!< ADC Wake Up Interrupt Status Register */
+    #define REG_ADC_XYDATA    (ADC_BA+0x020) /*!< ADC Touch XY Pressure Data */
+    #define REG_ADC_ZDATA     (ADC_BA+0x024) /*!< ADC Touch Z Pressure Data */
+    #define REG_ADC_DATA      (ADC_BA+0x028) /*!< ADC Normal Conversion Data */
+    #define REG_ADC_VBADATA   (ADC_BA+0x02C) /*!< ADC Battery Detection Data */
+    #define REG_ADC_KPDATA    (ADC_BA+0x030) /*!< ADC Key Pad Data */
+    #define REG_ADC_SELFDATA  (ADC_BA+0x034) /*!< ADC Self-Test Data */
+    #define REG_ADC_XYSORT0   (ADC_BA+0x1F4) /*!< ADC Touch XY Position Mean Value Sort 0 */
+    #define REG_ADC_XYSORT1   (ADC_BA+0x1F8) /*!< ADC Touch XY Position Mean Value Sort 1 */
+    #define REG_ADC_XYSORT2   (ADC_BA+0x1FC) /*!< ADC Touch XY Position Mean Value Sort 2 */
+    #define REG_ADC_XYSORT3   (ADC_BA+0x200) /*!< ADC Touch XY Position Mean Value Sort 3 */
+    #define REG_ADC_ZSORT0    (ADC_BA+0x204) /*!< ADC Touch Z Pressure Mean Value Sort 0 */
+    #define REG_ADC_ZSORT1    (ADC_BA+0x208) /*!< ADC Touch Z Pressure Mean Value Sort 1 */
+    #define REG_ADC_ZSORT2    (ADC_BA+0x20C) /*!< ADC Touch Z Pressure Mean Value Sort 2 */
+    #define REG_ADC_ZSORT3    (ADC_BA+0x210) /*!< ADC Touch Z Pressure Mean Value Sort 3 */
+    #define REG_ADC_MTMULCK   (ADC_BA+0x220) /*!< ADC Manual Test Mode Unlock */
+    #define REG_ADC_MTCONF    (ADC_BA+0x224) /*!< ADC Manual Test Mode Configure */
+    #define REG_ADC_MTCON     (ADC_BA+0x228) /*!< ADC Manual Test Mode Control */
+    #define REG_ADC_ADCAII    (ADC_BA+0x22C) /*!< ADC Analog Interface Information */
+    #define REG_ADC_ADCAIIRLT (ADC_BA+0x230) /*!< ADC Analog Interface Information Result */
+
+    /**@}*/ /* end of ADC register group */
 
 
     /*------------------ Capture Sensor Interface Controller ---------------------*/

+ 2 - 2
bsp/nuvoton/libraries/nuc980/Driver/Source/nu_emac.c

@@ -1129,7 +1129,7 @@ uint32_t EMAC_GetAvailRXBufSize(EMAC_MEMMGR_T *psMemMgr, uint8_t **ppuDataBuf)
   * @note Application can only call this function once every time \ref EMAC_RecvPkt or \ref EMAC_RecvPktTS returns 1
   * @note This function is without doing EMAC_TRIGGER_RX.
   */
-EMAC_DESCRIPTOR_T * EMAC_RecvPktDoneWoRxTrigger(EMAC_MEMMGR_T *psMemMgr)
+EMAC_DESCRIPTOR_T *EMAC_RecvPktDoneWoRxTrigger(EMAC_MEMMGR_T *psMemMgr)
 {
     /* Get Rx Frame Descriptor */
     EMAC_DESCRIPTOR_T *desc = (EMAC_DESCRIPTOR_T *)psMemMgr->psCurrentRxDesc;
@@ -1151,7 +1151,7 @@ EMAC_DESCRIPTOR_T * EMAC_RecvPktDoneWoRxTrigger(EMAC_MEMMGR_T *psMemMgr)
     return ret;
 }
 
-void EMAC_RxTrigger(EMAC_MEMMGR_T *psMemMgr, EMAC_DESCRIPTOR_T * rx_desc)
+void EMAC_RxTrigger(EMAC_MEMMGR_T *psMemMgr, EMAC_DESCRIPTOR_T *rx_desc)
 {
     EMAC_T *EMAC = psMemMgr->psEmac;
 

+ 7 - 0
bsp/nuvoton/libraries/nuc980/rtt_port/Kconfig

@@ -70,6 +70,13 @@ config SOC_SERIES_NUC980
         bool "Enable Analog-to-Digital Converter(ADC)"
         select RT_USING_ADC
 
+        if BSP_USING_ADC
+            config BSP_USING_ADC_TOUCH
+            bool "Enable ADC Touching function"
+            select RT_USING_TOUCH
+            default n
+        endif
+
     menuconfig BSP_USING_TMR
         bool "Enable Timer Controller(TIMER)"
 

+ 469 - 14
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc.c

@@ -15,9 +15,12 @@
 
 #include <rtdevice.h>
 #include "NuMicro.h"
-#include <drv_sys.h>
+#include "drv_sys.h"
+#include "nu_bitutil.h"
+#include "drv_adc.h"
 
 /* Private define ---------------------------------------------------------------*/
+#define DEF_ADC_TOUCH_SMPL_TICK  40
 
 /* Private Typedef --------------------------------------------------------------*/
 struct nu_adc
@@ -31,12 +34,33 @@ struct nu_adc
     int chn_num;
     uint32_t chn_mask;
     rt_sem_t m_psSem;
+
+#if defined(BSP_USING_ADC_TOUCH)
+    rt_touch_t psRtTouch;
+    rt_timer_t psRtTouchMenuTimer;
+    rt_mq_t m_pmqTouchXYZ;
+#endif
+
+    nu_adc_cb m_isr[eAdc_ISR_CNT];
+    nu_adc_cb m_wkisr[eAdc_WKISR_CNT];
 };
 typedef struct nu_adc *nu_adc_t;
 
+#if defined(BSP_USING_ADC_TOUCH)
+struct nu_adc_touch_data
+{
+    uint32_t    u32X;
+    uint32_t    u32Y;
+    uint32_t    u32Z0;
+    uint32_t    u32Z1;
+};
+typedef struct nu_adc_touch_data *nu_adc_touch_data_t;
+#endif
+
 /* Private functions ------------------------------------------------------------*/
 static rt_err_t nu_adc_enabled(struct rt_adc_device *device, rt_uint32_t channel, rt_bool_t enabled);
 static rt_err_t nu_adc_convert(struct rt_adc_device *device, rt_uint32_t channel, rt_uint32_t *value);
+static rt_err_t _nu_adc_control(rt_device_t dev, int cmd, void *args);
 
 /* Public functions ------------------------------------------------------------*/
 int rt_hw_adc_init(void);
@@ -56,24 +80,41 @@ static struct nu_adc g_sNuADC =
 
 static void nu_adc_isr(int vector, void *param)
 {
-    uint32_t isr, conf;
+    rt_int32_t isr, wkisr;
     nu_adc_t psNuAdc = (nu_adc_t)param;
+    rt_int32_t irqidx;
 
-    conf = inpw(REG_ADC_CONF);
     isr = inpw(REG_ADC_ISR);
+    wkisr = inpw(REG_ADC_WKISR);
 
-    if ((isr & ADC_ISR_NACF) && (conf & ADC_CONF_NACEN))
+    while ((irqidx = nu_ctz(isr)) < eAdc_ISR_CNT)
     {
-        outpw(REG_ADC_ISR, ADC_ISR_NACF);
-    }
+        uint32_t u32IsrBitMask =  1 << irqidx ;
 
-    if (isr & ADC_ISR_MF)
+        if (psNuAdc->m_isr[irqidx].cbfunc != RT_NULL)
+        {
+            //rt_kprintf("[%s] %d %x\n", __func__, irqidx, psNuAdc->m_isr[irqidx].cbfunc);
+            psNuAdc->m_isr[irqidx].cbfunc(isr, psNuAdc->m_isr[irqidx].private_data);
+        }
+
+        /* Clear sent bit */
+        outpw(REG_ADC_ISR, u32IsrBitMask);
+        isr &= ~(u32IsrBitMask);
+    } //while
+
+    while ((irqidx = nu_ctz(wkisr)) < eAdc_WKISR_CNT)
     {
-        rt_err_t result;
-        outpw(REG_ADC_ISR, ADC_ISR_MF);
-        result = rt_sem_release(psNuAdc->m_psSem);
-        RT_ASSERT(result == RT_EOK);
-    }
+        uint32_t u32IsrBitMask = 1 << irqidx ;
+
+        if (psNuAdc->m_wkisr[irqidx].cbfunc != RT_NULL)
+        {
+            psNuAdc->m_wkisr[irqidx].cbfunc(wkisr, psNuAdc->m_wkisr[irqidx].private_data);
+        }
+
+        /* Clear sent bit */
+        outpw(REG_ADC_WKISR, u32IsrBitMask);
+        wkisr &= ~(u32IsrBitMask);
+    } //while
 }
 
 static rt_err_t _nu_adc_init(rt_device_t dev)
@@ -96,11 +137,171 @@ static rt_err_t _nu_adc_init(rt_device_t dev)
     return RT_EOK;
 }
 
+static int32_t AdcMenuStartCallback(uint32_t status, uint32_t userData)
+{
+    nu_adc_t psNuAdc = (nu_adc_t)userData;
+
+#if defined(BSP_USING_ADC_TOUCH)
+
+    static struct nu_adc_touch_data point;
+    static rt_bool_t bDrop = RT_FALSE;
+    static uint32_t u32LastZ0 = 0xffffu;
+
+    if (psNuAdc->psRtTouch != RT_NULL)
+    {
+        uint32_t value;
+
+        value = inpw(REG_ADC_XYDATA);
+        point.u32X = (value & 0x0ffful);
+        point.u32Y = ((value >> 16) & 0x0ffful);
+
+        value = inpw(REG_ADC_ZDATA);
+        point.u32Z0 = (value & 0x0ffful);
+        point.u32Z1 = ((value >> 16) & 0x0ffful);
+
+        /* Trigger next or not. */
+        if (point.u32Z0 == 0)
+        {
+            /* Stop sampling procedure. */
+            rt_timer_stop(g_sNuADC.psRtTouchMenuTimer);
+
+            /* Re-start pendown detection */
+            nu_adc_touch_detect(RT_TRUE);
+
+            bDrop = RT_TRUE;
+        }
+        else
+        {
+            bDrop = RT_FALSE;
+        }
+
+        /* Notify upper layer. */
+        if ((!bDrop || (u32LastZ0 != 0)) && rt_mq_send(psNuAdc->m_pmqTouchXYZ, (const void *)&point, sizeof(struct nu_adc_touch_data)) == RT_EOK)
+        {
+            rt_hw_touch_isr(psNuAdc->psRtTouch);
+        }
+
+        u32LastZ0 = point.u32Z0;
+    }
+    else
+#endif
+    {
+        rt_err_t result = rt_sem_release(psNuAdc->m_psSem);
+        RT_ASSERT(result == RT_EOK);
+    }
+
+    return 0;
+}
+
+#if defined(BSP_USING_ADC_TOUCH)
+
+void nu_adc_touch_detect(rt_bool_t bStartDetect)
+{
+    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
+
+    if (bStartDetect)
+    {
+        /* Start detect PenDown */
+        _nu_adc_control((rt_device_t)psNuAdc, PEPOWER_ON, RT_NULL);
+    }
+    else
+    {
+        /* Stop detect PenDown */
+        _nu_adc_control((rt_device_t)psNuAdc, PEPOWER_OFF, RT_NULL);
+    }
+}
+
+static int32_t PenDownCallback(uint32_t status, uint32_t userData)
+{
+    nu_adc_touch_detect(RT_FALSE);
+
+    rt_timer_start(g_sNuADC.psRtTouchMenuTimer);
+
+    return 0;
+}
+
+int32_t nu_adc_touch_read_xyz(uint32_t *bufX, uint32_t *bufY, uint32_t *bufZ0, uint32_t *bufZ1, int32_t dataCnt)
+{
+    int i;
+    struct nu_adc_touch_data value;
+
+    for (i = 0 ; i < dataCnt; i++)
+    {
+        if (rt_mq_recv(g_sNuADC.m_pmqTouchXYZ, (void *)&value, sizeof(struct nu_adc_touch_data), 0) == -RT_ETIMEOUT)
+            break;
+
+        bufX[i]  = value.u32X;
+        bufY[i]  = value.u32Y;
+        bufZ0[i] = value.u32Z0;
+        bufZ1[i] = value.u32Z1;
+    }
+    return i;
+}
+
+void nu_adc_touch_start_conv(void)
+{
+    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
+    _nu_adc_control((rt_device_t)psNuAdc, START_MST, RT_NULL);
+}
+
+rt_err_t nu_adc_touch_enable(rt_touch_t psRtTouch)
+{
+    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
+    nu_adc_cb sNuAdcCb;
+
+    rt_adc_enable((rt_adc_device_t)psNuAdc, 4);
+    rt_adc_enable((rt_adc_device_t)psNuAdc, 5);
+    rt_adc_enable((rt_adc_device_t)psNuAdc, 6);
+    rt_adc_enable((rt_adc_device_t)psNuAdc, 7);
+
+    outpw(REG_ADC_CONF, (inpw(REG_ADC_CONF) & ~(0xfful << 24)) | 0xfful << 24);
+
+    /* Register touch device. */
+    psNuAdc->psRtTouch = psRtTouch;
+
+    /* Enable TouchXY. */
+    _nu_adc_control((rt_device_t)psNuAdc, T_ON, RT_NULL);
+
+    /* Enable TouchZZ. */
+    _nu_adc_control((rt_device_t)psNuAdc, Z_ON, RT_NULL);
+
+    /* Register PenDown callback. */
+    sNuAdcCb.cbfunc = PenDownCallback;
+    sNuAdcCb.private_data = (rt_uint32_t)psRtTouch;
+    _nu_adc_control((rt_device_t)psNuAdc, PEDEF_ON, (void *)&sNuAdcCb);
+
+    nu_adc_touch_detect(RT_TRUE);
+
+    return RT_EOK;
+}
+
+rt_err_t nu_adc_touch_disable(void)
+{
+    nu_adc_t psNuAdc = (nu_adc_t)&g_sNuADC;
+
+    nu_adc_touch_detect(RT_FALSE);
+
+    _nu_adc_control((rt_device_t)psNuAdc, T_OFF, RT_NULL);
+    _nu_adc_control((rt_device_t)psNuAdc, Z_OFF, RT_NULL);
+    _nu_adc_control((rt_device_t)psNuAdc, PEDEF_OFF, RT_NULL);
+
+    rt_adc_disable((rt_adc_device_t)psNuAdc, 4);
+    rt_adc_disable((rt_adc_device_t)psNuAdc, 5);
+    rt_adc_disable((rt_adc_device_t)psNuAdc, 6);
+    rt_adc_disable((rt_adc_device_t)psNuAdc, 7);
+
+    return RT_EOK;
+}
+
+#endif
+
 static rt_err_t _nu_adc_control(rt_device_t dev, int cmd, void *args)
 {
     rt_err_t ret = RT_EINVAL ;
     nu_adc_t psNuAdc = (nu_adc_t)dev;
 
+    nu_adc_cb_t psAdcCb = (nu_adc_cb_t)args;
+
     switch (cmd)
     {
     case START_MST:  /* Menu Start Conversion */
@@ -116,29 +317,259 @@ static rt_err_t _nu_adc_control(rt_device_t dev, int cmd, void *args)
         RT_ASSERT(ret == RT_EOK);
 
         /* Get data: valid data is 12-bit */
-        *((uint32_t *)args) = inpw(REG_ADC_DATA) & 0x00000FFF;
+        if (args != RT_NULL)
+            *((uint32_t *)args) = inpw(REG_ADC_DATA) & 0x00000FFF;
     }
     break;
+
+    /* case START_MST_POLLING:  Not supported. */
+
     case VBPOWER_ON: /* Enable ADC Internal Bandgap Power */
     {
         outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) | ADC_CTL_VBGEN);
     }
     break;
+
     case VBPOWER_OFF: /* Disable ADC Internal Bandgap Power */
     {
         outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) & ~ADC_CTL_VBGEN);
     }
     break;
+
+    case KPPOWER_ON: /* Enable ADC Keypad Power */
+    {
+        outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) | ADC_CTL_PWKPEN);
+    }
+    break;
+
+    case KPPOWER_OFF: /* Disable ADC Keypad Power */
+    {
+        outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) & ~ADC_CTL_PWKPEN);
+    }
+    break;
+
+    case PEPOWER_ON: /* Enable Pen Power */
+    {
+        int retry = 100;
+        uint32_t treg = inpw(REG_ADC_IER);
+        outpw(REG_ADC_IER, treg & ~(ADC_IER_PEDEIEN | ADC_IER_PEUEIEN));
+        outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) | ADC_CTL_PEDEEN);
+        do
+        {
+            outpw(REG_ADC_ISR, ADC_ISR_PEDEF | ADC_ISR_PEUEF);
+            rt_thread_mdelay(1);
+            if (retry-- == 0)
+                break;
+        }
+        while (inpw(REG_ADC_ISR) & (ADC_ISR_PEDEF | ADC_ISR_PEUEF));
+        outpw(REG_ADC_IER, treg);
+    }
+    break;
+
+    case PEPOWER_OFF: /* Disable Pen Power */
+    {
+        outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) & ~ADC_CTL_PEDEEN);
+    }
+    break;
+
+    case KPPRESS_ON:  /* Enable Keypad press event */
+    {
+        if (psAdcCb)
+        {
+            rt_memcpy(&psNuAdc->m_isr[eAdc_KPEF], psAdcCb, sizeof(nu_adc_cb));
+        }
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER) | ADC_IER_KPEIEN);
+    }
+    break;
+
+    case KPPRESS_OFF: /* Disable Keypad press event */
+    {
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER & ~ADC_IER_KPEIEN));
+    }
+    break;
+
+    case KPUP_ON:  /* Enable Keypad up event */
+    {
+        if (psAdcCb)
+        {
+            rt_memcpy(&psNuAdc->m_isr[eAdc_KPUEF], psAdcCb, sizeof(nu_adc_cb));
+        }
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER) | ADC_IER_KPUEIEN);
+    }
+    break;
+
+    case KPUP_OFF:  /* Disable Keypad up event */
+    {
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER) & ~ADC_IER_KPUEIEN);
+    }
+    break;
+
+    case PEDEF_ON:  /* Enable Pen Down Event */
+    {
+        if (psAdcCb)
+        {
+            rt_memcpy(&psNuAdc->m_isr[eAdc_PEDEF], psAdcCb, sizeof(nu_adc_cb));
+        }
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER) | ADC_IER_PEDEIEN);
+    }
+    break;
+
+    case PEDEF_OFF: /* Disable Pen Down Event */
+    {
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER) & ~ADC_IER_PEDEIEN);
+    }
+    break;
+
+    case WKP_ON:  /* Enable Keypad Press Wake Up */
+    {
+        if (psAdcCb)
+        {
+            rt_memcpy(&psNuAdc->m_wkisr[eAdc_WKPEF], psAdcCb, sizeof(nu_adc_cb));
+        }
+
+        outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) | ADC_CTL_WKPEN);
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER) | ADC_IER_WKPIEN);
+        //outpw(REG_SYS_WKUPSER, inpw(REG_SYS_WKUPSER) | (1 << 26));
+    }
+    break;
+
+    case WKP_OFF:  /* Disable Keypad Press Wake Up */
+    {
+        outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) & ~ADC_CTL_WKPEN);
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER) & ~ADC_IER_WKPIEN);
+        //outpw(REG_SYS_WKUPSER, inpw(REG_SYS_WKUPSER) & ~(1 << 26));
+    }
+    break;
+
+    case WKT_ON: /* Enable Touch Wake Up */
+    {
+        if (psAdcCb)
+        {
+            rt_memcpy(&psNuAdc->m_wkisr[eAdc_WPEDEF], psAdcCb, sizeof(nu_adc_cb));
+        }
+
+        outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) | ADC_CTL_WKTEN);
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER) | ADC_IER_WKTIEN);
+        //outpw(REG_SYS_WKUPSER, inpw(REG_SYS_WKUPSER) | (1 << 26));
+    }
+    break;
+
+    case WKT_OFF:  /* Disable Touch Wake Up */
+    {
+        outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) & ~ADC_CTL_WKTEN);
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER) & ~ADC_IER_WKTIEN);
+        //outpw(REG_SYS_WKUPSER, inpw(REG_SYS_WKUPSER) & ~(1 << 26));
+    }
+    break;
+
+    case SWITCH_5WIRE_ON:   /* Wire Mode Switch to 5-Wire */
+    {
+        outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) | ADC_CTL_WMSWCH);
+    }
+    break;
+
+    case SWITCH_5WIRE_OFF:  /* Wire Mode Switch to 4-Wire */
+    {
+        outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) & ~ADC_CTL_WMSWCH);
+    }
+    break;
+
+    case T_ON:   /* Enable Touch detection function */
+    {
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) | ADC_CONF_TEN);
+    }
+    break;
+
+    case T_OFF:   /* Disable Touch detection function */
+    {
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) & ~ADC_CONF_TEN);
+    }
+    break;
+
+    case TAVG_ON:   /* Enable Touch Mean average for X and Y function */
+    {
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) | ADC_CONF_DISTMAVEN);
+    }
+    break;
+
+    case TAVG_OFF:   /* Disable Touch Mean average for X and Y function */
+    {
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) & ~ADC_CONF_DISTMAVEN);
+    }
+    break;
+
+    case Z_ON:   /* Enable Press measure function */
+    {
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) | ADC_CONF_ZEN);
+    }
+    break;
+
+    case Z_OFF:   /* Disable Press measure function */
+    {
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) & ~ADC_CONF_ZEN);
+#if defined(BSP_USING_ADC_TOUCH)
+        rt_mq_control(psNuAdc->m_pmqTouchXYZ, RT_IPC_CMD_RESET, RT_NULL);
+#endif
+    }
+    break;
+
+    case TZAVG_ON:   /* Enable Pressure Mean average for Z1 and Z2 function */
+    {
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) | ADC_CONF_DISZMAVEN);
+    }
+    break;
+
+    case TZAVG_OFF:   /* Disable Pressure Mean average for Z1 and Z2 function */
+    {
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) & ~ADC_CONF_DISZMAVEN);
+    }
+    break;
+
     case NAC_ON: /* Enable Normal AD Conversion */
     {
         outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) | ADC_CONF_NACEN | ADC_CONF_REFSEL_AVDD33);
     }
     break;
+
     case NAC_OFF: /* Disable Normal AD Conversion */
     {
         outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) & ~ADC_CONF_NACEN);
     }
     break;
+
+    case VBAT_ON:   /* Enable Voltage Battery Conversion */
+    {
+        if (psAdcCb)
+        {
+            rt_memcpy(&psNuAdc->m_isr[eAdc_VBF], psAdcCb, sizeof(nu_adc_cb));
+        }
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) | ADC_CONF_VBATEN);
+    }
+    break;
+
+    case VBAT_OFF:   /* Disable Voltage Battery */
+    {
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) & ~ADC_CONF_VBATEN);
+    }
+    break;
+
+    case KPCONV_ON:   /* Enable Keypad conversion function */
+    {
+        if (psAdcCb)
+        {
+            rt_memcpy(&psNuAdc->m_isr[eAdc_KPCF], psAdcCb, sizeof(nu_adc_cb));
+        }
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) | ADC_CONF_KPCEN);
+        outpw(REG_ADC_IER, inpw(REG_ADC_IER) | ADC_IER_KPEIEN);
+    }
+    break;
+
+    case KPCONV_OFF:   /* Disable Keypad conversion function */
+    {
+        outpw(REG_ADC_CONF, inpw(REG_ADC_CONF) & ~ADC_CONF_KPCEN);
+    }
+    break;
+
     case SWITCH_CH:
     {
         int chn = (int)args;
@@ -265,6 +696,16 @@ exit_nu_adc_convert:
     return (-ret) ;
 }
 
+static void nu_adc_touch_smpl(void *p)
+{
+    /* Enable interrupt */
+    outpw(REG_ADC_IER, inpw(REG_ADC_IER) | ADC_IER_MIEN);
+
+    /* Start conversion */
+    outpw(REG_ADC_CTL, inpw(REG_ADC_CTL) | ADC_CTL_MST);
+}
+
+
 int rt_hw_adc_init(void)
 {
     rt_err_t result = RT_ERROR;
@@ -279,8 +720,22 @@ int rt_hw_adc_init(void)
     g_sNuADC.m_psSem = rt_sem_create("adc_mst_sem", 0, RT_IPC_FLAG_FIFO);
     RT_ASSERT(g_sNuADC.m_psSem != RT_NULL);
 
+#if defined(BSP_USING_ADC_TOUCH)
+    g_sNuADC.m_pmqTouchXYZ = rt_mq_create("ADC_TOUCH_XYZ", sizeof(struct nu_adc_touch_data), TOUCH_MQ_LENGTH, RT_IPC_FLAG_FIFO);
+    RT_ASSERT(g_sNuADC.m_pmqTouchXYZ != RT_NULL);
+
+    g_sNuADC.psRtTouchMenuTimer = rt_timer_create("TOUCH_SMPL_TIMER", nu_adc_touch_smpl, (void *)&g_sNuADC, DEF_ADC_TOUCH_SMPL_TICK, RT_TIMER_FLAG_PERIODIC);
+    RT_ASSERT(g_sNuADC.psRtTouchMenuTimer != RT_NULL);
+#endif
+
+    rt_memset(&g_sNuADC.m_isr, 0, sizeof(g_sNuADC.m_isr));
+    rt_memset(&g_sNuADC.m_wkisr, 0, sizeof(g_sNuADC.m_wkisr));
+
+    g_sNuADC.m_isr[eAdc_MF].cbfunc = AdcMenuStartCallback;
+    g_sNuADC.m_isr[eAdc_MF].private_data = (UINT32)&g_sNuADC;
+
     return (int)result;
 }
 INIT_BOARD_EXPORT(rt_hw_adc_init);
 
-#endif //#if defined(BSP_USING_EADC)
+#endif //#if defined(BSP_USING_ADC)

+ 84 - 0
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc.h

@@ -0,0 +1,84 @@
+/**************************************************************************//**
+*
+* @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
+*
+* SPDX-License-Identifier: Apache-2.0
+*
+* Change Logs:
+* Date            Author       Notes
+* 2021-4-7        Wayne        First version
+*
+******************************************************************************/
+
+#ifndef __DRV_ADC_H__
+#define __DRV_ADC_H__
+
+#include <rtthread.h>
+#include "nu_adc.h"
+#if defined(BSP_USING_ADC_TOUCH)
+    #include "touch.h"
+#endif
+
+#define TOUCH_MQ_LENGTH      64
+
+#define DEF_CAL_POINT_NUM    5
+
+typedef enum
+{
+    eAdc_MF, //0
+    eAdc_KPEF, //1
+    eAdc_PEDEF, //2
+    eAdc_KPUEF, //3
+    eAdc_PEUEF, //4
+    eAdc_TF = 8, //8
+    eAdc_ZF, //9
+    eAdc_NACF, //10
+    eAdc_VBF, //11
+    eAdc_KPCF, //12
+    eAdc_SELFTF, //13
+    eAdc_INTKP = 16, //16
+    eAdc_INTTC, //17
+    eAdc_ISR_CNT //18
+} E_ADC_ISR_EVENT;
+
+typedef enum
+{
+    eAdc_WKPEF,
+    eAdc_WPEDEF,
+    eAdc_WKISR_CNT
+} E_ADC_WKISR_EVENT;
+
+typedef struct
+{
+    ADC_CALLBACK cbfunc;
+    uint32_t private_data;
+} nu_adc_cb;
+
+typedef nu_adc_cb *nu_adc_cb_t;
+
+#if defined(BSP_USING_ADC_TOUCH)
+typedef struct
+{
+    int32_t   x;
+    int32_t   y;
+} S_COORDINATE_POINT;
+
+typedef struct
+{
+    int32_t   a;
+    int32_t   b;
+    int32_t   c;
+    int32_t   d;
+    int32_t   e;
+    int32_t   f;
+    int32_t   div;
+} S_CALIBRATION_MATRIX;
+
+int32_t nu_adc_touch_read_xyz(uint32_t *bufX, uint32_t *bufY, uint32_t *bufZ0, uint32_t *bufZ1, int32_t dataCnt);
+rt_err_t nu_adc_touch_enable(rt_touch_t psRtTouch);
+rt_err_t nu_adc_touch_disable(void);
+void nu_adc_touch_detect(rt_bool_t bStartDetect);
+void nu_adc_touch_start_conv(void);
+#endif
+
+#endif /* __DRV_ADC_H__ */

+ 681 - 0
bsp/nuvoton/libraries/nuc980/rtt_port/drv_adc_touch.c

@@ -0,0 +1,681 @@
+/**************************************************************************//**
+* @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
+*
+* SPDX-License-Identifier: Apache-2.0
+*
+* Change Logs:
+* Date            Author       Notes
+* 2021-04-20      Wayne        First version
+*
+******************************************************************************/
+
+#include <rtconfig.h>
+
+#if defined(BSP_USING_ADC_TOUCH)
+
+#include "NuMicro.h"
+#include <rtdevice.h>
+#include <dfs_posix.h>
+#include "drv_adc.h"
+#include "touch.h"
+
+#if !defined(PATH_CALIBRATION_FILE)
+    #define PATH_CALIBRATION_FILE "/mnt/filesystem/ts_calibration"
+#endif
+
+
+typedef struct
+{
+    struct rt_touch_device dev;
+    rt_uint32_t x_range;
+    rt_uint32_t y_range;
+} nu_adc_touch;
+typedef nu_adc_touch *nu_adc_touch_t;
+
+static nu_adc_touch s_NuAdcTouch = {0};
+
+#if (BSP_LCD_WIDTH==320) && (BSP_LCD_HEIGHT==240)
+static S_CALIBRATION_MATRIX g_sCalMat = { 43, -5839, 21672848, 4193, -11, -747882, 65536 };
+static volatile uint32_t g_u32Calibrated = 1;
+#else
+static S_CALIBRATION_MATRIX g_sCalMat = { 1, 0, 0, 0, 1, 0, 1 };
+static volatile uint32_t g_u32Calibrated = 0;
+#endif
+
+static int nu_adc_touch_readfile(void);
+
+static const S_CALIBRATION_MATRIX g_sCalZero = { 1, 0, 0, 0, 1, 0, 1 };
+
+static int nu_adc_cal_mat_get(const S_COORDINATE_POINT *psDispCP, S_COORDINATE_POINT *psADCCP, S_CALIBRATION_MATRIX *psCM)
+{
+#if (DEF_CAL_POINT_NUM==3)
+
+    psCM->div = ((psADCCP[0].x - psADCCP[2].x) * (psADCCP[1].y - psADCCP[2].y)) -
+                ((psADCCP[1].x - psADCCP[2].x) * (psADCCP[0].y - psADCCP[2].y)) ;
+
+    if (psCM->div == 0)
+    {
+        return -1;
+    }
+    else
+    {
+        psCM->a = ((psDispCP[0].x - psDispCP[2].x) * (psADCCP[1].y - psADCCP[2].y)) -
+                  ((psDispCP[1].x - psDispCP[2].x) * (psADCCP[0].y - psADCCP[2].y)) ;
+
+        psCM->b = ((psADCCP[0].x - psADCCP[2].x) * (psDispCP[1].x - psDispCP[2].x)) -
+                  ((psDispCP[0].x - psDispCP[2].x) * (psADCCP[1].x - psADCCP[2].x)) ;
+
+        psCM->c = (psADCCP[2].x * psDispCP[1].x - psADCCP[1].x * psDispCP[2].x) * psADCCP[0].y +
+                  (psADCCP[0].x * psDispCP[2].x - psADCCP[2].x * psDispCP[0].x) * psADCCP[1].y +
+                  (psADCCP[1].x * psDispCP[0].x - psADCCP[0].x * psDispCP[1].x) * psADCCP[2].y ;
+
+        psCM->d = ((psDispCP[0].y - psDispCP[2].y) * (psADCCP[1].y - psADCCP[2].y)) -
+                  ((psDispCP[1].y - psDispCP[2].y) * (psADCCP[0].y - psADCCP[2].y)) ;
+
+        psCM->e = ((psADCCP[0].x - psADCCP[2].x) * (psDispCP[1].y - psDispCP[2].y)) -
+                  ((psDispCP[0].y - psDispCP[2].y) * (psADCCP[1].x - psADCCP[2].x)) ;
+
+        psCM->f = (psADCCP[2].x * psDispCP[1].y - psADCCP[1].x * psDispCP[2].y) * psADCCP[0].y +
+                  (psADCCP[0].x * psDispCP[2].y - psADCCP[2].x * psDispCP[0].y) * psADCCP[1].y +
+                  (psADCCP[1].x * psDispCP[0].y - psADCCP[0].x * psDispCP[1].y) * psADCCP[2].y ;
+    }
+
+#elif (DEF_CAL_POINT_NUM==5)
+
+    int i;
+    float n, x, y, xx, yy, xy, z, zx, zy;
+    float a, b, c, d, e, f, g;
+    float scaling = 65536.0f;
+
+    n = x = y = xx = yy = xy = 0;
+    for (i = 0; i < DEF_CAL_POINT_NUM; i++)
+    {
+        n  += 1.0;
+        x  += (float)psADCCP[i].x;
+        y  += (float)psADCCP[i].y;
+        xx += (float)psADCCP[i].x * psADCCP[i].x;
+        yy += (float)psADCCP[i].y * psADCCP[i].y;
+        xy += (float)psADCCP[i].x * psADCCP[i].y;
+    }
+
+    d = n * (xx * yy - xy * xy) + x * (xy * y - x * yy) + y * (x * xy - y * xx);
+    if (d < 0.1 && d > -0.1)
+    {
+        return -1;
+    }
+
+    a = (xx * yy - xy * xy) / d;
+    b = (xy * y  - x * yy)  / d;
+    c = (x * xy  - y * xx)  / d;
+    e = (n * yy  - y * y)   / d;
+    f = (x * y   - n * xy)  / d;
+    g = (n * xx  - x * x)   / d;
+
+    z = zx = zy = 0;
+    for (i = 0; i < DEF_CAL_POINT_NUM; i++)
+    {
+        z  += (float)psDispCP[i].x;
+        zx += (float)psDispCP[i].x * psADCCP[i].x;
+        zy += (float)psDispCP[i].x * psADCCP[i].y;
+    }
+
+    psCM->c = (int32_t)((a * z + b * zx + c * zy) * scaling);
+    psCM->a = (int32_t)((b * z + e * zx + f * zy) * scaling);
+    psCM->b = (int32_t)((c * z + f * zx + g * zy) * scaling);
+
+    z = zx = zy = 0;
+    for (i = 0; i < DEF_CAL_POINT_NUM; i++)
+    {
+        z  += (float)psDispCP[i].y;
+        zx += (float)psDispCP[i].y * psADCCP[i].x;
+        zy += (float)psDispCP[i].y * psADCCP[i].y;
+    }
+
+    psCM->f = (int32_t)((a * z + b * zx + c * zy) * scaling);
+    psCM->d = (int32_t)((b * z + e * zx + f * zy) * scaling);
+    psCM->e = (int32_t)((c * z + f * zx + g * zy) * scaling);
+
+    psCM->div = (int32_t)scaling;
+
+#else
+#error "Not supported calibration method"
+#endif
+    return 0;
+}
+
+static void nu_adc_touch_cal(int32_t *sumx, int32_t *sumy)
+{
+    int32_t xtemp, ytemp;
+
+    xtemp = *sumx;
+    ytemp = *sumy;
+    *sumx = (g_sCalMat.c +
+             g_sCalMat.a * xtemp +
+             g_sCalMat.b * ytemp) / g_sCalMat.div;
+    *sumy = (g_sCalMat.f +
+             g_sCalMat.d * xtemp +
+             g_sCalMat.e * ytemp) / g_sCalMat.div;
+}
+
+static rt_size_t nu_adc_touch_readpoint(struct rt_touch_device *device, void *buf, rt_size_t read_num)
+{
+    static uint32_t last_report_x = 0, last_report_y = 0;
+    struct rt_touch_data *pPoint = (struct rt_touch_data *)buf;
+    nu_adc_touch_t psNuAdcTouch = (nu_adc_touch_t)device;
+
+    RT_ASSERT(device != RT_NULL);
+    RT_ASSERT(buf != RT_NULL);
+
+    int i;
+
+    for (i = 0; i < read_num; i++)
+    {
+        uint32_t bufZ0 = 0, bufZ1 = 0;
+        int32_t sumx = 0, sumy = 0;
+        pPoint[i].timestamp = rt_touch_get_ts();
+        pPoint[i].track_id = 0;
+
+        if (nu_adc_touch_read_xyz((uint32_t *)&sumx, (uint32_t *)&sumy, &bufZ0, &bufZ1, 1) != 1)
+            break;
+
+        if (bufZ0 == 0)
+        {
+            /* Workaround: In this case, x, y values are unstable. so, report last point's coordinate.*/
+            pPoint[i].event = RT_TOUCH_EVENT_UP;
+            pPoint[i].x_coordinate = (uint16_t)last_report_x;
+            pPoint[i].y_coordinate = (uint16_t)last_report_y;
+        }
+        else
+        {
+            if (g_u32Calibrated)
+            {
+                nu_adc_touch_cal(&sumx, &sumy);
+            }
+            last_report_x = sumx;
+            last_report_y = sumy;
+
+            pPoint[i].event = RT_TOUCH_EVENT_DOWN;
+            pPoint[i].x_coordinate = (uint16_t)sumx;
+            pPoint[i].y_coordinate = (uint16_t)sumy;
+        }
+
+        if (g_u32Calibrated)
+        {
+            bufZ0 = bufZ0 >> 3;
+            pPoint[i].width = (bufZ0 > 255) ? 255 : bufZ0;
+
+            //Limit max x, y coordinate if value is over its range.
+            pPoint[i].x_coordinate = (pPoint[i].x_coordinate > psNuAdcTouch->x_range) ? psNuAdcTouch->x_range : pPoint[i].x_coordinate;
+            pPoint[i].y_coordinate = (pPoint[i].y_coordinate > psNuAdcTouch->y_range) ? psNuAdcTouch->y_range : pPoint[i].y_coordinate;
+        }
+    }
+    return (rt_size_t)i;
+}
+
+static rt_err_t nu_adc_touch_control(struct rt_touch_device *device, int cmd, void *data)
+{
+    nu_adc_touch_t psNuAdcTouch = (nu_adc_touch_t)device;
+    RT_ASSERT(psNuAdcTouch != RT_NULL);
+
+    switch (cmd)
+    {
+    case RT_TOUCH_CTRL_SET_X_RANGE: /* set x range */
+        psNuAdcTouch->x_range = *((rt_int32_t *)data);
+        break;
+
+    case RT_TOUCH_CTRL_SET_Y_RANGE: /* set y range */
+        psNuAdcTouch->y_range = *((rt_int32_t *)data);
+        break;
+
+    case RT_TOUCH_CTRL_ENABLE_INT: /* enable pen_down interrupt */
+        nu_adc_touch_detect(RT_TRUE);
+        break;
+
+    case RT_TOUCH_CTRL_DISABLE_INT: /* disable pen_down interrupt */
+        nu_adc_touch_detect(RT_FALSE);
+        break;
+
+    case RT_TOUCH_CTRL_POWER_ON:    /* Touch Power On */
+        return nu_adc_touch_enable(device);
+
+    case RT_TOUCH_CTRL_POWER_OFF:   /* Touch Power Off */
+        return nu_adc_touch_disable();
+
+    default:
+        return -RT_ERROR;
+    }
+    return RT_EOK;
+}
+
+static struct rt_touch_ops touch_ops =
+{
+    .touch_readpoint = nu_adc_touch_readpoint,
+    .touch_control = nu_adc_touch_control,
+};
+
+static void nu_adc_touch_update_calmat(S_CALIBRATION_MATRIX *psNewCalMat)
+{
+    if (psNewCalMat &&
+            psNewCalMat->div != 0)
+    {
+        rt_memcpy(&g_sCalMat, psNewCalMat, sizeof(S_CALIBRATION_MATRIX));
+        g_u32Calibrated = 1;
+        rt_kprintf("Applied calibration data: %d, %d, %d, %d, %d, %d, %d\n",
+                   g_sCalMat.a,
+                   g_sCalMat.b,
+                   g_sCalMat.c,
+                   g_sCalMat.d,
+                   g_sCalMat.e,
+                   g_sCalMat.f,
+                   g_sCalMat.div);
+
+    }
+}
+
+static void nu_adc_touch_reset_calmat(void)
+{
+    rt_memcpy(&g_sCalMat, &g_sCalZero, sizeof(S_CALIBRATION_MATRIX));
+    g_u32Calibrated = 0;
+}
+
+int rt_hw_adc_touch_init(void)
+{
+    /* Register touch device */
+    s_NuAdcTouch.dev.info.type = RT_TOUCH_TYPE_RESISTANCE;
+    s_NuAdcTouch.dev.info.vendor = RT_TOUCH_VENDOR_UNKNOWN;
+    s_NuAdcTouch.dev.info.point_num = 1;
+    s_NuAdcTouch.dev.info.range_x = BSP_LCD_WIDTH;
+    s_NuAdcTouch.dev.info.range_y = BSP_LCD_HEIGHT;
+
+    s_NuAdcTouch.dev.ops = &touch_ops;
+
+    return (int)rt_hw_touch_register(&s_NuAdcTouch.dev, "adc_touch", RT_DEVICE_FLAG_INT_RX, RT_NULL);
+}
+INIT_DEVICE_EXPORT(rt_hw_adc_touch_init);
+
+
+static rt_thread_t  adc_touch_thread = RT_NULL;
+static rt_sem_t     adc_touch_sem = RT_NULL;
+static int          adc_touch_worker_run = 0;
+
+static rt_err_t adc_touch_rx_callback(rt_device_t dev, rt_size_t size)
+{
+    //rt_kprintf("[%s %d] %d\n", __func__, __LINE__, size);
+    return rt_sem_release(adc_touch_sem);
+}
+
+static rt_err_t adc_request_point(rt_device_t pdev, struct rt_touch_data *psTouchPoint)
+{
+    rt_err_t ret = -RT_ERROR;
+
+    if ((ret = rt_sem_take(adc_touch_sem, rt_tick_from_millisecond(500))) == RT_EOK)
+    {
+        rt_memset(psTouchPoint, 0, sizeof(struct rt_touch_data));
+
+        if (rt_device_read(pdev, 0, psTouchPoint, s_NuAdcTouch.dev.info.point_num) == s_NuAdcTouch.dev.info.point_num)
+        {
+            ret = RT_EOK;
+        }
+
+    }
+
+    return ret;
+}
+
+RT_WEAK void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t event)
+{
+}
+
+static rt_device_t lcd_device = 0;
+static struct rt_device_graphic_info info;
+
+static void lcd_cleanscreen(void)
+{
+    if (info.framebuffer != RT_NULL)
+    {
+        /* Rendering */
+        struct rt_device_rect_info rect;
+
+        rt_memset(info.framebuffer, 0, (info.pitch * info.height));
+        rect.x = 0;
+        rect.y = 0;
+        rect.width = info.width;
+        rect.height = info.height;
+        rt_device_control(lcd_device, RTGRAPHIC_CTRL_RECT_UPDATE, &rect);
+    }
+    else
+    {
+        // TODO
+    }
+}
+
+#define DEF_DOT_NUMBER    9
+#define DOTS_NUMBER       (DEF_DOT_NUMBER*DEF_DOT_NUMBER)
+static void nu_draw_bots(int x, int y)
+{
+    if (info.framebuffer != RT_NULL)
+    {
+        /* Rendering */
+        struct rt_device_rect_info rect;
+        int i, j;
+        int start_x = x - (DEF_DOT_NUMBER / 2);
+        int start_y = y - (DEF_DOT_NUMBER / 2);
+
+        if (info.pixel_format == RTGRAPHIC_PIXEL_FORMAT_RGB565)
+        {
+            uint16_t *pu16Start = (uint16_t *)((uint32_t)info.framebuffer + (start_y) * info.pitch + (start_x * 2));
+            for (j = 0; j < DEF_DOT_NUMBER; j++)
+            {
+                for (i = 0; i < DEF_DOT_NUMBER; i++)
+                    pu16Start[i] = 0x07E0; //Green, RGB
+                pu16Start += info.width;
+            }
+        }
+        else if (info.pixel_format == RTGRAPHIC_PIXEL_FORMAT_ARGB888)
+        {
+            uint32_t *pu32Start = (uint32_t *)((uint32_t)info.framebuffer + (start_y) * info.pitch + (start_x * 4));
+            for (j = 0; j < DEF_DOT_NUMBER; j++)
+            {
+                for (i = 0; i < DEF_DOT_NUMBER; i++)
+                    pu32Start[i] = 0xff00ff00; //Green, ARGB
+                pu32Start += info.width;
+            }
+        }
+        else
+        {
+            //Not supported
+        }
+
+        rect.x = 0;
+        rect.y = 0;
+        rect.width = info.width;
+        rect.height = info.height;
+        rt_device_control(lcd_device, RTGRAPHIC_CTRL_RECT_UPDATE, &rect);
+    }
+    else
+    {
+        // TODO
+    }
+}
+
+#if (DEF_CAL_POINT_NUM==3)
+const S_COORDINATE_POINT sDispPoints[DEF_CAL_POINT_NUM] =
+{
+    {BSP_LCD_WIDTH / 4, BSP_LCD_HEIGHT / 2},
+    {BSP_LCD_WIDTH - BSP_LCD_WIDTH / 4, BSP_LCD_HEIGHT / 4},
+    {BSP_LCD_WIDTH / 2, BSP_LCD_HEIGHT - BSP_LCD_HEIGHT / 4}
+};
+#elif (DEF_CAL_POINT_NUM==5)
+const static S_COORDINATE_POINT sDispPoints[DEF_CAL_POINT_NUM] =
+{
+#define DEF_CUT_PIECES 8
+    {BSP_LCD_WIDTH / DEF_CUT_PIECES, BSP_LCD_HEIGHT / DEF_CUT_PIECES},
+    {BSP_LCD_WIDTH - BSP_LCD_WIDTH / DEF_CUT_PIECES, BSP_LCD_HEIGHT / DEF_CUT_PIECES},
+    {BSP_LCD_WIDTH - BSP_LCD_WIDTH / DEF_CUT_PIECES, BSP_LCD_HEIGHT - BSP_LCD_HEIGHT / DEF_CUT_PIECES},
+    {BSP_LCD_WIDTH / DEF_CUT_PIECES, BSP_LCD_HEIGHT - BSP_LCD_HEIGHT / DEF_CUT_PIECES},
+
+    {BSP_LCD_WIDTH / 2, BSP_LCD_HEIGHT / 2}
+};
+#endif
+
+static int nu_adc_touch_readfile(void)
+{
+    int fd;
+
+    S_CALIBRATION_MATRIX sCalMat;
+
+    if ((fd = open(PATH_CALIBRATION_FILE, O_RDONLY, 0)) < 0)
+    {
+        goto exit_nu_adc_touch_readfile;
+    }
+    else if (read(fd, &sCalMat, sizeof(S_CALIBRATION_MATRIX)) == sizeof(S_CALIBRATION_MATRIX))
+    {
+        rt_kprintf("[%s] %s\n", __func__, PATH_CALIBRATION_FILE);
+    }
+
+    close(fd);
+
+    nu_adc_touch_update_calmat(&sCalMat);
+
+    return 0;
+
+exit_nu_adc_touch_readfile:
+
+    return -1;
+}
+
+static int nu_adc_touch_writefile(void *buf, int buf_len)
+{
+    int fd;
+
+    if ((fd = open(PATH_CALIBRATION_FILE, O_WRONLY | O_CREAT, 0)) < 0)
+    {
+        goto exit_nu_adc_touch_writefile;
+    }
+    else if (write(fd, buf, buf_len) == buf_len)
+    {
+        rt_kprintf("[%s] %s\n", __func__, PATH_CALIBRATION_FILE);
+    }
+
+    close(fd);
+
+    return 0;
+
+exit_nu_adc_touch_writefile:
+
+    return -1;
+}
+
+static void nu_touch_do_calibration(rt_device_t pdev)
+{
+    int i;
+    rt_err_t result;
+
+    S_CALIBRATION_MATRIX sCalMat;
+    S_COORDINATE_POINT sADCPoints[DEF_CAL_POINT_NUM];
+
+    lcd_device = rt_device_find("lcd");
+    if (!lcd_device)
+    {
+        rt_kprintf("Not supported graphics ops\n");
+        return;
+    }
+
+    result = rt_device_control(lcd_device, RTGRAPHIC_CTRL_GET_INFO, &info);
+    if (result != RT_EOK)
+    {
+        rt_kprintf("error!");
+        return;
+    }
+
+    result = rt_device_open(lcd_device, 0);
+    if (result != RT_EOK)
+    {
+        rt_kprintf("opened?");
+    }
+
+    rt_device_control(lcd_device, RTGRAPHIC_CTRL_PAN_DISPLAY, info.framebuffer);
+    rt_device_control(lcd_device, RTGRAPHIC_CTRL_POWERON, RT_NULL);
+
+    for (i = 0; i < DEF_CAL_POINT_NUM; i++)
+    {
+        struct rt_touch_data sTouchPoint;
+        int count = 0;
+
+        lcd_cleanscreen();
+
+        /* Drain RX queue before doing calibrate. */
+        while (adc_request_point(pdev, &sTouchPoint) == RT_EOK);
+
+        rt_thread_mdelay(100);
+
+        /* Ready to calibrate */
+        nu_draw_bots(sDispPoints[i].x, sDispPoints[i].y);
+
+#define DEF_MAX_GET_POINT_NUM 5
+
+        sADCPoints[i].x = 0;
+        sADCPoints[i].y = 0;
+
+        while (count < DEF_MAX_GET_POINT_NUM)
+        {
+            if (adc_request_point(pdev, &sTouchPoint) == RT_EOK)
+            {
+                sADCPoints[i].x += (int32_t)sTouchPoint.x_coordinate;
+                sADCPoints[i].y += (int32_t)sTouchPoint.y_coordinate;
+                rt_kprintf("[%d %d] - Disp:[%d, %d] -> ADC:[%d, %d]\n", i, count, sDispPoints[i].x, sDispPoints[i].y, sADCPoints[i].x, sADCPoints[i].y);
+                count++;
+            }
+        }
+
+        sADCPoints[i].x = (int32_t)((float)sADCPoints[i].x / DEF_MAX_GET_POINT_NUM);
+        sADCPoints[i].y = (int32_t)((float)sADCPoints[i].y / DEF_MAX_GET_POINT_NUM);
+        rt_kprintf("[%d] - Disp:[%d, %d], ADC:[%d, %d]\n", i, sDispPoints[i].x, sDispPoints[i].y, sADCPoints[i].x, sADCPoints[i].y);
+
+        rt_thread_mdelay(300);
+    }
+
+    lcd_cleanscreen();
+
+    /* Get calibration matrix. */
+    if (nu_adc_cal_mat_get(&sDispPoints[0], &sADCPoints[0], &sCalMat) == 0)
+    {
+        /* Finally, update calibration matrix to drivers. */
+        nu_adc_touch_update_calmat(&sCalMat);
+
+        nu_adc_touch_writefile(&sCalMat, sizeof(sCalMat));
+
+        for (i = 0; i < DEF_CAL_POINT_NUM; i++)
+        {
+            rt_kprintf("[%d] - Disp:[%d, %d], ADC:[%d, %d]\n", i, sDispPoints[i].x, sDispPoints[i].y, sADCPoints[i].x, sADCPoints[i].y);
+        }
+    }
+    else
+    {
+        rt_kprintf("Failed to calibrate.\n");
+    }
+
+    rt_device_control(lcd_device, RTGRAPHIC_CTRL_POWEROFF, RT_NULL);
+    rt_device_close(lcd_device);
+
+    return;
+}
+
+static void adc_touch_entry(void *parameter)
+{
+    struct rt_touch_data touch_point;
+
+    rt_err_t result;
+    rt_device_t pdev;
+
+    int max_range;
+
+    adc_touch_sem = rt_sem_create("adc_touch_sem", 0, RT_IPC_FLAG_FIFO);
+    RT_ASSERT(adc_touch_sem != RT_NULL);
+
+    pdev = rt_device_find("adc_touch");
+    if (!pdev)
+    {
+        rt_kprintf("Not found\n");
+        return ;
+    }
+
+    nu_adc_touch_readfile();
+
+    result = rt_device_open(pdev, RT_DEVICE_FLAG_INT_RX);
+    RT_ASSERT(result == RT_EOK);
+
+    result = rt_device_set_rx_indicate(pdev, adc_touch_rx_callback);
+    RT_ASSERT(result == RT_EOK);
+
+    max_range = BSP_LCD_WIDTH;
+    result = rt_device_control(pdev, RT_TOUCH_CTRL_SET_X_RANGE, (void *)&max_range);
+    RT_ASSERT(result == RT_EOK);
+
+    max_range = BSP_LCD_HEIGHT;
+    result = rt_device_control(pdev, RT_TOUCH_CTRL_SET_Y_RANGE, (void *)&max_range);
+    RT_ASSERT(result == RT_EOK);
+
+    result = rt_device_control(pdev, RT_TOUCH_CTRL_POWER_ON, RT_NULL);
+    RT_ASSERT(result == RT_EOK);
+
+    while (adc_touch_worker_run)
+    {
+        if (!g_u32Calibrated)
+        {
+            rt_kprintf("Start ADC touching calibration.\n");
+            nu_touch_do_calibration(pdev);
+            rt_kprintf("Stop ADC touching calibration.\n");
+            continue;
+        }
+
+        if (adc_request_point(pdev, &touch_point) == RT_EOK)
+        {
+            if (touch_point.event == RT_TOUCH_EVENT_DOWN
+                    || touch_point.event == RT_TOUCH_EVENT_UP
+                    || touch_point.event == RT_TOUCH_EVENT_MOVE)
+            {
+                nu_touch_inputevent_cb(touch_point.x_coordinate, touch_point.y_coordinate, touch_point.event);
+
+                rt_kprintf("x=%d y=%d event=%s%s%s\n",
+                           touch_point.x_coordinate,
+                           touch_point.y_coordinate,
+                           (touch_point.event == RT_TOUCH_EVENT_DOWN) ? "DOWN" : "",
+                           (touch_point.event == RT_TOUCH_EVENT_UP) ? "UP" : "",
+                           (touch_point.event == RT_TOUCH_EVENT_MOVE) ? "MOVE" : "");
+            }
+        }
+    }
+
+    result = rt_device_control(pdev, RT_TOUCH_CTRL_POWER_OFF, RT_NULL);
+    RT_ASSERT(result == RT_EOK);
+
+    result = rt_device_close(pdev);
+    RT_ASSERT(result == RT_EOK);
+}
+
+
+/* Support "nu_touch_start" command line in msh mode */
+static rt_err_t nu_touch_start(int argc, char **argv)
+{
+    if (adc_touch_thread == RT_NULL)
+    {
+        adc_touch_thread = rt_thread_create("adc_touch_thread",
+                                            adc_touch_entry,
+                                            RT_NULL,
+                                            4096,
+                                            25,
+                                            5);
+        adc_touch_worker_run = 1;
+        if (adc_touch_thread != RT_NULL)
+            rt_thread_startup(adc_touch_thread);
+    }
+    return 0;
+}
+MSH_CMD_EXPORT(nu_touch_start, e.g: start adc touch);
+
+/* Support "nu_touch_stop" command line in msh mode */
+static rt_err_t nu_touch_stop(int argc, char **argv)
+{
+    adc_touch_worker_run = 0;
+    adc_touch_thread = RT_NULL;
+    return 0;
+}
+MSH_CMD_EXPORT(nu_touch_stop, e.g: stop adc touch);
+
+static int nu_touch_autostart(void)
+{
+    return nu_touch_start(0, RT_NULL);
+}
+INIT_APP_EXPORT(nu_touch_autostart);
+
+static rt_err_t nu_touch_calibration(int argc, char **argv)
+{
+    /* Clean calibration matrix data for getting raw adc value. */
+    nu_adc_touch_reset_calmat();
+
+    return 0;
+}
+MSH_CMD_EXPORT(nu_touch_calibration, for adc touch);
+
+#endif //#if defined(BSP_USING_ADC_TOUCH)

+ 189 - 178
bsp/nuvoton/libraries/nuc980/rtt_port/drv_can.c

@@ -64,6 +64,7 @@ struct nu_can
     IRQn_Type irqn;
     E_SYS_IPRST rstidx;
     E_SYS_IPCLK clkidx;
+    uint32_t int_flag;
 };
 typedef struct nu_can *nu_can_t;
 
@@ -130,16 +131,16 @@ static const struct can_configure nu_can_default_config = NU_CAN_CONFIG_DEFAULT;
 /* Interrupt Handle Function  ----------------------------------------------------*/
 static void nu_can_isr(int vector, void *param)
 {
-    uint32_t u32IIDRstatus;
     nu_can_t psNuCAN  = (nu_can_t)param;
 
     /* Get base address of CAN register */
     CAN_T *base = psNuCAN->base;
 
     /* Get interrupt event */
-    u32IIDRstatus = CAN_GET_INT_PENDING_STATUS(base);
+    uint32_t u32IIDRstatus = CAN_GET_INT_PENDING_STATUS(base) & CAN_IIDR_INTID_Msk;
 
-    if (u32IIDRstatus == 0x00008000)       /* Check Status Interrupt Flag (Error status Int and Status change Int) */
+    /* Check Status Interrupt Flag (Error status Int and Status change Int) */
+    if (u32IIDRstatus == 0x00008000)
     {
         /**************************/
         /* Status Change interrupt*/
@@ -147,20 +148,24 @@ static void nu_can_isr(int vector, void *param)
         if (base->STATUS & CAN_STATUS_TXOK_Msk)
         {
             base->STATUS &= ~CAN_STATUS_TXOK_Msk;    /* Clear Tx Ok status*/
-            //rt_kprintf("%s: TX\n", psNuCAN->name) ;
 #ifndef RT_CAN_USING_HDR
-            /* Using as Lisen,Loopback,Loopback+Lisen mode*/
-            rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_TX_DONE);
+            if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_TX)
+            {
+                /*Using as Lisen,Loopback,Loopback+Lisen mode*/
+                rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_TX_DONE);
+            }
 #endif
         }
 
         if (base->STATUS & CAN_STATUS_RXOK_Msk)
         {
             base->STATUS &= ~CAN_STATUS_RXOK_Msk;   /* Clear Rx Ok status*/
-            //rt_kprintf("%s: RX\n", psNuCAN->name) ;
 #ifndef RT_CAN_USING_HDR
-            /* Using as Lisen,Loopback,Loopback+Lisen mode*/
-            rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_RX_IND);
+            if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_RX)
+            {
+                /*Using as Lisen,Loopback,Loopback+Lisen mode*/
+                rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_RX_IND);
+            }
 #endif
         }
 
@@ -169,17 +174,16 @@ static void nu_can_isr(int vector, void *param)
         /**************************/
         if (base->STATUS & CAN_STATUS_EWARN_Msk)
         {
-            rt_kprintf("%s: EWARN\n", psNuCAN->name) ;
+            rt_kprintf("[%s]EWARN INT\n", psNuCAN->name) ;
         }
 
         if (base->STATUS & CAN_STATUS_BOFF_Msk)
         {
-            rt_kprintf("%s: BUSOFF\n", psNuCAN->name) ;
+            rt_kprintf("[%s]BUSOFF INT\n", psNuCAN->name) ;
 
-            /* Do Init to release busoff pin */
-            base->CON = (CAN_CON_INIT_Msk | CAN_CON_CCE_Msk);
-            base->CON &= (~(CAN_CON_INIT_Msk | CAN_CON_CCE_Msk));
-            while (base->CON & CAN_CON_INIT_Msk);
+            /* To release busoff pin */
+            CAN_EnterInitMode(base, CAN_CON_INIT_Msk | CAN_CON_CCE_Msk);
+            CAN_LeaveInitMode(base);
         }
 
         if (base->STATUS & CAN_STATUS_LEC_Msk)
@@ -192,66 +196,83 @@ static void nu_can_isr(int vector, void *param)
     /*IntId: 0x0001-0x0020, Number of Message Object which caused the interrupt.*/
     else if (u32IIDRstatus > 0 && u32IIDRstatus <= 32)
     {
-        /*Message RAM 0~RX_MSG_ID_INDEX for CAN Tx using*/
-        if (u32IIDRstatus <= RX_MSG_ID_INDEX)
+        if ((psNuCAN->int_flag & RT_DEVICE_FLAG_INT_TX) &&
+                (u32IIDRstatus <= RX_MSG_ID_INDEX))
         {
-            //rt_kprintf("[%s-Tx]IntId = %d\n", psNuCAN->name, u32IIDRstatus);
+            /*Message RAM 0~RX_MSG_ID_INDEX for CAN Tx using*/
             rt_hw_can_isr(&psNuCAN->dev, RT_CAN_EVENT_TX_DONE);
         }
-        else /*Message RAM RX_MSG_ID_INDEX~31 for CAN Rx using*/
+        else if (psNuCAN->int_flag & RT_DEVICE_FLAG_INT_RX)
         {
-            //rt_kprintf("[%s-Rx]IntId = %d\n",  psNuCAN->name, u32IIDRstatus);
+            /*Message RAM RX_MSG_ID_INDEX~31 for CAN Rx using*/
             rt_hw_can_isr(&psNuCAN->dev, (RT_CAN_EVENT_RX_IND | ((u32IIDRstatus - 1) << 8)));
         }
         CAN_CLR_INT_PENDING_BIT(base, (u32IIDRstatus - 1));     /* Clear Interrupt Pending */
     }
 #endif
-
 }
 
+static void nu_can_ie(nu_can_t psNuCAN)
+{
+    uint32_t u32CanIE = CAN_CON_IE_Msk;
+
+    if (psNuCAN->int_flag & (RT_DEVICE_FLAG_INT_RX | RT_DEVICE_FLAG_INT_TX))
+    {
+        u32CanIE |= CAN_CON_SIE_Msk;
+    }
+    else
+    {
+        u32CanIE &= ~CAN_CON_SIE_Msk;
+    }
+
+    if (psNuCAN->int_flag & RT_DEVICE_CAN_INT_ERR)
+    {
+        u32CanIE |= CAN_CON_EIE_Msk;
+    }
+    else
+    {
+        u32CanIE &= ~CAN_CON_EIE_Msk;
+    }
+
+    if (u32CanIE & (CAN_CON_SIE_Msk | CAN_CON_EIE_Msk))
+    {
+        CAN_EnableInt(psNuCAN->base, u32CanIE);
+
+        /* Enable interrupt. */
+        rt_hw_interrupt_umask(psNuCAN->irqn);
+    }
+    else
+    {
+        u32CanIE |= (CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
+        CAN_DisableInt(psNuCAN->base, u32CanIE);
+
+        /* Disable interrupt. */
+        rt_hw_interrupt_mask(psNuCAN->irqn);
+    }
+}
 
 static rt_err_t nu_can_configure(struct rt_can_device *can, struct can_configure *cfg)
 {
     nu_can_t psNuCAN  = (nu_can_t)can;
+    uint32_t u32CANMode;
 
-    RT_ASSERT(can != RT_NULL);
-    RT_ASSERT(cfg != RT_NULL);
+    RT_ASSERT(can);
+    RT_ASSERT(cfg);
 
     /* Get base address of CAN register */
     CAN_T *base = psNuCAN->base;
 
-    RT_ASSERT(base != RT_NULL);
-
-    switch (cfg->mode)
-    {
-    /* CAN default Normal mode */
-    case RT_CAN_MODE_NORMAL:
-        can->config.mode = CAN_NORMAL_MODE;
-        break;
-    case RT_CAN_MODE_LISEN:
-        can->config.mode = RT_CAN_MODE_LISEN;
-        break;
-    case RT_CAN_MODE_LOOPBACK:
-        can->config.mode = RT_CAN_MODE_LOOPBACK;
-        break;
-    case RT_CAN_MODE_LOOPBACKANLISEN:
-        can->config.mode = RT_CAN_MODE_LOOPBACKANLISEN;
-        break;
-    default:
-        rt_kprintf("Unsupported Operating mode");
-        goto exit_nu_can_configure;
-    }
-
+    /* Reset this module */
     nu_sys_ip_reset(psNuCAN->rstidx);
 
-    /*Set the CAN Bit Rate and Operating mode*/
-    if (CAN_Open(base, can->config.baud_rate, can->config.mode) < 1)
-        return -(RT_ERROR);
+    u32CANMode = (cfg->mode == RT_CAN_MODE_NORMAL) ? CAN_NORMAL_MODE : CAN_BASIC_MODE;
 
+    /*Set the CAN Bit Rate and Operating mode*/
+    if (CAN_Open(base, cfg->baud_rate, u32CANMode) != cfg->baud_rate)
+        goto exit_nu_can_configure;
 
     switch (cfg->mode)
     {
-    /* CAN default Normal mode */
     case RT_CAN_MODE_NORMAL:
 #ifdef RT_CAN_USING_HDR
         CAN_LeaveTestMode(base);
@@ -273,6 +294,7 @@ static rt_err_t nu_can_configure(struct rt_can_device *can, struct can_configure
         goto exit_nu_can_configure;
     }
 
+    nu_can_ie(psNuCAN);
 
     return RT_EOK;
 
@@ -285,73 +307,33 @@ exit_nu_can_configure:
 
 static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 {
-    rt_uint32_t argval;
-    nu_can_t psNuCAN  = (nu_can_t)can;
-
-#ifdef RT_CAN_USING_HDR
-    struct rt_can_filter_config *filter_cfg;
-#endif
-    /* Get base address of CAN register */
-    CAN_T *base = psNuCAN->base;
+    rt_uint32_t argval = (rt_uint32_t)arg;
+    nu_can_t psNuCAN = (nu_can_t)can;
 
-    RT_ASSERT(base != RT_NULL);
-    /* Check baud rate */
-    RT_ASSERT(can->config.baud_rate != 0);
+    RT_ASSERT(can);
 
     switch (cmd)
     {
-    case RT_DEVICE_CTRL_CLR_INT:
-        argval = (rt_uint32_t) arg;
-        if ((argval == RT_DEVICE_FLAG_INT_RX) || (argval == RT_DEVICE_FLAG_INT_TX))
-        {
-            /* Disable NVIC interrupt. */
-            rt_hw_interrupt_mask(psNuCAN->irqn);
-
-            /* Disable Status Change Interrupt  */
-            CAN_DisableInt(base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
-
-        }
-        else if (argval == RT_DEVICE_CAN_INT_ERR)
-        {
-            /* Disable interrupt. */
-            rt_hw_interrupt_mask(psNuCAN->irqn);
-
-            /* Disable Error Interrupt */
-            CAN_DisableInt(base, CAN_CON_EIE_Msk);
-        }
-        break;
-
     case RT_DEVICE_CTRL_SET_INT:
-        argval = (rt_uint32_t) arg;
-        if (argval == RT_DEVICE_FLAG_INT_RX || (argval == RT_DEVICE_FLAG_INT_TX))
-        {
-            /* Enable Status Change Interrupt  */
-            CAN_EnableInt(base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk);
-
-            /* Enable interrupt. */
-            rt_hw_interrupt_umask(psNuCAN->irqn);
-        }
-        else if (argval == RT_DEVICE_CAN_INT_ERR)
-        {
-            /* Enable Error Status and Status Change Interrupt  */
-            CAN_EnableInt(base, CAN_CON_IE_Msk | CAN_CON_SIE_Msk | CAN_CON_EIE_Msk);
+        psNuCAN->int_flag |= argval;
+        nu_can_ie(psNuCAN);
+        break;
 
-            /* Enable interrupt. */
-            rt_hw_interrupt_umask(psNuCAN->irqn);
-        }
+    case RT_DEVICE_CTRL_CLR_INT:
+        psNuCAN->int_flag &= ~argval;
+        nu_can_ie(psNuCAN);
         break;
 
-#ifdef RT_CAN_USING_HDR
     case RT_CAN_CMD_SET_FILTER:
-        filter_cfg = (struct rt_can_filter_config *)arg;
+    {
+        struct rt_can_filter_config *filter_cfg = (struct rt_can_filter_config *)arg;
 
         for (int i = 0; i < filter_cfg->count; i++)
         {
-
             /*set the filter message object*/
             if (filter_cfg->items[i].mode == 1)
             {
-                if (CAN_SetRxMsgObjAndMsk(base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask, FALSE) == FALSE)
+                if (CAN_SetRxMsgObjAndMsk(psNuCAN->base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask, FALSE) == FALSE)
                 {
                     return -(RT_ERROR);
                 }
@@ -359,46 +341,61 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
             else
             {
                 /*set the filter message object*/
-                if (CAN_SetRxMsgAndMsk(base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask) == FALSE)
+                if (CAN_SetRxMsgAndMsk(psNuCAN->base, MSG(filter_cfg->items[i].hdr + RX_MSG_ID_INDEX), filter_cfg->items[i].ide, filter_cfg->items[i].id, filter_cfg->items[i].mask) == FALSE)
                 {
                     return -(RT_ERROR);
                 }
             }
         }
-        break;
-#endif
+    }
+    break;
 
     case RT_CAN_CMD_SET_MODE:
-        argval = (rt_uint32_t) arg;
-        if (argval != RT_CAN_MODE_NORMAL && argval != RT_CAN_MODE_LISEN &&
-                argval != RT_CAN_MODE_LOOPBACK && argval != RT_CAN_MODE_LOOPBACKANLISEN)
+        if ((argval == RT_CAN_MODE_NORMAL) ||
+                (argval == RT_CAN_MODE_LISEN) ||
+                (argval == RT_CAN_MODE_LOOPBACK) ||
+                (argval == RT_CAN_MODE_LOOPBACKANLISEN))
         {
-            return -(RT_ERROR);
+            if (argval != can->config.mode)
+            {
+                can->config.mode = argval;
+                return nu_can_configure(can, &can->config);
+            }
         }
-        if (argval != can->config.mode)
+        else
         {
-            can->config.mode = argval;
-            return nu_can_configure(can, &can->config);
+            return -(RT_ERROR);
         }
         break;
 
     case RT_CAN_CMD_SET_BAUD:
-        argval = (rt_uint32_t) arg;
-        if (argval != CAN1MBaud && argval != CAN800kBaud && argval != CAN500kBaud && argval != CAN250kBaud &&
-                argval != CAN125kBaud && argval != CAN100kBaud && argval != CAN50kBaud  && argval != CAN20kBaud  && argval != CAN10kBaud)
+    {
+        if ((argval == CAN1MBaud) ||
+                (argval == CAN800kBaud) ||
+                (argval == CAN500kBaud) ||
+                (argval == CAN250kBaud) ||
+                (argval == CAN125kBaud) ||
+                (argval == CAN100kBaud) ||
+                (argval == CAN50kBaud) ||
+                (argval == CAN20kBaud) ||
+                (argval == CAN10kBaud))
         {
-            return -(RT_ERROR);
+            if (argval != can->config.baud_rate)
+            {
+                can->config.baud_rate = argval;
+                return nu_can_configure(can, &can->config);
+            }
         }
-        if (argval != can->config.baud_rate)
+        else
         {
-            can->config.baud_rate = argval;
-            return nu_can_configure(can, &can->config);
+            return -(RT_ERROR);
         }
-        break;
+    }
+    break;
 
     case RT_CAN_CMD_SET_PRIV:
-        argval = (rt_uint32_t) arg;
-        if (argval != RT_CAN_MODE_PRIV && argval != RT_CAN_MODE_NOPRIV)
+        if (argval != RT_CAN_MODE_PRIV &&
+                argval != RT_CAN_MODE_NOPRIV)
         {
             return -(RT_ERROR);
         }
@@ -411,16 +408,23 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 
     case RT_CAN_CMD_GET_STATUS:
     {
-        rt_uint32_t errtype;
-        errtype = base->ERR;
-        /*Receive Error Counter*/
+        rt_uint32_t errtype = psNuCAN->base->ERR;
+
+        RT_ASSERT(arg);
+
+        /*Receive Error Counter, return value is with Receive Error Passive.*/
         can->status.rcverrcnt = (errtype >> 8);
+
         /*Transmit Error Counter*/
-        can->status.snderrcnt = ((errtype >> 24) & 0xFF);
-        can->status.lasterrtype = CAN_GET_INT_STATUS(base) & 0x8000;
-        /*status error code*/
-        can->status.errcode = CAN_GET_INT_STATUS(base) & 0x07;
-        rt_memcpy(arg, &can->status, sizeof(can->status));
+        can->status.snderrcnt = (errtype & 0xFF);
+
+        /*Last Error Type*/
+        can->status.lasterrtype = CAN_GET_INT_STATUS(psNuCAN->base) & 0x8000;
+
+        /*Status error code*/
+        can->status.errcode = CAN_GET_INT_STATUS(psNuCAN->base) & 0x07;
+
+        rt_memcpy(arg, &can->status, sizeof(struct rt_can_status));
     }
     break;
 
@@ -435,64 +439,91 @@ static rt_err_t nu_can_control(struct rt_can_device *can, int cmd, void *arg)
 static int nu_can_sendmsg(struct rt_can_device *can, const void *buf, rt_uint32_t boxno)
 {
     STR_CANMSG_T tMsg;
-    struct rt_can_msg *pmsg = (struct rt_can_msg *) buf;
-
-    /* Get base address of CAN register */
-    CAN_T *base = ((nu_can_t)can)->base;
+    struct rt_can_msg *pmsg;
+    nu_can_t psNuCAN = (nu_can_t)can;
 
-    RT_ASSERT(base != RT_NULL);
-    RT_ASSERT(buf != RT_NULL);
+    RT_ASSERT(can);
+    RT_ASSERT(buf);
 
-    /* Check the parameters */
-    RT_ASSERT(IS_CAN_DLC(pmsg->len));
+    pmsg = (struct rt_can_msg *) buf;
 
-    /* Standard ID (11 bits)*/
-    if (pmsg->ide == RT_CAN_STDID)
+    if (pmsg->ide == RT_CAN_STDID && IS_CAN_STDID(pmsg->id))
     {
+        /* Standard ID (11 bits)*/
         tMsg.IdType = CAN_STD_ID;
-        RT_ASSERT(IS_CAN_STDID(pmsg->id))
         tMsg.Id  = pmsg->id ;
     }
-    else
+    else if (pmsg->ide == RT_CAN_EXTID && IS_CAN_EXTID(pmsg->id))
     {
         /* Extended ID (29 bits)*/
         tMsg.IdType = CAN_EXT_ID;
-        RT_ASSERT(IS_CAN_EXTID(pmsg->id));
         tMsg.Id = pmsg->id ;
     }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
 
     if (pmsg->rtr == RT_CAN_DTR)
     {
         /* Data frame */
         tMsg.FrameType = CAN_DATA_FRAME;
     }
-    else
+    else if (pmsg->rtr == RT_CAN_RTR)
     {
         /* Remote frame */
         tMsg.FrameType = CAN_REMOTE_FRAME;
     }
-    tMsg.DLC = pmsg->len;
-    rt_memcpy(tMsg.Data, pmsg->data, pmsg->len);
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
 
-    if (CAN_Transmit(base, MSG(boxno), &tMsg) == FALSE) // Configure Msg RAM and send the Msg in the RAM
+    /* Check the parameters */
+    if (IS_CAN_DLC(pmsg->len))
     {
-        return -(RT_ERROR);
+        tMsg.DLC = pmsg->len;
+    }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
+
+    if (pmsg->data && pmsg->len)
+    {
+        rt_memcpy(&tMsg.Data[0], pmsg->data, pmsg->len);
+    }
+    else
+    {
+        goto exit_nu_can_sendmsg;
+    }
+
+    /* Configure Msg RAM and send the Msg in the RAM. */
+    if (CAN_Transmit(psNuCAN->base, MSG(boxno), &tMsg) == FALSE)
+    {
+        goto exit_nu_can_sendmsg;
     }
 
     return RT_EOK;
+
+exit_nu_can_sendmsg:
+
+    return -(RT_ERROR);
 }
+
 static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxno)
 {
     STR_CANMSG_T tMsg;
-    struct rt_can_msg *pmsg = (struct rt_can_msg *) buf;
-    /* Get base address of CAN register */
-    CAN_T *base = ((nu_can_t)can)->base;
+    struct rt_can_msg *pmsg;
+    nu_can_t psNuCAN = (nu_can_t)can;
+
+    RT_ASSERT(can);
+    RT_ASSERT(buf);
 
-    RT_ASSERT(base != RT_NULL);
-    RT_ASSERT(buf != RT_NULL);
+    pmsg = (struct rt_can_msg *) buf;
 
     /* get data */
-    if (CAN_Receive(base, boxno, &tMsg) == FALSE)
+    if (CAN_Receive(psNuCAN->base, boxno, &tMsg) == FALSE)
     {
         rt_kprintf("No available RX Msg.\n");
         return -(RT_ERROR);
@@ -504,32 +535,13 @@ static int nu_can_recvmsg(struct rt_can_device *can, void *buf, rt_uint32_t boxn
     can->hdr[pmsg->hdr].connected = 1;
 #endif
 
-    /* Standard ID (11 bits)*/
-    if (tMsg.IdType == CAN_STD_ID)
-    {
-        pmsg->ide = RT_CAN_STDID;
-        pmsg->id  = tMsg.Id;
-    }
-    else /* Extended ID (29 bits)*/
-    {
-        pmsg->ide = RT_CAN_EXTID;
-        pmsg->id  = tMsg.Id;
-    }
-
-    if (tMsg.FrameType == CAN_DATA_FRAME)
-    {
-        /* Data frame */
-        pmsg->rtr = RT_CAN_DTR;
-    }
-    else
-    {
-        /* Remote frame */
-        pmsg->rtr = RT_CAN_RTR;
-    }
-
+    pmsg->ide = (tMsg.IdType == CAN_STD_ID) ? RT_CAN_STDID : RT_CAN_EXTID;
+    pmsg->rtr = (tMsg.FrameType == CAN_DATA_FRAME) ? RT_CAN_DTR : RT_CAN_RTR;
+    pmsg->id  = tMsg.Id;
     pmsg->len = tMsg.DLC ;
 
-    rt_memcpy(pmsg->data, tMsg.Data, pmsg->len);
+    if (pmsg->data && pmsg->len)
+        rt_memcpy(pmsg->data, &tMsg.Data[0], pmsg->len);
 
     return RT_EOK;
 }
@@ -564,5 +576,4 @@ static int rt_hw_can_init(void)
     return (int)ret;
 }
 INIT_DEVICE_EXPORT(rt_hw_can_init);
-
 #endif  //#if defined(BSP_USING_CAN)

+ 1 - 1
bsp/nuvoton/libraries/nuc980/rtt_port/drv_emac.c

@@ -682,7 +682,7 @@ lwiperf_report(void *arg, enum lwiperf_report_type report_type,
                (int)report_type, ipaddr_ntoa(remote_addr), (int)remote_port, bytes_transferred, ms_duration, bandwidth_kbitpsec);
 }
 
-void lwiperf_example_init(void)
+void lwiperf_example_init(int argc, char **argv)
 {
     lwiperf_start_tcp_server_default(lwiperf_report, NULL);
 }

+ 1 - 1
bsp/nuvoton/libraries/nuc980/rtt_port/drv_i2c.c

@@ -118,7 +118,7 @@ static rt_err_t nu_i2c_bus_control(struct rt_i2c_bus_device *bus, rt_uint32_t u3
     RT_ASSERT(bus != RT_NULL);
     nu_i2c = (nu_i2c_bus_t *) bus;
 
-    switch (RT_I2C_DEV_CTRL_CLK)
+    switch (u32Cmd)
     {
     case RT_I2C_DEV_CTRL_CLK:
         I2C_SetBusClockFreq(nu_i2c->I2C, u32Value);

+ 26 - 33
bsp/nuvoton/nk-980iot/.config

@@ -203,8 +203,7 @@ CONFIG_RT_AUDIO_REPLAY_MP_BLOCK_SIZE=4096
 CONFIG_RT_AUDIO_REPLAY_MP_BLOCK_COUNT=2
 CONFIG_RT_AUDIO_RECORD_PIPE_SIZE=2048
 # CONFIG_RT_USING_SENSOR is not set
-CONFIG_RT_USING_TOUCH=y
-# CONFIG_RT_TOUCH_PIN_IRQ is not set
+# CONFIG_RT_USING_TOUCH is not set
 CONFIG_RT_USING_HWCRYPTO=y
 CONFIG_RT_HWCRYPTO_DEFAULT_NAME="hwcryto"
 CONFIG_RT_HWCRYPTO_IV_MAX_SIZE=16
@@ -550,17 +549,11 @@ CONFIG_PKG_NETUTILS_VER_NUM=0x10301
 #
 # LVGL: powerful and easy-to-use embedded GUI library
 #
-CONFIG_PKG_USING_LVGL=y
-CONFIG_PKG_LVGL_PATH="/packages/multimedia/LVGL/LVGL"
-# CONFIG_PKG_USING_LVGL_EXAMPLES is not set
-CONFIG_PKG_USING_LVGL_V810=y
+# CONFIG_PKG_USING_LVGL is not set
+# CONFIG_PKG_USING_LVGL_V810 is not set
 # CONFIG_PKG_USING_LVGL_LATEST_VERSION is not set
-CONFIG_PKG_LVGL_VER="v8.1.0"
-CONFIG_PKG_LVGL_VER_NUM=0x08010
 # CONFIG_PKG_USING_LITTLEVGL2RTT is not set
-CONFIG_PKG_USING_LV_MUSIC_DEMO=y
-CONFIG_PKG_LV_MUSIC_DEMO_PATH="/packages/multimedia/LVGL/lv_music_demo"
-CONFIG_PKG_LV_MUSIC_DEMO_VER="v0.1.1"
+# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
 
 #
 # u8g2: a monochrome graphic library
@@ -597,6 +590,7 @@ CONFIG_PKG_WAVPLAYER_VER="latest"
 # CONFIG_PKG_USING_MCURSES is not set
 # CONFIG_PKG_USING_TERMBOX is not set
 # CONFIG_PKG_USING_VT100 is not set
+# CONFIG_PKG_USING_QRCODE is not set
 
 #
 # tools packages
@@ -607,7 +601,6 @@ CONFIG_PKG_WAVPLAYER_VER="latest"
 # CONFIG_PKG_USING_SYSTEMVIEW is not set
 # CONFIG_PKG_USING_SEGGER_RTT is not set
 # CONFIG_PKG_USING_RDB is not set
-# CONFIG_PKG_USING_QRCODE is not set
 # CONFIG_PKG_USING_ULOG_EASYFLASH is not set
 # CONFIG_PKG_USING_ULOG_FILE is not set
 # CONFIG_PKG_USING_LOGMGR is not set
@@ -658,6 +651,7 @@ CONFIG_PKG_WAVPLAYER_VER="latest"
 # CONFIG_PKG_USING_POSIX_GETLINE is not set
 # CONFIG_PKG_USING_POSIX_WCWIDTH is not set
 # CONFIG_PKG_USING_POSIX_ITOA is not set
+# CONFIG_PKG_USING_POSIX_STRINGS is not set
 
 #
 # acceleration: Assembly language or algorithmic acceleration packages
@@ -783,6 +777,7 @@ CONFIG_PKG_RAMDISK_VER="latest"
 # CONFIG_PKG_USING_SSD1306 is not set
 # CONFIG_PKG_USING_QKEY is not set
 # CONFIG_PKG_USING_RS485 is not set
+# CONFIG_PKG_USING_RS232 is not set
 # CONFIG_PKG_USING_NES is not set
 # CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
 # CONFIG_PKG_USING_VDEVICE is not set
@@ -874,23 +869,8 @@ CONFIG_PKG_OPTPARSE_VER="latest"
 # CONFIG_PKG_USING_LWGPS is not set
 # CONFIG_PKG_USING_STATE_MACHINE is not set
 # CONFIG_PKG_USING_DESIGN_PATTERN is not set
-
-#
-# Nuvoton Packages Config
-#
-CONFIG_NU_PKG_USING_UTILS=y
-CONFIG_NU_PKG_USING_DEMO=y
-# CONFIG_NU_PKG_USING_BMX055 is not set
-# CONFIG_NU_PKG_USING_MAX31875 is not set
-# CONFIG_NU_PKG_USING_NAU88L25 is not set
-CONFIG_NU_PKG_USING_NAU8822=y
-# CONFIG_NU_PKG_USING_DA9062 is not set
-CONFIG_NU_PKG_USING_ILI9341=y
-CONFIG_NU_PKG_USING_ILI9341_SPI=y
-# CONFIG_NU_PKG_USING_ILI9341_EBI is not set
-CONFIG_NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER=y
-CONFIG_NU_PKG_ILI9341_HORIZONTAL=y
-CONFIG_NU_PKG_USING_SPINAND=y
+# CONFIG_PKG_USING_CONTROLLER is not set
+# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
 
 #
 # Hardware Drivers Config
@@ -913,6 +893,7 @@ CONFIG_BSP_USING_RTC=y
 CONFIG_NU_RTC_SUPPORT_IO_RW=y
 CONFIG_NU_RTC_SUPPORT_MSH_CMD=y
 CONFIG_BSP_USING_ADC=y
+# CONFIG_BSP_USING_ADC_TOUCH is not set
 CONFIG_BSP_USING_TMR=y
 CONFIG_BSP_USING_TIMER=y
 CONFIG_BSP_USING_TMR0=y
@@ -998,8 +979,20 @@ CONFIG_BOARD_USING_USB1_HOST=y
 # Board extended module drivers
 #
 # CONFIG_BOARD_USING_MAX31875 is not set
-CONFIG_BOARD_USING_LCD_ILI9341=y
-CONFIG_BOARD_USING_ILI9341_PIN_BACKLIGHT=103
-CONFIG_BOARD_USING_ILI9341_PIN_RESET=90
-CONFIG_BOARD_USING_ILI9341_PIN_DC=89
+# CONFIG_BOARD_USING_LCD_ILI9341 is not set
 # CONFIG_BOARD_USING_ESP8266 is not set
+
+#
+# Nuvoton Packages Config
+#
+CONFIG_NU_PKG_USING_UTILS=y
+CONFIG_NU_PKG_USING_DEMO=y
+# CONFIG_NU_PKG_USING_BMX055 is not set
+# CONFIG_NU_PKG_USING_MAX31875 is not set
+# CONFIG_NU_PKG_USING_NAU88L25 is not set
+CONFIG_NU_PKG_USING_NAU8822=y
+# CONFIG_NU_PKG_USING_DA9062 is not set
+# CONFIG_NU_PKG_USING_ILI9341 is not set
+CONFIG_NU_PKG_USING_SPINAND=y
+CONFIG_BOARD_USE_UTEST=y
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.nk980-iot.test.utest."

+ 0 - 6
bsp/nuvoton/nk-980iot/Kconfig

@@ -18,12 +18,6 @@ config PKGS_DIR
     option env="PKGS_ROOT"
     default "packages"
 
-config NU_PKGS_DIR
-    string
-    option env="NU_PKGS_ROOT"
-    default "../libraries/nu_packages"
-
 source "$RTT_DIR/Kconfig"
 source "$PKGS_DIR/Kconfig"
-source "$NU_PKGS_DIR/Kconfig"
 source "$BSP_DIR/board/Kconfig"

+ 2 - 0
bsp/nuvoton/nk-980iot/board/Kconfig

@@ -72,6 +72,7 @@ menu "Hardware Drivers Config"
         config BOARD_USING_LCD_ILI9341
             bool "LCD ILI9341 (over spi0)"
             select RT_USING_TOUCH
+            select BSP_USING_ADC_TOUCH
             select NU_PKG_USING_ILI9341
             select NU_PKG_USING_ILI9341_SPI
             select NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER
@@ -113,5 +114,6 @@ menu "Hardware Drivers Config"
 
     endmenu
 
+    source "$BSP_DIR/../libraries/nu_packages/Kconfig"
 
 endmenu

+ 2 - 0
bsp/nuvoton/nk-980iot/board/nu_pin_init.c

@@ -57,8 +57,10 @@ static void nu_pin_i2c_init(void)
     /* I2C0: PA[0, 1]  */
     outpw(REG_SYS_GPA_MFPL, (inpw(REG_SYS_GPA_MFPL) & ~0x000000FF) | 0x00000033);
 
+#if !defined(BSP_USING_ADC_TOUCH)
     /* I2C2: PB5, PB7  */
     outpw(REG_SYS_GPB_MFPL, (inpw(REG_SYS_GPB_MFPL) & ~0xF0F00000) | 0x20200000);
+#endif
 }
 
 

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 350
bsp/nuvoton/nk-980iot/project.uvproj


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 334
bsp/nuvoton/nk-980iot/project.uvprojx


+ 0 - 459
bsp/nuvoton/nk-980iot/rtconfig.h

@@ -1,459 +0,0 @@
-#ifndef RT_CONFIG_H__
-#define RT_CONFIG_H__
-
-/* Automatically generated file; DO NOT EDIT. */
-/* RT-Thread Configuration */
-
-/* RT-Thread Kernel */
-
-#define RT_NAME_MAX 16
-#define RT_ALIGN_SIZE 4
-#define RT_THREAD_PRIORITY_32
-#define RT_THREAD_PRIORITY_MAX 32
-#define RT_TICK_PER_SECOND 1000
-#define RT_USING_OVERFLOW_CHECK
-#define RT_USING_HOOK
-#define RT_HOOK_USING_FUNC_PTR
-#define RT_USING_IDLE_HOOK
-#define RT_IDLE_HOOK_LIST_SIZE 4
-#define IDLE_THREAD_STACK_SIZE 2048
-
-/* kservice optimization */
-
-#define RT_DEBUG
-#define RT_DEBUG_COLOR
-
-/* Inter-Thread communication */
-
-#define RT_USING_SEMAPHORE
-#define RT_USING_MUTEX
-#define RT_USING_EVENT
-#define RT_USING_MAILBOX
-#define RT_USING_MESSAGEQUEUE
-#define RT_USING_SIGNALS
-
-/* Memory Management */
-
-#define RT_USING_MEMPOOL
-#define RT_USING_SMALL_MEM
-#define RT_USING_MEMHEAP
-#define RT_MEMHEAP_FAST_MODE
-#define RT_USING_SMALL_MEM_AS_HEAP
-#define RT_USING_MEMTRACE
-#define RT_USING_HEAP
-
-/* Kernel Device Object */
-
-#define RT_USING_DEVICE
-#define RT_USING_CONSOLE
-#define RT_CONSOLEBUF_SIZE 256
-#define RT_CONSOLE_DEVICE_NAME "uart0"
-#define RT_VER_NUM 0x40100
-#define ARCH_ARM
-#define ARCH_ARM_ARM9
-
-/* RT-Thread Components */
-
-#define RT_USING_COMPONENTS_INIT
-#define RT_USING_USER_MAIN
-#define RT_MAIN_THREAD_STACK_SIZE 2048
-#define RT_MAIN_THREAD_PRIORITY 10
-
-/* C++ features */
-
-
-/* Command shell */
-
-#define RT_USING_FINSH
-#define RT_USING_MSH
-#define FINSH_USING_MSH
-#define FINSH_THREAD_NAME "tshell"
-#define FINSH_THREAD_PRIORITY 20
-#define FINSH_THREAD_STACK_SIZE 4096
-#define FINSH_USING_HISTORY
-#define FINSH_HISTORY_LINES 5
-#define FINSH_USING_SYMTAB
-#define FINSH_CMD_SIZE 80
-#define MSH_USING_BUILT_IN_COMMANDS
-#define FINSH_USING_DESCRIPTION
-#define FINSH_ARG_MAX 10
-
-/* Device virtual file system */
-
-#define RT_USING_DFS
-#define DFS_USING_POSIX
-#define DFS_USING_WORKDIR
-#define DFS_FILESYSTEMS_MAX 16
-#define DFS_FILESYSTEM_TYPES_MAX 16
-#define DFS_FD_MAX 64
-#define RT_USING_DFS_MNTTABLE
-#define RT_USING_DFS_ELMFAT
-
-/* elm-chan's FatFs, Generic FAT Filesystem Module */
-
-#define RT_DFS_ELM_CODE_PAGE 437
-#define RT_DFS_ELM_WORD_ACCESS
-#define RT_DFS_ELM_USE_LFN_3
-#define RT_DFS_ELM_USE_LFN 3
-#define RT_DFS_ELM_LFN_UNICODE_0
-#define RT_DFS_ELM_LFN_UNICODE 0
-#define RT_DFS_ELM_MAX_LFN 255
-#define RT_DFS_ELM_DRIVES 8
-#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
-#define RT_DFS_ELM_REENTRANT
-#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
-#define RT_USING_DFS_DEVFS
-
-/* Device Drivers */
-
-#define RT_USING_DEVICE_IPC
-#define RT_USING_SYSTEM_WORKQUEUE
-#define RT_SYSTEM_WORKQUEUE_STACKSIZE 2048
-#define RT_SYSTEM_WORKQUEUE_PRIORITY 23
-#define RT_USING_SERIAL
-#define RT_USING_SERIAL_V1
-#define RT_SERIAL_USING_DMA
-#define RT_SERIAL_RB_BUFSZ 2048
-#define RT_USING_CAN
-#define RT_CAN_USING_HDR
-#define RT_USING_HWTIMER
-#define RT_USING_CPUTIME
-#define RT_USING_I2C
-#define RT_USING_I2C_BITOPS
-#define RT_USING_PIN
-#define RT_USING_ADC
-#define RT_USING_PWM
-#define RT_USING_MTD_NAND
-#define RT_MTD_NAND_DEBUG
-#define RT_USING_RTC
-#define RT_USING_ALARM
-#define RT_USING_SPI
-#define RT_USING_QSPI
-#define RT_USING_WDT
-#define RT_USING_AUDIO
-#define RT_AUDIO_REPLAY_MP_BLOCK_SIZE 4096
-#define RT_AUDIO_REPLAY_MP_BLOCK_COUNT 2
-#define RT_AUDIO_RECORD_PIPE_SIZE 2048
-#define RT_USING_TOUCH
-#define RT_USING_HWCRYPTO
-#define RT_HWCRYPTO_DEFAULT_NAME "hwcryto"
-#define RT_HWCRYPTO_IV_MAX_SIZE 16
-#define RT_HWCRYPTO_KEYBIT_MAX_SIZE 256
-#define RT_HWCRYPTO_USING_AES
-#define RT_HWCRYPTO_USING_AES_ECB
-#define RT_HWCRYPTO_USING_AES_CBC
-#define RT_HWCRYPTO_USING_AES_CFB
-#define RT_HWCRYPTO_USING_AES_CTR
-#define RT_HWCRYPTO_USING_AES_OFB
-#define RT_HWCRYPTO_USING_SHA1
-#define RT_HWCRYPTO_USING_SHA2
-#define RT_HWCRYPTO_USING_SHA2_224
-#define RT_HWCRYPTO_USING_SHA2_256
-#define RT_HWCRYPTO_USING_SHA2_384
-#define RT_HWCRYPTO_USING_SHA2_512
-#define RT_HWCRYPTO_USING_RNG
-
-/* Using USB */
-
-#define RT_USING_USB
-#define RT_USING_USB_HOST
-#define RT_USBH_MSTORAGE
-#define UDISK_MOUNTPOINT "/mnt/udisk"
-#define RT_USING_USB_DEVICE
-#define RT_USBD_THREAD_STACK_SZ 4096
-#define USB_VENDOR_ID 0x0FFE
-#define USB_PRODUCT_ID 0x0001
-#define RT_USB_DEVICE_COMPOSITE
-#define RT_USB_DEVICE_CDC
-#define RT_USB_DEVICE_NONE
-#define RT_USB_DEVICE_MSTORAGE
-#define RT_VCOM_TASK_STK_SIZE 2048
-#define RT_CDC_RX_BUFSIZE 128
-#define RT_VCOM_SERNO "32021919830108"
-#define RT_VCOM_SER_LEN 14
-#define RT_VCOM_TX_TIMEOUT 1000
-#define RT_USB_MSTORAGE_DISK_NAME "ramdisk1"
-
-/* POSIX layer and C standard library */
-
-#define RT_LIBC_DEFAULT_TIMEZONE 8
-
-/* POSIX (Portable Operating System Interface) layer */
-
-#define RT_USING_POSIX_FS
-#define RT_USING_POSIX_POLL
-#define RT_USING_POSIX_SELECT
-
-/* Interprocess Communication (IPC) */
-
-
-/* Socket is in the 'Network' category */
-
-/* Network */
-
-/* Socket abstraction layer */
-
-#define RT_USING_SAL
-
-/* protocol stack implement */
-
-#define SAL_USING_LWIP
-#define SAL_USING_POSIX
-
-/* Network interface device */
-
-#define RT_USING_NETDEV
-#define NETDEV_USING_IFCONFIG
-#define NETDEV_USING_PING
-#define NETDEV_USING_NETSTAT
-#define NETDEV_USING_AUTO_DEFAULT
-#define NETDEV_IPV4 1
-#define NETDEV_IPV6 0
-
-/* light weight TCP/IP stack */
-
-#define RT_USING_LWIP
-#define RT_USING_LWIP212
-#define RT_LWIP_MEM_ALIGNMENT 4
-#define RT_LWIP_IGMP
-#define RT_LWIP_ICMP
-#define RT_LWIP_DNS
-#define RT_LWIP_DHCP
-#define IP_SOF_BROADCAST 1
-#define IP_SOF_BROADCAST_RECV 1
-
-/* Static IPv4 Address */
-
-#define RT_LWIP_IPADDR "192.168.31.55"
-#define RT_LWIP_GWADDR "192.168.31.1"
-#define RT_LWIP_MSKADDR "255.255.255.0"
-#define RT_LWIP_UDP
-#define RT_LWIP_TCP
-#define RT_LWIP_RAW
-#define RT_MEMP_NUM_NETCONN 16
-#define RT_LWIP_PBUF_NUM 256
-#define RT_LWIP_RAW_PCB_NUM 16
-#define RT_LWIP_UDP_PCB_NUM 16
-#define RT_LWIP_TCP_PCB_NUM 16
-#define RT_LWIP_TCP_SEG_NUM 64
-#define RT_LWIP_TCP_SND_BUF 16384
-#define RT_LWIP_TCP_WND 65535
-#define RT_LWIP_TCPTHREAD_PRIORITY 10
-#define RT_LWIP_TCPTHREAD_MBOX_SIZE 256
-#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
-#define RT_LWIP_ETHTHREAD_PRIORITY 12
-#define RT_LWIP_ETHTHREAD_STACKSIZE 4096
-#define RT_LWIP_ETHTHREAD_MBOX_SIZE 256
-#define RT_LWIP_REASSEMBLY_FRAG
-#define LWIP_NETIF_STATUS_CALLBACK 1
-#define LWIP_NETIF_LINK_CALLBACK 1
-#define SO_REUSE 1
-#define LWIP_SO_RCVTIMEO 1
-#define LWIP_SO_SNDTIMEO 1
-#define LWIP_SO_RCVBUF 1
-#define LWIP_SO_LINGER 0
-#define RT_LWIP_NETIF_LOOPBACK
-#define LWIP_NETIF_LOOPBACK 1
-#define RT_LWIP_STATS
-#define RT_LWIP_USING_PING
-
-/* AT commands */
-
-
-/* VBUS(Virtual Software BUS) */
-
-
-/* Utilities */
-
-#define RT_USING_UTEST
-#define UTEST_THR_STACK_SIZE 4096
-#define UTEST_THR_PRIORITY 20
-
-/* RT-Thread Utestcases */
-
-
-/* RT-Thread online packages */
-
-/* IoT - internet of things */
-
-
-/* Wi-Fi */
-
-/* Marvell WiFi */
-
-
-/* Wiced WiFi */
-
-#define PKG_USING_NETUTILS
-#define PKG_NETUTILS_TFTP
-#define PKG_NETUTILS_IPERF
-#define PKG_NETUTILS_NTP
-#define NTP_USING_AUTO_SYNC
-#define NTP_AUTO_SYNC_FIRST_DELAY 30
-#define NTP_AUTO_SYNC_PERIOD 3600
-#define NETUTILS_NTP_HOSTNAME "0.tw.pool.ntp.org"
-#define NETUTILS_NTP_HOSTNAME2 "1.tw.pool.ntp.org"
-#define NETUTILS_NTP_HOSTNAME3 "2.tw.pool.ntp.org"
-#define PKG_USING_NETUTILS_V131
-#define PKG_NETUTILS_VER_NUM 0x10301
-
-/* IoT Cloud */
-
-
-/* security packages */
-
-
-/* language packages */
-
-
-/* multimedia packages */
-
-/* LVGL: powerful and easy-to-use embedded GUI library */
-
-#define PKG_USING_LVGL
-#define PKG_USING_LVGL_V810
-#define PKG_LVGL_VER_NUM 0x08010
-#define PKG_USING_LV_MUSIC_DEMO
-
-/* u8g2: a monochrome graphic library */
-
-#define PKG_USING_WAVPLAYER
-#define PKG_WP_USING_PLAY
-#define PKG_WP_PLAY_DEVICE "sound0"
-#define PKG_WP_USING_RECORD
-#define PKG_WP_RECORD_DEVICE "sound0"
-#define PKG_USING_WAVPLAYER_LATEST_VERSION
-
-/* PainterEngine: A cross-platform graphics application framework written in C language */
-
-
-/* tools packages */
-
-
-/* system packages */
-
-/* enhanced kernel services */
-
-
-/* POSIX extension functions */
-
-
-/* acceleration: Assembly language or algorithmic acceleration packages */
-
-
-/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
-
-
-/* Micrium: Micrium software products porting for RT-Thread */
-
-#define PKG_USING_DFS_UFFS
-#define RT_USING_DFS_UFFS
-#define RT_UFFS_ECC_MODE_3
-#define RT_UFFS_ECC_MODE 3
-#define PKG_USING_DFS_UFFS_LATEST_VERSION
-#define PKG_USING_RAMDISK
-#define PKG_USING_RAMDISK_LATEST_VERSION
-
-/* peripheral libraries and drivers */
-
-
-/* AI packages */
-
-
-/* miscellaneous packages */
-
-/* samples: kernel and components samples */
-
-
-/* entertainment: terminal games and other interesting software packages */
-
-#define PKG_USING_OPTPARSE
-#define PKG_USING_OPTPARSE_LATEST_VERSION
-
-/* Nuvoton Packages Config */
-
-#define NU_PKG_USING_UTILS
-#define NU_PKG_USING_DEMO
-#define NU_PKG_USING_NAU8822
-#define NU_PKG_USING_ILI9341
-#define NU_PKG_USING_ILI9341_SPI
-#define NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER
-#define NU_PKG_ILI9341_HORIZONTAL
-#define NU_PKG_USING_SPINAND
-
-/* Hardware Drivers Config */
-
-/* On-chip Peripheral Drivers */
-
-#define SOC_SERIES_NUC980
-#define BSP_USE_STDDRIVER_SOURCE
-#define BSP_USING_MMU
-#define BSP_USING_PDMA
-#define NU_PDMA_MEMFUN_ACTOR_MAX 2
-#define BSP_USING_GPIO
-#define BSP_USING_EMAC
-#define BSP_USING_EMAC0
-#define BSP_USING_RTC
-#define NU_RTC_SUPPORT_IO_RW
-#define NU_RTC_SUPPORT_MSH_CMD
-#define BSP_USING_ADC
-#define BSP_USING_TMR
-#define BSP_USING_TIMER
-#define BSP_USING_TMR0
-#define BSP_USING_TIMER0
-#define BSP_USING_TMR1
-#define BSP_USING_TIMER1
-#define BSP_USING_TMR2
-#define BSP_USING_TIMER2
-#define BSP_USING_TMR3
-#define BSP_USING_TIMER3
-#define BSP_USING_TMR4
-#define BSP_USING_TIMER4
-#define BSP_USING_UART
-#define BSP_USING_UART0
-#define BSP_USING_UART1
-#define BSP_USING_UART1_TX_DMA
-#define BSP_USING_UART1_RX_DMA
-#define BSP_USING_I2C
-#define BSP_USING_I2C0
-#define BSP_USING_I2C2
-#define BSP_USING_SDH
-#define BSP_USING_SDH1
-#define NU_SDH_USING_PDMA
-#define NU_SDH_HOTPLUG
-#define BSP_USING_PWM
-#define BSP_USING_PWM0
-#define BSP_USING_SPI
-#define BSP_USING_SPI_PDMA
-#define BSP_USING_SPI0
-#define BSP_USING_SPI0_PDMA
-#define BSP_USING_SPI1_NONE
-#define BSP_USING_I2S
-#define NU_I2S_DMA_FIFO_SIZE 4096
-#define BSP_USING_QSPI
-#define BSP_USING_QSPI_PDMA
-#define BSP_USING_QSPI0
-#define BSP_USING_QSPI0_PDMA
-#define BSP_USING_CRYPTO
-#define BSP_USING_WDT
-#define BSP_USING_USBD
-#define BSP_USING_USBH
-
-/* On-board Peripheral Drivers */
-
-#define BSP_USING_CONSOLE
-#define BOARD_USING_IP101GR
-#define BOARD_USING_NAU8822
-#define BOARD_USING_STORAGE_SDCARD
-#define BOARD_USING_STORAGE_SPINAND
-#define BOARD_USING_USB0_DEVICE_HOST
-#define BOARD_USING_USB1_HOST
-
-/* Board extended module drivers */
-
-#define BOARD_USING_LCD_ILI9341
-#define BOARD_USING_ILI9341_PIN_BACKLIGHT 103
-#define BOARD_USING_ILI9341_PIN_RESET 90
-#define BOARD_USING_ILI9341_PIN_DC 89
-
-#endif

+ 7 - 1
bsp/nuvoton/nk-980iot/rtconfig.py

@@ -85,4 +85,10 @@ elif PLATFORM == 'armcc':
         CFLAGS += ' -O2'
 
     POST_ACTION = 'fromelf --bin $TARGET --output ' + TARGET_NAME + ' \n'
-    POST_ACTION += 'fromelf -z $TARGET\n'
+    POST_ACTION += 'fromelf -z $TARGET\n'
+def dist_handle(BSP_ROOT, dist_dir):
+    import sys
+    cwd_path = os.getcwd()
+    sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
+    from sdk_dist import dist_do_building
+    dist_do_building(BSP_ROOT, dist_dir)

+ 299 - 106
bsp/nuvoton/nk-980iot/spinor.config

@@ -7,6 +7,7 @@
 # RT-Thread Kernel
 #
 CONFIG_RT_NAME_MAX=16
+# CONFIG_RT_USING_BIG_ENDIAN is not set
 # CONFIG_RT_USING_ARCH_DATA_TYPE is not set
 # CONFIG_RT_USING_SMP is not set
 CONFIG_RT_ALIGN_SIZE=4
@@ -17,10 +18,19 @@ CONFIG_RT_THREAD_PRIORITY_MAX=32
 CONFIG_RT_TICK_PER_SECOND=1000
 CONFIG_RT_USING_OVERFLOW_CHECK=y
 CONFIG_RT_USING_HOOK=y
+CONFIG_RT_HOOK_USING_FUNC_PTR=y
 CONFIG_RT_USING_IDLE_HOOK=y
 CONFIG_RT_IDLE_HOOK_LIST_SIZE=4
 CONFIG_IDLE_THREAD_STACK_SIZE=2048
 # CONFIG_RT_USING_TIMER_SOFT is not set
+
+#
+# kservice optimization
+#
+# CONFIG_RT_KSERVICE_USING_STDLIB is not set
+# CONFIG_RT_KSERVICE_USING_TINY_SIZE is not set
+# CONFIG_RT_USING_TINY_FFS is not set
+# CONFIG_RT_PRINTF_LONGLONG is not set
 CONFIG_RT_DEBUG=y
 CONFIG_RT_DEBUG_COLOR=y
 # CONFIG_RT_DEBUG_INIT_CONFIG is not set
@@ -48,13 +58,18 @@ CONFIG_RT_USING_SIGNALS=y
 # Memory Management
 #
 CONFIG_RT_USING_MEMPOOL=y
-CONFIG_RT_USING_MEMHEAP=y
-# CONFIG_RT_USING_NOHEAP is not set
 CONFIG_RT_USING_SMALL_MEM=y
 # CONFIG_RT_USING_SLAB is not set
+CONFIG_RT_USING_MEMHEAP=y
+CONFIG_RT_MEMHEAP_FAST_MODE=y
+# CONFIG_RT_MEMHEAP_BSET_MODE is not set
+CONFIG_RT_USING_SMALL_MEM_AS_HEAP=y
 # CONFIG_RT_USING_MEMHEAP_AS_HEAP is not set
+# CONFIG_RT_USING_SLAB_AS_HEAP is not set
 # CONFIG_RT_USING_USERHEAP is not set
+# CONFIG_RT_USING_NOHEAP is not set
 CONFIG_RT_USING_MEMTRACE=y
+# CONFIG_RT_USING_HEAP_ISR is not set
 CONFIG_RT_USING_HEAP=y
 
 #
@@ -66,7 +81,7 @@ CONFIG_RT_USING_DEVICE=y
 CONFIG_RT_USING_CONSOLE=y
 CONFIG_RT_CONSOLEBUF_SIZE=256
 CONFIG_RT_CONSOLE_DEVICE_NAME="uart0"
-CONFIG_RT_VER_NUM=0x40003
+CONFIG_RT_VER_NUM=0x40100
 CONFIG_ARCH_ARM=y
 # CONFIG_RT_USING_CPU_FFS is not set
 CONFIG_ARCH_ARM_ARM9=y
@@ -79,6 +94,7 @@ CONFIG_RT_USING_COMPONENTS_INIT=y
 CONFIG_RT_USING_USER_MAIN=y
 CONFIG_RT_MAIN_THREAD_STACK_SIZE=2048
 CONFIG_RT_MAIN_THREAD_PRIORITY=10
+# CONFIG_RT_USING_LEGACY is not set
 
 #
 # C++ features
@@ -89,25 +105,26 @@ CONFIG_RT_MAIN_THREAD_PRIORITY=10
 # Command shell
 #
 CONFIG_RT_USING_FINSH=y
+CONFIG_RT_USING_MSH=y
+CONFIG_FINSH_USING_MSH=y
 CONFIG_FINSH_THREAD_NAME="tshell"
+CONFIG_FINSH_THREAD_PRIORITY=20
+CONFIG_FINSH_THREAD_STACK_SIZE=4096
 CONFIG_FINSH_USING_HISTORY=y
 CONFIG_FINSH_HISTORY_LINES=5
 CONFIG_FINSH_USING_SYMTAB=y
+CONFIG_FINSH_CMD_SIZE=80
+CONFIG_MSH_USING_BUILT_IN_COMMANDS=y
 CONFIG_FINSH_USING_DESCRIPTION=y
 # CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
-CONFIG_FINSH_THREAD_PRIORITY=20
-CONFIG_FINSH_THREAD_STACK_SIZE=4096
-CONFIG_FINSH_CMD_SIZE=80
 # CONFIG_FINSH_USING_AUTH is not set
-CONFIG_FINSH_USING_MSH=y
-CONFIG_FINSH_USING_MSH_DEFAULT=y
-# CONFIG_FINSH_USING_MSH_ONLY is not set
 CONFIG_FINSH_ARG_MAX=10
 
 #
 # Device virtual file system
 #
 CONFIG_RT_USING_DFS=y
+CONFIG_DFS_USING_POSIX=y
 CONFIG_DFS_USING_WORKDIR=y
 CONFIG_DFS_FILESYSTEMS_MAX=16
 CONFIG_DFS_FILESYSTEM_TYPES_MAX=16
@@ -125,27 +142,32 @@ CONFIG_RT_DFS_ELM_WORD_ACCESS=y
 # CONFIG_RT_DFS_ELM_USE_LFN_2 is not set
 CONFIG_RT_DFS_ELM_USE_LFN_3=y
 CONFIG_RT_DFS_ELM_USE_LFN=3
+CONFIG_RT_DFS_ELM_LFN_UNICODE_0=y
+# CONFIG_RT_DFS_ELM_LFN_UNICODE_1 is not set
+# CONFIG_RT_DFS_ELM_LFN_UNICODE_2 is not set
+# CONFIG_RT_DFS_ELM_LFN_UNICODE_3 is not set
+CONFIG_RT_DFS_ELM_LFN_UNICODE=0
 CONFIG_RT_DFS_ELM_MAX_LFN=255
 CONFIG_RT_DFS_ELM_DRIVES=8
 CONFIG_RT_DFS_ELM_MAX_SECTOR_SIZE=4096
 # CONFIG_RT_DFS_ELM_USE_ERASE is not set
 CONFIG_RT_DFS_ELM_REENTRANT=y
+CONFIG_RT_DFS_ELM_MUTEX_TIMEOUT=3000
 CONFIG_RT_USING_DFS_DEVFS=y
 # CONFIG_RT_USING_DFS_ROMFS is not set
 # CONFIG_RT_USING_DFS_RAMFS is not set
-# CONFIG_RT_USING_DFS_UFFS is not set
-# CONFIG_RT_USING_DFS_JFFS2 is not set
 # CONFIG_RT_USING_DFS_NFS is not set
 
 #
 # Device Drivers
 #
 CONFIG_RT_USING_DEVICE_IPC=y
-CONFIG_RT_PIPE_BUFSZ=512
 CONFIG_RT_USING_SYSTEM_WORKQUEUE=y
 CONFIG_RT_SYSTEM_WORKQUEUE_STACKSIZE=2048
 CONFIG_RT_SYSTEM_WORKQUEUE_PRIORITY=23
 CONFIG_RT_USING_SERIAL=y
+CONFIG_RT_USING_SERIAL_V1=y
+# CONFIG_RT_USING_SERIAL_V2 is not set
 CONFIG_RT_SERIAL_USING_DMA=y
 CONFIG_RT_SERIAL_RB_BUFSZ=2048
 CONFIG_RT_USING_CAN=y
@@ -167,9 +189,6 @@ CONFIG_RT_USING_PWM=y
 CONFIG_RT_USING_RTC=y
 CONFIG_RT_USING_ALARM=y
 # CONFIG_RT_USING_SOFT_RTC is not set
-CONFIG_RTC_SYNC_USING_NTP=y
-CONFIG_RTC_NTP_FIRST_SYNC_DELAY=30
-CONFIG_RTC_NTP_SYNC_PERIOD=3600
 # CONFIG_RT_USING_SDIO is not set
 CONFIG_RT_USING_SPI=y
 CONFIG_RT_USING_QSPI=y
@@ -220,9 +239,11 @@ CONFIG_RT_HWCRYPTO_USING_RNG=y
 #
 # Using USB
 #
+CONFIG_RT_USING_USB=y
 CONFIG_RT_USING_USB_HOST=y
 CONFIG_RT_USBH_MSTORAGE=y
 CONFIG_UDISK_MOUNTPOINT="/mnt/udisk"
+# CONFIG_RT_USBH_HID is not set
 CONFIG_RT_USING_USB_DEVICE=y
 CONFIG_RT_USBD_THREAD_STACK_SZ=4096
 CONFIG_USB_VENDOR_ID=0x0FFE
@@ -247,14 +268,34 @@ CONFIG_RT_USB_MSTORAGE_DISK_NAME="ramdisk1"
 #
 # POSIX layer and C standard library
 #
-CONFIG_RT_USING_LIBC=y
-# CONFIG_RT_USING_PTHREADS is not set
-CONFIG_RT_USING_POSIX=y
-# CONFIG_RT_USING_POSIX_MMAP is not set
+# CONFIG_RT_USING_MODULE is not set
+CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
+
+#
+# POSIX (Portable Operating System Interface) layer
+#
+CONFIG_RT_USING_POSIX_FS=y
+CONFIG_RT_USING_POSIX_DEVIO=y
+CONFIG_RT_USING_POSIX_STDIO=y
+CONFIG_RT_USING_POSIX_POLL=y
+CONFIG_RT_USING_POSIX_SELECT=y
 # CONFIG_RT_USING_POSIX_TERMIOS is not set
-# CONFIG_RT_USING_POSIX_GETLINE is not set
 # CONFIG_RT_USING_POSIX_AIO is not set
-# CONFIG_RT_USING_MODULE is not set
+# CONFIG_RT_USING_POSIX_MMAN is not set
+# CONFIG_RT_USING_POSIX_DELAY is not set
+# CONFIG_RT_USING_POSIX_CLOCK is not set
+# CONFIG_RT_USING_PTHREADS is not set
+
+#
+# Interprocess Communication (IPC)
+#
+# CONFIG_RT_USING_POSIX_PIPE is not set
+# CONFIG_RT_USING_POSIX_MESSAGE_QUEUE is not set
+# CONFIG_RT_USING_POSIX_MESSAGE_SEMAPHORE is not set
+
+#
+# Socket is in the 'Network' category
+#
 
 #
 # Network
@@ -264,7 +305,7 @@ CONFIG_RT_USING_POSIX=y
 # Socket abstraction layer
 #
 CONFIG_RT_USING_SAL=y
-CONFIG_SAL_INTERNET_CHECK=y
+# CONFIG_SAL_INTERNET_CHECK is not set
 
 #
 # protocol stack implement
@@ -290,8 +331,9 @@ CONFIG_NETDEV_IPV6=0
 #
 CONFIG_RT_USING_LWIP=y
 # CONFIG_RT_USING_LWIP141 is not set
-CONFIG_RT_USING_LWIP202=y
-# CONFIG_RT_USING_LWIP212 is not set
+# CONFIG_RT_USING_LWIP202 is not set
+# CONFIG_RT_USING_LWIP203 is not set
+CONFIG_RT_USING_LWIP212=y
 # CONFIG_RT_USING_LWIP_IPV6 is not set
 CONFIG_RT_LWIP_MEM_ALIGNMENT=4
 CONFIG_RT_LWIP_IGMP=y
@@ -305,30 +347,30 @@ CONFIG_IP_SOF_BROADCAST_RECV=1
 #
 # Static IPv4 Address
 #
-CONFIG_RT_LWIP_IPADDR="192.168.1.30"
-CONFIG_RT_LWIP_GWADDR="192.168.1.1"
+CONFIG_RT_LWIP_IPADDR="192.168.31.55"
+CONFIG_RT_LWIP_GWADDR="192.168.31.1"
 CONFIG_RT_LWIP_MSKADDR="255.255.255.0"
 CONFIG_RT_LWIP_UDP=y
 CONFIG_RT_LWIP_TCP=y
 CONFIG_RT_LWIP_RAW=y
 # CONFIG_RT_LWIP_PPP is not set
-CONFIG_RT_MEMP_NUM_NETCONN=32
+CONFIG_RT_MEMP_NUM_NETCONN=16
 CONFIG_RT_LWIP_PBUF_NUM=256
-CONFIG_RT_LWIP_RAW_PCB_NUM=32
-CONFIG_RT_LWIP_UDP_PCB_NUM=32
-CONFIG_RT_LWIP_TCP_PCB_NUM=32
-CONFIG_RT_LWIP_TCP_SEG_NUM=256
-CONFIG_RT_LWIP_TCP_SND_BUF=32768
-CONFIG_RT_LWIP_TCP_WND=10240
+CONFIG_RT_LWIP_RAW_PCB_NUM=16
+CONFIG_RT_LWIP_UDP_PCB_NUM=16
+CONFIG_RT_LWIP_TCP_PCB_NUM=16
+CONFIG_RT_LWIP_TCP_SEG_NUM=64
+CONFIG_RT_LWIP_TCP_SND_BUF=16384
+CONFIG_RT_LWIP_TCP_WND=65535
 CONFIG_RT_LWIP_TCPTHREAD_PRIORITY=10
-CONFIG_RT_LWIP_TCPTHREAD_MBOX_SIZE=32
+CONFIG_RT_LWIP_TCPTHREAD_MBOX_SIZE=256
 CONFIG_RT_LWIP_TCPTHREAD_STACKSIZE=4096
 # CONFIG_LWIP_NO_RX_THREAD is not set
 # CONFIG_LWIP_NO_TX_THREAD is not set
 CONFIG_RT_LWIP_ETHTHREAD_PRIORITY=12
-CONFIG_RT_LWIP_ETHTHREAD_STACKSIZE=1024
-CONFIG_RT_LWIP_ETHTHREAD_MBOX_SIZE=32
-# CONFIG_RT_LWIP_REASSEMBLY_FRAG is not set
+CONFIG_RT_LWIP_ETHTHREAD_STACKSIZE=4096
+CONFIG_RT_LWIP_ETHTHREAD_MBOX_SIZE=256
+CONFIG_RT_LWIP_REASSEMBLY_FRAG=y
 CONFIG_LWIP_NETIF_STATUS_CALLBACK=1
 CONFIG_LWIP_NETIF_LINK_CALLBACK=1
 CONFIG_SO_REUSE=1
@@ -362,8 +404,15 @@ CONFIG_RT_LWIP_USING_PING=y
 CONFIG_RT_USING_UTEST=y
 CONFIG_UTEST_THR_STACK_SIZE=4096
 CONFIG_UTEST_THR_PRIORITY=20
+# CONFIG_RT_USING_VAR_EXPORT is not set
+# CONFIG_RT_USING_RT_LINK is not set
 # CONFIG_RT_USING_LWP is not set
 
+#
+# RT-Thread Utestcases
+#
+# CONFIG_RT_USING_UTESTCASES is not set
+
 #
 # RT-Thread online packages
 #
@@ -411,22 +460,25 @@ CONFIG_PKG_NETUTILS_TFTP=y
 CONFIG_PKG_NETUTILS_IPERF=y
 # CONFIG_PKG_NETUTILS_NETIO is not set
 CONFIG_PKG_NETUTILS_NTP=y
-CONFIG_NETUTILS_NTP_TIMEZONE=8
+CONFIG_NTP_USING_AUTO_SYNC=y
+CONFIG_NTP_AUTO_SYNC_FIRST_DELAY=30
+CONFIG_NTP_AUTO_SYNC_PERIOD=3600
 CONFIG_NETUTILS_NTP_HOSTNAME="0.tw.pool.ntp.org"
 CONFIG_NETUTILS_NTP_HOSTNAME2="1.tw.pool.ntp.org"
 CONFIG_NETUTILS_NTP_HOSTNAME3="2.tw.pool.ntp.org"
 # CONFIG_PKG_NETUTILS_TELNET is not set
 # CONFIG_PKG_NETUTILS_TCPDUMP is not set
-CONFIG_PKG_USING_NETUTILS_V120=y
-# CONFIG_PKG_USING_NETUTILS_V110 is not set
-# CONFIG_PKG_USING_NETUTILS_V100 is not set
 # CONFIG_PKG_USING_NETUTILS_LATEST_VERSION is not set
-CONFIG_PKG_NETUTILS_VER="v1.2.0"
+CONFIG_PKG_USING_NETUTILS_V131=y
+# CONFIG_PKG_USING_NETUTILS_V130 is not set
+CONFIG_PKG_NETUTILS_VER="v1.3.1"
+CONFIG_PKG_NETUTILS_VER_NUM=0x10301
 # CONFIG_PKG_USING_CMUX is not set
 # CONFIG_PKG_USING_PPP_DEVICE is not set
 # CONFIG_PKG_USING_AT_DEVICE is not set
 # CONFIG_PKG_USING_ATSRV_SOCKET is not set
 # CONFIG_PKG_USING_WIZNET is not set
+# CONFIG_PKG_USING_ZB_COORDINATOR is not set
 
 #
 # IoT Cloud
@@ -439,6 +491,7 @@ CONFIG_PKG_NETUTILS_VER="v1.2.0"
 # CONFIG_PKG_USING_JIOT-C-SDK is not set
 # CONFIG_PKG_USING_UCLOUD_IOT_SDK is not set
 # CONFIG_PKG_USING_JOYLINK is not set
+# CONFIG_PKG_USING_EZ_IOT_OS is not set
 # CONFIG_PKG_USING_NIMBLE is not set
 # CONFIG_PKG_USING_OTA_DOWNLOADER is not set
 # CONFIG_PKG_USING_IPMSG is not set
@@ -447,8 +500,6 @@ CONFIG_PKG_NETUTILS_VER="v1.2.0"
 # CONFIG_PKG_USING_LIBRWS is not set
 # CONFIG_PKG_USING_TCPSERVER is not set
 # CONFIG_PKG_USING_PROTOBUF_C is not set
-# CONFIG_PKG_USING_ONNX_PARSER is not set
-# CONFIG_PKG_USING_ONNX_BACKEND is not set
 # CONFIG_PKG_USING_DLT645 is not set
 # CONFIG_PKG_USING_QXWZ is not set
 # CONFIG_PKG_USING_SMTP_CLIENT is not set
@@ -462,12 +513,26 @@ CONFIG_PKG_NETUTILS_VER="v1.2.0"
 # CONFIG_PKG_USING_PDULIB is not set
 # CONFIG_PKG_USING_BTSTACK is not set
 # CONFIG_PKG_USING_LORAWAN_ED_STACK is not set
+# CONFIG_PKG_USING_WAYZ_IOTKIT is not set
+# CONFIG_PKG_USING_MAVLINK is not set
+# CONFIG_PKG_USING_RAPIDJSON is not set
+# CONFIG_PKG_USING_BSAL is not set
+# CONFIG_PKG_USING_AGILE_MODBUS is not set
+# CONFIG_PKG_USING_AGILE_FTP is not set
+# CONFIG_PKG_USING_EMBEDDEDPROTO is not set
+# CONFIG_PKG_USING_RT_LINK_HW is not set
+# CONFIG_PKG_USING_LORA_PKT_FWD is not set
+# CONFIG_PKG_USING_LORA_GW_DRIVER_LIB is not set
+# CONFIG_PKG_USING_LORA_PKT_SNIFFER is not set
+# CONFIG_PKG_USING_HM is not set
+# CONFIG_PKG_USING_SMALL_MODBUS is not set
+# CONFIG_PKG_USING_NET_SERVER is not set
 
 #
 # security packages
 #
 # CONFIG_PKG_USING_MBEDTLS is not set
-# CONFIG_PKG_USING_libsodium is not set
+# CONFIG_PKG_USING_LIBSODIUM is not set
 # CONFIG_PKG_USING_TINYCRYPT is not set
 # CONFIG_PKG_USING_TFM is not set
 # CONFIG_PKG_USING_YD_CRYPTO is not set
@@ -475,21 +540,51 @@ CONFIG_PKG_NETUTILS_VER="v1.2.0"
 #
 # language packages
 #
+# CONFIG_PKG_USING_LUATOS_SOC is not set
 # CONFIG_PKG_USING_LUA is not set
 # CONFIG_PKG_USING_JERRYSCRIPT is not set
 # CONFIG_PKG_USING_MICROPYTHON is not set
+# CONFIG_PKG_USING_PIKASCRIPT is not set
 
 #
 # multimedia packages
 #
+
+#
+# LVGL: powerful and easy-to-use embedded GUI library
+#
+# CONFIG_PKG_USING_LVGL is not set
+# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
+# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
+
+#
+# u8g2: a monochrome graphic library
+#
+# CONFIG_PKG_USING_U8G2_OFFICIAL is not set
+# CONFIG_PKG_USING_U8G2 is not set
 # CONFIG_PKG_USING_OPENMV is not set
 # CONFIG_PKG_USING_MUPDF is not set
 # CONFIG_PKG_USING_STEMWIN is not set
 # CONFIG_PKG_USING_WAVPLAYER is not set
 # CONFIG_PKG_USING_TJPGD is not set
+# CONFIG_PKG_USING_PDFGEN is not set
 # CONFIG_PKG_USING_HELIX is not set
 # CONFIG_PKG_USING_AZUREGUIX is not set
 # CONFIG_PKG_USING_TOUCHGFX2RTT is not set
+# CONFIG_PKG_USING_NUEMWIN is not set
+# CONFIG_PKG_USING_MP3PLAYER is not set
+# CONFIG_PKG_USING_TINYJPEG is not set
+# CONFIG_PKG_USING_UGUI is not set
+
+#
+# PainterEngine: A cross-platform graphics application framework written in C language
+#
+# CONFIG_PKG_USING_PAINTERENGINE is not set
+# CONFIG_PKG_USING_PAINTERENGINE_AUX is not set
+# CONFIG_PKG_USING_MCURSES is not set
+# CONFIG_PKG_USING_TERMBOX is not set
+# CONFIG_PKG_USING_VT100 is not set
+# CONFIG_PKG_USING_QRCODE is not set
 
 #
 # tools packages
@@ -498,9 +593,11 @@ CONFIG_PKG_NETUTILS_VER="v1.2.0"
 # CONFIG_PKG_USING_EASYFLASH is not set
 # CONFIG_PKG_USING_EASYLOGGER is not set
 # CONFIG_PKG_USING_SYSTEMVIEW is not set
+# CONFIG_PKG_USING_SEGGER_RTT is not set
 # CONFIG_PKG_USING_RDB is not set
-# CONFIG_PKG_USING_QRCODE is not set
 # CONFIG_PKG_USING_ULOG_EASYFLASH is not set
+# CONFIG_PKG_USING_ULOG_FILE is not set
+# CONFIG_PKG_USING_LOGMGR is not set
 # CONFIG_PKG_USING_ADBD is not set
 # CONFIG_PKG_USING_COREMARK is not set
 # CONFIG_PKG_USING_DHRYSTONE is not set
@@ -514,15 +611,72 @@ CONFIG_PKG_NETUTILS_VER="v1.2.0"
 # CONFIG_PKG_USING_UMCN is not set
 # CONFIG_PKG_USING_LWRB2RTT is not set
 # CONFIG_PKG_USING_CPU_USAGE is not set
+# CONFIG_PKG_USING_GBK2UTF8 is not set
+# CONFIG_PKG_USING_VCONSOLE is not set
+# CONFIG_PKG_USING_KDB is not set
+# CONFIG_PKG_USING_WAMR is not set
+# CONFIG_PKG_USING_MICRO_XRCE_DDS_CLIENT is not set
+# CONFIG_PKG_USING_LWLOG is not set
+# CONFIG_PKG_USING_ANV_TRACE is not set
+# CONFIG_PKG_USING_ANV_MEMLEAK is not set
+# CONFIG_PKG_USING_ANV_TESTSUIT is not set
+# CONFIG_PKG_USING_ANV_BENCH is not set
+# CONFIG_PKG_USING_DEVMEM is not set
+# CONFIG_PKG_USING_REGEX is not set
+CONFIG_PKG_USING_MEM_SANDBOX=y
+CONFIG_PKG_MEM_SANDBOX_PATH="/packages/tools/mem_sandbox"
+CONFIG_PKG_USING_MEM_SANDBOX_LATEST_VERSION=y
+CONFIG_PKG_MEM_SANDBOX_VER="latest"
+# CONFIG_PKG_USING_SOLAR_TERMS is not set
+# CONFIG_PKG_USING_GAN_ZHI is not set
+# CONFIG_PKG_USING_FDT is not set
 
 #
 # system packages
 #
+
+#
+# enhanced kernel services
+#
+# CONFIG_PKG_USING_RT_MEMCPY_CM is not set
+# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
+# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
+
+#
+# POSIX extension functions
+#
+# CONFIG_PKG_USING_POSIX_GETLINE is not set
+# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
+# CONFIG_PKG_USING_POSIX_ITOA is not set
+# CONFIG_PKG_USING_POSIX_STRINGS is not set
+
+#
+# acceleration: Assembly language or algorithmic acceleration packages
+#
+# CONFIG_PKG_USING_QFPLIB_M0_FULL is not set
+# CONFIG_PKG_USING_QFPLIB_M0_TINY is not set
+# CONFIG_PKG_USING_QFPLIB_M3 is not set
+
+#
+# CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
+#
+# CONFIG_PKG_USING_CMSIS_5 is not set
+# CONFIG_PKG_USING_CMSIS_RTOS2 is not set
+
+#
+# Micrium: Micrium software products porting for RT-Thread
+#
+# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set
+# CONFIG_PKG_USING_UCOSII_WRAPPER is not set
+# CONFIG_PKG_USING_UC_CRC is not set
+# CONFIG_PKG_USING_UC_CLK is not set
+# CONFIG_PKG_USING_UC_COMMON is not set
+# CONFIG_PKG_USING_UC_MODBUS is not set
+# CONFIG_RT_USING_ARDUINO is not set
 # CONFIG_PKG_USING_GUIENGINE is not set
 # CONFIG_PKG_USING_PERSIMMON is not set
 # CONFIG_PKG_USING_CAIRO is not set
 # CONFIG_PKG_USING_PIXMAN is not set
-# CONFIG_PKG_USING_LWEXT4 is not set
 # CONFIG_PKG_USING_PARTITION is not set
 CONFIG_PKG_USING_FAL=y
 CONFIG_PKG_FAL_PATH="/packages/system/fal"
@@ -542,10 +696,11 @@ CONFIG_PKG_FAL_VER_NUM=0x99999
 # CONFIG_PKG_USING_FLASHDB is not set
 # CONFIG_PKG_USING_SQLITE is not set
 # CONFIG_PKG_USING_RTI is not set
-# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
-# CONFIG_PKG_USING_CMSIS is not set
 # CONFIG_PKG_USING_DFS_YAFFS is not set
 # CONFIG_PKG_USING_LITTLEFS is not set
+# CONFIG_PKG_USING_DFS_JFFS2 is not set
+# CONFIG_PKG_USING_DFS_UFFS is not set
+# CONFIG_PKG_USING_LWEXT4 is not set
 # CONFIG_PKG_USING_THREAD_POOL is not set
 # CONFIG_PKG_USING_ROBOTS is not set
 # CONFIG_PKG_USING_EV is not set
@@ -559,17 +714,15 @@ CONFIG_PKG_USING_RAMDISK_LATEST_VERSION=y
 CONFIG_PKG_RAMDISK_VER="latest"
 # CONFIG_PKG_USING_MININI is not set
 # CONFIG_PKG_USING_QBOOT is not set
-
-#
-# Micrium: Micrium software products porting for RT-Thread
-#
-# CONFIG_PKG_USING_UCOSIII_WRAPPER is not set
-# CONFIG_PKG_USING_UCOSII_WRAPPER is not set
-# CONFIG_PKG_USING_UC_CRC is not set
-# CONFIG_PKG_USING_UC_CLK is not set
-# CONFIG_PKG_USING_UC_COMMON is not set
-# CONFIG_PKG_USING_UC_MODBUS is not set
 # CONFIG_PKG_USING_PPOOL is not set
+# CONFIG_PKG_USING_OPENAMP is not set
+# CONFIG_PKG_USING_LPM is not set
+# CONFIG_PKG_USING_TLSF is not set
+# CONFIG_PKG_USING_EVENT_RECORDER is not set
+# CONFIG_PKG_USING_ARM_2D is not set
+# CONFIG_PKG_USING_MCUBOOT is not set
+# CONFIG_PKG_USING_TINYUSB is not set
+# CONFIG_PKG_USING_USB_STACK is not set
 
 #
 # peripheral libraries and drivers
@@ -578,9 +731,9 @@ CONFIG_PKG_RAMDISK_VER="latest"
 # CONFIG_PKG_USING_REALTEK_AMEBA is not set
 # CONFIG_PKG_USING_SHT2X is not set
 # CONFIG_PKG_USING_SHT3X is not set
+# CONFIG_PKG_USING_AS7341 is not set
 # CONFIG_PKG_USING_STM32_SDIO is not set
 # CONFIG_PKG_USING_ICM20608 is not set
-# CONFIG_PKG_USING_U8G2 is not set
 # CONFIG_PKG_USING_BUTTON is not set
 # CONFIG_PKG_USING_PCF8574 is not set
 # CONFIG_PKG_USING_SX12XX is not set
@@ -593,7 +746,6 @@ CONFIG_PKG_RAMDISK_VER="latest"
 # CONFIG_PKG_USING_WM_LIBRARIES is not set
 # CONFIG_PKG_USING_KENDRYTE_SDK is not set
 # CONFIG_PKG_USING_INFRARED is not set
-# CONFIG_PKG_USING_ROSSERIAL is not set
 # CONFIG_PKG_USING_AGILE_BUTTON is not set
 # CONFIG_PKG_USING_AGILE_LED is not set
 # CONFIG_PKG_USING_AT24CXX is not set
@@ -627,16 +779,73 @@ CONFIG_PKG_RAMDISK_VER="latest"
 # CONFIG_PKG_USING_SSD1306 is not set
 # CONFIG_PKG_USING_QKEY is not set
 # CONFIG_PKG_USING_RS485 is not set
+# CONFIG_PKG_USING_RS232 is not set
+# CONFIG_PKG_USING_NES is not set
+# CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
+# CONFIG_PKG_USING_VDEVICE is not set
+# CONFIG_PKG_USING_SGM706 is not set
+# CONFIG_PKG_USING_STM32WB55_SDK is not set
+# CONFIG_PKG_USING_RDA58XX is not set
+# CONFIG_PKG_USING_LIBNFC is not set
+# CONFIG_PKG_USING_MFOC is not set
+# CONFIG_PKG_USING_TMC51XX is not set
+# CONFIG_PKG_USING_TCA9534 is not set
+# CONFIG_PKG_USING_KOBUKI is not set
+# CONFIG_PKG_USING_ROSSERIAL is not set
+# CONFIG_PKG_USING_MICRO_ROS is not set
+# CONFIG_PKG_USING_MCP23008 is not set
+# CONFIG_PKG_USING_BLUETRUM_SDK is not set
+# CONFIG_PKG_USING_MISAKA_AT24CXX is not set
+# CONFIG_PKG_USING_MISAKA_RGB_BLING is not set
+# CONFIG_PKG_USING_LORA_MODEM_DRIVER is not set
+# CONFIG_PKG_USING_BL_MCU_SDK is not set
+# CONFIG_PKG_USING_SOFT_SERIAL is not set
+# CONFIG_PKG_USING_MB85RS16 is not set
+# CONFIG_PKG_USING_CW2015 is not set
+
+#
+# AI packages
+#
+# CONFIG_PKG_USING_LIBANN is not set
+# CONFIG_PKG_USING_NNOM is not set
+# CONFIG_PKG_USING_ONNX_BACKEND is not set
+# CONFIG_PKG_USING_ONNX_PARSER is not set
+# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set
+# CONFIG_PKG_USING_ELAPACK is not set
+# CONFIG_PKG_USING_ULAPACK is not set
+# CONFIG_PKG_USING_QUEST is not set
+# CONFIG_PKG_USING_NAXOS is not set
 
 #
 # miscellaneous packages
 #
+
+#
+# samples: kernel and components samples
+#
+# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
+# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
+# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
+# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
+
+#
+# entertainment: terminal games and other interesting software packages
+#
+# CONFIG_PKG_USING_CMATRIX is not set
+# CONFIG_PKG_USING_SL is not set
+# CONFIG_PKG_USING_CAL is not set
+# CONFIG_PKG_USING_ACLOCK is not set
+# CONFIG_PKG_USING_THREES is not set
+# CONFIG_PKG_USING_2048 is not set
+# CONFIG_PKG_USING_SNAKE is not set
+# CONFIG_PKG_USING_TETRIS is not set
+# CONFIG_PKG_USING_DONUT is not set
+# CONFIG_PKG_USING_COWSAY is not set
 # CONFIG_PKG_USING_LIBCSV is not set
 CONFIG_PKG_USING_OPTPARSE=y
 CONFIG_PKG_OPTPARSE_PATH="/packages/misc/optparse"
-CONFIG_PKG_USING_OPTPARSE_V100=y
-# CONFIG_PKG_USING_OPTPARSE_LATEST_VERSION is not set
-CONFIG_PKG_OPTPARSE_VER="v1.0.0"
+CONFIG_PKG_USING_OPTPARSE_LATEST_VERSION=y
+CONFIG_PKG_OPTPARSE_VER="latest"
 # CONFIG_OPTPARSE_USING_DEMO is not set
 # CONFIG_PKG_USING_FASTLZ is not set
 # CONFIG_PKG_USING_MINILZO is not set
@@ -646,69 +855,44 @@ CONFIG_PKG_OPTPARSE_VER="v1.0.0"
 # CONFIG_PKG_USING_FLEXIBLE_BUTTON is not set
 # CONFIG_PKG_USING_CANFESTIVAL is not set
 # CONFIG_PKG_USING_ZLIB is not set
+# CONFIG_PKG_USING_MINIZIP is not set
 # CONFIG_PKG_USING_DSTR is not set
 # CONFIG_PKG_USING_TINYFRAME is not set
 # CONFIG_PKG_USING_KENDRYTE_DEMO is not set
 # CONFIG_PKG_USING_DIGITALCTRL is not set
 # CONFIG_PKG_USING_UPACKER is not set
 # CONFIG_PKG_USING_UPARAM is not set
-
-#
-# samples: kernel and components samples
-#
-# CONFIG_PKG_USING_KERNEL_SAMPLES is not set
-# CONFIG_PKG_USING_FILESYSTEM_SAMPLES is not set
-# CONFIG_PKG_USING_NETWORK_SAMPLES is not set
-# CONFIG_PKG_USING_PERIPHERAL_SAMPLES is not set
 # CONFIG_PKG_USING_HELLO is not set
 CONFIG_PKG_USING_VI=y
 CONFIG_PKG_VI_PATH="/packages/misc/vi"
+CONFIG_VI_SANDBOX_SIZE_KB=20
 CONFIG_VI_MAX_LEN=4096
 # CONFIG_VI_ENABLE_8BIT is not set
 CONFIG_VI_ENABLE_COLON=y
+CONFIG_VI_ENABLE_COLON_EXPAND=y
 CONFIG_VI_ENABLE_YANKMARK=y
 CONFIG_VI_ENABLE_SEARCH=y
 CONFIG_VI_ENABLE_DOT_CMD=y
 CONFIG_VI_ENABLE_READONLY=y
 CONFIG_VI_ENABLE_SETOPTS=y
 CONFIG_VI_ENABLE_SET=y
+# CONFIG_VI_ENABLE_WIN_RESIZE is not set
 CONFIG_VI_ENABLE_VI_ASK_TERMINAL=y
 CONFIG_VI_ENABLE_UNDO=y
 CONFIG_VI_ENABLE_UNDO_QUEUE=y
 CONFIG_VI_UNDO_QUEUE_MAX=256
+CONFIG_VI_ENABLE_VERBOSE_STATUS=y
 CONFIG_PKG_USING_VI_LATEST_VERSION=y
 CONFIG_PKG_VI_VER="latest"
 # CONFIG_PKG_USING_KI is not set
-# CONFIG_PKG_USING_NNOM is not set
-# CONFIG_PKG_USING_LIBANN is not set
-# CONFIG_PKG_USING_ELAPACK is not set
 # CONFIG_PKG_USING_ARMv7M_DWT is not set
-# CONFIG_PKG_USING_VT100 is not set
-# CONFIG_PKG_USING_ULAPACK is not set
 # CONFIG_PKG_USING_UKAL is not set
 # CONFIG_PKG_USING_CRCLIB is not set
-
-#
-# games: games run on RT-Thread console
-#
-# CONFIG_PKG_USING_THREES is not set
-# CONFIG_PKG_USING_2048 is not set
-# CONFIG_PKG_USING_SNAKE is not set
-# CONFIG_PKG_USING_TETRIS is not set
 # CONFIG_PKG_USING_LWGPS is not set
-# CONFIG_PKG_USING_TENSORFLOWLITEMICRO is not set
-
-#
-# Nuvoton Packages Config
-#
-CONFIG_NU_PKG_USING_UTILS=y
-CONFIG_NU_PKG_USING_DEMO=y
-# CONFIG_NU_PKG_USING_BMX055 is not set
-# CONFIG_NU_PKG_USING_MAX31875 is not set
-# CONFIG_NU_PKG_USING_NAU88L25 is not set
-CONFIG_NU_PKG_USING_NAU8822=y
-# CONFIG_NU_PKG_USING_ILI9341 is not set
-# CONFIG_NU_PKG_USING_SPINAND is not set
+# CONFIG_PKG_USING_STATE_MACHINE is not set
+# CONFIG_PKG_USING_DESIGN_PATTERN is not set
+# CONFIG_PKG_USING_CONTROLLER is not set
+# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
 
 #
 # Hardware Drivers Config
@@ -718,12 +902,11 @@ CONFIG_NU_PKG_USING_NAU8822=y
 # On-chip Peripheral Drivers
 #
 CONFIG_SOC_SERIES_NUC980=y
-# CONFIG_BSP_USE_STDDRIVER_SOURCE is not set
+CONFIG_BSP_USE_STDDRIVER_SOURCE=y
 CONFIG_BSP_USING_MMU=y
 CONFIG_BSP_USING_PDMA=y
 CONFIG_NU_PDMA_MEMFUN_ACTOR_MAX=2
 CONFIG_BSP_USING_GPIO=y
-# CONFIG_BSP_USING_CLK is not set
 CONFIG_BSP_USING_EMAC=y
 CONFIG_BSP_USING_EMAC0=y
 # CONFIG_BSP_USING_EMAC1 is not set
@@ -732,27 +915,23 @@ CONFIG_BSP_USING_RTC=y
 CONFIG_NU_RTC_SUPPORT_IO_RW=y
 CONFIG_NU_RTC_SUPPORT_MSH_CMD=y
 CONFIG_BSP_USING_ADC=y
+# CONFIG_BSP_USING_ADC_TOUCH is not set
 CONFIG_BSP_USING_TMR=y
 CONFIG_BSP_USING_TIMER=y
 CONFIG_BSP_USING_TMR0=y
 CONFIG_BSP_USING_TIMER0=y
-# CONFIG_BSP_USING_TPWM0 is not set
 # CONFIG_BSP_USING_TIMER0_CAPTURE is not set
 CONFIG_BSP_USING_TMR1=y
 CONFIG_BSP_USING_TIMER1=y
-# CONFIG_BSP_USING_TPWM1 is not set
 # CONFIG_BSP_USING_TIMER1_CAPTURE is not set
 CONFIG_BSP_USING_TMR2=y
 CONFIG_BSP_USING_TIMER2=y
-# CONFIG_BSP_USING_TPWM2 is not set
 # CONFIG_BSP_USING_TIMER2_CAPTURE is not set
 CONFIG_BSP_USING_TMR3=y
 CONFIG_BSP_USING_TIMER3=y
-# CONFIG_BSP_USING_TPWM3 is not set
 # CONFIG_BSP_USING_TIMER3_CAPTURE is not set
 CONFIG_BSP_USING_TMR4=y
 CONFIG_BSP_USING_TIMER4=y
-# CONFIG_BSP_USING_TPWM4 is not set
 # CONFIG_BSP_USING_TIMER4_CAPTURE is not set
 CONFIG_BSP_USING_UART=y
 CONFIG_BSP_USING_UART0=y
@@ -794,8 +973,9 @@ CONFIG_BSP_USING_SPI1_NONE=y
 CONFIG_BSP_USING_I2S=y
 CONFIG_NU_I2S_DMA_FIFO_SIZE=4096
 CONFIG_BSP_USING_QSPI=y
+# CONFIG_BSP_USING_QSPI_PDMA is not set
 CONFIG_BSP_USING_QSPI0=y
-CONFIG_BSP_USING_QSPI0_PDMA=y
+# CONFIG_BSP_USING_QSPI0_PDMA is not set
 # CONFIG_BSP_USING_SCUART is not set
 CONFIG_BSP_USING_CRYPTO=y
 # CONFIG_NU_PRNG_USE_SEED is not set
@@ -823,5 +1003,18 @@ CONFIG_BOARD_USING_USB1_HOST=y
 # CONFIG_BOARD_USING_MAX31875 is not set
 # CONFIG_BOARD_USING_LCD_ILI9341 is not set
 # CONFIG_BOARD_USING_ESP8266 is not set
+
+#
+# Nuvoton Packages Config
+#
+CONFIG_NU_PKG_USING_UTILS=y
+CONFIG_NU_PKG_USING_DEMO=y
+# CONFIG_NU_PKG_USING_BMX055 is not set
+# CONFIG_NU_PKG_USING_MAX31875 is not set
+# CONFIG_NU_PKG_USING_NAU88L25 is not set
+CONFIG_NU_PKG_USING_NAU8822=y
+# CONFIG_NU_PKG_USING_DA9062 is not set
+# CONFIG_NU_PKG_USING_ILI9341 is not set
+# CONFIG_NU_PKG_USING_SPINAND is not set
 CONFIG_BOARD_USE_UTEST=y
 CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.nk980-iot.test.utest."

+ 23 - 14
bsp/nuvoton/nk-n9h30/.config

@@ -744,6 +744,7 @@ CONFIG_PKG_RAMDISK_VER="latest"
 # CONFIG_PKG_USING_SSD1306 is not set
 # CONFIG_PKG_USING_QKEY is not set
 # CONFIG_PKG_USING_RS485 is not set
+# CONFIG_PKG_USING_RS232 is not set
 # CONFIG_PKG_USING_NES is not set
 # CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
 # CONFIG_PKG_USING_VDEVICE is not set
@@ -832,19 +833,6 @@ CONFIG_PKG_RAMDISK_VER="latest"
 # CONFIG_PKG_USING_STATE_MACHINE is not set
 # CONFIG_PKG_USING_DESIGN_PATTERN is not set
 
-#
-# Nuvoton Packages Config
-#
-CONFIG_NU_PKG_USING_UTILS=y
-# CONFIG_NU_PKG_USING_DEMO is not set
-# CONFIG_NU_PKG_USING_BMX055 is not set
-# CONFIG_NU_PKG_USING_MAX31875 is not set
-# CONFIG_NU_PKG_USING_NAU88L25 is not set
-CONFIG_NU_PKG_USING_NAU8822=y
-# CONFIG_NU_PKG_USING_DA9062 is not set
-# CONFIG_NU_PKG_USING_ILI9341 is not set
-# CONFIG_NU_PKG_USING_SPINAND is not set
-
 #
 # Hardware Drivers Config
 #
@@ -929,6 +917,7 @@ CONFIG_BSP_USING_VPOST=y
 # CONFIG_LCM_USING_LSA40AT9001 is not set
 CONFIG_LCM_USING_FW070TFT=y
 # CONFIG_LCM_USING_FW043TFT is not set
+# CONFIG_LCM_USING_FW070TFT_WSVGA is not set
 CONFIG_VPOST_USING_LCD_IDX=3
 CONFIG_BSP_LCD_BPP=32
 CONFIG_BSP_LCD_WIDTH=800
@@ -946,10 +935,30 @@ CONFIG_BOARD_USING_NAU8822=y
 CONFIG_BOARD_USING_STORAGE_SDCARD=y
 CONFIG_BOARD_USING_STORAGE_SPIFLASH=y
 CONFIG_BOARD_USING_BUZZER=y
-CONFIG_BOARD_USING_LCM=y
 CONFIG_BOARD_USING_USB0_DEVICE_HOST=y
 CONFIG_BOARD_USING_USB1_HOST=y
 
 #
 # Board extended module drivers
 #
+CONFIG_BOARD_USING_LCM=y
+CONFIG_BOARD_USING_LCM_FW070TFT_WVGA=y
+# CONFIG_BOARD_USING_LCM_FW043TFT_HVGA is not set
+# CONFIG_BOARD_USING_LCM_FW070TFT_WSVGA is not set
+CONFIG_BOARD_USING_ADCTOUCH=y
+# CONFIG_BOARD_USING_GT911 is not set
+
+#
+# Nuvoton Packages Config
+#
+CONFIG_NU_PKG_USING_UTILS=y
+# CONFIG_NU_PKG_USING_DEMO is not set
+# CONFIG_NU_PKG_USING_BMX055 is not set
+# CONFIG_NU_PKG_USING_MAX31875 is not set
+# CONFIG_NU_PKG_USING_NAU88L25 is not set
+CONFIG_NU_PKG_USING_NAU8822=y
+# CONFIG_NU_PKG_USING_DA9062 is not set
+# CONFIG_NU_PKG_USING_ILI9341 is not set
+# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_BOARD_USE_UTEST=y
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.nk-n9h30.test.utest."

+ 0 - 6
bsp/nuvoton/nk-n9h30/Kconfig

@@ -18,12 +18,6 @@ config PKGS_DIR
     option env="PKGS_ROOT"
     default "packages"
 
-config NU_PKGS_DIR
-    string
-    option env="NU_PKGS_ROOT"
-    default "../libraries/nu_packages"
-
 source "$RTT_DIR/Kconfig"
 source "$PKGS_DIR/Kconfig"
-source "$NU_PKGS_DIR/Kconfig"
 source "$BSP_DIR/board/Kconfig"

+ 45 - 16
bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_disp.c

@@ -26,9 +26,30 @@ static lv_disp_drv_t disp_drv;  /*Descriptor of a display driver*/
 
 static void *buf3_next = RT_NULL;
 
+static uint32_t u32FirstFlush = 0;
+
+static void nu_antitearing(lv_disp_draw_buf_t *draw_buf, lv_color_t *color_p)
+{
+    if (buf3_next)
+    {
+        /* vsync-none: Use triple screen-sized buffers. */
+        if (draw_buf->buf1 == color_p)
+            draw_buf->buf1 = buf3_next;
+        else
+            draw_buf->buf2 = buf3_next;
+
+        draw_buf->buf_act = buf3_next;
+        buf3_next = color_p;
+    }
+    else
+    {
+        /* vsync-after: Use ping-pong screen-sized buffers only.*/
+        rt_device_control(lcd_device, RTGRAPHIC_CTRL_WAIT_VSYNC, RT_NULL);
+    }
+}
+
 static void nu_flush_direct(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
 {
-    lv_disp_t *psDisp = _lv_refr_get_disp_refreshing();
     void *pvDstReDraw;
 
 #if (LV_USE_GPU_N9H30_GE2D==0)
@@ -55,8 +76,14 @@ static void nu_flush_direct(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_c
     mmu_invalidate_dcache((uint32_t)pvDstReDraw, disp_drv->draw_buf->size * sizeof(lv_color_t));
 #endif
 
-    /* WAIT_VSYNC */
-    rt_device_control(lcd_device, RTGRAPHIC_CTRL_WAIT_VSYNC, RT_NULL);
+    nu_antitearing(disp_drv->draw_buf, color_p);
+
+    if (!u32FirstFlush)
+    {
+        /* Enable backlight at first flushing. */
+        rt_device_control(lcd_device, RTGRAPHIC_CTRL_POWERON, RT_NULL);
+        u32FirstFlush = 1;
+    }
 
     lv_disp_flush_ready(disp_drv);
 }
@@ -70,21 +97,13 @@ static void nu_flush_full_refresh(lv_disp_drv_t *disp_drv, const lv_area_t *area
     /* Use PANDISPLAY without H/W copying */
     rt_device_control(lcd_device, RTGRAPHIC_CTRL_PAN_DISPLAY, color_p);
 
-    if (buf3_next)
-    {
-        /* vsync-none: Use triple screen-sized buffers. */
-        if (disp_drv->draw_buf->buf1 == color_p)
-            disp_drv->draw_buf->buf1 = buf3_next;
-        else
-            disp_drv->draw_buf->buf2 = buf3_next;
+    nu_antitearing(disp_drv->draw_buf, color_p);
 
-        disp_drv->draw_buf->buf_act = buf3_next;
-        buf3_next = color_p;
-    }
-    else
+    if (!u32FirstFlush)
     {
-        /* vsync-after: Use ping-pong screen-sized buffers only.*/
-        rt_device_control(lcd_device, RTGRAPHIC_CTRL_WAIT_VSYNC, RT_NULL);
+        /* Enable backlight at first flushing. */
+        rt_device_control(lcd_device, RTGRAPHIC_CTRL_POWERON, RT_NULL);
+        u32FirstFlush = 1;
     }
 
     lv_disp_flush_ready(disp_drv);
@@ -106,6 +125,13 @@ static void nu_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t
     ge2dSpriteBlt_Screen(area->x1, area->y1, flush_area_w, flush_area_h, (void *)color_p);
     // -> Leave GE2D
 
+    if (!u32FirstFlush)
+    {
+        /* Enable backlight at first flushing. */
+        rt_device_control(lcd_device, RTGRAPHIC_CTRL_POWERON, RT_NULL);
+        u32FirstFlush = 1;
+    }
+
     lv_disp_flush_ready(disp_drv);
 }
 
@@ -188,6 +214,9 @@ void lv_port_disp_init(void)
         return;
     }
 
+    /* Disable backlight at startup. */
+    rt_device_control(lcd_device, RTGRAPHIC_CTRL_POWEROFF, RT_NULL);
+
     RT_ASSERT(info.bits_per_pixel == 8 || info.bits_per_pixel == 16 ||
               info.bits_per_pixel == 24 || info.bits_per_pixel == 32);
 

+ 54 - 6
bsp/nuvoton/nk-n9h30/board/Kconfig

@@ -45,12 +45,6 @@ menu "Hardware Drivers Config"
             select BSP_USING_PWM0
             default n
 
-        config BOARD_USING_LCM
-            bool "NuDesign TFT-LCD7(over vpost)"
-            select BSP_USING_VPOST
-            select LCM_USING_FW070TFT
-            default y
-
         config BOARD_USING_USB0_DEVICE_HOST
             select BSP_USING_USBH
             select BSP_USING_USBD
@@ -69,7 +63,61 @@ menu "Hardware Drivers Config"
 
     menu "Board extended module drivers"
 
+        config BOARD_USING_LCM
+            bool "Use LCD panel."
+            default y
+
+        if BOARD_USING_LCM
+
+            choice
+                prompt "Select LCD panel devices.(Over VPOST)"
+                    default BOARD_USING_LCM_FW070TFT_WVGA
+
+                config BOARD_USING_LCM_FW070TFT_WVGA
+                    bool "NuDesign TFT-LCD7-WVGA"
+                    select BSP_USING_VPOST
+                    select LCM_USING_FW070TFT
+                    help
+                        Choose this option if you use 7" 800x480x32b LCD panel.
+
+                config BOARD_USING_LCM_FW043TFT_HVGA
+                    bool "NuDesign TFT-LCD43-HVGA"
+                    select BSP_USING_VPOST
+                    select LCM_USING_FW043TFT
+                    help
+                        Choose this option if you use 4.3" 480x272x32b LCD panel.
+
+                config BOARD_USING_LCM_FW070TFT_WSVGA
+                    bool "NuDesign TFT-LCD7-WSVGA"
+                    select BSP_USING_VPOST
+                    select LCM_USING_FW070TFT_WSVGA
+                    help
+                        Choose this option if you use 7" 1024x600x32b LCD panel.
+            endchoice
+
+            choice
+                prompt "Select Touch devices."
+                    default BOARD_USING_ADCTOUCH
+
+                config BOARD_USING_ADCTOUCH
+                    bool "ADC touching"
+                    select BSP_USING_ADC_TOUCH
+                    help
+                        Choose this option if you use internal ADC touching function.
+
+                config BOARD_USING_GT911
+                    bool "GT911 TSC"
+                    select BSP_USING_I2C
+                    select BSP_USING_I2C0
+                    select PKG_USING_GT911
+                    help
+                        Choose this option if you use GT911 external TSC touching function.
+            endchoice
+
+        endif
+    
     endmenu
 
+    source "$BSP_DIR/../libraries/nu_packages/Kconfig"
 
 endmenu

+ 52 - 10
bsp/nuvoton/nk-n9h30/board/board_dev.c

@@ -173,6 +173,34 @@ int rt_hw_nau8822_port(void)
 INIT_COMPONENT_EXPORT(rt_hw_nau8822_port);
 #endif /* BOARD_USING_NAU8822 */
 
+//#if defined(BOARD_USING_GT911) && defined(PKG_USING_GT911)
+#if defined(PKG_USING_GT911)
+#include "drv_gpio.h"
+#include "gt911.h"
+
+#define GT911_RST_PIN   NU_GET_PININDEX(NU_PG, 4)
+#define GT911_IRQ_PIN   NU_GET_PININDEX(NU_PG, 5)
+
+extern int gt911_sample(const char *name, rt_uint16_t x, rt_uint16_t y);
+int rt_hw_gt911_port(void)
+{
+    struct rt_touch_config cfg;
+    rt_uint8_t rst_pin;
+
+    rst_pin = GT911_RST_PIN;
+    cfg.dev_name = "i2c0";
+    cfg.irq_pin.pin = GT911_IRQ_PIN;
+    cfg.irq_pin.mode = PIN_MODE_INPUT_PULLDOWN;
+    cfg.user_data = &rst_pin;
+
+    rt_hw_gt911_init("gt911", &cfg);
+    gt911_sample("gt911", BSP_LCD_WIDTH, BSP_LCD_HEIGHT);
+
+    return 0;
+}
+INIT_ENV_EXPORT(rt_hw_gt911_port);
+#endif /* if defined(BOARD_USING_GT911) && defined(PKG_USING_GT911) */
+
 #if defined(BOARD_USING_BUZZER)
 
 #define PWM_DEV_NAME       "pwm0"
@@ -224,13 +252,13 @@ static void PlayRingTone(void)
     #include <drv_gpio.h>
 
     /* defined the LCM_BLEN pin: PH3 */
-    #define LCM_BLEN  NU_GET_PININDEX(NU_PH, 3)
+    #define LCM_BACKLIGHT_CTRL  NU_GET_PININDEX(NU_PH, 3)
 #endif
 
-#define PWM_DEV_NAME       "pwm0"
-#define LCM_PWM_CHANNEL    (0)
+#define PWM_DEV_NAME         "pwm0"
+#define LCM_PWM_CHANNEL      (0)
 
-static void LCMLightOn(void)
+void nu_lcd_backlight_on(void)
 {
     struct rt_device_pwm *pwm_dev;
 
@@ -243,10 +271,27 @@ static void LCMLightOn(void)
     {
         rt_kprintf("Can't find %s\n", PWM_DEV_NAME);
     }
+
+    rt_pin_mode(LCM_BACKLIGHT_CTRL, PIN_MODE_OUTPUT);
+    rt_pin_write(LCM_BACKLIGHT_CTRL, PIN_HIGH);
+}
+
+void nu_lcd_backlight_off(void)
+{
+    struct rt_device_pwm *pwm_dev;
+
+    if ((pwm_dev = (struct rt_device_pwm *)rt_device_find(PWM_DEV_NAME)) != RT_NULL)
+    {
+        rt_pwm_disable(pwm_dev, LCM_PWM_CHANNEL);
+    }
+    else
+    {
+        rt_kprintf("Can't find %s\n", PWM_DEV_NAME);
+    }
+
+    rt_pin_mode(LCM_BACKLIGHT_CTRL, PIN_MODE_OUTPUT);
+    rt_pin_write(LCM_BACKLIGHT_CTRL, PIN_LOW);
 }
-#ifdef FINSH_USING_MSH
-    MSH_CMD_EXPORT(LCMLightOn, LCM - light on panel);
-#endif
 
 int rt_hw_lcm_port(void)
 {
@@ -259,9 +304,6 @@ int rt_hw_lcm_port(void)
     }
 #endif
 
-    /* Use PWM to control backlight. */
-    LCMLightOn();
-
     return 0;
 }
 INIT_COMPONENT_EXPORT(rt_hw_lcm_port);

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 350
bsp/nuvoton/nk-n9h30/project.uvproj


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 334
bsp/nuvoton/nk-n9h30/project.uvprojx


+ 0 - 422
bsp/nuvoton/nk-n9h30/rtconfig.h

@@ -1,422 +0,0 @@
-#ifndef RT_CONFIG_H__
-#define RT_CONFIG_H__
-
-/* Automatically generated file; DO NOT EDIT. */
-/* RT-Thread Configuration */
-
-/* RT-Thread Kernel */
-
-#define RT_NAME_MAX 16
-#define RT_ALIGN_SIZE 4
-#define RT_THREAD_PRIORITY_32
-#define RT_THREAD_PRIORITY_MAX 32
-#define RT_TICK_PER_SECOND 1000
-#define RT_USING_OVERFLOW_CHECK
-#define RT_USING_HOOK
-#define RT_HOOK_USING_FUNC_PTR
-#define RT_USING_IDLE_HOOK
-#define RT_IDLE_HOOK_LIST_SIZE 4
-#define IDLE_THREAD_STACK_SIZE 2048
-
-/* kservice optimization */
-
-#define RT_DEBUG
-#define RT_DEBUG_COLOR
-
-/* Inter-Thread communication */
-
-#define RT_USING_SEMAPHORE
-#define RT_USING_MUTEX
-#define RT_USING_EVENT
-#define RT_USING_MAILBOX
-#define RT_USING_MESSAGEQUEUE
-#define RT_USING_SIGNALS
-
-/* Memory Management */
-
-#define RT_USING_MEMPOOL
-#define RT_USING_SMALL_MEM
-#define RT_USING_MEMHEAP
-#define RT_MEMHEAP_FAST_MODE
-#define RT_USING_SMALL_MEM_AS_HEAP
-#define RT_USING_MEMTRACE
-#define RT_USING_HEAP
-
-/* Kernel Device Object */
-
-#define RT_USING_DEVICE
-#define RT_USING_INTERRUPT_INFO
-#define RT_USING_CONSOLE
-#define RT_CONSOLEBUF_SIZE 256
-#define RT_CONSOLE_DEVICE_NAME "uart0"
-#define RT_VER_NUM 0x40100
-#define ARCH_ARM
-#define ARCH_ARM_ARM9
-
-/* RT-Thread Components */
-
-#define RT_USING_COMPONENTS_INIT
-#define RT_USING_USER_MAIN
-#define RT_MAIN_THREAD_STACK_SIZE 2048
-#define RT_MAIN_THREAD_PRIORITY 10
-
-/* C++ features */
-
-
-/* Command shell */
-
-#define RT_USING_FINSH
-#define RT_USING_MSH
-#define FINSH_USING_MSH
-#define FINSH_THREAD_NAME "tshell"
-#define FINSH_THREAD_PRIORITY 20
-#define FINSH_THREAD_STACK_SIZE 4096
-#define FINSH_USING_HISTORY
-#define FINSH_HISTORY_LINES 5
-#define FINSH_USING_SYMTAB
-#define FINSH_CMD_SIZE 80
-#define MSH_USING_BUILT_IN_COMMANDS
-#define FINSH_USING_DESCRIPTION
-#define FINSH_ARG_MAX 10
-
-/* Device virtual file system */
-
-#define RT_USING_DFS
-#define DFS_USING_POSIX
-#define DFS_USING_WORKDIR
-#define DFS_FILESYSTEMS_MAX 16
-#define DFS_FILESYSTEM_TYPES_MAX 16
-#define DFS_FD_MAX 64
-#define RT_USING_DFS_MNTTABLE
-#define RT_USING_DFS_ELMFAT
-
-/* elm-chan's FatFs, Generic FAT Filesystem Module */
-
-#define RT_DFS_ELM_CODE_PAGE 437
-#define RT_DFS_ELM_WORD_ACCESS
-#define RT_DFS_ELM_USE_LFN_3
-#define RT_DFS_ELM_USE_LFN 3
-#define RT_DFS_ELM_LFN_UNICODE_0
-#define RT_DFS_ELM_LFN_UNICODE 0
-#define RT_DFS_ELM_MAX_LFN 255
-#define RT_DFS_ELM_DRIVES 8
-#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
-#define RT_DFS_ELM_REENTRANT
-#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
-#define RT_USING_DFS_DEVFS
-
-/* Device Drivers */
-
-#define RT_USING_DEVICE_IPC
-#define RT_USING_SYSTEM_WORKQUEUE
-#define RT_SYSTEM_WORKQUEUE_STACKSIZE 2048
-#define RT_SYSTEM_WORKQUEUE_PRIORITY 23
-#define RT_USING_SERIAL
-#define RT_USING_SERIAL_V1
-#define RT_SERIAL_RB_BUFSZ 2048
-#define RT_USING_CAN
-#define RT_USING_HWTIMER
-#define RT_USING_I2C
-#define RT_USING_I2C_BITOPS
-#define RT_USING_PIN
-#define RT_USING_ADC
-#define RT_USING_PWM
-#define RT_USING_RTC
-#define RT_USING_ALARM
-#define RT_USING_SPI
-#define RT_USING_QSPI
-#define RT_USING_SFUD
-#define RT_SFUD_USING_SFDP
-#define RT_SFUD_USING_FLASH_INFO_TABLE
-#define RT_SFUD_USING_QSPI
-#define RT_SFUD_SPI_MAX_HZ 50000000
-#define RT_USING_WDT
-#define RT_USING_AUDIO
-#define RT_AUDIO_REPLAY_MP_BLOCK_SIZE 4096
-#define RT_AUDIO_REPLAY_MP_BLOCK_COUNT 2
-#define RT_AUDIO_RECORD_PIPE_SIZE 2048
-#define RT_USING_TOUCH
-#define RT_USING_INPUT_CAPTURE
-#define RT_INPUT_CAPTURE_RB_SIZE 100
-
-/* Using USB */
-
-#define RT_USING_USB
-#define RT_USING_USB_HOST
-#define RT_USBH_MSTORAGE
-#define UDISK_MOUNTPOINT "/mnt/udisk"
-#define RT_USING_USB_DEVICE
-#define RT_USBD_THREAD_STACK_SZ 4096
-#define USB_VENDOR_ID 0x0FFE
-#define USB_PRODUCT_ID 0x0001
-#define RT_USB_DEVICE_COMPOSITE
-#define RT_USB_DEVICE_CDC
-#define RT_USB_DEVICE_NONE
-#define RT_USB_DEVICE_MSTORAGE
-#define RT_VCOM_TASK_STK_SIZE 512
-#define RT_CDC_RX_BUFSIZE 128
-#define RT_VCOM_SERNO "32021919830108"
-#define RT_VCOM_SER_LEN 14
-#define RT_VCOM_TX_TIMEOUT 1000
-#define RT_USB_MSTORAGE_DISK_NAME "ramdisk1"
-
-/* POSIX layer and C standard library */
-
-#define RT_LIBC_DEFAULT_TIMEZONE 8
-
-/* POSIX (Portable Operating System Interface) layer */
-
-#define RT_USING_POSIX_FS
-#define RT_USING_POSIX_DEVIO
-#define RT_USING_POSIX_POLL
-#define RT_USING_POSIX_SELECT
-
-/* Interprocess Communication (IPC) */
-
-
-/* Socket is in the 'Network' category */
-
-/* Network */
-
-/* Socket abstraction layer */
-
-#define RT_USING_SAL
-#define SAL_INTERNET_CHECK
-
-/* protocol stack implement */
-
-#define SAL_USING_LWIP
-#define SAL_USING_POSIX
-
-/* Network interface device */
-
-#define RT_USING_NETDEV
-#define NETDEV_USING_IFCONFIG
-#define NETDEV_USING_PING
-#define NETDEV_USING_NETSTAT
-#define NETDEV_USING_AUTO_DEFAULT
-#define NETDEV_IPV4 1
-#define NETDEV_IPV6 0
-
-/* light weight TCP/IP stack */
-
-#define RT_USING_LWIP
-#define RT_USING_LWIP202
-#define RT_LWIP_MEM_ALIGNMENT 4
-#define RT_LWIP_IGMP
-#define RT_LWIP_ICMP
-#define RT_LWIP_DNS
-#define RT_LWIP_DHCP
-#define IP_SOF_BROADCAST 1
-#define IP_SOF_BROADCAST_RECV 1
-
-/* Static IPv4 Address */
-
-#define RT_LWIP_IPADDR "192.168.1.30"
-#define RT_LWIP_GWADDR "192.168.1.1"
-#define RT_LWIP_MSKADDR "255.255.255.0"
-#define RT_LWIP_UDP
-#define RT_LWIP_TCP
-#define RT_LWIP_RAW
-#define RT_MEMP_NUM_NETCONN 32
-#define RT_LWIP_PBUF_NUM 256
-#define RT_LWIP_RAW_PCB_NUM 32
-#define RT_LWIP_UDP_PCB_NUM 32
-#define RT_LWIP_TCP_PCB_NUM 32
-#define RT_LWIP_TCP_SEG_NUM 256
-#define RT_LWIP_TCP_SND_BUF 32768
-#define RT_LWIP_TCP_WND 10240
-#define RT_LWIP_TCPTHREAD_PRIORITY 10
-#define RT_LWIP_TCPTHREAD_MBOX_SIZE 32
-#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
-#define RT_LWIP_ETHTHREAD_PRIORITY 12
-#define RT_LWIP_ETHTHREAD_STACKSIZE 1024
-#define RT_LWIP_ETHTHREAD_MBOX_SIZE 32
-#define LWIP_NETIF_STATUS_CALLBACK 1
-#define LWIP_NETIF_LINK_CALLBACK 1
-#define SO_REUSE 1
-#define LWIP_SO_RCVTIMEO 1
-#define LWIP_SO_SNDTIMEO 1
-#define LWIP_SO_RCVBUF 1
-#define LWIP_SO_LINGER 0
-#define RT_LWIP_NETIF_LOOPBACK
-#define LWIP_NETIF_LOOPBACK 1
-#define RT_LWIP_STATS
-#define RT_LWIP_USING_PING
-
-/* AT commands */
-
-
-/* VBUS(Virtual Software BUS) */
-
-
-/* Utilities */
-
-#define RT_USING_UTEST
-#define UTEST_THR_STACK_SIZE 4096
-#define UTEST_THR_PRIORITY 20
-
-/* RT-Thread Utestcases */
-
-
-/* RT-Thread online packages */
-
-/* IoT - internet of things */
-
-
-/* Wi-Fi */
-
-/* Marvell WiFi */
-
-
-/* Wiced WiFi */
-
-
-/* IoT Cloud */
-
-
-/* security packages */
-
-
-/* language packages */
-
-
-/* multimedia packages */
-
-/* LVGL: powerful and easy-to-use embedded GUI library */
-
-#define PKG_USING_LVGL
-#define PKG_USING_LVGL_V810
-#define PKG_LVGL_VER_NUM 0x08010
-#define PKG_USING_LV_MUSIC_DEMO
-
-/* u8g2: a monochrome graphic library */
-
-
-/* PainterEngine: A cross-platform graphics application framework written in C language */
-
-
-/* tools packages */
-
-
-/* system packages */
-
-/* enhanced kernel services */
-
-
-/* POSIX extension functions */
-
-
-/* acceleration: Assembly language or algorithmic acceleration packages */
-
-
-/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
-
-
-/* Micrium: Micrium software products porting for RT-Thread */
-
-#define PKG_USING_FAL
-#define FAL_DEBUG_CONFIG
-#define FAL_DEBUG 1
-#define FAL_PART_HAS_TABLE_CFG
-#define FAL_USING_SFUD_PORT
-#define FAL_USING_NOR_FLASH_DEV_NAME "norflash0"
-#define PKG_USING_FAL_LATEST_VERSION
-#define PKG_FAL_VER_NUM 0x99999
-#define PKG_USING_RAMDISK
-#define PKG_USING_RAMDISK_LATEST_VERSION
-
-/* peripheral libraries and drivers */
-
-
-/* AI packages */
-
-
-/* miscellaneous packages */
-
-/* samples: kernel and components samples */
-
-
-/* entertainment: terminal games and other interesting software packages */
-
-
-/* Nuvoton Packages Config */
-
-#define NU_PKG_USING_UTILS
-#define NU_PKG_USING_NAU8822
-
-/* Hardware Drivers Config */
-
-/* On-chip Peripheral Drivers */
-
-#define SOC_SERIES_N9H30
-#define BSP_USING_MMU
-#define BSP_USING_GPIO
-#define BSP_USING_EMAC
-#define BSP_USING_EMAC0
-#define BSP_USING_EMAC1
-#define BSP_USING_RTC
-#define BSP_USING_ADC
-#define BSP_USING_ADC_TOUCH
-#define BSP_USING_ETMR
-#define BSP_USING_ETIMER
-#define BSP_USING_ETIMER_CAPTURE
-#define BSP_USING_ETMR0
-#define BSP_USING_ETIMER0
-#define BSP_USING_ETMR1
-#define BSP_USING_ETIMER1
-#define BSP_USING_ETMR2
-#define BSP_USING_ETIMER2_CAPTURE
-#define BSP_USING_ETMR3
-#define BSP_USING_ETIMER3_CAPTURE
-#define BSP_USING_TMR
-#define BSP_USING_TIMER
-#define BSP_USING_TIMER0
-#define BSP_USING_TIMER1
-#define BSP_USING_TIMER2
-#define BSP_USING_TIMER3
-#define BSP_USING_UART
-#define BSP_USING_UART0
-#define BSP_USING_I2C
-#define BSP_USING_I2C0
-#define BSP_USING_SDH
-#define BSP_USING_SDH0
-#define BSP_USING_SDH1
-#define NU_SDH_HOTPLUG
-#define BSP_USING_CAN
-#define BSP_USING_CAN0
-#define BSP_USING_PWM
-#define BSP_USING_PWM0
-#define BSP_USING_QSPI
-#define BSP_USING_QSPI0
-#define BSP_USING_QSPI1_NONE
-#define BSP_USING_I2S
-#define NU_I2S_DMA_FIFO_SIZE 2048
-#define BSP_USING_WDT
-#define BSP_USING_EBI
-#define BSP_USING_VPOST
-#define LCM_USING_FW070TFT
-#define VPOST_USING_LCD_IDX 3
-#define BSP_LCD_BPP 32
-#define BSP_LCD_WIDTH 800
-#define BSP_LCD_HEIGHT 480
-#define BSP_USING_VPOST_OSD
-#define BSP_USING_USBD
-#define BSP_USING_USBH
-
-/* On-board Peripheral Drivers */
-
-#define BSP_USING_CONSOLE
-#define BOARD_USING_IP101GR
-#define BOARD_USING_NAU8822
-#define BOARD_USING_STORAGE_SDCARD
-#define BOARD_USING_STORAGE_SPIFLASH
-#define BOARD_USING_BUZZER
-#define BOARD_USING_LCM
-#define BOARD_USING_USB0_DEVICE_HOST
-#define BOARD_USING_USB1_HOST
-
-/* Board extended module drivers */
-
-
-#endif

+ 7 - 1
bsp/nuvoton/nk-n9h30/rtconfig.py

@@ -85,4 +85,10 @@ elif PLATFORM == 'armcc':
         CFLAGS += ' -O2'
 
     POST_ACTION = 'fromelf --bin $TARGET --output ' + TARGET_NAME + ' \n'
-    POST_ACTION += 'fromelf -z $TARGET\n'
+    POST_ACTION += 'fromelf -z $TARGET\n'
+def dist_handle(BSP_ROOT, dist_dir):
+    import sys
+    cwd_path = os.getcwd()
+    sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
+    from sdk_dist import dist_do_building
+    dist_do_building(BSP_ROOT, dist_dir)

+ 2 - 0
bsp/nuvoton/nk-rtu980/.config

@@ -974,3 +974,5 @@ CONFIG_BOARD_USING_USB0_DEVICE_HOST=y
 # Board extended module drivers
 #
 CONFIG_BOARD_USING_IP101GR=y
+CONFIG_BOARD_USE_UTEST=y
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.nk-rtu980.test.utest."

+ 0 - 6
bsp/nuvoton/nk-rtu980/Kconfig

@@ -18,12 +18,6 @@ config PKGS_DIR
     option env="PKGS_ROOT"
     default "packages"
 
-config NU_PKGS_DIR
-    string
-    option env="NU_PKGS_ROOT"
-    default "../libraries/nu_packages"
-
 source "$RTT_DIR/Kconfig"
 source "$PKGS_DIR/Kconfig"
-source "$NU_PKGS_DIR/Kconfig"
 source "$BSP_DIR/board/Kconfig"

+ 1 - 0
bsp/nuvoton/nk-rtu980/board/Kconfig

@@ -44,5 +44,6 @@ menu "Hardware Drivers Config"
 
     endmenu
 
+    source "$BSP_DIR/../libraries/nu_packages/Kconfig"
 
 endmenu

+ 0 - 1774
bsp/nuvoton/nk-rtu980/project.uvproj

@@ -1,1774 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
-<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_proj.xsd">
-  <SchemaVersion>1.1</SchemaVersion>
-  <Header>### uVision Project, (C) Keil Software</Header>
-  <Targets>
-    <Target>
-      <TargetName>rtthread</TargetName>
-      <ToolsetNumber>0x4</ToolsetNumber>
-      <ToolsetName>ARM-ADS</ToolsetName>
-      <TargetOption>
-        <TargetCommonOption>
-          <Device>Nuvoton_ARM9_Series</Device>
-          <Vendor>Nuvoton</Vendor>
-          <Cpu />
-          <FlashUtilSpec />
-          <StartupFile />
-          <FlashDriverDll />
-          <DeviceId>0</DeviceId>
-          <RegisterFile />
-          <MemoryEnv />
-          <Cmp />
-          <Asm />
-          <Linker />
-          <OHString />
-          <InfinionOptionDll />
-          <SLE66CMisc />
-          <SLE66AMisc />
-          <SLE66LinkerMisc />
-          <SFDFile />
-          <UseEnv>0</UseEnv>
-          <BinPath />
-          <IncludePath />
-          <LibPath />
-          <RegisterFilePath>Atmel\SAM9260\</RegisterFilePath>
-          <DBRegisterFilePath>Atmel\SAM9260\</DBRegisterFilePath>
-          <TargetStatus>
-            <Error>0</Error>
-            <ExitCodeStop>0</ExitCodeStop>
-            <ButtonStop>0</ButtonStop>
-            <NotGenerated>0</NotGenerated>
-            <InvalidFlash>1</InvalidFlash>
-          </TargetStatus>
-          <OutputDirectory>.\Objects\</OutputDirectory>
-          <OutputName>rtthread</OutputName>
-          <CreateExecutable>1</CreateExecutable>
-          <CreateLib>0</CreateLib>
-          <CreateHexFile>0</CreateHexFile>
-          <DebugInformation>1</DebugInformation>
-          <BrowseInformation>1</BrowseInformation>
-          <ListingPath>.\Listings\</ListingPath>
-          <HexFormatSelection>1</HexFormatSelection>
-          <Merge32K>0</Merge32K>
-          <CreateBatchFile>0</CreateBatchFile>
-          <BeforeCompile>
-            <RunUserProg1>0</RunUserProg1>
-            <RunUserProg2>0</RunUserProg2>
-            <UserProg1Name />
-            <UserProg2Name />
-            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
-            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
-            <nStopU1X>0</nStopU1X>
-            <nStopU2X>0</nStopU2X>
-          </BeforeCompile>
-          <BeforeMake>
-            <RunUserProg1>0</RunUserProg1>
-            <RunUserProg2>0</RunUserProg2>
-            <UserProg1Name />
-            <UserProg2Name />
-            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
-            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
-          </BeforeMake>
-          <AfterMake>
-            <RunUserProg1>0</RunUserProg1>
-            <RunUserProg2>0</RunUserProg2>
-            <UserProg1Name />
-            <UserProg2Name />
-            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
-            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
-          </AfterMake>
-          <SelectedForBatchBuild>0</SelectedForBatchBuild>
-          <SVCSIdString />
-        </TargetCommonOption>
-        <CommonProperty>
-          <UseCPPCompiler>0</UseCPPCompiler>
-          <RVCTCodeConst>0</RVCTCodeConst>
-          <RVCTZI>0</RVCTZI>
-          <RVCTOtherData>0</RVCTOtherData>
-          <ModuleSelection>0</ModuleSelection>
-          <IncludeInBuild>1</IncludeInBuild>
-          <AlwaysBuild>0</AlwaysBuild>
-          <GenerateAssemblyFile>0</GenerateAssemblyFile>
-          <AssembleAssemblyFile>0</AssembleAssemblyFile>
-          <PublicsOnly>0</PublicsOnly>
-          <StopOnExitCode>3</StopOnExitCode>
-          <CustomArgument />
-          <IncludeLibraryModules />
-        </CommonProperty>
-        <DllOption>
-          <SimDllName>SARM.DLL</SimDllName>
-          <SimDllArguments>-cAT91SAM9</SimDllArguments>
-          <SimDlgDll>DARMATS9.DLL</SimDlgDll>
-          <SimDlgDllArguments>-p91SAM9260</SimDlgDllArguments>
-          <TargetDllName>SARM.DLL</TargetDllName>
-          <TargetDllArguments />
-          <TargetDlgDll>TARMATS9.DLL</TargetDlgDll>
-          <TargetDlgDllArguments>-p91SAM9260</TargetDlgDllArguments>
-        </DllOption>
-        <DebugOption>
-          <OPTHX>
-            <HexSelection>1</HexSelection>
-            <HexRangeLowAddress>0</HexRangeLowAddress>
-            <HexRangeHighAddress>0</HexRangeHighAddress>
-            <HexOffset>0</HexOffset>
-            <Oh166RecLen>16</Oh166RecLen>
-          </OPTHX>
-          <Simulator>
-            <UseSimulator>0</UseSimulator>
-            <LoadApplicationAtStartup>1</LoadApplicationAtStartup>
-            <RunToMain>1</RunToMain>
-            <RestoreBreakpoints>1</RestoreBreakpoints>
-            <RestoreWatchpoints>1</RestoreWatchpoints>
-            <RestoreMemoryDisplay>1</RestoreMemoryDisplay>
-            <RestoreFunctions>1</RestoreFunctions>
-            <RestoreToolbox>1</RestoreToolbox>
-            <LimitSpeedToRealTime>0</LimitSpeedToRealTime>
-          </Simulator>
-          <Target>
-            <UseTarget>1</UseTarget>
-            <LoadApplicationAtStartup>0</LoadApplicationAtStartup>
-            <RunToMain>0</RunToMain>
-            <RestoreBreakpoints>1</RestoreBreakpoints>
-            <RestoreWatchpoints>1</RestoreWatchpoints>
-            <RestoreMemoryDisplay>1</RestoreMemoryDisplay>
-            <RestoreFunctions>0</RestoreFunctions>
-            <RestoreToolbox>1</RestoreToolbox>
-            <RestoreTracepoints>1</RestoreTracepoints>
-          </Target>
-          <RunDebugAfterBuild>0</RunDebugAfterBuild>
-          <TargetSelection>6</TargetSelection>
-          <SimDlls>
-            <CpuDll />
-            <CpuDllArguments />
-            <PeripheralDll />
-            <PeripheralDllArguments />
-            <InitializationFile />
-          </SimDlls>
-          <TargetDlls>
-            <CpuDll />
-            <CpuDllArguments />
-            <PeripheralDll />
-            <PeripheralDllArguments />
-            <InitializationFile>..\libraries\nuc980\Script\NUC980xx61.ini</InitializationFile>
-            <Driver>Segger\JLTAgdi.dll</Driver>
-          </TargetDlls>
-        </DebugOption>
-        <Utilities>
-          <Flash1>
-            <UseTargetDll>1</UseTargetDll>
-            <UseExternalTool>0</UseExternalTool>
-            <RunIndependent>0</RunIndependent>
-            <UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
-            <Capability>1</Capability>
-            <DriverSelection>4098</DriverSelection>
-          </Flash1>
-          <bUseTDR>0</bUseTDR>
-          <Flash2>Segger\JLTAgdi.dll</Flash2>
-          <Flash3>"" ()</Flash3>
-          <Flash4 />
-        </Utilities>
-        <TargetArmAds>
-          <ArmAdsMisc>
-            <GenerateListings>0</GenerateListings>
-            <asHll>1</asHll>
-            <asAsm>1</asAsm>
-            <asMacX>1</asMacX>
-            <asSyms>1</asSyms>
-            <asFals>1</asFals>
-            <asDbgD>1</asDbgD>
-            <asForm>1</asForm>
-            <ldLst>0</ldLst>
-            <ldmm>1</ldmm>
-            <ldXref>1</ldXref>
-            <BigEnd>0</BigEnd>
-            <AdsALst>1</AdsALst>
-            <AdsACrf>1</AdsACrf>
-            <AdsANop>0</AdsANop>
-            <AdsANot>0</AdsANot>
-            <AdsLLst>1</AdsLLst>
-            <AdsLmap>1</AdsLmap>
-            <AdsLcgr>1</AdsLcgr>
-            <AdsLsym>1</AdsLsym>
-            <AdsLszi>1</AdsLszi>
-            <AdsLtoi>1</AdsLtoi>
-            <AdsLsun>1</AdsLsun>
-            <AdsLven>1</AdsLven>
-            <AdsLsxf>1</AdsLsxf>
-            <RvctClst>0</RvctClst>
-            <GenPPlst>0</GenPPlst>
-            <AdsCpuType />
-            <RvctDeviceName />
-            <mOS>0</mOS>
-            <uocRom>0</uocRom>
-            <uocRam>0</uocRam>
-            <hadIROM>0</hadIROM>
-            <hadIRAM>0</hadIRAM>
-            <hadXRAM>0</hadXRAM>
-            <uocXRam>0</uocXRam>
-            <RvdsVP>0</RvdsVP>
-            <hadIRAM2>0</hadIRAM2>
-            <hadIROM2>0</hadIROM2>
-            <StupSel>0</StupSel>
-            <useUlib>0</useUlib>
-            <EndSel>0</EndSel>
-            <uLtcg>0</uLtcg>
-            <RoSelD>3</RoSelD>
-            <RwSelD>3</RwSelD>
-            <CodeSel>0</CodeSel>
-            <OptFeed>0</OptFeed>
-            <NoZi1>0</NoZi1>
-            <NoZi2>0</NoZi2>
-            <NoZi3>0</NoZi3>
-            <NoZi4>0</NoZi4>
-            <NoZi5>0</NoZi5>
-            <Ro1Chk>0</Ro1Chk>
-            <Ro2Chk>0</Ro2Chk>
-            <Ro3Chk>0</Ro3Chk>
-            <Ir1Chk>0</Ir1Chk>
-            <Ir2Chk>0</Ir2Chk>
-            <Ra1Chk>0</Ra1Chk>
-            <Ra2Chk>0</Ra2Chk>
-            <Ra3Chk>0</Ra3Chk>
-            <Im1Chk>0</Im1Chk>
-            <Im2Chk>0</Im2Chk>
-            <OnChipMemories>
-              <Ocm1>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm1>
-              <Ocm2>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm2>
-              <Ocm3>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm3>
-              <Ocm4>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm4>
-              <Ocm5>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm5>
-              <Ocm6>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm6>
-              <IRAM>
-                <Type>0</Type>
-                <StartAddress>0x200000</StartAddress>
-                <Size>0x1000</Size>
-              </IRAM>
-              <IROM>
-                <Type>1</Type>
-                <StartAddress>0x100000</StartAddress>
-                <Size>0x8000</Size>
-              </IROM>
-              <XRAM>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </XRAM>
-              <OCR_RVCT1>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT1>
-              <OCR_RVCT2>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT2>
-              <OCR_RVCT3>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT3>
-              <OCR_RVCT4>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT4>
-              <OCR_RVCT5>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT5>
-              <OCR_RVCT6>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT6>
-              <OCR_RVCT7>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT7>
-              <OCR_RVCT8>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT8>
-              <OCR_RVCT9>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT9>
-              <OCR_RVCT10>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT10>
-            </OnChipMemories>
-            <RvctStartVector />
-          </ArmAdsMisc>
-          <Cads>
-            <interw>1</interw>
-            <Optim>3</Optim>
-            <oTime>0</oTime>
-            <SplitLS>0</SplitLS>
-            <OneElfS>0</OneElfS>
-            <Strict>0</Strict>
-            <EnumInt>0</EnumInt>
-            <PlainCh>0</PlainCh>
-            <Ropi>0</Ropi>
-            <Rwpi>0</Rwpi>
-            <wLevel>2</wLevel>
-            <uThumb>0</uThumb>
-            <uSurpInc>0</uSurpInc>
-            <VariousControls>
-              <MiscControls>--c99</MiscControls>
-              <Define>__RTTHREAD__, RT_USING_ARM_LIBC, __CLK_TCK=RT_TICK_PER_SECOND</Define>
-              <Undefine />
-              <IncludePath>applications;.;board;..\..\..\components\libc\compilers\common;..\..\..\components\libc\compilers\common\nogcc;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\arm926;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\hwcrypto;.;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\spi;..\..\..\components\drivers\include;..\..\..\components\drivers\spi\sfud\inc;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\libraries\nuc980\rtt_port;..\..\..\components\dfs\include;..\..\..\components\dfs\filesystems\devfs;..\..\..\components\dfs\filesystems\elmfat;..\..\..\components\finsh;.;..\..\..\include;..\libraries\nuc980\Driver\Include;..\..\..\components\net\lwip-2.1.2\src;..\..\..\components\net\lwip-2.1.2\src\include;..\..\..\components\net\lwip-2.1.2\src\arch\include;..\..\..\components\net\lwip-2.1.2\src\include\netif;..\libraries\nu_packages\Demo;..\libraries\nuc980\UsbHostLib\inc;..\libraries\nu_packages\NuUtils\inc;..\..\..\components\libc\posix\io;..\..\..\components\libc\posix\io\poll;..\..\..\components\libc\posix\ipc;..\..\..\components\drivers\usb\usbdevice;..\..\..\components\drivers\usb\usbhost;..\..\..\components\drivers\usb\usbhost\class;..\..\..\components\drivers\usb\usbhost\core;..\..\..\components\drivers\usb\usbhost\include;..\..\..\components\drivers\include;..\..\..\components\net\netdev\include;..\..\..\components\net\sal_socket\include;..\..\..\components\net\sal_socket\include\socket;..\..\..\components\net\sal_socket\impl;..\..\..\components\net\sal_socket\include\dfs_net;..\..\..\components\net\sal_socket\include\socket\sys_socket;..\..\..\components\utilities\utest;..\..\..\examples\utest\testcases\kernel</IncludePath>
-            </VariousControls>
-          </Cads>
-          <Aads>
-            <interw>1</interw>
-            <Ropi>0</Ropi>
-            <Rwpi>0</Rwpi>
-            <thumb>0</thumb>
-            <SplitLS>0</SplitLS>
-            <SwStkChk>0</SwStkChk>
-            <NoWarn>0</NoWarn>
-            <uSurpInc>0</uSurpInc>
-            <VariousControls>
-              <MiscControls />
-              <Define />
-              <Undefine />
-              <IncludePath />
-            </VariousControls>
-          </Aads>
-          <LDads>
-            <umfTarg>0</umfTarg>
-            <Ropi>0</Ropi>
-            <Rwpi>0</Rwpi>
-            <noStLib>0</noStLib>
-            <RepFail>1</RepFail>
-            <useFile>0</useFile>
-            <TextAddressRange>0x20000000</TextAddressRange>
-            <DataAddressRange>0x20800000</DataAddressRange>
-            <ScatterFile>.\linking_scripts\nuc980.sct</ScatterFile>
-            <IncludeLibs />
-            <IncludeLibsPath />
-            <Misc />
-            <LinkerInputFile />
-            <DisabledWarnings />
-          </LDads>
-        </TargetArmAds>
-      </TargetOption>
-      <Groups>
-        <Group>
-          <GroupName>Applications</GroupName>
-          <Files>
-            <File>
-              <FileName>mnt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>applications\mnt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>main.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>applications\main.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>board</GroupName>
-          <Files>
-            <File>
-              <FileName>board_dev.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>board\board_dev.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_pin_init.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>board\nu_pin_init.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Compiler</GroupName>
-          <Files>
-            <File>
-              <FileName>libc_syms.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\armlibc\libc_syms.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>syscall_mem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\armlibc\syscall_mem.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>syscalls.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\armlibc\syscalls.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>stdlib.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\common\stdlib.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>time.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\common\time.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>CPU</GroupName>
-          <Files>
-            <File>
-              <FileName>div0.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\div0.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>showmem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\showmem.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>backtrace.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\backtrace.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>cpuport.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\cpuport.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\context_rvds.S</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>start_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\start_rvds.S</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>stack.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\stack.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>machine.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\machine.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>trap.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\trap.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mmu.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\mmu.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>DeviceDrivers</GroupName>
-          <Files>
-            <File>
-              <FileName>can.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\can\can.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>cputime.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\cputime\cputime.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hw_symmetric.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwcrypto\hw_symmetric.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hwcrypto.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwcrypto\hwcrypto.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hw_rng.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwcrypto\hw_rng.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hw_hash.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwcrypto\hw_hash.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hwtimer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwtimer\hwtimer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>i2c_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\i2c\i2c_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>i2c_dev.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\i2c\i2c_dev.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>i2c-bit-ops.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\i2c\i2c-bit-ops.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>adc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\misc\adc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>pin.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\misc\pin.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>serial.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\serial\serial.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sfud.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\sfud\src\sfud.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>spi_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\spi_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sfud_sfdp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>spi_dev.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\spi_dev.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>qspi_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\qspi_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>spi_flash_sfud.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\spi_flash_sfud.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ringbuffer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\ringbuffer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dataqueue.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\dataqueue.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>workqueue.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\workqueue.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>waitqueue.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\waitqueue.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>pipe.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\pipe.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>completion.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\completion.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ringblk_buf.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\ringblk_buf.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>watchdog.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\watchdog\watchdog.c</FilePath>
-            </File>
-          </Files>
-          <GroupOption>
-            <GroupArmAds>
-              <Cads>
-                <VariousControls>
-                  <MiscControls> --c99</MiscControls>
-                  <Define> </Define>
-                  <Undefine> </Undefine>
-                  <IncludePath> </IncludePath>
-                </VariousControls>
-              </Cads>
-            </GroupArmAds>
-          </GroupOption>
-        </Group>
-        <Group>
-          <GroupName>Drivers</GroupName>
-          <Files>
-            <File>
-              <FileName>drv_uart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_uart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_pwm.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_pwm.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_ebi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_ebi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_i2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_i2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_rtc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_rtc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_common.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_common.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_usbd.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_usbd.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_crypto.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_crypto.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_usbhost.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_usbhost.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_gpio.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_gpio.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_softi2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_softi2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_spi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_spi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_pdma.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_pdma.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_sdh.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_sdh.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_emac.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_emac.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_etimer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_etimer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_wdt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_wdt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_scuart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_scuart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_i2s.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_i2s.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_sys.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_sys.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_systick.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_systick.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_etimer_capture.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_etimer_capture.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_adc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_adc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_can.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_can.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_qspi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_qspi.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Filesystem</GroupName>
-          <Files>
-            <File>
-              <FileName>dfs_posix.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_posix.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs_fs.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_fs.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs_file.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_file.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>devfs.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs_elm.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ffunicode.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\filesystems\elmfat\ffunicode.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ff.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Finsh</GroupName>
-          <Files>
-            <File>
-              <FileName>shell.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\shell.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>msh.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\msh.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>msh_file.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\msh_file.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>cmd.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\cmd.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Kernel</GroupName>
-          <Files>
-            <File>
-              <FileName>irq.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\irq.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>device.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\device.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>clock.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\clock.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>object.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\object.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>signal.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\signal.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>memheap.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\memheap.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>idle.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\idle.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mempool.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\mempool.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ipc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\ipc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>thread.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\thread.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>kservice.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\kservice.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>components.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\components.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>scheduler.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\scheduler.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\mem.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>timer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\timer.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Libraries</GroupName>
-          <Files>
-            <File>
-              <FileName>nu_sys.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_sys.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_rtc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_rtc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_spi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_spi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_etimer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_etimer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_ebi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_ebi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_sdh.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_sdh.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_uart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_uart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_wdt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_wdt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_i2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_i2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_wwdt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_wwdt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_gpio.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_gpio.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_i2s.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_i2s.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_can.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_can.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_emac.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_emac.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_crypto.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_crypto.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_pdma.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_pdma.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_usbd.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_usbd.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_cap.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_cap.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_scuart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_scuart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_qspi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_qspi.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>lwIP</GroupName>
-          <Files>
-            <File>
-              <FileName>netdb.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\netdb.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ip.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ip.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>autoip.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\autoip.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ethernet.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\netif\ethernet.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>netif.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\netif.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sys.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\sys.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sockets.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\sockets.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>altcp_alloc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\altcp_alloc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>netifapi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\netifapi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>tcpip.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\tcpip.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ip4_addr.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\ip4_addr.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dhcp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\dhcp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>init.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\init.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ethernetif.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\netif\ethernetif.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>etharp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\etharp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>memp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\memp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ip4.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\ip4.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>netbuf.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\netbuf.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>raw.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\raw.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ip4_frag.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\ip4_frag.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>tcp_out.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\tcp_out.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>lowpan6.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\netif\lowpan6.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>icmp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\icmp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>api_lib.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\api_lib.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>inet_chksum.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\inet_chksum.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>stats.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\stats.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>err.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\err.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>altcp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\altcp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>tcp_in.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\tcp_in.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dns.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\dns.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sys_arch.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\arch\sys_arch.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>timeouts.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\timeouts.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>igmp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\igmp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>udp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\udp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>altcp_tcp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\altcp_tcp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>pbuf.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\pbuf.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>def.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\def.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>api_msg.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\api_msg.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ping.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\apps\ping\ping.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>if_api.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\if_api.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>tcp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\tcp.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>nu_pkgs_demo</GroupName>
-          <Files>
-            <File>
-              <FileName>usbd_cdc_vcom_echo.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nu_packages\Demo\usbd_cdc_vcom_echo.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>slcd_show_tick.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nu_packages\Demo\slcd_show_tick.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbd_hid_dance_mouse.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nu_packages\Demo\usbd_hid_dance_mouse.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>nuc980_usbhostlib</GroupName>
-          <Files>
-            <File>
-              <FileName>support.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\support.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ehci.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\ehci.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ehci_iso.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\ehci_iso.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mem_alloc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\mem_alloc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usb_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\usb_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ohci.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\ohci.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>POSIX</GroupName>
-          <Files>
-            <File>
-              <FileName>select.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\posix\io\select.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>poll.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\posix\io\poll\poll.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>rt_usbd</GroupName>
-          <Files>
-            <File>
-              <FileName>cdc_vcom.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\class\cdc_vcom.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbdevice_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\core\usbdevice_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbdevice.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\core\usbdevice.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mstorage.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\class\mstorage.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>rt_usbh</GroupName>
-          <Files>
-            <File>
-              <FileName>hub.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\core\hub.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbhost.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\core\usbhost.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mass.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\class\mass.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbhost_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\core\usbhost_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>udisk.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\class\udisk.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>driver.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\core\driver.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>SAL</GroupName>
-          <Files>
-            <File>
-              <FileName>netdev.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\netdev\src\netdev.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>netdev_ipaddr.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\netdev\src\netdev_ipaddr.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>net_netdb.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\sal_socket\socket\net_netdb.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>af_inet_lwip.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\sal_socket\impl\af_inet_lwip.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs_net.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\sal_socket\dfs_net\dfs_net.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sal_socket.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\sal_socket\src\sal_socket.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>net_sockets.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\sal_socket\socket\net_sockets.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>UTest</GroupName>
-          <Files>
-            <File>
-              <FileName>utest.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\utilities\utest\utest.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-      </Groups>
-    </Target>
-  </Targets>
-</Project>

+ 0 - 1766
bsp/nuvoton/nk-rtu980/project.uvprojx

@@ -1,1766 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
-<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
-  <SchemaVersion>2.1</SchemaVersion>
-  <Header>### uVision Project, (C) Keil Software</Header>
-  <Targets>
-    <Target>
-      <TargetName>rtthread</TargetName>
-      <ToolsetNumber>0x4</ToolsetNumber>
-      <ToolsetName>ARM-ADS</ToolsetName>
-      <uAC6>0</uAC6>
-      <TargetOption>
-        <TargetCommonOption>
-          <Device>Nuvoton_ARM9_Series</Device>
-          <Vendor>Nuvoton</Vendor>
-          <Cpu />
-          <FlashUtilSpec />
-          <StartupFile />
-          <FlashDriverDll />
-          <DeviceId>0</DeviceId>
-          <RegisterFile />
-          <MemoryEnv />
-          <Cmp />
-          <Asm />
-          <Linker />
-          <OHString />
-          <InfinionOptionDll />
-          <SLE66CMisc />
-          <SLE66AMisc />
-          <SLE66LinkerMisc />
-          <SFDFile />
-          <bCustSvd>0</bCustSvd>
-          <UseEnv>0</UseEnv>
-          <BinPath />
-          <IncludePath />
-          <LibPath />
-          <RegisterFilePath>Atmel\SAM9260\</RegisterFilePath>
-          <DBRegisterFilePath>Atmel\SAM9260\</DBRegisterFilePath>
-          <TargetStatus>
-            <Error>0</Error>
-            <ExitCodeStop>0</ExitCodeStop>
-            <ButtonStop>0</ButtonStop>
-            <NotGenerated>0</NotGenerated>
-            <InvalidFlash>1</InvalidFlash>
-          </TargetStatus>
-          <OutputDirectory>.\build\keil5\</OutputDirectory>
-          <OutputName>rtthread</OutputName>
-          <CreateExecutable>1</CreateExecutable>
-          <CreateLib>0</CreateLib>
-          <CreateHexFile>1</CreateHexFile>
-          <DebugInformation>1</DebugInformation>
-          <BrowseInformation>1</BrowseInformation>
-          <ListingPath>.\build\keil5\</ListingPath>
-          <HexFormatSelection>1</HexFormatSelection>
-          <Merge32K>0</Merge32K>
-          <CreateBatchFile>0</CreateBatchFile>
-          <BeforeCompile>
-            <RunUserProg1>0</RunUserProg1>
-            <RunUserProg2>0</RunUserProg2>
-            <UserProg1Name />
-            <UserProg2Name />
-            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
-            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
-            <nStopU1X>0</nStopU1X>
-            <nStopU2X>0</nStopU2X>
-          </BeforeCompile>
-          <BeforeMake>
-            <RunUserProg1>0</RunUserProg1>
-            <RunUserProg2>0</RunUserProg2>
-            <UserProg1Name />
-            <UserProg2Name />
-            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
-            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
-            <nStopB1X>0</nStopB1X>
-            <nStopB2X>0</nStopB2X>
-          </BeforeMake>
-          <AfterMake>
-            <RunUserProg1>1</RunUserProg1>
-            <RunUserProg2>0</RunUserProg2>
-            <UserProg1Name>fromelf.exe --bin --output "$L@L.bin" "$L@L.axf"</UserProg1Name>
-            <UserProg2Name />
-            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
-            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
-            <nStopA1X>0</nStopA1X>
-            <nStopA2X>0</nStopA2X>
-          </AfterMake>
-          <SelectedForBatchBuild>0</SelectedForBatchBuild>
-          <SVCSIdString />
-        </TargetCommonOption>
-        <CommonProperty>
-          <UseCPPCompiler>0</UseCPPCompiler>
-          <RVCTCodeConst>0</RVCTCodeConst>
-          <RVCTZI>0</RVCTZI>
-          <RVCTOtherData>0</RVCTOtherData>
-          <ModuleSelection>0</ModuleSelection>
-          <IncludeInBuild>1</IncludeInBuild>
-          <AlwaysBuild>0</AlwaysBuild>
-          <GenerateAssemblyFile>0</GenerateAssemblyFile>
-          <AssembleAssemblyFile>0</AssembleAssemblyFile>
-          <PublicsOnly>0</PublicsOnly>
-          <StopOnExitCode>3</StopOnExitCode>
-          <CustomArgument />
-          <IncludeLibraryModules />
-          <ComprImg>1</ComprImg>
-        </CommonProperty>
-        <DllOption>
-          <SimDllName>SARM.DLL</SimDllName>
-          <SimDllArguments>-cAT91SAM9260</SimDllArguments>
-          <SimDlgDll>DARMATS9.DLL</SimDlgDll>
-          <SimDlgDllArguments>-p91SAM9260</SimDlgDllArguments>
-          <TargetDllName>SARM.DLL</TargetDllName>
-          <TargetDllArguments />
-          <TargetDlgDll>TARMATS9.DLL</TargetDlgDll>
-          <TargetDlgDllArguments>-p91SAM9260</TargetDlgDllArguments>
-        </DllOption>
-        <DebugOption>
-          <OPTHX>
-            <HexSelection>1</HexSelection>
-            <HexRangeLowAddress>0</HexRangeLowAddress>
-            <HexRangeHighAddress>0</HexRangeHighAddress>
-            <HexOffset>0</HexOffset>
-            <Oh166RecLen>16</Oh166RecLen>
-          </OPTHX>
-        </DebugOption>
-        <Utilities>
-          <Flash1>
-            <UseTargetDll>1</UseTargetDll>
-            <UseExternalTool>0</UseExternalTool>
-            <RunIndependent>0</RunIndependent>
-            <UpdateFlashBeforeDebugging>0</UpdateFlashBeforeDebugging>
-            <Capability>1</Capability>
-            <DriverSelection>4098</DriverSelection>
-          </Flash1>
-          <bUseTDR>0</bUseTDR>
-          <Flash2>Segger\JLTAgdi.dll</Flash2>
-          <Flash3>"" ()</Flash3>
-          <Flash4 />
-          <pFcarmOut />
-          <pFcarmGrp />
-          <pFcArmRoot />
-          <FcArmLst>0</FcArmLst>
-        </Utilities>
-        <TargetArmAds>
-          <ArmAdsMisc>
-            <GenerateListings>0</GenerateListings>
-            <asHll>1</asHll>
-            <asAsm>1</asAsm>
-            <asMacX>1</asMacX>
-            <asSyms>1</asSyms>
-            <asFals>1</asFals>
-            <asDbgD>1</asDbgD>
-            <asForm>1</asForm>
-            <ldLst>0</ldLst>
-            <ldmm>1</ldmm>
-            <ldXref>1</ldXref>
-            <BigEnd>0</BigEnd>
-            <AdsALst>1</AdsALst>
-            <AdsACrf>1</AdsACrf>
-            <AdsANop>0</AdsANop>
-            <AdsANot>0</AdsANot>
-            <AdsLLst>1</AdsLLst>
-            <AdsLmap>1</AdsLmap>
-            <AdsLcgr>1</AdsLcgr>
-            <AdsLsym>1</AdsLsym>
-            <AdsLszi>1</AdsLszi>
-            <AdsLtoi>1</AdsLtoi>
-            <AdsLsun>1</AdsLsun>
-            <AdsLven>1</AdsLven>
-            <AdsLsxf>1</AdsLsxf>
-            <RvctClst>0</RvctClst>
-            <GenPPlst>0</GenPPlst>
-            <AdsCpuType>ARM926EJ-S</AdsCpuType>
-            <RvctDeviceName />
-            <mOS>0</mOS>
-            <uocRom>0</uocRom>
-            <uocRam>0</uocRam>
-            <hadIROM>1</hadIROM>
-            <hadIRAM>1</hadIRAM>
-            <hadXRAM>0</hadXRAM>
-            <uocXRam>0</uocXRam>
-            <RvdsVP>0</RvdsVP>
-            <RvdsMve>0</RvdsMve>
-            <hadIRAM2>1</hadIRAM2>
-            <hadIROM2>0</hadIROM2>
-            <StupSel>8</StupSel>
-            <useUlib>0</useUlib>
-            <EndSel>0</EndSel>
-            <uLtcg>0</uLtcg>
-            <nSecure>0</nSecure>
-            <RoSelD>3</RoSelD>
-            <RwSelD>3</RwSelD>
-            <CodeSel>0</CodeSel>
-            <OptFeed>0</OptFeed>
-            <NoZi1>0</NoZi1>
-            <NoZi2>0</NoZi2>
-            <NoZi3>0</NoZi3>
-            <NoZi4>0</NoZi4>
-            <NoZi5>0</NoZi5>
-            <Ro1Chk>0</Ro1Chk>
-            <Ro2Chk>0</Ro2Chk>
-            <Ro3Chk>0</Ro3Chk>
-            <Ir1Chk>0</Ir1Chk>
-            <Ir2Chk>0</Ir2Chk>
-            <Ra1Chk>0</Ra1Chk>
-            <Ra2Chk>0</Ra2Chk>
-            <Ra3Chk>0</Ra3Chk>
-            <Im1Chk>0</Im1Chk>
-            <Im2Chk>0</Im2Chk>
-            <OnChipMemories>
-              <Ocm1>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm1>
-              <Ocm2>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm2>
-              <Ocm3>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm3>
-              <Ocm4>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm4>
-              <Ocm5>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm5>
-              <Ocm6>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm6>
-              <IRAM>
-                <Type>0</Type>
-                <StartAddress>0x200000</StartAddress>
-                <Size>0x1000</Size>
-              </IRAM>
-              <IROM>
-                <Type>1</Type>
-                <StartAddress>0x100000</StartAddress>
-                <Size>0x8000</Size>
-              </IROM>
-              <XRAM>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </XRAM>
-              <OCR_RVCT1>
-                <Type>1</Type>
-                <StartAddress>0x20000000</StartAddress>
-                <Size>0x800000</Size>
-              </OCR_RVCT1>
-              <OCR_RVCT2>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT2>
-              <OCR_RVCT3>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT3>
-              <OCR_RVCT4>
-                <Type>1</Type>
-                <StartAddress>0x100000</StartAddress>
-                <Size>0x8000</Size>
-              </OCR_RVCT4>
-              <OCR_RVCT5>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT5>
-              <OCR_RVCT6>
-                <Type>0</Type>
-                <StartAddress>0x20800000</StartAddress>
-                <Size>0x1800000</Size>
-              </OCR_RVCT6>
-              <OCR_RVCT7>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT7>
-              <OCR_RVCT8>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT8>
-              <OCR_RVCT9>
-                <Type>0</Type>
-                <StartAddress>0x200000</StartAddress>
-                <Size>0x1000</Size>
-              </OCR_RVCT9>
-              <OCR_RVCT10>
-                <Type>0</Type>
-                <StartAddress>0x300000</StartAddress>
-                <Size>0x1000</Size>
-              </OCR_RVCT10>
-            </OnChipMemories>
-            <RvctStartVector />
-          </ArmAdsMisc>
-          <Cads>
-            <interw>1</interw>
-            <Optim>1</Optim>
-            <oTime>0</oTime>
-            <SplitLS>0</SplitLS>
-            <OneElfS>0</OneElfS>
-            <Strict>0</Strict>
-            <EnumInt>0</EnumInt>
-            <PlainCh>0</PlainCh>
-            <Ropi>0</Ropi>
-            <Rwpi>0</Rwpi>
-            <wLevel>2</wLevel>
-            <uThumb>0</uThumb>
-            <uSurpInc>0</uSurpInc>
-            <uC99>0</uC99>
-            <uGnu>0</uGnu>
-            <useXO>0</useXO>
-            <v6Lang>1</v6Lang>
-            <v6LangP>1</v6LangP>
-            <vShortEn>1</vShortEn>
-            <vShortWch>1</vShortWch>
-            <v6Lto>0</v6Lto>
-            <v6WtE>0</v6WtE>
-            <v6Rtti>0</v6Rtti>
-            <VariousControls>
-              <MiscControls>--c99</MiscControls>
-              <Define>__RTTHREAD__, RT_USING_ARM_LIBC, __CLK_TCK=RT_TICK_PER_SECOND</Define>
-              <Undefine />
-              <IncludePath>applications;.;board;..\..\..\components\libc\compilers\common;..\..\..\components\libc\compilers\common\nogcc;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\arm926;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\hwcrypto;.;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\spi;..\..\..\components\drivers\include;..\..\..\components\drivers\spi\sfud\inc;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\libraries\nuc980\rtt_port;..\..\..\components\dfs\include;..\..\..\components\dfs\filesystems\devfs;..\..\..\components\dfs\filesystems\elmfat;..\..\..\components\finsh;.;..\..\..\include;..\libraries\nuc980\Driver\Include;..\..\..\components\net\lwip-2.1.2\src;..\..\..\components\net\lwip-2.1.2\src\include;..\..\..\components\net\lwip-2.1.2\src\arch\include;..\..\..\components\net\lwip-2.1.2\src\include\netif;..\libraries\nu_packages\Demo;..\libraries\nuc980\UsbHostLib\inc;..\libraries\nu_packages\NuUtils\inc;..\..\..\components\libc\posix\io;..\..\..\components\libc\posix\io\poll;..\..\..\components\libc\posix\ipc;..\..\..\components\drivers\usb\usbdevice;..\..\..\components\drivers\usb\usbhost;..\..\..\components\drivers\usb\usbhost\class;..\..\..\components\drivers\usb\usbhost\core;..\..\..\components\drivers\usb\usbhost\include;..\..\..\components\drivers\include;..\..\..\components\net\netdev\include;..\..\..\components\net\sal_socket\include;..\..\..\components\net\sal_socket\include\socket;..\..\..\components\net\sal_socket\impl;..\..\..\components\net\sal_socket\include\dfs_net;..\..\..\components\net\sal_socket\include\socket\sys_socket;..\..\..\components\utilities\utest;..\..\..\examples\utest\testcases\kernel</IncludePath>
-            </VariousControls>
-          </Cads>
-          <Aads>
-            <interw>1</interw>
-            <Ropi>0</Ropi>
-            <Rwpi>0</Rwpi>
-            <thumb>0</thumb>
-            <SplitLS>0</SplitLS>
-            <SwStkChk>0</SwStkChk>
-            <NoWarn>0</NoWarn>
-            <uSurpInc>0</uSurpInc>
-            <useXO>0</useXO>
-            <uClangAs>0</uClangAs>
-            <VariousControls>
-              <MiscControls />
-              <Define />
-              <Undefine />
-              <IncludePath />
-            </VariousControls>
-          </Aads>
-          <LDads>
-            <umfTarg>0</umfTarg>
-            <Ropi>0</Ropi>
-            <Rwpi>0</Rwpi>
-            <noStLib>0</noStLib>
-            <RepFail>1</RepFail>
-            <useFile>0</useFile>
-            <TextAddressRange>0x20000000</TextAddressRange>
-            <DataAddressRange>0x20800000</DataAddressRange>
-            <pXoBase />
-            <ScatterFile>.\linking_scripts\nuc980.sct</ScatterFile>
-            <IncludeLibs />
-            <IncludeLibsPath />
-            <Misc />
-            <LinkerInputFile />
-            <DisabledWarnings />
-          </LDads>
-        </TargetArmAds>
-      </TargetOption>
-      <Groups>
-        <Group>
-          <GroupName>Applications</GroupName>
-          <Files>
-            <File>
-              <FileName>main.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>applications\main.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mnt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>applications\mnt.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>board</GroupName>
-          <Files>
-            <File>
-              <FileName>nu_pin_init.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>board\nu_pin_init.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>board_dev.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>board\board_dev.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Compiler</GroupName>
-          <Files>
-            <File>
-              <FileName>syscalls.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\armlibc\syscalls.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>libc_syms.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\armlibc\libc_syms.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>syscall_mem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\armlibc\syscall_mem.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>stdlib.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\common\stdlib.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>time.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\common\time.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>CPU</GroupName>
-          <Files>
-            <File>
-              <FileName>showmem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\showmem.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>div0.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\div0.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>backtrace.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\backtrace.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>start_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\start_rvds.S</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>cpuport.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\cpuport.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>stack.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\stack.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\context_rvds.S</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>trap.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\trap.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>machine.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\machine.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mmu.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\arm926\mmu.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>DeviceDrivers</GroupName>
-          <Files>
-            <File>
-              <FileName>can.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\can\can.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>cputime.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\cputime\cputime.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hw_symmetric.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwcrypto\hw_symmetric.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hwcrypto.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwcrypto\hwcrypto.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hw_rng.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwcrypto\hw_rng.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hw_hash.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwcrypto\hw_hash.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hwtimer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwtimer\hwtimer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>i2c_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\i2c\i2c_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>i2c_dev.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\i2c\i2c_dev.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>i2c-bit-ops.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\i2c\i2c-bit-ops.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>adc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\misc\adc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>pin.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\misc\pin.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>serial.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\serial\serial.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sfud.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\sfud\src\sfud.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>spi_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\spi_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sfud_sfdp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\sfud\src\sfud_sfdp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>spi_dev.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\spi_dev.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>qspi_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\qspi_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>spi_flash_sfud.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\spi\spi_flash_sfud.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>pipe.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\pipe.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dataqueue.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\dataqueue.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ringblk_buf.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\ringblk_buf.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>completion.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\completion.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ringbuffer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\ringbuffer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>waitqueue.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\waitqueue.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>workqueue.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\workqueue.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>watchdog.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\watchdog\watchdog.c</FilePath>
-            </File>
-          </Files>
-          <GroupOption>
-            <GroupArmAds>
-              <Cads>
-                <VariousControls>
-                  <MiscControls> --c99</MiscControls>
-                  <Define> </Define>
-                  <Undefine> </Undefine>
-                  <IncludePath> </IncludePath>
-                </VariousControls>
-              </Cads>
-            </GroupArmAds>
-          </GroupOption>
-        </Group>
-        <Group>
-          <GroupName>Drivers</GroupName>
-          <Files>
-            <File>
-              <FileName>drv_usbd.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_usbd.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_etimer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_etimer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_gpio.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_gpio.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_adc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_adc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_spi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_spi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_sdh.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_sdh.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_crypto.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_crypto.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_can.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_can.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_ebi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_ebi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_sys.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_sys.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_qspi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_qspi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_scuart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_scuart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_uart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_uart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_common.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_common.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_emac.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_emac.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_softi2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_softi2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_i2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_i2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_usbhost.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_usbhost.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_etimer_capture.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_etimer_capture.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_wdt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_wdt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_pdma.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_pdma.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_systick.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_systick.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_i2s.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_i2s.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_rtc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_rtc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_pwm.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\rtt_port\drv_pwm.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Filesystem</GroupName>
-          <Files>
-            <File>
-              <FileName>dfs_posix.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_posix.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs_fs.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_fs.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs_file.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_file.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>devfs.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ffunicode.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\filesystems\elmfat\ffunicode.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ff.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\filesystems\elmfat\ff.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs_elm.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\filesystems\elmfat\dfs_elm.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Finsh</GroupName>
-          <Files>
-            <File>
-              <FileName>shell.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\shell.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>msh.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\msh.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>msh_file.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\msh_file.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>cmd.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\cmd.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Kernel</GroupName>
-          <Files>
-            <File>
-              <FileName>thread.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\thread.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>idle.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\idle.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ipc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\ipc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>timer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\timer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>clock.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\clock.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>signal.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\signal.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mempool.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\mempool.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>kservice.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\kservice.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>device.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\device.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>scheduler.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\scheduler.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>components.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\components.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>irq.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\irq.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\mem.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>memheap.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\memheap.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>object.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\object.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Libraries</GroupName>
-          <Files>
-            <File>
-              <FileName>nu_wdt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_wdt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_rtc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_rtc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_crypto.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_crypto.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_pdma.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_pdma.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_uart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_uart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_qspi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_qspi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_sdh.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_sdh.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_scuart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_scuart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_sys.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_sys.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_can.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_can.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_usbd.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_usbd.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_cap.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_cap.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_i2s.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_i2s.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_ebi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_ebi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_gpio.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_gpio.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_wwdt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_wwdt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_i2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_i2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_spi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_spi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_emac.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_emac.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_etimer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\Driver\Source\nu_etimer.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>lwIP</GroupName>
-          <Files>
-            <File>
-              <FileName>netdb.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\netdb.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ip.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ip.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>autoip.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\autoip.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ethernet.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\netif\ethernet.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>netif.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\netif.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sys.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\sys.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sockets.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\sockets.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>altcp_alloc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\altcp_alloc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>netifapi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\netifapi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>tcpip.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\tcpip.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ip4_addr.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\ip4_addr.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dhcp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\dhcp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>init.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\init.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ethernetif.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\netif\ethernetif.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>etharp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\etharp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>memp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\memp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ip4.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\ip4.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>netbuf.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\netbuf.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>raw.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\raw.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ip4_frag.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\ip4_frag.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>tcp_out.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\tcp_out.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>lowpan6.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\netif\lowpan6.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>icmp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\icmp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>api_lib.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\api_lib.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>inet_chksum.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\inet_chksum.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>stats.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\stats.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>err.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\err.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>altcp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\altcp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>tcp_in.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\tcp_in.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dns.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\dns.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sys_arch.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\arch\sys_arch.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>timeouts.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\timeouts.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>igmp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\ipv4\igmp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>udp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\udp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>altcp_tcp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\altcp_tcp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>pbuf.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\pbuf.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>def.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\def.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>api_msg.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\api_msg.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ping.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\apps\ping\ping.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>if_api.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\api\if_api.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>tcp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\lwip-2.1.2\src\core\tcp.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>nu_pkgs_demo</GroupName>
-          <Files>
-            <File>
-              <FileName>usbd_cdc_vcom_echo.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nu_packages\Demo\usbd_cdc_vcom_echo.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>slcd_show_tick.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nu_packages\Demo\slcd_show_tick.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbd_hid_dance_mouse.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nu_packages\Demo\usbd_hid_dance_mouse.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>nuc980_usbhostlib</GroupName>
-          <Files>
-            <File>
-              <FileName>ehci.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\ehci.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ehci_iso.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\ehci_iso.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mem_alloc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\mem_alloc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ohci.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\ohci.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>support.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\support.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usb_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nuc980\UsbHostLib\src\usb_core.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>POSIX</GroupName>
-          <Files>
-            <File>
-              <FileName>select.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\posix\io\select.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>poll.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\posix\io\poll\poll.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>rt_usbd</GroupName>
-          <Files>
-            <File>
-              <FileName>usbdevice_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\core\usbdevice_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mstorage.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\class\mstorage.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbdevice.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\core\usbdevice.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>cdc_vcom.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\class\cdc_vcom.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>rt_usbh</GroupName>
-          <Files>
-            <File>
-              <FileName>hub.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\core\hub.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbhost.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\core\usbhost.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbhost_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\core\usbhost_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>udisk.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\class\udisk.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mass.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\class\mass.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>driver.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbhost\core\driver.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>SAL</GroupName>
-          <Files>
-            <File>
-              <FileName>netdev.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\netdev\src\netdev.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>netdev_ipaddr.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\netdev\src\netdev_ipaddr.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>net_netdb.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\sal_socket\socket\net_netdb.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>af_inet_lwip.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\sal_socket\impl\af_inet_lwip.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>sal_socket.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\sal_socket\src\sal_socket.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>net_sockets.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\sal_socket\socket\net_sockets.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs_net.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\net\sal_socket\dfs_net\dfs_net.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>UTest</GroupName>
-          <Files>
-            <File>
-              <FileName>utest.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\utilities\utest\utest.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-      </Groups>
-    </Target>
-  </Targets>
-  <RTE>
-    <apis />
-    <components />
-    <files />
-  </RTE>
-</Project>

+ 0 - 431
bsp/nuvoton/nk-rtu980/rtconfig.h

@@ -1,431 +0,0 @@
-#ifndef RT_CONFIG_H__
-#define RT_CONFIG_H__
-
-/* Automatically generated file; DO NOT EDIT. */
-/* RT-Thread Configuration */
-
-/* RT-Thread Kernel */
-
-#define RT_NAME_MAX 16
-#define RT_ALIGN_SIZE 4
-#define RT_THREAD_PRIORITY_32
-#define RT_THREAD_PRIORITY_MAX 32
-#define RT_TICK_PER_SECOND 1000
-#define RT_USING_OVERFLOW_CHECK
-#define RT_USING_HOOK
-#define RT_HOOK_USING_FUNC_PTR
-#define RT_USING_IDLE_HOOK
-#define RT_IDLE_HOOK_LIST_SIZE 4
-#define IDLE_THREAD_STACK_SIZE 2048
-
-/* kservice optimization */
-
-#define RT_DEBUG
-#define RT_DEBUG_COLOR
-
-/* Inter-Thread communication */
-
-#define RT_USING_SEMAPHORE
-#define RT_USING_MUTEX
-#define RT_USING_EVENT
-#define RT_USING_MAILBOX
-#define RT_USING_MESSAGEQUEUE
-#define RT_USING_SIGNALS
-
-/* Memory Management */
-
-#define RT_USING_MEMPOOL
-#define RT_USING_SMALL_MEM
-#define RT_USING_MEMHEAP
-#define RT_MEMHEAP_FAST_MODE
-#define RT_USING_SMALL_MEM_AS_HEAP
-#define RT_USING_MEMTRACE
-#define RT_USING_HEAP
-
-/* Kernel Device Object */
-
-#define RT_USING_DEVICE
-#define RT_USING_CONSOLE
-#define RT_CONSOLEBUF_SIZE 256
-#define RT_CONSOLE_DEVICE_NAME "uart0"
-#define RT_VER_NUM 0x40100
-#define ARCH_ARM
-#define ARCH_ARM_ARM9
-
-/* RT-Thread Components */
-
-#define RT_USING_COMPONENTS_INIT
-#define RT_USING_USER_MAIN
-#define RT_MAIN_THREAD_STACK_SIZE 2048
-#define RT_MAIN_THREAD_PRIORITY 10
-
-/* C++ features */
-
-
-/* Command shell */
-
-#define RT_USING_FINSH
-#define RT_USING_MSH
-#define FINSH_USING_MSH
-#define FINSH_THREAD_NAME "tshell"
-#define FINSH_THREAD_PRIORITY 20
-#define FINSH_THREAD_STACK_SIZE 4096
-#define FINSH_USING_HISTORY
-#define FINSH_HISTORY_LINES 5
-#define FINSH_USING_SYMTAB
-#define FINSH_CMD_SIZE 80
-#define MSH_USING_BUILT_IN_COMMANDS
-#define FINSH_USING_DESCRIPTION
-#define FINSH_ARG_MAX 10
-
-/* Device virtual file system */
-
-#define RT_USING_DFS
-#define DFS_USING_POSIX
-#define DFS_USING_WORKDIR
-#define DFS_FILESYSTEMS_MAX 16
-#define DFS_FILESYSTEM_TYPES_MAX 16
-#define DFS_FD_MAX 64
-#define RT_USING_DFS_MNTTABLE
-#define RT_USING_DFS_ELMFAT
-
-/* elm-chan's FatFs, Generic FAT Filesystem Module */
-
-#define RT_DFS_ELM_CODE_PAGE 437
-#define RT_DFS_ELM_WORD_ACCESS
-#define RT_DFS_ELM_USE_LFN_3
-#define RT_DFS_ELM_USE_LFN 3
-#define RT_DFS_ELM_LFN_UNICODE_0
-#define RT_DFS_ELM_LFN_UNICODE 0
-#define RT_DFS_ELM_MAX_LFN 255
-#define RT_DFS_ELM_DRIVES 8
-#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
-#define RT_DFS_ELM_REENTRANT
-#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
-#define RT_USING_DFS_DEVFS
-
-/* Device Drivers */
-
-#define RT_USING_DEVICE_IPC
-#define RT_USING_SYSTEM_WORKQUEUE
-#define RT_SYSTEM_WORKQUEUE_STACKSIZE 2048
-#define RT_SYSTEM_WORKQUEUE_PRIORITY 23
-#define RT_USING_SERIAL
-#define RT_USING_SERIAL_V1
-#define RT_SERIAL_USING_DMA
-#define RT_SERIAL_RB_BUFSZ 2048
-#define RT_USING_CAN
-#define RT_CAN_USING_HDR
-#define RT_USING_HWTIMER
-#define RT_USING_CPUTIME
-#define RT_USING_I2C
-#define RT_USING_I2C_BITOPS
-#define RT_USING_PIN
-#define RT_USING_ADC
-#define RT_USING_SPI
-#define RT_USING_QSPI
-#define RT_USING_SFUD
-#define RT_SFUD_USING_SFDP
-#define RT_SFUD_USING_FLASH_INFO_TABLE
-#define RT_SFUD_USING_QSPI
-#define RT_SFUD_SPI_MAX_HZ 50000000
-#define RT_USING_WDT
-#define RT_USING_HWCRYPTO
-#define RT_HWCRYPTO_DEFAULT_NAME "hwcryto"
-#define RT_HWCRYPTO_IV_MAX_SIZE 16
-#define RT_HWCRYPTO_KEYBIT_MAX_SIZE 256
-#define RT_HWCRYPTO_USING_AES
-#define RT_HWCRYPTO_USING_AES_ECB
-#define RT_HWCRYPTO_USING_AES_CBC
-#define RT_HWCRYPTO_USING_AES_CFB
-#define RT_HWCRYPTO_USING_AES_CTR
-#define RT_HWCRYPTO_USING_AES_OFB
-#define RT_HWCRYPTO_USING_SHA1
-#define RT_HWCRYPTO_USING_SHA2
-#define RT_HWCRYPTO_USING_SHA2_224
-#define RT_HWCRYPTO_USING_SHA2_256
-#define RT_HWCRYPTO_USING_SHA2_384
-#define RT_HWCRYPTO_USING_SHA2_512
-#define RT_HWCRYPTO_USING_RNG
-
-/* Using USB */
-
-#define RT_USING_USB
-#define RT_USING_USB_HOST
-#define RT_USBH_MSTORAGE
-#define UDISK_MOUNTPOINT "/mnt/udisk"
-#define RT_USING_USB_DEVICE
-#define RT_USBD_THREAD_STACK_SZ 4096
-#define USB_VENDOR_ID 0x0FFE
-#define USB_PRODUCT_ID 0x0001
-#define RT_USB_DEVICE_COMPOSITE
-#define RT_USB_DEVICE_CDC
-#define RT_USB_DEVICE_NONE
-#define RT_USB_DEVICE_MSTORAGE
-#define RT_VCOM_TASK_STK_SIZE 2048
-#define RT_CDC_RX_BUFSIZE 128
-#define RT_VCOM_SERNO "32021919830108"
-#define RT_VCOM_SER_LEN 14
-#define RT_VCOM_TX_TIMEOUT 1000
-#define RT_USB_MSTORAGE_DISK_NAME "ramdisk1"
-
-/* POSIX layer and C standard library */
-
-#define RT_LIBC_DEFAULT_TIMEZONE 8
-
-/* POSIX (Portable Operating System Interface) layer */
-
-#define RT_USING_POSIX_FS
-#define RT_USING_POSIX_DEVIO
-#define RT_USING_POSIX_POLL
-#define RT_USING_POSIX_SELECT
-
-/* Interprocess Communication (IPC) */
-
-
-/* Socket is in the 'Network' category */
-
-/* Network */
-
-/* Socket abstraction layer */
-
-#define RT_USING_SAL
-
-/* protocol stack implement */
-
-#define SAL_USING_LWIP
-#define SAL_USING_POSIX
-
-/* Network interface device */
-
-#define RT_USING_NETDEV
-#define NETDEV_USING_IFCONFIG
-#define NETDEV_USING_PING
-#define NETDEV_USING_NETSTAT
-#define NETDEV_USING_AUTO_DEFAULT
-#define NETDEV_IPV4 1
-#define NETDEV_IPV6 0
-
-/* light weight TCP/IP stack */
-
-#define RT_USING_LWIP
-#define RT_USING_LWIP212
-#define RT_LWIP_MEM_ALIGNMENT 4
-#define RT_LWIP_IGMP
-#define RT_LWIP_ICMP
-#define RT_LWIP_DNS
-#define RT_LWIP_DHCP
-#define IP_SOF_BROADCAST 1
-#define IP_SOF_BROADCAST_RECV 1
-
-/* Static IPv4 Address */
-
-#define RT_LWIP_IPADDR "192.168.31.55"
-#define RT_LWIP_GWADDR "192.168.31.1"
-#define RT_LWIP_MSKADDR "255.255.255.0"
-#define RT_LWIP_UDP
-#define RT_LWIP_TCP
-#define RT_LWIP_RAW
-#define RT_MEMP_NUM_NETCONN 16
-#define RT_LWIP_PBUF_NUM 256
-#define RT_LWIP_RAW_PCB_NUM 16
-#define RT_LWIP_UDP_PCB_NUM 16
-#define RT_LWIP_TCP_PCB_NUM 16
-#define RT_LWIP_TCP_SEG_NUM 64
-#define RT_LWIP_TCP_SND_BUF 16384
-#define RT_LWIP_TCP_WND 65535
-#define RT_LWIP_TCPTHREAD_PRIORITY 10
-#define RT_LWIP_TCPTHREAD_MBOX_SIZE 256
-#define RT_LWIP_TCPTHREAD_STACKSIZE 4096
-#define RT_LWIP_ETHTHREAD_PRIORITY 12
-#define RT_LWIP_ETHTHREAD_STACKSIZE 4096
-#define RT_LWIP_ETHTHREAD_MBOX_SIZE 256
-#define RT_LWIP_REASSEMBLY_FRAG
-#define LWIP_NETIF_STATUS_CALLBACK 1
-#define LWIP_NETIF_LINK_CALLBACK 1
-#define SO_REUSE 1
-#define LWIP_SO_RCVTIMEO 1
-#define LWIP_SO_SNDTIMEO 1
-#define LWIP_SO_RCVBUF 1
-#define LWIP_SO_LINGER 0
-#define RT_LWIP_NETIF_LOOPBACK
-#define LWIP_NETIF_LOOPBACK 1
-#define RT_LWIP_STATS
-#define RT_LWIP_USING_PING
-
-/* AT commands */
-
-
-/* VBUS(Virtual Software BUS) */
-
-
-/* Utilities */
-
-#define RT_USING_UTEST
-#define UTEST_THR_STACK_SIZE 4096
-#define UTEST_THR_PRIORITY 20
-
-/* RT-Thread Utestcases */
-
-
-/* RT-Thread online packages */
-
-/* IoT - internet of things */
-
-
-/* Wi-Fi */
-
-/* Marvell WiFi */
-
-
-/* Wiced WiFi */
-
-#define PKG_USING_NETUTILS
-#define PKG_NETUTILS_TFTP
-#define PKG_NETUTILS_IPERF
-#define PKG_NETUTILS_NTP
-#define NTP_USING_AUTO_SYNC
-#define NTP_AUTO_SYNC_FIRST_DELAY 30
-#define NTP_AUTO_SYNC_PERIOD 3600
-#define NETUTILS_NTP_HOSTNAME "0.tw.pool.ntp.org"
-#define NETUTILS_NTP_HOSTNAME2 "1.tw.pool.ntp.org"
-#define NETUTILS_NTP_HOSTNAME3 "2.tw.pool.ntp.org"
-#define PKG_USING_NETUTILS_V131
-#define PKG_NETUTILS_VER_NUM 0x10301
-
-/* IoT Cloud */
-
-
-/* security packages */
-
-
-/* language packages */
-
-
-/* multimedia packages */
-
-/* LVGL: powerful and easy-to-use embedded GUI library */
-
-
-/* u8g2: a monochrome graphic library */
-
-
-/* PainterEngine: A cross-platform graphics application framework written in C language */
-
-
-/* tools packages */
-
-
-/* system packages */
-
-/* enhanced kernel services */
-
-
-/* POSIX extension functions */
-
-
-/* acceleration: Assembly language or algorithmic acceleration packages */
-
-
-/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
-
-
-/* Micrium: Micrium software products porting for RT-Thread */
-
-#define PKG_USING_FAL
-#define FAL_DEBUG_CONFIG
-#define FAL_DEBUG 1
-#define FAL_PART_HAS_TABLE_CFG
-#define FAL_USING_SFUD_PORT
-#define FAL_USING_NOR_FLASH_DEV_NAME "norflash0"
-#define PKG_USING_FAL_LATEST_VERSION
-#define PKG_FAL_VER_NUM 0x99999
-#define PKG_USING_RAMDISK
-#define PKG_USING_RAMDISK_LATEST_VERSION
-
-/* peripheral libraries and drivers */
-
-
-/* AI packages */
-
-
-/* miscellaneous packages */
-
-/* samples: kernel and components samples */
-
-
-/* entertainment: terminal games and other interesting software packages */
-
-#define PKG_USING_OPTPARSE
-#define PKG_USING_OPTPARSE_LATEST_VERSION
-
-/* Nuvoton Packages Config */
-
-#define NU_PKG_USING_UTILS
-#define NU_PKG_USING_DEMO
-
-/* Hardware Drivers Config */
-
-/* On-chip Peripheral Drivers */
-
-#define SOC_SERIES_NUC980
-#define BSP_USE_STDDRIVER_SOURCE
-#define BSP_USING_MMU
-#define BSP_USING_PDMA
-#define NU_PDMA_MEMFUN_ACTOR_MAX 2
-#define BSP_USING_GPIO
-#define BSP_USING_EMAC
-#define BSP_USING_EMAC1
-#define NU_EMAC_PDMA_MEMCOPY
-#define NU_EMAC_PDMA_MEMCOPY_THRESHOLD 128
-#define BSP_USING_ADC
-#define BSP_USING_TMR
-#define BSP_USING_TIMER
-#define BSP_USING_TMR0
-#define BSP_USING_TIMER0
-#define BSP_USING_TMR1
-#define BSP_USING_TIMER1
-#define BSP_USING_TMR2
-#define BSP_USING_TIMER2
-#define BSP_USING_TMR3
-#define BSP_USING_TIMER3
-#define BSP_USING_TMR4
-#define BSP_USING_TIMER4
-#define BSP_USING_UART
-#define BSP_USING_UART0
-#define BSP_USING_UART4
-#define BSP_USING_UART4_TX_DMA
-#define BSP_USING_UART4_RX_DMA
-#define BSP_USING_UART8
-#define BSP_USING_UART8_TX_DMA
-#define BSP_USING_UART8_RX_DMA
-#define BSP_USING_I2C
-#define BSP_USING_I2C1
-#define BSP_USING_CAN
-#define BSP_USING_CAN3
-#define BSP_USING_SPI
-#define BSP_USING_SPI_PDMA
-#define BSP_USING_SPI0
-#define BSP_USING_SPI0_PDMA
-#define BSP_USING_SPI1_NONE
-#define BSP_USING_QSPI
-#define BSP_USING_QSPI_PDMA
-#define BSP_USING_QSPI0
-#define BSP_USING_QSPI0_PDMA
-#define BSP_USING_CRYPTO
-#define BSP_USING_WDT
-#define BSP_USING_USBD
-#define BSP_USING_USBH
-
-/* On-board Peripheral Drivers */
-
-#define BSP_USING_CONSOLE
-#define BOARD_USING_UART8_RS485
-#define BOARD_USING_STORAGE_SPIFLASH
-#define BOARD_USING_USB0_DEVICE_HOST
-
-/* Board extended module drivers */
-
-#define BOARD_USING_IP101GR
-
-#endif

+ 7 - 1
bsp/nuvoton/nk-rtu980/rtconfig.py

@@ -85,4 +85,10 @@ elif PLATFORM == 'armcc':
         CFLAGS += ' -O2'
 
     POST_ACTION = 'fromelf --bin $TARGET --output ' + TARGET_NAME + ' \n'
-    POST_ACTION += 'fromelf -z $TARGET\n'
+    POST_ACTION += 'fromelf -z $TARGET\n'
+def dist_handle(BSP_ROOT, dist_dir):
+    import sys
+    cwd_path = os.getcwd()
+    sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
+    from sdk_dist import dist_do_building
+    dist_do_building(BSP_ROOT, dist_dir)

+ 2 - 0
bsp/nuvoton/numaker-iot-m487/.config

@@ -973,3 +973,5 @@ CONFIG_BOARD_USING_HSUSBH_USBD=y
 #
 # CONFIG_BOARD_USING_MAX31875 is not set
 # CONFIG_BOARD_USING_LCD_ILI9341 is not set
+CONFIG_BOARD_USE_UTEST=y
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.numaker-iot-m487.test.utest."

+ 0 - 6
bsp/nuvoton/numaker-iot-m487/Kconfig

@@ -18,12 +18,6 @@ config PKGS_DIR
     option env="PKGS_ROOT"
     default "packages"
 
-config NU_PKGS_DIR
-    string
-    option env="NU_PKGS_ROOT"
-    default "../libraries/nu_packages"
-
 source "$RTT_DIR/Kconfig"
 source "$PKGS_DIR/Kconfig"
-source "$NU_PKGS_DIR/Kconfig"
 source "$BSP_DIR/board/Kconfig"

+ 1 - 0
bsp/nuvoton/numaker-iot-m487/board/Kconfig

@@ -129,5 +129,6 @@ menu "Hardware Drivers Config"
 
     endmenu
 
+    source "$BSP_DIR/../libraries/nu_packages/Kconfig"
 
 endmenu

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 356
bsp/nuvoton/numaker-iot-m487/project.uvproj


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 336
bsp/nuvoton/numaker-iot-m487/project.uvprojx


+ 0 - 400
bsp/nuvoton/numaker-iot-m487/rtconfig.h

@@ -1,400 +0,0 @@
-#ifndef RT_CONFIG_H__
-#define RT_CONFIG_H__
-
-/* Automatically generated file; DO NOT EDIT. */
-/* RT-Thread Configuration */
-
-/* RT-Thread Kernel */
-
-#define RT_NAME_MAX 8
-#define RT_ALIGN_SIZE 4
-#define RT_THREAD_PRIORITY_32
-#define RT_THREAD_PRIORITY_MAX 32
-#define RT_TICK_PER_SECOND 1000
-#define RT_USING_OVERFLOW_CHECK
-#define RT_USING_HOOK
-#define RT_HOOK_USING_FUNC_PTR
-#define RT_USING_IDLE_HOOK
-#define RT_IDLE_HOOK_LIST_SIZE 4
-#define IDLE_THREAD_STACK_SIZE 1024
-
-/* kservice optimization */
-
-#define RT_DEBUG
-#define RT_DEBUG_COLOR
-
-/* Inter-Thread communication */
-
-#define RT_USING_SEMAPHORE
-#define RT_USING_MUTEX
-#define RT_USING_EVENT
-#define RT_USING_MAILBOX
-#define RT_USING_MESSAGEQUEUE
-#define RT_USING_SIGNALS
-
-/* Memory Management */
-
-#define RT_USING_MEMPOOL
-#define RT_USING_SMALL_MEM
-#define RT_USING_SMALL_MEM_AS_HEAP
-#define RT_USING_HEAP
-
-/* Kernel Device Object */
-
-#define RT_USING_DEVICE
-#define RT_USING_CONSOLE
-#define RT_CONSOLEBUF_SIZE 256
-#define RT_CONSOLE_DEVICE_NAME "uart0"
-#define RT_VER_NUM 0x40100
-#define ARCH_ARM
-#define RT_USING_CPU_FFS
-#define ARCH_ARM_CORTEX_M
-#define ARCH_ARM_CORTEX_M4
-
-/* RT-Thread Components */
-
-#define RT_USING_COMPONENTS_INIT
-#define RT_USING_USER_MAIN
-#define RT_MAIN_THREAD_STACK_SIZE 2048
-#define RT_MAIN_THREAD_PRIORITY 10
-
-/* C++ features */
-
-
-/* Command shell */
-
-#define RT_USING_FINSH
-#define RT_USING_MSH
-#define FINSH_USING_MSH
-#define FINSH_THREAD_NAME "tshell"
-#define FINSH_THREAD_PRIORITY 20
-#define FINSH_THREAD_STACK_SIZE 2048
-#define FINSH_USING_HISTORY
-#define FINSH_HISTORY_LINES 5
-#define FINSH_USING_SYMTAB
-#define FINSH_CMD_SIZE 80
-#define MSH_USING_BUILT_IN_COMMANDS
-#define FINSH_USING_DESCRIPTION
-#define FINSH_ARG_MAX 10
-
-/* Device virtual file system */
-
-#define RT_USING_DFS
-#define DFS_USING_POSIX
-#define DFS_USING_WORKDIR
-#define DFS_FILESYSTEMS_MAX 8
-#define DFS_FILESYSTEM_TYPES_MAX 4
-#define DFS_FD_MAX 32
-#define RT_USING_DFS_ELMFAT
-
-/* elm-chan's FatFs, Generic FAT Filesystem Module */
-
-#define RT_DFS_ELM_CODE_PAGE 437
-#define RT_DFS_ELM_WORD_ACCESS
-#define RT_DFS_ELM_USE_LFN_3
-#define RT_DFS_ELM_USE_LFN 3
-#define RT_DFS_ELM_LFN_UNICODE_0
-#define RT_DFS_ELM_LFN_UNICODE 0
-#define RT_DFS_ELM_MAX_LFN 255
-#define RT_DFS_ELM_DRIVES 8
-#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
-#define RT_DFS_ELM_REENTRANT
-#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
-#define RT_USING_DFS_DEVFS
-
-/* Device Drivers */
-
-#define RT_USING_DEVICE_IPC
-#define RT_USING_SYSTEM_WORKQUEUE
-#define RT_SYSTEM_WORKQUEUE_STACKSIZE 2048
-#define RT_SYSTEM_WORKQUEUE_PRIORITY 23
-#define RT_USING_SERIAL
-#define RT_USING_SERIAL_V1
-#define RT_SERIAL_USING_DMA
-#define RT_SERIAL_RB_BUFSZ 2048
-#define RT_USING_CAN
-#define RT_USING_HWTIMER
-#define RT_USING_I2C
-#define RT_USING_I2C_BITOPS
-#define RT_USING_PIN
-#define RT_USING_ADC
-#define RT_USING_PWM
-#define RT_USING_PM
-#define PM_TICKLESS_THRESHOLD_TIME 2
-#define RT_USING_RTC
-#define RT_USING_SPI
-#define RT_USING_QSPI
-#define RT_USING_SFUD
-#define RT_SFUD_USING_SFDP
-#define RT_SFUD_USING_FLASH_INFO_TABLE
-#define RT_SFUD_SPI_MAX_HZ 50000000
-#define RT_USING_WDT
-#define RT_USING_AUDIO
-#define RT_AUDIO_REPLAY_MP_BLOCK_SIZE 4096
-#define RT_AUDIO_REPLAY_MP_BLOCK_COUNT 2
-#define RT_AUDIO_RECORD_PIPE_SIZE 2048
-#define RT_USING_SENSOR
-#define RT_USING_SENSOR_CMD
-#define RT_USING_HWCRYPTO
-#define RT_HWCRYPTO_DEFAULT_NAME "hwcryto"
-#define RT_HWCRYPTO_IV_MAX_SIZE 16
-#define RT_HWCRYPTO_KEYBIT_MAX_SIZE 256
-#define RT_HWCRYPTO_USING_AES
-#define RT_HWCRYPTO_USING_AES_ECB
-#define RT_HWCRYPTO_USING_AES_CBC
-#define RT_HWCRYPTO_USING_AES_CFB
-#define RT_HWCRYPTO_USING_AES_CTR
-#define RT_HWCRYPTO_USING_AES_OFB
-#define RT_HWCRYPTO_USING_DES
-#define RT_HWCRYPTO_USING_DES_ECB
-#define RT_HWCRYPTO_USING_DES_CBC
-#define RT_HWCRYPTO_USING_3DES
-#define RT_HWCRYPTO_USING_3DES_ECB
-#define RT_HWCRYPTO_USING_3DES_CBC
-#define RT_HWCRYPTO_USING_SHA1
-#define RT_HWCRYPTO_USING_SHA2
-#define RT_HWCRYPTO_USING_SHA2_224
-#define RT_HWCRYPTO_USING_SHA2_256
-#define RT_HWCRYPTO_USING_SHA2_384
-#define RT_HWCRYPTO_USING_SHA2_512
-#define RT_HWCRYPTO_USING_RNG
-#define RT_HWCRYPTO_USING_CRC
-#define RT_HWCRYPTO_USING_CRC_07
-#define RT_HWCRYPTO_USING_CRC_8005
-#define RT_HWCRYPTO_USING_CRC_1021
-#define RT_HWCRYPTO_USING_CRC_04C11DB7
-
-/* Using USB */
-
-#define RT_USING_USB
-#define RT_USING_USB_HOST
-#define RT_USBH_MSTORAGE
-#define UDISK_MOUNTPOINT "/mnt/udisk/"
-#define RT_USING_USB_DEVICE
-#define RT_USBD_THREAD_STACK_SZ 4096
-#define USB_VENDOR_ID 0x0FFE
-#define USB_PRODUCT_ID 0x0001
-#define _RT_USB_DEVICE_HID
-#define RT_USB_DEVICE_HID
-#define RT_USB_DEVICE_HID_MOUSE
-
-/* POSIX layer and C standard library */
-
-#define RT_LIBC_DEFAULT_TIMEZONE 8
-
-/* POSIX (Portable Operating System Interface) layer */
-
-#define RT_USING_POSIX_FS
-#define RT_USING_POSIX_DEVIO
-#define RT_USING_POSIX_POLL
-#define RT_USING_POSIX_SELECT
-
-/* Interprocess Communication (IPC) */
-
-
-/* Socket is in the 'Network' category */
-
-/* Network */
-
-/* Socket abstraction layer */
-
-#define RT_USING_SAL
-#define SAL_INTERNET_CHECK
-
-/* protocol stack implement */
-
-#define SAL_USING_AT
-#define SAL_USING_POSIX
-
-/* Network interface device */
-
-#define RT_USING_NETDEV
-#define NETDEV_USING_IFCONFIG
-#define NETDEV_USING_PING
-#define NETDEV_USING_NETSTAT
-#define NETDEV_USING_AUTO_DEFAULT
-#define NETDEV_IPV4 1
-#define NETDEV_IPV6 0
-
-/* light weight TCP/IP stack */
-
-
-/* AT commands */
-
-#define RT_USING_AT
-#define AT_USING_CLIENT
-#define AT_CLIENT_NUM_MAX 1
-#define AT_USING_SOCKET
-#define AT_USING_CLI
-#define AT_CMD_MAX_LEN 512
-#define AT_SW_VERSION_NUM 0x10301
-
-/* VBUS(Virtual Software BUS) */
-
-
-/* Utilities */
-
-#define RT_USING_UTEST
-#define UTEST_THR_STACK_SIZE 4096
-#define UTEST_THR_PRIORITY 20
-
-/* RT-Thread Utestcases */
-
-
-/* RT-Thread online packages */
-
-/* IoT - internet of things */
-
-
-/* Wi-Fi */
-
-/* Marvell WiFi */
-
-
-/* Wiced WiFi */
-
-#define PKG_USING_AT_DEVICE
-#define AT_DEVICE_USING_ESP8266
-#define AT_DEVICE_ESP8266_INIT_ASYN
-#define PKG_USING_AT_DEVICE_LATEST_VERSION
-#define PKG_AT_DEVICE_VER_NUM 0x99999
-
-/* IoT Cloud */
-
-
-/* security packages */
-
-
-/* language packages */
-
-
-/* multimedia packages */
-
-/* LVGL: powerful and easy-to-use embedded GUI library */
-
-
-/* u8g2: a monochrome graphic library */
-
-
-/* PainterEngine: A cross-platform graphics application framework written in C language */
-
-
-/* tools packages */
-
-
-/* system packages */
-
-/* enhanced kernel services */
-
-
-/* POSIX extension functions */
-
-
-/* acceleration: Assembly language or algorithmic acceleration packages */
-
-
-/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
-
-
-/* Micrium: Micrium software products porting for RT-Thread */
-
-#define PKG_USING_FAL
-#define FAL_DEBUG_CONFIG
-#define FAL_DEBUG 1
-#define FAL_PART_HAS_TABLE_CFG
-#define PKG_USING_FAL_LATEST_VERSION
-#define PKG_FAL_VER_NUM 0x99999
-
-/* peripheral libraries and drivers */
-
-
-/* AI packages */
-
-
-/* miscellaneous packages */
-
-/* samples: kernel and components samples */
-
-
-/* entertainment: terminal games and other interesting software packages */
-
-
-/* Nuvoton Packages Config */
-
-#define NU_PKG_USING_UTILS
-#define NU_PKG_USING_DEMO
-#define NU_PKG_USING_BMX055
-#define NU_PKG_USING_NAU88L25
-
-/* Hardware Drivers Config */
-
-/* On-chip Peripheral Drivers */
-
-#define SOC_SERIES_M480
-#define BSP_USE_STDDRIVER_SOURCE
-#define BSP_USING_PDMA
-#define NU_PDMA_MEMFUN_ACTOR_MAX 2
-#define NU_PDMA_SGTBL_POOL_SIZE 16
-#define BSP_USING_FMC
-#define BSP_USING_GPIO
-#define BSP_USING_CLK
-#define NU_CLK_INVOKE_WKTMR
-#define BSP_USING_RTC
-#define NU_RTC_SUPPORT_MSH_CMD
-#define BSP_USING_TMR
-#define BSP_USING_UART
-#define BSP_USING_UART0
-#define BSP_USING_UART1
-#define BSP_USING_UART1_TX_DMA
-#define BSP_USING_UART1_RX_DMA
-#define BSP_USING_UART2
-#define BSP_USING_UART2_TX_DMA
-#define BSP_USING_UART2_RX_DMA
-#define BSP_USING_I2C
-#define BSP_USING_I2C0
-#define BSP_USING_I2C1
-#define BSP_USING_I2C2
-#define BSP_USING_USCI
-#define BSP_USING_UUART
-#define BSP_USING_USCI0
-#define BSP_USING_UUART0
-#define BSP_USING_UUART0_TX_DMA
-#define BSP_USING_UUART0_RX_DMA
-#define BSP_USING_SDH
-#define BSP_USING_SDH0
-#define NU_SDH_USING_PDMA
-#define NU_SDH_HOTPLUG
-#define BSP_USING_SPI
-#define BSP_USING_SPI_PDMA
-#define BSP_USING_SPI0_NONE
-#define BSP_USING_SPI1
-#define BSP_USING_SPI1_PDMA
-#define BSP_USING_SPI2
-#define BSP_USING_SPI3_NONE
-#define BSP_USING_I2S
-#define NU_I2S_DMA_FIFO_SIZE 2048
-#define BSP_USING_QSPI
-#define BSP_USING_QSPI0
-#define BSP_USING_CRYPTO
-#define BSP_USING_TRNG
-#define BSP_USING_CRC
-#define NU_CRC_USE_PDMA
-#define BSP_USING_WDT
-#define BSP_USING_USBD
-#define BSP_USING_HSUSBH
-#define NU_USBHOST_HUB_POLLING_INTERVAL 100
-
-/* On-board Peripheral Drivers */
-
-#define BSP_USING_NULINKME
-#define BOARD_USING_ESP8266
-#define BOARD_USING_BMX055
-#define BOARD_USING_NAU88L25
-#define BOARD_USING_STORAGE_SDCARD
-#define BOARD_USING_STORAGE_SPIFLASH
-#define BOARD_USING_HSUSBH_USBD
-
-/* Board extended module drivers */
-
-
-#endif

+ 8 - 0
bsp/nuvoton/numaker-iot-m487/rtconfig.py

@@ -130,3 +130,11 @@ elif PLATFORM == 'iar':
 
     EXEC_PATH = EXEC_PATH + '/arm/bin/'
     POST_ACTION = ''
+
+def dist_handle(BSP_ROOT, dist_dir):
+    import sys
+    cwd_path = os.getcwd()
+    sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
+    from sdk_dist import dist_do_building
+    dist_do_building(BSP_ROOT, dist_dir)
+

+ 2 - 0
bsp/nuvoton/numaker-m032ki/.config

@@ -797,3 +797,5 @@ CONFIG_BSP_USING_NULINKME=y
 # Board extended module drivers
 #
 # CONFIG_BOARD_USING_STORAGE_SPIFLASH is not set
+CONFIG_BOARD_USE_UTEST=y
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.numaker-m032ki.test.utest."

+ 0 - 6
bsp/nuvoton/numaker-m032ki/Kconfig

@@ -18,12 +18,6 @@ config PKGS_DIR
     option env="PKGS_ROOT"
     default "packages"
 
-config NU_PKGS_DIR
-    string
-    option env="NU_PKGS_ROOT"
-    default "../libraries/nu_packages"
-
 source "$RTT_DIR/Kconfig"
 source "$PKGS_DIR/Kconfig"
-source "$NU_PKGS_DIR/Kconfig"
 source "$BSP_DIR/board/Kconfig"

+ 1 - 0
bsp/nuvoton/numaker-m032ki/board/Kconfig

@@ -24,4 +24,5 @@ menu "Hardware Drivers Config"
 
     endmenu
 
+    source "$BSP_DIR/../libraries/nu_packages/Kconfig"
 endmenu

+ 0 - 1228
bsp/nuvoton/numaker-m032ki/project.uvprojx

@@ -1,1228 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
-<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
-  <SchemaVersion>2.1</SchemaVersion>
-  <Header>### uVision Project, (C) Keil Software</Header>
-  <Targets>
-    <Target>
-      <TargetName>rtthread-m031</TargetName>
-      <ToolsetNumber>0x4</ToolsetNumber>
-      <ToolsetName>ARM-ADS</ToolsetName>
-      <pArmCC>5060750::V5.06 update 6 (build 750)::ARMCC</pArmCC>
-      <pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
-      <uAC6>0</uAC6>
-      <TargetOption>
-        <TargetCommonOption>
-          <Device>M032KIAAE</Device>
-          <Vendor>Nuvoton</Vendor>
-          <PackID>Nuvoton.NuMicro_DFP.1.3.10</PackID>
-          <PackURL>http://www.nuvoton.com/hq/enu/Documents/KEILSoftwarePack</PackURL>
-          <Cpu>IRAM(0x20000000,0x18000) IROM(0x00000000,0x80000) CPUTYPE("Cortex-M0") CLOCK(12000000)</Cpu>
-          <FlashUtilSpec />
-          <StartupFile />
-          <FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0M031_AP_512 -FS00 -FL080000 -FP0($$Device:M032KIAAE$Flash\M031_AP_512.FLM))</FlashDriverDll>
-          <DeviceId>0</DeviceId>
-          <RegisterFile>$$Device:M032KIAAE$Device\M031\Include\M031Series.h</RegisterFile>
-          <MemoryEnv />
-          <Cmp />
-          <Asm />
-          <Linker />
-          <OHString />
-          <InfinionOptionDll />
-          <SLE66CMisc />
-          <SLE66AMisc />
-          <SLE66LinkerMisc />
-          <SFDFile>$$Device:M032KIAAE$SVD\Nuvoton\M031AE_v1.svd</SFDFile>
-          <bCustSvd>0</bCustSvd>
-          <UseEnv>0</UseEnv>
-          <BinPath />
-          <IncludePath />
-          <LibPath />
-          <RegisterFilePath />
-          <DBRegisterFilePath />
-          <TargetStatus>
-            <Error>0</Error>
-            <ExitCodeStop>0</ExitCodeStop>
-            <ButtonStop>0</ButtonStop>
-            <NotGenerated>0</NotGenerated>
-            <InvalidFlash>1</InvalidFlash>
-          </TargetStatus>
-          <OutputDirectory>.\build\keil5\</OutputDirectory>
-          <OutputName>rtthread</OutputName>
-          <CreateExecutable>1</CreateExecutable>
-          <CreateLib>0</CreateLib>
-          <CreateHexFile>1</CreateHexFile>
-          <DebugInformation>1</DebugInformation>
-          <BrowseInformation>1</BrowseInformation>
-          <ListingPath>.\build\keil5\</ListingPath>
-          <HexFormatSelection>1</HexFormatSelection>
-          <Merge32K>0</Merge32K>
-          <CreateBatchFile>0</CreateBatchFile>
-          <BeforeCompile>
-            <RunUserProg1>0</RunUserProg1>
-            <RunUserProg2>0</RunUserProg2>
-            <UserProg1Name />
-            <UserProg2Name />
-            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
-            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
-            <nStopU1X>0</nStopU1X>
-            <nStopU2X>0</nStopU2X>
-          </BeforeCompile>
-          <BeforeMake>
-            <RunUserProg1>0</RunUserProg1>
-            <RunUserProg2>0</RunUserProg2>
-            <UserProg1Name />
-            <UserProg2Name />
-            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
-            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
-            <nStopB1X>0</nStopB1X>
-            <nStopB2X>0</nStopB2X>
-          </BeforeMake>
-          <AfterMake>
-            <RunUserProg1>1</RunUserProg1>
-            <RunUserProg2>1</RunUserProg2>
-            <UserProg1Name>fromelf --bin ".\build\keil5\\@L.axf" --output ".\build\keil5\\@L.bin"</UserProg1Name>
-            <UserProg2Name>fromelf --text -c ".\build\keil5\\@L.axf" --output ".\build\keil5\\@L.txt"</UserProg2Name>
-            <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
-            <UserProg2Dos16Mode>0</UserProg2Dos16Mode>
-            <nStopA1X>0</nStopA1X>
-            <nStopA2X>0</nStopA2X>
-          </AfterMake>
-          <SelectedForBatchBuild>1</SelectedForBatchBuild>
-          <SVCSIdString />
-        </TargetCommonOption>
-        <CommonProperty>
-          <UseCPPCompiler>0</UseCPPCompiler>
-          <RVCTCodeConst>0</RVCTCodeConst>
-          <RVCTZI>0</RVCTZI>
-          <RVCTOtherData>0</RVCTOtherData>
-          <ModuleSelection>0</ModuleSelection>
-          <IncludeInBuild>1</IncludeInBuild>
-          <AlwaysBuild>0</AlwaysBuild>
-          <GenerateAssemblyFile>0</GenerateAssemblyFile>
-          <AssembleAssemblyFile>0</AssembleAssemblyFile>
-          <PublicsOnly>0</PublicsOnly>
-          <StopOnExitCode>3</StopOnExitCode>
-          <CustomArgument />
-          <IncludeLibraryModules />
-          <ComprImg>1</ComprImg>
-        </CommonProperty>
-        <DllOption>
-          <SimDllName>SARMCM3.DLL</SimDllName>
-          <SimDllArguments>  </SimDllArguments>
-          <SimDlgDll>DARMCM1.DLL</SimDlgDll>
-          <SimDlgDllArguments>-pCM0</SimDlgDllArguments>
-          <TargetDllName>SARMCM3.DLL</TargetDllName>
-          <TargetDllArguments> </TargetDllArguments>
-          <TargetDlgDll>TARMCM1.DLL</TargetDlgDll>
-          <TargetDlgDllArguments>-pCM0</TargetDlgDllArguments>
-        </DllOption>
-        <DebugOption>
-          <OPTHX>
-            <HexSelection>1</HexSelection>
-            <HexRangeLowAddress>0</HexRangeLowAddress>
-            <HexRangeHighAddress>0</HexRangeHighAddress>
-            <HexOffset>0</HexOffset>
-            <Oh166RecLen>16</Oh166RecLen>
-          </OPTHX>
-        </DebugOption>
-        <Utilities>
-          <Flash1>
-            <UseTargetDll>1</UseTargetDll>
-            <UseExternalTool>0</UseExternalTool>
-            <RunIndependent>0</RunIndependent>
-            <UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
-            <Capability>1</Capability>
-            <DriverSelection>4103</DriverSelection>
-          </Flash1>
-          <bUseTDR>1</bUseTDR>
-          <Flash2>NULink\Nu_Link.dll</Flash2>
-          <Flash3>"" ()</Flash3>
-          <Flash4 />
-          <pFcarmOut />
-          <pFcarmGrp />
-          <pFcArmRoot />
-          <FcArmLst>0</FcArmLst>
-        </Utilities>
-        <TargetArmAds>
-          <ArmAdsMisc>
-            <GenerateListings>0</GenerateListings>
-            <asHll>1</asHll>
-            <asAsm>1</asAsm>
-            <asMacX>1</asMacX>
-            <asSyms>1</asSyms>
-            <asFals>1</asFals>
-            <asDbgD>1</asDbgD>
-            <asForm>1</asForm>
-            <ldLst>0</ldLst>
-            <ldmm>1</ldmm>
-            <ldXref>1</ldXref>
-            <BigEnd>0</BigEnd>
-            <AdsALst>1</AdsALst>
-            <AdsACrf>1</AdsACrf>
-            <AdsANop>0</AdsANop>
-            <AdsANot>0</AdsANot>
-            <AdsLLst>1</AdsLLst>
-            <AdsLmap>1</AdsLmap>
-            <AdsLcgr>1</AdsLcgr>
-            <AdsLsym>1</AdsLsym>
-            <AdsLszi>1</AdsLszi>
-            <AdsLtoi>1</AdsLtoi>
-            <AdsLsun>1</AdsLsun>
-            <AdsLven>1</AdsLven>
-            <AdsLsxf>1</AdsLsxf>
-            <RvctClst>0</RvctClst>
-            <GenPPlst>0</GenPPlst>
-            <AdsCpuType>"Cortex-M0"</AdsCpuType>
-            <RvctDeviceName />
-            <mOS>0</mOS>
-            <uocRom>0</uocRom>
-            <uocRam>0</uocRam>
-            <hadIROM>1</hadIROM>
-            <hadIRAM>1</hadIRAM>
-            <hadXRAM>0</hadXRAM>
-            <uocXRam>0</uocXRam>
-            <RvdsVP>0</RvdsVP>
-            <RvdsMve>0</RvdsMve>
-            <hadIRAM2>0</hadIRAM2>
-            <hadIROM2>0</hadIROM2>
-            <StupSel>8</StupSel>
-            <useUlib>0</useUlib>
-            <EndSel>0</EndSel>
-            <uLtcg>0</uLtcg>
-            <nSecure>0</nSecure>
-            <RoSelD>3</RoSelD>
-            <RwSelD>3</RwSelD>
-            <CodeSel>0</CodeSel>
-            <OptFeed>0</OptFeed>
-            <NoZi1>0</NoZi1>
-            <NoZi2>0</NoZi2>
-            <NoZi3>0</NoZi3>
-            <NoZi4>0</NoZi4>
-            <NoZi5>0</NoZi5>
-            <Ro1Chk>0</Ro1Chk>
-            <Ro2Chk>0</Ro2Chk>
-            <Ro3Chk>0</Ro3Chk>
-            <Ir1Chk>0</Ir1Chk>
-            <Ir2Chk>0</Ir2Chk>
-            <Ra1Chk>0</Ra1Chk>
-            <Ra2Chk>0</Ra2Chk>
-            <Ra3Chk>0</Ra3Chk>
-            <Im1Chk>0</Im1Chk>
-            <Im2Chk>0</Im2Chk>
-            <OnChipMemories>
-              <Ocm1>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm1>
-              <Ocm2>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm2>
-              <Ocm3>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm3>
-              <Ocm4>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm4>
-              <Ocm5>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm5>
-              <Ocm6>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </Ocm6>
-              <IRAM>
-                <Type>0</Type>
-                <StartAddress>0x20000000</StartAddress>
-                <Size>0x18000</Size>
-              </IRAM>
-              <IROM>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x80000</Size>
-              </IROM>
-              <XRAM>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </XRAM>
-              <OCR_RVCT1>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT1>
-              <OCR_RVCT2>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT2>
-              <OCR_RVCT3>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT3>
-              <OCR_RVCT4>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x80000</Size>
-              </OCR_RVCT4>
-              <OCR_RVCT5>
-                <Type>1</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT5>
-              <OCR_RVCT6>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT6>
-              <OCR_RVCT7>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT7>
-              <OCR_RVCT8>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT8>
-              <OCR_RVCT9>
-                <Type>0</Type>
-                <StartAddress>0x20000000</StartAddress>
-                <Size>0x18000</Size>
-              </OCR_RVCT9>
-              <OCR_RVCT10>
-                <Type>0</Type>
-                <StartAddress>0x0</StartAddress>
-                <Size>0x0</Size>
-              </OCR_RVCT10>
-            </OnChipMemories>
-            <RvctStartVector />
-          </ArmAdsMisc>
-          <Cads>
-            <interw>1</interw>
-            <Optim>1</Optim>
-            <oTime>0</oTime>
-            <SplitLS>0</SplitLS>
-            <OneElfS>1</OneElfS>
-            <Strict>0</Strict>
-            <EnumInt>0</EnumInt>
-            <PlainCh>0</PlainCh>
-            <Ropi>0</Ropi>
-            <Rwpi>0</Rwpi>
-            <wLevel>1</wLevel>
-            <uThumb>0</uThumb>
-            <uSurpInc>0</uSurpInc>
-            <uC99>1</uC99>
-            <uGnu>0</uGnu>
-            <useXO>0</useXO>
-            <v6Lang>5</v6Lang>
-            <v6LangP>3</v6LangP>
-            <vShortEn>0</vShortEn>
-            <vShortWch>0</vShortWch>
-            <v6Lto>0</v6Lto>
-            <v6WtE>1</v6WtE>
-            <v6Rtti>0</v6Rtti>
-            <VariousControls>
-              <MiscControls />
-              <Define>__RTTHREAD__, RT_USING_ARM_LIBC, __CLK_TCK=RT_TICK_PER_SECOND</Define>
-              <Undefine />
-              <IncludePath>applications;.;board;board\NuClockConfig;board\NuPinConfig;..\libraries\m031\CMSIS\Include;..\..\..\components\libc\compilers\common;..\..\..\components\libc\compilers\common\nogcc;..\..\..\libcpu\arm\common;..\..\..\libcpu\arm\cortex-m0;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\..\..\components\drivers\include;..\libraries\m031\Device\Nuvoton\M031\Include;..\libraries\m031\rtt_port;..\..\..\components\dfs\include;..\..\..\components\dfs\filesystems\devfs;..\..\..\components\finsh;.;..\..\..\include;..\libraries\m031\StdDriver\inc;..\libraries\nu_packages\Demo;..\libraries\nu_packages\NuUtils\inc;..\..\..\components\libc\posix\io\poll;..\..\..\components\libc\posix\ipc;..\..\..\components\drivers\usb\usbdevice;..\..\..\components\utilities\utest;..\..\..\examples\utest\testcases\kernel;..\..\..\examples\utest\testcases\utest</IncludePath>
-            </VariousControls>
-          </Cads>
-          <Aads>
-            <interw>1</interw>
-            <Ropi>0</Ropi>
-            <Rwpi>0</Rwpi>
-            <thumb>1</thumb>
-            <SplitLS>0</SplitLS>
-            <SwStkChk>0</SwStkChk>
-            <NoWarn>1</NoWarn>
-            <uSurpInc>0</uSurpInc>
-            <useXO>0</useXO>
-            <uClangAs>0</uClangAs>
-            <VariousControls>
-              <MiscControls />
-              <Define />
-              <Undefine />
-              <IncludePath />
-            </VariousControls>
-          </Aads>
-          <LDads>
-            <umfTarg>0</umfTarg>
-            <Ropi>0</Ropi>
-            <Rwpi>0</Rwpi>
-            <noStLib>0</noStLib>
-            <RepFail>1</RepFail>
-            <useFile>0</useFile>
-            <TextAddressRange>0x00000000</TextAddressRange>
-            <DataAddressRange>0x20000000</DataAddressRange>
-            <pXoBase />
-            <ScatterFile>.\linking_scripts\m031_flash.sct</ScatterFile>
-            <IncludeLibs />
-            <IncludeLibsPath />
-            <Misc />
-            <LinkerInputFile />
-            <DisabledWarnings />
-          </LDads>
-        </TargetArmAds>
-      </TargetOption>
-      <Groups>
-        <Group>
-          <GroupName>Applications</GroupName>
-          <Files>
-            <File>
-              <FileName>main.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>applications\main.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mnt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>applications\mnt.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>board</GroupName>
-          <Files>
-            <File>
-              <FileName>nutool_pincfg.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>board\NuPinConfig\nutool_pincfg.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nutool_modclkcfg.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>board\NuClockConfig\nutool_modclkcfg.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>board_dev.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>board\board_dev.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Compiler</GroupName>
-          <Files>
-            <File>
-              <FileName>libc_syms.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\armlibc\libc_syms.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>syscalls.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\armlibc\syscalls.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>syscall_mem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\armlibc\syscall_mem.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>stdlib.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\common\stdlib.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>time.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\libc\compilers\common\time.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>CPU</GroupName>
-          <Files>
-            <File>
-              <FileName>showmem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\showmem.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>backtrace.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\backtrace.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>div0.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\common\div0.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>context_rvds.S</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\..\..\libcpu\arm\cortex-m0\context_rvds.S</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>cpuport.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\libcpu\arm\cortex-m0\cpuport.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>DeviceDrivers</GroupName>
-          <Files>
-            <File>
-              <FileName>hwtimer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\hwtimer\hwtimer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>adc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\misc\adc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>rt_drv_pwm.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\misc\rt_drv_pwm.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>pin.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\misc\pin.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>lptimer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\pm\lptimer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>pm.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\pm\pm.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>rtc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\rtc\rtc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>serial.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\serial\serial.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dataqueue.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\dataqueue.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>pipe.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\pipe.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ringbuffer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\ringbuffer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>workqueue.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\workqueue.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>waitqueue.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\waitqueue.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ringblk_buf.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\ringblk_buf.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>completion.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\src\completion.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>watchdog.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\watchdog\watchdog.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Drivers</GroupName>
-          <Files>
-            <File>
-              <FileName>system_M031Series.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\Device\Nuvoton\M031\Source\system_M031Series.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>startup_M031Series.s</FileName>
-              <FileType>2</FileType>
-              <FilePath>..\libraries\m031\Device\Nuvoton\M031\Source\ARM\startup_M031Series.s</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_timer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_timer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_bpwm_capture.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_bpwm_capture.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_pwm_capture.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_pwm_capture.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_ebi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_ebi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_adc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_adc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_common.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_common.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_uuart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_uuart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_wdt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_wdt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_uspi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_uspi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_qspi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_qspi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_spi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_spi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_fmc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_fmc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_crc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_crc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_i2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_i2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_gpio.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_gpio.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_timer_capture.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_timer_capture.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_crypto.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_crypto.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_rtc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_rtc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_bpwm.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_bpwm.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_uart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_uart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_spii2s.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_spii2s.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_pdma.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_pdma.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_pwm.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_pwm.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_softi2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_softi2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_clk.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_clk.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_ui2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_ui2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>drv_usbd.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\rtt_port\drv_usbd.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Filesystem</GroupName>
-          <Files>
-            <File>
-              <FileName>dfs_posix.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_posix.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs_fs.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_fs.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>dfs_file.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\src\dfs_file.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>devfs.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\dfs\filesystems\devfs\devfs.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Finsh</GroupName>
-          <Files>
-            <File>
-              <FileName>shell.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\shell.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>msh.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\msh.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>msh_file.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\msh_file.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>cmd.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\finsh\cmd.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Kernel</GroupName>
-          <Files>
-            <File>
-              <FileName>scheduler.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\scheduler.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>idle.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\idle.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>object.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\object.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>clock.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\clock.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mem.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\mem.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>timer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\timer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>device.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\device.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>irq.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\irq.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>kservice.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\kservice.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>components.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\components.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>mempool.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\mempool.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>thread.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\thread.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>ipc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\src\ipc.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>Libraries</GroupName>
-          <Files>
-            <File>
-              <FileName>nu_ebi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_ebi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_adc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_adc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_clk.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_clk.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_uart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_uart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_usbd.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_usbd.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_pdma.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_pdma.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_i2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_i2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_spi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_spi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_wwdt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_wwdt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_pwm.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_pwm.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_rtc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_rtc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_bpwm.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_bpwm.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_usci_i2c.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_usci_i2c.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_gpio.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_gpio.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_usci_spi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_usci_spi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_wdt.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_wdt.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_usci_uart.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_usci_uart.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_sys.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_sys.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_qspi.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_qspi.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_timer.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_timer.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_acmp.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_acmp.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_fmc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_fmc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>nu_crc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\m031\StdDriver\src\nu_crc.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>nu_pkgs_demo</GroupName>
-          <Files>
-            <File>
-              <FileName>usbd_cdc_vcom_echo.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nu_packages\Demo\usbd_cdc_vcom_echo.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>slcd_show_tick.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nu_packages\Demo\slcd_show_tick.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbd_hid_dance_mouse.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\libraries\nu_packages\Demo\usbd_hid_dance_mouse.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>rt_usbd</GroupName>
-          <Files>
-            <File>
-              <FileName>usbdevice_core.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\core\usbdevice_core.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>usbdevice.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\core\usbdevice.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>hid.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\drivers\usb\usbdevice\class\hid.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>UTest</GroupName>
-          <Files>
-            <File>
-              <FileName>utest.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\components\utilities\utest\utest.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-        <Group>
-          <GroupName>utestcases</GroupName>
-          <Files>
-            <File>
-              <FileName>mem_tc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\examples\utest\testcases\kernel\mem_tc.c</FilePath>
-            </File>
-          </Files>
-          <Files>
-            <File>
-              <FileName>pass_tc.c</FileName>
-              <FileType>1</FileType>
-              <FilePath>..\..\..\examples\utest\testcases\utest\pass_tc.c</FilePath>
-            </File>
-          </Files>
-        </Group>
-      </Groups>
-    </Target>
-  </Targets>
-  <RTE>
-    <apis />
-    <components />
-    <files />
-  </RTE>
-</Project>

+ 0 - 286
bsp/nuvoton/numaker-m032ki/rtconfig.h

@@ -1,286 +0,0 @@
-#ifndef RT_CONFIG_H__
-#define RT_CONFIG_H__
-
-/* Automatically generated file; DO NOT EDIT. */
-/* RT-Thread Configuration */
-
-/* RT-Thread Kernel */
-
-#define RT_NAME_MAX 8
-#define RT_ALIGN_SIZE 4
-#define RT_THREAD_PRIORITY_32
-#define RT_THREAD_PRIORITY_MAX 32
-#define RT_TICK_PER_SECOND 1000
-#define RT_USING_OVERFLOW_CHECK
-#define RT_USING_HOOK
-#define RT_HOOK_USING_FUNC_PTR
-#define RT_USING_IDLE_HOOK
-#define RT_IDLE_HOOK_LIST_SIZE 4
-#define IDLE_THREAD_STACK_SIZE 512
-#define RT_USING_TIMER_SOFT
-#define RT_TIMER_THREAD_PRIO 4
-#define RT_TIMER_THREAD_STACK_SIZE 512
-
-/* kservice optimization */
-
-#define RT_DEBUG
-
-/* Inter-Thread communication */
-
-#define RT_USING_SEMAPHORE
-#define RT_USING_MUTEX
-#define RT_USING_EVENT
-#define RT_USING_MAILBOX
-#define RT_USING_MESSAGEQUEUE
-
-/* Memory Management */
-
-#define RT_USING_MEMPOOL
-#define RT_USING_SMALL_MEM
-#define RT_USING_SMALL_MEM_AS_HEAP
-#define RT_USING_HEAP
-
-/* Kernel Device Object */
-
-#define RT_USING_DEVICE
-#define RT_USING_CONSOLE
-#define RT_CONSOLEBUF_SIZE 256
-#define RT_CONSOLE_DEVICE_NAME "uart0"
-#define RT_VER_NUM 0x40100
-#define ARCH_ARM
-#define ARCH_ARM_CORTEX_M
-#define ARCH_ARM_CORTEX_M0
-
-/* RT-Thread Components */
-
-#define RT_USING_COMPONENTS_INIT
-#define RT_USING_USER_MAIN
-#define RT_MAIN_THREAD_STACK_SIZE 2048
-#define RT_MAIN_THREAD_PRIORITY 10
-
-/* C++ features */
-
-
-/* Command shell */
-
-#define RT_USING_FINSH
-#define RT_USING_MSH
-#define FINSH_USING_MSH
-#define FINSH_THREAD_NAME "tshell"
-#define FINSH_THREAD_PRIORITY 20
-#define FINSH_THREAD_STACK_SIZE 4096
-#define FINSH_USING_HISTORY
-#define FINSH_HISTORY_LINES 5
-#define FINSH_USING_SYMTAB
-#define FINSH_CMD_SIZE 80
-#define MSH_USING_BUILT_IN_COMMANDS
-#define FINSH_USING_DESCRIPTION
-#define FINSH_ARG_MAX 10
-
-/* Device virtual file system */
-
-#define RT_USING_DFS
-#define DFS_USING_POSIX
-#define DFS_USING_WORKDIR
-#define DFS_FILESYSTEMS_MAX 2
-#define DFS_FILESYSTEM_TYPES_MAX 2
-#define DFS_FD_MAX 16
-#define RT_USING_DFS_DEVFS
-
-/* Device Drivers */
-
-#define RT_USING_DEVICE_IPC
-#define RT_USING_SERIAL
-#define RT_USING_SERIAL_V1
-#define RT_SERIAL_USING_DMA
-#define RT_SERIAL_RB_BUFSZ 64
-#define RT_USING_HWTIMER
-#define RT_USING_PIN
-#define RT_USING_ADC
-#define RT_USING_PWM
-#define RT_USING_PM
-#define PM_TICKLESS_THRESHOLD_TIME 2
-#define RT_USING_RTC
-#define RT_USING_WDT
-
-/* Using USB */
-
-#define RT_USING_USB
-#define RT_USING_USB_DEVICE
-#define RT_USBD_THREAD_STACK_SZ 4096
-#define USB_VENDOR_ID 0x0FFE
-#define USB_PRODUCT_ID 0x0001
-#define RT_USB_DEVICE_COMPOSITE
-#define RT_USB_DEVICE_NONE
-#define RT_USB_DEVICE_HID
-#define RT_USB_DEVICE_HID_MOUSE
-
-/* POSIX layer and C standard library */
-
-#define RT_LIBC_DEFAULT_TIMEZONE 8
-
-/* POSIX (Portable Operating System Interface) layer */
-
-
-/* Interprocess Communication (IPC) */
-
-
-/* Socket is in the 'Network' category */
-
-/* Network */
-
-/* Socket abstraction layer */
-
-
-/* Network interface device */
-
-
-/* light weight TCP/IP stack */
-
-
-/* AT commands */
-
-
-/* VBUS(Virtual Software BUS) */
-
-
-/* Utilities */
-
-#define RT_USING_UTEST
-#define UTEST_THR_STACK_SIZE 4096
-#define UTEST_THR_PRIORITY 20
-
-/* RT-Thread Utestcases */
-
-#define RT_USING_UTESTCASES
-
-/* Utest Self Testcase */
-
-#define UTEST_SELF_PASS_TC
-
-/* Kernel Testcase */
-
-#define UTEST_SMALL_MEM_TC
-
-/* Utest Serial Testcase */
-
-
-/* RT-Thread online packages */
-
-/* IoT - internet of things */
-
-
-/* Wi-Fi */
-
-/* Marvell WiFi */
-
-
-/* Wiced WiFi */
-
-
-/* IoT Cloud */
-
-
-/* security packages */
-
-
-/* language packages */
-
-
-/* multimedia packages */
-
-/* LVGL: powerful and easy-to-use embedded GUI library */
-
-
-/* u8g2: a monochrome graphic library */
-
-
-/* PainterEngine: A cross-platform graphics application framework written in C language */
-
-
-/* tools packages */
-
-
-/* system packages */
-
-/* enhanced kernel services */
-
-
-/* POSIX extension functions */
-
-
-/* acceleration: Assembly language or algorithmic acceleration packages */
-
-
-/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
-
-
-/* Micrium: Micrium software products porting for RT-Thread */
-
-
-/* peripheral libraries and drivers */
-
-
-/* AI packages */
-
-
-/* miscellaneous packages */
-
-/* samples: kernel and components samples */
-
-
-/* entertainment: terminal games and other interesting software packages */
-
-
-/* Nuvoton Packages Config */
-
-#define NU_PKG_USING_UTILS
-#define NU_PKG_USING_DEMO
-
-/* Hardware Drivers Config */
-
-/* On-chip Peripheral Drivers */
-
-#define SOC_SERIES_M032
-#define BSP_USE_STDDRIVER_SOURCE
-#define BSP_USING_PDMA
-#define NU_PDMA_MEMFUN_ACTOR_MAX 4
-#define NU_PDMA_SGTBL_POOL_SIZE 16
-#define BSP_USING_GPIO
-#define BSP_USING_CLK
-#define NU_CLK_INVOKE_WKTMR
-#define BSP_USING_RTC
-#define NU_RTC_SUPPORT_IO_RW
-#define NU_RTC_SUPPORT_MSH_CMD
-#define BSP_USING_ADC
-#define BSP_USING_ADC0
-#define BSP_USING_TMR
-#define BSP_USING_TIMER
-#define BSP_USING_TMR0
-#define BSP_USING_TIMER0
-#define BSP_USING_TMR1
-#define BSP_USING_TIMER1
-#define BSP_USING_TMR2
-#define BSP_USING_TIMER2
-#define BSP_USING_UART
-#define BSP_USING_UART0
-#define BSP_USING_UART1
-#define BSP_USING_UART1_TX_DMA
-#define BSP_USING_UART1_RX_DMA
-#define BSP_USING_UART2
-#define BSP_USING_UART3
-#define BSP_USING_UART4
-#define BSP_USING_UART5
-#define BSP_USING_UART6
-#define BSP_USING_UART7
-#define BSP_USING_WDT
-#define BSP_USING_USBD
-
-/* On-board Peripheral Drivers */
-
-#define BSP_USING_NULINKME
-
-/* Board extended module drivers */
-
-
-#endif

+ 8 - 0
bsp/nuvoton/numaker-m032ki/rtconfig.py

@@ -122,3 +122,11 @@ elif PLATFORM == 'iar':
 
     EXEC_PATH += '/arm/bin/'
     POST_ACTION = ''
+
+def dist_handle(BSP_ROOT, dist_dir):
+    import sys
+    cwd_path = os.getcwd()
+    sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
+    from sdk_dist import dist_do_building
+    dist_do_building(BSP_ROOT, dist_dir)
+

+ 24 - 18
bsp/nuvoton/numaker-m2354/.config

@@ -557,6 +557,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
 # CONFIG_PKG_USING_MCURSES is not set
 # CONFIG_PKG_USING_TERMBOX is not set
 # CONFIG_PKG_USING_VT100 is not set
+# CONFIG_PKG_USING_QRCODE is not set
 
 #
 # tools packages
@@ -567,7 +568,6 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
 # CONFIG_PKG_USING_SYSTEMVIEW is not set
 # CONFIG_PKG_USING_SEGGER_RTT is not set
 # CONFIG_PKG_USING_RDB is not set
-# CONFIG_PKG_USING_QRCODE is not set
 # CONFIG_PKG_USING_ULOG_EASYFLASH is not set
 # CONFIG_PKG_USING_ULOG_FILE is not set
 # CONFIG_PKG_USING_LOGMGR is not set
@@ -618,6 +618,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
 # CONFIG_PKG_USING_POSIX_GETLINE is not set
 # CONFIG_PKG_USING_POSIX_WCWIDTH is not set
 # CONFIG_PKG_USING_POSIX_ITOA is not set
+# CONFIG_PKG_USING_POSIX_STRINGS is not set
 
 #
 # acceleration: Assembly language or algorithmic acceleration packages
@@ -652,14 +653,14 @@ CONFIG_FAL_DEBUG_CONFIG=y
 CONFIG_FAL_DEBUG=1
 CONFIG_FAL_PART_HAS_TABLE_CFG=y
 # CONFIG_FAL_USING_SFUD_PORT is not set
-CONFIG_PKG_USING_FAL_V00500=y
+# CONFIG_PKG_USING_FAL_V00500 is not set
 # CONFIG_PKG_USING_FAL_V00400 is not set
 # CONFIG_PKG_USING_FAL_V00300 is not set
 # CONFIG_PKG_USING_FAL_V00200 is not set
 # CONFIG_PKG_USING_FAL_V00100 is not set
-# CONFIG_PKG_USING_FAL_LATEST_VERSION is not set
-CONFIG_PKG_FAL_VER="v0.5.0"
-CONFIG_PKG_FAL_VER_NUM=0x00500
+CONFIG_PKG_USING_FAL_LATEST_VERSION=y
+CONFIG_PKG_FAL_VER="latest"
+CONFIG_PKG_FAL_VER_NUM=0x99999
 # CONFIG_PKG_USING_FLASHDB is not set
 # CONFIG_PKG_USING_SQLITE is not set
 # CONFIG_PKG_USING_RTI is not set
@@ -742,6 +743,7 @@ CONFIG_PKG_FAL_VER_NUM=0x00500
 # CONFIG_PKG_USING_SSD1306 is not set
 # CONFIG_PKG_USING_QKEY is not set
 # CONFIG_PKG_USING_RS485 is not set
+# CONFIG_PKG_USING_RS232 is not set
 # CONFIG_PKG_USING_NES is not set
 # CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
 # CONFIG_PKG_USING_VDEVICE is not set
@@ -829,19 +831,8 @@ CONFIG_PKG_FAL_VER_NUM=0x00500
 # CONFIG_PKG_USING_LWGPS is not set
 # CONFIG_PKG_USING_STATE_MACHINE is not set
 # CONFIG_PKG_USING_DESIGN_PATTERN is not set
-
-#
-# Nuvoton Packages Config
-#
-CONFIG_NU_PKG_USING_UTILS=y
-CONFIG_NU_PKG_USING_DEMO=y
-# CONFIG_NU_PKG_USING_BMX055 is not set
-# CONFIG_NU_PKG_USING_MAX31875 is not set
-# CONFIG_NU_PKG_USING_NAU88L25 is not set
-# CONFIG_NU_PKG_USING_NAU8822 is not set
-# CONFIG_NU_PKG_USING_DA9062 is not set
-# CONFIG_NU_PKG_USING_ILI9341 is not set
-# CONFIG_NU_PKG_USING_SPINAND is not set
+# CONFIG_PKG_USING_CONTROLLER is not set
+# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
 
 #
 # Hardware Drivers Config
@@ -947,3 +938,18 @@ CONFIG_BOARD_USING_OTG=y
 # Board extended module drivers
 #
 CONFIG_BOARD_USING_SEGMENT_LCD=y
+
+#
+# Nuvoton Packages Config
+#
+CONFIG_NU_PKG_USING_UTILS=y
+CONFIG_NU_PKG_USING_DEMO=y
+# CONFIG_NU_PKG_USING_BMX055 is not set
+# CONFIG_NU_PKG_USING_MAX31875 is not set
+# CONFIG_NU_PKG_USING_NAU88L25 is not set
+# CONFIG_NU_PKG_USING_NAU8822 is not set
+# CONFIG_NU_PKG_USING_DA9062 is not set
+# CONFIG_NU_PKG_USING_ILI9341 is not set
+# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_BOARD_USE_UTEST=y
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.numaker-m2354.test.utest."

+ 1 - 7
bsp/nuvoton/numaker-m2354/Kconfig

@@ -9,7 +9,7 @@ config RTT_DIR
     string
     option env="RTT_ROOT"
     default "../../.."
-
+    
 # you can change the RTT_ROOT default "../../.." to your rtthread_root,
 # example : default "F:/git_repositories/rt-thread"
 
@@ -18,12 +18,6 @@ config PKGS_DIR
     option env="PKGS_ROOT"
     default "packages"
 
-config NU_PKGS_DIR
-    string
-    option env="NU_PKGS_ROOT"
-    default "../libraries/nu_packages"
-
 source "$RTT_DIR/Kconfig"
 source "$PKGS_DIR/Kconfig"
-source "$NU_PKGS_DIR/Kconfig"
 source "$BSP_DIR/board/Kconfig"

+ 2 - 0
bsp/nuvoton/numaker-m2354/board/Kconfig

@@ -68,4 +68,6 @@ menu "Hardware Drivers Config"
 
     endmenu
 
+    source "$BSP_DIR/../libraries/nu_packages/Kconfig"
+
 endmenu

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 337
bsp/nuvoton/numaker-m2354/project.uvprojx


+ 0 - 383
bsp/nuvoton/numaker-m2354/rtconfig.h

@@ -1,383 +0,0 @@
-#ifndef RT_CONFIG_H__
-#define RT_CONFIG_H__
-
-/* Automatically generated file; DO NOT EDIT. */
-/* RT-Thread Configuration */
-
-/* RT-Thread Kernel */
-
-#define RT_NAME_MAX 8
-#define RT_ALIGN_SIZE 4
-#define RT_THREAD_PRIORITY_32
-#define RT_THREAD_PRIORITY_MAX 32
-#define RT_TICK_PER_SECOND 1000
-#define RT_USING_OVERFLOW_CHECK
-#define RT_USING_HOOK
-#define RT_HOOK_USING_FUNC_PTR
-#define RT_USING_IDLE_HOOK
-#define RT_IDLE_HOOK_LIST_SIZE 4
-#define IDLE_THREAD_STACK_SIZE 2048
-
-/* kservice optimization */
-
-#define RT_DEBUG
-#define RT_DEBUG_COLOR
-
-/* Inter-Thread communication */
-
-#define RT_USING_SEMAPHORE
-#define RT_USING_MUTEX
-#define RT_USING_EVENT
-#define RT_USING_MAILBOX
-#define RT_USING_MESSAGEQUEUE
-#define RT_USING_SIGNALS
-
-/* Memory Management */
-
-#define RT_USING_MEMPOOL
-#define RT_USING_SMALL_MEM
-#define RT_USING_SMALL_MEM_AS_HEAP
-#define RT_USING_HEAP
-
-/* Kernel Device Object */
-
-#define RT_USING_DEVICE
-#define RT_USING_CONSOLE
-#define RT_CONSOLEBUF_SIZE 256
-#define RT_CONSOLE_DEVICE_NAME "uart0"
-#define RT_VER_NUM 0x40100
-
-/* RT-Thread Components */
-
-#define RT_USING_COMPONENTS_INIT
-#define RT_USING_USER_MAIN
-#define RT_MAIN_THREAD_STACK_SIZE 2048
-#define RT_MAIN_THREAD_PRIORITY 10
-
-/* C++ features */
-
-
-/* Command shell */
-
-#define RT_USING_FINSH
-#define RT_USING_MSH
-#define FINSH_USING_MSH
-#define FINSH_THREAD_NAME "tshell"
-#define FINSH_THREAD_PRIORITY 20
-#define FINSH_THREAD_STACK_SIZE 4096
-#define FINSH_USING_HISTORY
-#define FINSH_HISTORY_LINES 5
-#define FINSH_USING_SYMTAB
-#define FINSH_CMD_SIZE 80
-#define MSH_USING_BUILT_IN_COMMANDS
-#define FINSH_USING_DESCRIPTION
-#define FINSH_ARG_MAX 10
-
-/* Device virtual file system */
-
-#define RT_USING_DFS
-#define DFS_USING_POSIX
-#define DFS_USING_WORKDIR
-#define DFS_FILESYSTEMS_MAX 4
-#define DFS_FILESYSTEM_TYPES_MAX 4
-#define DFS_FD_MAX 32
-#define RT_USING_DFS_ELMFAT
-
-/* elm-chan's FatFs, Generic FAT Filesystem Module */
-
-#define RT_DFS_ELM_CODE_PAGE 437
-#define RT_DFS_ELM_WORD_ACCESS
-#define RT_DFS_ELM_USE_LFN_3
-#define RT_DFS_ELM_USE_LFN 3
-#define RT_DFS_ELM_LFN_UNICODE_0
-#define RT_DFS_ELM_LFN_UNICODE 0
-#define RT_DFS_ELM_MAX_LFN 255
-#define RT_DFS_ELM_DRIVES 2
-#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
-#define RT_DFS_ELM_REENTRANT
-#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
-#define RT_USING_DFS_DEVFS
-
-/* Device Drivers */
-
-#define RT_USING_DEVICE_IPC
-#define RT_USING_SYSTEM_WORKQUEUE
-#define RT_SYSTEM_WORKQUEUE_STACKSIZE 2048
-#define RT_SYSTEM_WORKQUEUE_PRIORITY 23
-#define RT_USING_SERIAL
-#define RT_USING_SERIAL_V1
-#define RT_SERIAL_USING_DMA
-#define RT_SERIAL_RB_BUFSZ 2048
-#define RT_USING_CAN
-#define RT_USING_HWTIMER
-#define RT_USING_I2C
-#define RT_USING_I2C_BITOPS
-#define RT_USING_PIN
-#define RT_USING_ADC
-#define RT_USING_PWM
-#define RT_USING_PM
-#define PM_TICKLESS_THRESHOLD_TIME 2
-#define RT_USING_RTC
-#define RT_USING_SPI
-#define RT_USING_QSPI
-#define RT_USING_SFUD
-#define RT_SFUD_USING_SFDP
-#define RT_SFUD_USING_FLASH_INFO_TABLE
-#define RT_SFUD_USING_QSPI
-#define RT_SFUD_SPI_MAX_HZ 50000000
-#define RT_DEBUG_SFUD
-#define RT_USING_WDT
-#define RT_USING_AUDIO
-#define RT_AUDIO_REPLAY_MP_BLOCK_SIZE 4096
-#define RT_AUDIO_REPLAY_MP_BLOCK_COUNT 2
-#define RT_AUDIO_RECORD_PIPE_SIZE 2048
-#define RT_USING_SENSOR
-#define RT_USING_SENSOR_CMD
-#define RT_USING_HWCRYPTO
-#define RT_HWCRYPTO_DEFAULT_NAME "hwcryto"
-#define RT_HWCRYPTO_IV_MAX_SIZE 16
-#define RT_HWCRYPTO_KEYBIT_MAX_SIZE 256
-#define RT_HWCRYPTO_USING_AES
-#define RT_HWCRYPTO_USING_AES_ECB
-#define RT_HWCRYPTO_USING_AES_CBC
-#define RT_HWCRYPTO_USING_AES_CFB
-#define RT_HWCRYPTO_USING_AES_CTR
-#define RT_HWCRYPTO_USING_AES_OFB
-#define RT_HWCRYPTO_USING_DES
-#define RT_HWCRYPTO_USING_DES_ECB
-#define RT_HWCRYPTO_USING_DES_CBC
-#define RT_HWCRYPTO_USING_3DES
-#define RT_HWCRYPTO_USING_3DES_ECB
-#define RT_HWCRYPTO_USING_3DES_CBC
-#define RT_HWCRYPTO_USING_SHA1
-#define RT_HWCRYPTO_USING_SHA2
-#define RT_HWCRYPTO_USING_SHA2_224
-#define RT_HWCRYPTO_USING_SHA2_256
-#define RT_HWCRYPTO_USING_SHA2_384
-#define RT_HWCRYPTO_USING_SHA2_512
-#define RT_HWCRYPTO_USING_RNG
-#define RT_HWCRYPTO_USING_CRC
-#define RT_HWCRYPTO_USING_CRC_07
-#define RT_HWCRYPTO_USING_CRC_8005
-#define RT_HWCRYPTO_USING_CRC_1021
-#define RT_HWCRYPTO_USING_CRC_04C11DB7
-
-/* Using USB */
-
-#define RT_USING_USB
-#define RT_USING_USB_HOST
-#define RT_USBH_MSTORAGE
-#define UDISK_MOUNTPOINT "/"
-#define RT_USING_USB_DEVICE
-#define RT_USBD_THREAD_STACK_SZ 4096
-#define USB_VENDOR_ID 0x0FFE
-#define USB_PRODUCT_ID 0x0001
-#define _RT_USB_DEVICE_HID
-#define RT_USB_DEVICE_HID
-#define RT_USB_DEVICE_HID_MOUSE
-
-/* POSIX layer and C standard library */
-
-#define RT_LIBC_DEFAULT_TIMEZONE 8
-
-/* POSIX (Portable Operating System Interface) layer */
-
-#define RT_USING_POSIX_FS
-#define RT_USING_POSIX_DEVIO
-#define RT_USING_POSIX_POLL
-#define RT_USING_POSIX_SELECT
-
-/* Interprocess Communication (IPC) */
-
-
-/* Socket is in the 'Network' category */
-
-/* Network */
-
-/* Socket abstraction layer */
-
-#define RT_USING_SAL
-#define SAL_INTERNET_CHECK
-
-/* protocol stack implement */
-
-#define SAL_USING_AT
-#define SAL_USING_POSIX
-
-/* Network interface device */
-
-#define RT_USING_NETDEV
-#define NETDEV_USING_IFCONFIG
-#define NETDEV_USING_PING
-#define NETDEV_USING_NETSTAT
-#define NETDEV_USING_AUTO_DEFAULT
-#define NETDEV_IPV4 1
-#define NETDEV_IPV6 0
-
-/* light weight TCP/IP stack */
-
-
-/* AT commands */
-
-#define RT_USING_AT
-#define AT_USING_CLIENT
-#define AT_CLIENT_NUM_MAX 1
-#define AT_USING_SOCKET
-#define AT_USING_CLI
-#define AT_CMD_MAX_LEN 2048
-#define AT_SW_VERSION_NUM 0x10301
-
-/* VBUS(Virtual Software BUS) */
-
-
-/* Utilities */
-
-#define RT_USING_UTEST
-#define UTEST_THR_STACK_SIZE 4096
-#define UTEST_THR_PRIORITY 20
-
-/* RT-Thread Utestcases */
-
-
-/* RT-Thread online packages */
-
-/* IoT - internet of things */
-
-
-/* Wi-Fi */
-
-/* Marvell WiFi */
-
-
-/* Wiced WiFi */
-
-#define PKG_USING_AT_DEVICE
-#define AT_DEVICE_USING_ESP8266
-#define AT_DEVICE_ESP8266_INIT_ASYN
-#define PKG_USING_AT_DEVICE_LATEST_VERSION
-#define PKG_AT_DEVICE_VER_NUM 0x99999
-
-/* IoT Cloud */
-
-
-/* security packages */
-
-
-/* language packages */
-
-
-/* multimedia packages */
-
-/* LVGL: powerful and easy-to-use embedded GUI library */
-
-
-/* u8g2: a monochrome graphic library */
-
-
-/* PainterEngine: A cross-platform graphics application framework written in C language */
-
-
-/* tools packages */
-
-
-/* system packages */
-
-/* enhanced kernel services */
-
-
-/* POSIX extension functions */
-
-
-/* acceleration: Assembly language or algorithmic acceleration packages */
-
-
-/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
-
-
-/* Micrium: Micrium software products porting for RT-Thread */
-
-#define PKG_USING_FAL
-#define FAL_DEBUG_CONFIG
-#define FAL_DEBUG 1
-#define FAL_PART_HAS_TABLE_CFG
-#define PKG_USING_FAL_V00500
-#define PKG_FAL_VER_NUM 0x00500
-
-/* peripheral libraries and drivers */
-
-
-/* AI packages */
-
-
-/* miscellaneous packages */
-
-/* samples: kernel and components samples */
-
-
-/* entertainment: terminal games and other interesting software packages */
-
-
-/* Nuvoton Packages Config */
-
-#define NU_PKG_USING_UTILS
-#define NU_PKG_USING_DEMO
-
-/* Hardware Drivers Config */
-
-/* On-chip Peripheral Drivers */
-
-#define SOC_SERIES_M2354
-#define BSP_USE_STDDRIVER_SOURCE
-#define BSP_USING_PDMA
-#define NU_PDMA_MEMFUN_ACTOR_MAX 2
-#define NU_PDMA_SGTBL_POOL_SIZE 16
-#define BSP_USING_FMC
-#define BSP_USING_GPIO
-#define BSP_USING_CLK
-#define NU_CLK_INVOKE_WKTMR
-#define BSP_USING_RTC
-#define NU_RTC_SUPPORT_MSH_CMD
-#define BSP_USING_EADC
-#define BSP_USING_EADC0
-#define BSP_USING_TMR
-#define BSP_USING_UART
-#define BSP_USING_UART0
-#define BSP_USING_UART1
-#define BSP_USING_UART4
-#define BSP_USING_UART4_TX_DMA
-#define BSP_USING_UART4_RX_DMA
-#define BSP_USING_I2C
-#define BSP_USING_I2C1
-#define BSP_USING_SDH
-#define BSP_USING_SDH0
-#define NU_SDH_USING_PDMA
-#define NU_SDH_HOTPLUG
-#define NU_SDH_MOUNT_ON_ROOT
-#define BSP_USING_SPI
-#define BSP_USING_SPI0
-#define BSP_USING_SPI1
-#define BSP_USING_SPI2_NONE
-#define BSP_USING_SPI3_NONE
-#define BSP_USING_CRYPTO
-#define BSP_USING_TRNG
-#define BSP_USING_CRC
-#define NU_CRC_USE_PDMA
-#define BSP_USING_WDT
-#define BSP_USING_SLCD
-#define BSP_USING_USBD
-#define BSP_USING_USBH
-#define NU_USBHOST_HUB_POLLING_INTERVAL 100
-#define BSP_USING_OTG
-
-/* On-board Peripheral Drivers */
-
-#define BSP_USING_NULINKME
-#define BOARD_USING_ESP8266
-#define BOARD_USING_STORAGE_SDCARD
-#define BOARD_USING_OTG
-
-/* Board extended module drivers */
-
-#define BOARD_USING_SEGMENT_LCD
-
-#endif

+ 8 - 0
bsp/nuvoton/numaker-m2354/rtconfig.py

@@ -122,3 +122,11 @@ elif PLATFORM == 'iar':
 
     EXEC_PATH += '/arm/bin/'
     POST_ACTION = ''
+
+def dist_handle(BSP_ROOT, dist_dir):
+    import sys
+    cwd_path = os.getcwd()
+    sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
+    from sdk_dist import dist_do_building
+    dist_do_building(BSP_ROOT, dist_dir)
+

+ 24 - 18
bsp/nuvoton/numaker-pfm-m487/.config

@@ -578,6 +578,7 @@ CONFIG_UTEST_THR_PRIORITY=20
 # CONFIG_PKG_USING_MCURSES is not set
 # CONFIG_PKG_USING_TERMBOX is not set
 # CONFIG_PKG_USING_VT100 is not set
+# CONFIG_PKG_USING_QRCODE is not set
 
 #
 # tools packages
@@ -588,7 +589,6 @@ CONFIG_UTEST_THR_PRIORITY=20
 # CONFIG_PKG_USING_SYSTEMVIEW is not set
 # CONFIG_PKG_USING_SEGGER_RTT is not set
 # CONFIG_PKG_USING_RDB is not set
-# CONFIG_PKG_USING_QRCODE is not set
 # CONFIG_PKG_USING_ULOG_EASYFLASH is not set
 # CONFIG_PKG_USING_ULOG_FILE is not set
 # CONFIG_PKG_USING_LOGMGR is not set
@@ -639,6 +639,7 @@ CONFIG_UTEST_THR_PRIORITY=20
 # CONFIG_PKG_USING_POSIX_GETLINE is not set
 # CONFIG_PKG_USING_POSIX_WCWIDTH is not set
 # CONFIG_PKG_USING_POSIX_ITOA is not set
+# CONFIG_PKG_USING_POSIX_STRINGS is not set
 
 #
 # acceleration: Assembly language or algorithmic acceleration packages
@@ -675,13 +676,13 @@ CONFIG_FAL_DEBUG=1
 CONFIG_FAL_PART_HAS_TABLE_CFG=y
 # CONFIG_FAL_USING_SFUD_PORT is not set
 # CONFIG_PKG_USING_FAL_V00500 is not set
-CONFIG_PKG_USING_FAL_V00400=y
+# CONFIG_PKG_USING_FAL_V00400 is not set
 # CONFIG_PKG_USING_FAL_V00300 is not set
 # CONFIG_PKG_USING_FAL_V00200 is not set
 # CONFIG_PKG_USING_FAL_V00100 is not set
-# CONFIG_PKG_USING_FAL_LATEST_VERSION is not set
-CONFIG_PKG_FAL_VER="v0.4.0"
-CONFIG_PKG_FAL_VER_NUM=0x00400
+CONFIG_PKG_USING_FAL_LATEST_VERSION=y
+CONFIG_PKG_FAL_VER="latest"
+CONFIG_PKG_FAL_VER_NUM=0x99999
 # CONFIG_PKG_USING_FLASHDB is not set
 # CONFIG_PKG_USING_SQLITE is not set
 # CONFIG_PKG_USING_RTI is not set
@@ -764,6 +765,7 @@ CONFIG_PKG_FAL_VER_NUM=0x00400
 # CONFIG_PKG_USING_SSD1306 is not set
 # CONFIG_PKG_USING_QKEY is not set
 # CONFIG_PKG_USING_RS485 is not set
+# CONFIG_PKG_USING_RS232 is not set
 # CONFIG_PKG_USING_NES is not set
 # CONFIG_PKG_USING_VIRTUAL_SENSOR is not set
 # CONFIG_PKG_USING_VDEVICE is not set
@@ -851,19 +853,8 @@ CONFIG_PKG_FAL_VER_NUM=0x00400
 # CONFIG_PKG_USING_LWGPS is not set
 # CONFIG_PKG_USING_STATE_MACHINE is not set
 # CONFIG_PKG_USING_DESIGN_PATTERN is not set
-
-#
-# Nuvoton Packages Config
-#
-CONFIG_NU_PKG_USING_UTILS=y
-CONFIG_NU_PKG_USING_DEMO=y
-# CONFIG_NU_PKG_USING_BMX055 is not set
-# CONFIG_NU_PKG_USING_MAX31875 is not set
-CONFIG_NU_PKG_USING_NAU88L25=y
-# CONFIG_NU_PKG_USING_NAU8822 is not set
-# CONFIG_NU_PKG_USING_DA9062 is not set
-# CONFIG_NU_PKG_USING_ILI9341 is not set
-# CONFIG_NU_PKG_USING_SPINAND is not set
+# CONFIG_PKG_USING_CONTROLLER is not set
+# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
 
 #
 # Hardware Drivers Config
@@ -975,3 +966,18 @@ CONFIG_BOARD_USING_HSUSBH_USBD=y
 # Board extended module drivers
 #
 # CONFIG_BOARD_USING_ADVANCE_V4 is not set
+
+#
+# Nuvoton Packages Config
+#
+CONFIG_NU_PKG_USING_UTILS=y
+CONFIG_NU_PKG_USING_DEMO=y
+# CONFIG_NU_PKG_USING_BMX055 is not set
+# CONFIG_NU_PKG_USING_MAX31875 is not set
+CONFIG_NU_PKG_USING_NAU88L25=y
+# CONFIG_NU_PKG_USING_NAU8822 is not set
+# CONFIG_NU_PKG_USING_DA9062 is not set
+# CONFIG_NU_PKG_USING_ILI9341 is not set
+# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_BOARD_USE_UTEST=y
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.numaker-pfm-m487.test.utest."

+ 0 - 6
bsp/nuvoton/numaker-pfm-m487/Kconfig

@@ -18,12 +18,6 @@ config PKGS_DIR
     option env="PKGS_ROOT"
     default "packages"
 
-config NU_PKGS_DIR
-    string
-    option env="NU_PKGS_ROOT"
-    default "../libraries/nu_packages"
-
 source "$RTT_DIR/Kconfig"
 source "$PKGS_DIR/Kconfig"
-source "$NU_PKGS_DIR/Kconfig"
 source "$BSP_DIR/board/Kconfig"

+ 2 - 0
bsp/nuvoton/numaker-pfm-m487/board/Kconfig

@@ -162,4 +162,6 @@ menu "Hardware Drivers Config"
 
     endmenu
 
+    source "$BSP_DIR/../libraries/nu_packages/Kconfig"
+
 endmenu

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 356
bsp/nuvoton/numaker-pfm-m487/project.uvproj


Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 336
bsp/nuvoton/numaker-pfm-m487/project.uvprojx


+ 0 - 413
bsp/nuvoton/numaker-pfm-m487/rtconfig.h

@@ -1,413 +0,0 @@
-#ifndef RT_CONFIG_H__
-#define RT_CONFIG_H__
-
-/* Automatically generated file; DO NOT EDIT. */
-/* RT-Thread Configuration */
-
-/* RT-Thread Kernel */
-
-#define RT_NAME_MAX 8
-#define RT_ALIGN_SIZE 4
-#define RT_THREAD_PRIORITY_32
-#define RT_THREAD_PRIORITY_MAX 32
-#define RT_TICK_PER_SECOND 1000
-#define RT_USING_OVERFLOW_CHECK
-#define RT_USING_HOOK
-#define RT_HOOK_USING_FUNC_PTR
-#define RT_USING_IDLE_HOOK
-#define RT_IDLE_HOOK_LIST_SIZE 4
-#define IDLE_THREAD_STACK_SIZE 1024
-
-/* kservice optimization */
-
-#define RT_DEBUG
-#define RT_DEBUG_COLOR
-
-/* Inter-Thread communication */
-
-#define RT_USING_SEMAPHORE
-#define RT_USING_MUTEX
-#define RT_USING_EVENT
-#define RT_USING_MAILBOX
-#define RT_USING_MESSAGEQUEUE
-#define RT_USING_SIGNALS
-
-/* Memory Management */
-
-#define RT_USING_MEMPOOL
-#define RT_USING_SMALL_MEM
-#define RT_USING_SMALL_MEM_AS_HEAP
-#define RT_USING_HEAP
-
-/* Kernel Device Object */
-
-#define RT_USING_DEVICE
-#define RT_USING_CONSOLE
-#define RT_CONSOLEBUF_SIZE 256
-#define RT_CONSOLE_DEVICE_NAME "uart0"
-#define RT_VER_NUM 0x40100
-#define ARCH_ARM
-#define RT_USING_CPU_FFS
-#define ARCH_ARM_CORTEX_M
-#define ARCH_ARM_CORTEX_M4
-
-/* RT-Thread Components */
-
-#define RT_USING_COMPONENTS_INIT
-#define RT_USING_USER_MAIN
-#define RT_MAIN_THREAD_STACK_SIZE 2048
-#define RT_MAIN_THREAD_PRIORITY 10
-
-/* C++ features */
-
-
-/* Command shell */
-
-#define RT_USING_FINSH
-#define RT_USING_MSH
-#define FINSH_USING_MSH
-#define FINSH_THREAD_NAME "tshell"
-#define FINSH_THREAD_PRIORITY 20
-#define FINSH_THREAD_STACK_SIZE 2048
-#define FINSH_USING_HISTORY
-#define FINSH_HISTORY_LINES 5
-#define FINSH_USING_SYMTAB
-#define FINSH_CMD_SIZE 80
-#define MSH_USING_BUILT_IN_COMMANDS
-#define FINSH_USING_DESCRIPTION
-#define FINSH_ARG_MAX 10
-
-/* Device virtual file system */
-
-#define RT_USING_DFS
-#define DFS_USING_POSIX
-#define DFS_USING_WORKDIR
-#define DFS_FILESYSTEMS_MAX 8
-#define DFS_FILESYSTEM_TYPES_MAX 4
-#define DFS_FD_MAX 32
-#define RT_USING_DFS_ELMFAT
-
-/* elm-chan's FatFs, Generic FAT Filesystem Module */
-
-#define RT_DFS_ELM_CODE_PAGE 437
-#define RT_DFS_ELM_WORD_ACCESS
-#define RT_DFS_ELM_USE_LFN_3
-#define RT_DFS_ELM_USE_LFN 3
-#define RT_DFS_ELM_LFN_UNICODE_0
-#define RT_DFS_ELM_LFN_UNICODE 0
-#define RT_DFS_ELM_MAX_LFN 255
-#define RT_DFS_ELM_DRIVES 8
-#define RT_DFS_ELM_MAX_SECTOR_SIZE 4096
-#define RT_DFS_ELM_REENTRANT
-#define RT_DFS_ELM_MUTEX_TIMEOUT 3000
-#define RT_USING_DFS_DEVFS
-
-/* Device Drivers */
-
-#define RT_USING_DEVICE_IPC
-#define RT_USING_SYSTEM_WORKQUEUE
-#define RT_SYSTEM_WORKQUEUE_STACKSIZE 2048
-#define RT_SYSTEM_WORKQUEUE_PRIORITY 23
-#define RT_USING_SERIAL
-#define RT_USING_SERIAL_V1
-#define RT_SERIAL_USING_DMA
-#define RT_SERIAL_RB_BUFSZ 128
-#define RT_USING_CAN
-#define RT_USING_HWTIMER
-#define RT_USING_I2C
-#define RT_USING_I2C_BITOPS
-#define RT_USING_PIN
-#define RT_USING_ADC
-#define RT_USING_PWM
-#define RT_USING_PM
-#define PM_TICKLESS_THRESHOLD_TIME 2
-#define RT_USING_RTC
-#define RT_USING_SPI
-#define RT_USING_QSPI
-#define RT_USING_SFUD
-#define RT_SFUD_USING_SFDP
-#define RT_SFUD_USING_FLASH_INFO_TABLE
-#define RT_SFUD_SPI_MAX_HZ 50000000
-#define RT_USING_WDT
-#define RT_USING_AUDIO
-#define RT_AUDIO_REPLAY_MP_BLOCK_SIZE 4096
-#define RT_AUDIO_REPLAY_MP_BLOCK_COUNT 2
-#define RT_AUDIO_RECORD_PIPE_SIZE 2048
-#define RT_USING_HWCRYPTO
-#define RT_HWCRYPTO_DEFAULT_NAME "hwcryto"
-#define RT_HWCRYPTO_IV_MAX_SIZE 16
-#define RT_HWCRYPTO_KEYBIT_MAX_SIZE 256
-#define RT_HWCRYPTO_USING_AES
-#define RT_HWCRYPTO_USING_AES_ECB
-#define RT_HWCRYPTO_USING_AES_CBC
-#define RT_HWCRYPTO_USING_AES_CFB
-#define RT_HWCRYPTO_USING_AES_CTR
-#define RT_HWCRYPTO_USING_AES_OFB
-#define RT_HWCRYPTO_USING_DES
-#define RT_HWCRYPTO_USING_DES_ECB
-#define RT_HWCRYPTO_USING_DES_CBC
-#define RT_HWCRYPTO_USING_3DES
-#define RT_HWCRYPTO_USING_3DES_ECB
-#define RT_HWCRYPTO_USING_3DES_CBC
-#define RT_HWCRYPTO_USING_SHA1
-#define RT_HWCRYPTO_USING_SHA2
-#define RT_HWCRYPTO_USING_SHA2_224
-#define RT_HWCRYPTO_USING_SHA2_256
-#define RT_HWCRYPTO_USING_SHA2_384
-#define RT_HWCRYPTO_USING_SHA2_512
-#define RT_HWCRYPTO_USING_RNG
-#define RT_HWCRYPTO_USING_CRC
-#define RT_HWCRYPTO_USING_CRC_07
-#define RT_HWCRYPTO_USING_CRC_8005
-#define RT_HWCRYPTO_USING_CRC_1021
-#define RT_HWCRYPTO_USING_CRC_04C11DB7
-
-/* Using USB */
-
-#define RT_USING_USB
-#define RT_USING_USB_HOST
-#define RT_USBH_MSTORAGE
-#define UDISK_MOUNTPOINT "/mnt/udisk/"
-#define RT_USING_USB_DEVICE
-#define RT_USBD_THREAD_STACK_SZ 4096
-#define USB_VENDOR_ID 0x0FFE
-#define USB_PRODUCT_ID 0x0001
-#define _RT_USB_DEVICE_HID
-#define RT_USB_DEVICE_HID
-#define RT_USB_DEVICE_HID_MOUSE
-
-/* POSIX layer and C standard library */
-
-#define RT_LIBC_DEFAULT_TIMEZONE 8
-
-/* POSIX (Portable Operating System Interface) layer */
-
-#define RT_USING_POSIX_FS
-#define RT_USING_POSIX_DEVIO
-
-/* Interprocess Communication (IPC) */
-
-
-/* Socket is in the 'Network' category */
-
-/* Network */
-
-/* Socket abstraction layer */
-
-#define RT_USING_SAL
-#define SAL_INTERNET_CHECK
-
-/* protocol stack implement */
-
-#define SAL_USING_LWIP
-#define SAL_SOCKETS_NUM 16
-
-/* Network interface device */
-
-#define RT_USING_NETDEV
-#define NETDEV_USING_IFCONFIG
-#define NETDEV_USING_PING
-#define NETDEV_USING_NETSTAT
-#define NETDEV_USING_AUTO_DEFAULT
-#define NETDEV_IPV4 1
-#define NETDEV_IPV6 0
-
-/* light weight TCP/IP stack */
-
-#define RT_USING_LWIP
-#define RT_USING_LWIP202
-#define RT_LWIP_MEM_ALIGNMENT 4
-#define RT_LWIP_IGMP
-#define RT_LWIP_ICMP
-#define RT_LWIP_DNS
-#define RT_LWIP_DHCP
-#define IP_SOF_BROADCAST 1
-#define IP_SOF_BROADCAST_RECV 1
-
-/* Static IPv4 Address */
-
-#define RT_LWIP_IPADDR "192.168.1.30"
-#define RT_LWIP_GWADDR "192.168.1.1"
-#define RT_LWIP_MSKADDR "255.255.255.0"
-#define RT_LWIP_UDP
-#define RT_LWIP_TCP
-#define RT_LWIP_RAW
-#define RT_MEMP_NUM_NETCONN 8
-#define RT_LWIP_PBUF_NUM 16
-#define RT_LWIP_RAW_PCB_NUM 4
-#define RT_LWIP_UDP_PCB_NUM 4
-#define RT_LWIP_TCP_PCB_NUM 4
-#define RT_LWIP_TCP_SEG_NUM 40
-#define RT_LWIP_TCP_SND_BUF 8196
-#define RT_LWIP_TCP_WND 8196
-#define RT_LWIP_TCPTHREAD_PRIORITY 10
-#define RT_LWIP_TCPTHREAD_MBOX_SIZE 8
-#define RT_LWIP_TCPTHREAD_STACKSIZE 1024
-#define RT_LWIP_ETHTHREAD_PRIORITY 12
-#define RT_LWIP_ETHTHREAD_STACKSIZE 1024
-#define RT_LWIP_ETHTHREAD_MBOX_SIZE 8
-#define LWIP_NETIF_STATUS_CALLBACK 1
-#define LWIP_NETIF_LINK_CALLBACK 1
-#define SO_REUSE 1
-#define LWIP_SO_RCVTIMEO 1
-#define LWIP_SO_SNDTIMEO 1
-#define LWIP_SO_RCVBUF 1
-#define LWIP_SO_LINGER 0
-#define LWIP_NETIF_LOOPBACK 0
-#define RT_LWIP_USING_PING
-
-/* AT commands */
-
-
-/* VBUS(Virtual Software BUS) */
-
-
-/* Utilities */
-
-#define RT_USING_UTEST
-#define UTEST_THR_STACK_SIZE 4096
-#define UTEST_THR_PRIORITY 20
-
-/* RT-Thread Utestcases */
-
-
-/* RT-Thread online packages */
-
-/* IoT - internet of things */
-
-
-/* Wi-Fi */
-
-/* Marvell WiFi */
-
-
-/* Wiced WiFi */
-
-
-/* IoT Cloud */
-
-
-/* security packages */
-
-
-/* language packages */
-
-
-/* multimedia packages */
-
-/* LVGL: powerful and easy-to-use embedded GUI library */
-
-
-/* u8g2: a monochrome graphic library */
-
-
-/* PainterEngine: A cross-platform graphics application framework written in C language */
-
-
-/* tools packages */
-
-
-/* system packages */
-
-/* enhanced kernel services */
-
-
-/* POSIX extension functions */
-
-
-/* acceleration: Assembly language or algorithmic acceleration packages */
-
-
-/* CMSIS: ARM Cortex-M Microcontroller Software Interface Standard */
-
-
-/* Micrium: Micrium software products porting for RT-Thread */
-
-#define PKG_USING_FAL
-#define FAL_DEBUG_CONFIG
-#define FAL_DEBUG 1
-#define FAL_PART_HAS_TABLE_CFG
-#define PKG_USING_FAL_V00400
-#define PKG_FAL_VER_NUM 0x00400
-
-/* peripheral libraries and drivers */
-
-
-/* AI packages */
-
-
-/* miscellaneous packages */
-
-/* samples: kernel and components samples */
-
-
-/* entertainment: terminal games and other interesting software packages */
-
-
-/* Nuvoton Packages Config */
-
-#define NU_PKG_USING_UTILS
-#define NU_PKG_USING_DEMO
-#define NU_PKG_USING_NAU88L25
-
-/* Hardware Drivers Config */
-
-/* On-chip Peripheral Drivers */
-
-#define SOC_SERIES_M480
-#define BSP_USE_STDDRIVER_SOURCE
-#define BSP_USING_PDMA
-#define NU_PDMA_MEMFUN_ACTOR_MAX 2
-#define NU_PDMA_SGTBL_POOL_SIZE 16
-#define BSP_USING_FMC
-#define BSP_USING_GPIO
-#define BSP_USING_CLK
-#define NU_CLK_INVOKE_WKTMR
-#define BSP_USING_EMAC
-#define NU_EMAC_PDMA_MEMCOPY
-#define NU_EMAC_PDMA_MEMCOPY_THRESHOLD 128
-#define BSP_USING_RTC
-#define NU_RTC_SUPPORT_MSH_CMD
-#define BSP_USING_TMR
-#define BSP_USING_UART
-#define BSP_USING_UART0
-#define BSP_USING_I2C
-#define BSP_USING_I2C1
-#define BSP_USING_I2C2
-#define BSP_USING_SDH
-#define BSP_USING_SDH0
-#define NU_SDH_USING_PDMA
-#define NU_SDH_HOTPLUG
-#define BSP_USING_SPI
-#define BSP_USING_SPI_PDMA
-#define BSP_USING_SPI0_NONE
-#define BSP_USING_SPI1_NONE
-#define BSP_USING_SPI2_NONE
-#define BSP_USING_SPI3
-#define BSP_USING_I2S
-#define NU_I2S_DMA_FIFO_SIZE 2048
-#define BSP_USING_QSPI
-#define BSP_USING_QSPI0
-#define BSP_USING_QSPI0_PDMA
-#define BSP_USING_CRYPTO
-#define BSP_USING_TRNG
-#define BSP_USING_CRC
-#define NU_CRC_USE_PDMA
-#define BSP_USING_WDT
-#define BSP_USING_USBD
-#define BSP_USING_HSUSBH
-#define NU_USBHOST_HUB_POLLING_INTERVAL 100
-
-/* On-board Peripheral Drivers */
-
-#define BSP_USING_NULINKME
-#define BOARD_USING_IP101GR
-#define BOARD_USING_NAU88L25
-#define BOARD_USING_STORAGE_SDCARD
-#define BOARD_USING_STORAGE_SPIFLASH
-#define BOARD_USING_HSUSBH_USBD
-
-/* Board extended module drivers */
-
-
-#endif

+ 8 - 0
bsp/nuvoton/numaker-pfm-m487/rtconfig.py

@@ -130,3 +130,11 @@ elif PLATFORM == 'iar':
 
     EXEC_PATH = EXEC_PATH + '/arm/bin/'
     POST_ACTION = ''
+
+def dist_handle(BSP_ROOT, dist_dir):
+    import sys
+    cwd_path = os.getcwd()
+    sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
+    from sdk_dist import dist_do_building
+    dist_do_building(BSP_ROOT, dist_dir)
+

+ 39 - 0
bsp/nuvoton/tools/sdk_dist.py

@@ -0,0 +1,39 @@
+import os
+import sys
+import shutil
+cwd_path = os.getcwd()
+sys.path.append(os.path.join(os.path.dirname(cwd_path), 'rt-thread', 'tools'))
+
+def dist_modify_relative_path(board_kconfig_path):
+    # Read in the file
+    with open(board_kconfig_path, 'r') as file :
+        filedata = file.read()
+
+    # Replace the target string
+    filedata = filedata.replace('$BSP_DIR/../libraries', './libraries')
+
+    # Write the file out again
+    with open(board_kconfig_path, 'w') as file:
+        file.write(filedata)
+
+# BSP dist function
+def dist_do_building(BSP_ROOT, dist_dir):
+    from mkdist import bsp_copy_files
+    import rtconfig
+
+    library_path = os.path.join(os.path.dirname(BSP_ROOT), 'libraries')
+    library_dir  = os.path.join(dist_dir, 'libraries')
+
+    print('=> copy nuvoton bsp drivers')
+    bsp_copy_files(os.path.join(library_path, rtconfig.BSP_LIBRARY_TYPE), 
+                   os.path.join(library_dir, rtconfig.BSP_LIBRARY_TYPE))
+
+    print('=> copy nu_packages')
+    bsp_copy_files(os.path.join(library_path, 'nu_packages'), 
+                   os.path.join(library_dir, 'nu_packages'))
+
+    print('=> copy Kconfig')
+    shutil.copyfile(os.path.join(library_path, 'Kconfig'), os.path.join(library_dir, 'Kconfig'))
+
+    print('=> Modify libraries relative path in board/Kconfig ')
+    dist_modify_relative_path(os.path.join(dist_dir, 'board', 'Kconfig'))

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно