diff --git a/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/M2354.h b/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/M2354.h
index 5b546a056e..8ef3b514e2 100644
--- a/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/M2354.h
+++ b/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/M2354.h
@@ -1089,6 +1089,7 @@ extern void SystemInit(void);
#include "nu_scu.h"
#include "nu_tamper.h"
#include "nu_rng.h"
+#include "nu_trng.h"
#include "nu_dpm.h"
#include "nu_fvc.h"
#include "nu_ewwdt.h"
diff --git a/bsp/nuvoton/libraries/m2354/StdDriver/inc/nu_sdh.h b/bsp/nuvoton/libraries/m2354/StdDriver/inc/nu_sdh.h
index 3304e1af30..40640de9b0 100644
--- a/bsp/nuvoton/libraries/m2354/StdDriver/inc/nu_sdh.h
+++ b/bsp/nuvoton/libraries/m2354/StdDriver/inc/nu_sdh.h
@@ -185,7 +185,7 @@ void SDH_Open(SDH_T *sdh, uint32_t u32CardDetSrc);
uint32_t SDH_Probe(SDH_T *sdh);
uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_t u32SecCount);
uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_t u32SecCount);
-
+void SDH_Set_clock(SDH_T *sdh, uint32_t u32SDClockKhz);
uint32_t SDH_CardDetection(SDH_T *sdh);
void SDH_Open_Disk(SDH_T *sdh, uint32_t u32CardDetSrc);
void SDH_Close_Disk(SDH_T *sdh);
diff --git a/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.ewp b/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.ewp
index 69c44b7d03..5c7f5c6b2c 100644
--- a/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.ewp
+++ b/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.ewp
@@ -2181,6 +2181,9 @@
$PROJ_DIR$\..\src\nu_timer_pwm.c
+
+ $PROJ_DIR$\..\src\nu_trng.c
+
$PROJ_DIR$\..\src\nu_uart.c
diff --git a/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.uvprojx b/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.uvprojx
index b28ca38daf..83c6f46860 100644
--- a/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.uvprojx
+++ b/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.uvprojx
@@ -16,8 +16,8 @@
M2354ES
Nuvoton
- Nuvoton.NuMicro_DFP.1.3.10
- http://www.nuvoton.com/hq/enu/Documents/KEILSoftwarePack
+ Nuvoton.NuMicro_DFP.1.3.13
+ https://github.com/OpenNuvoton/cmsis-packs/raw/master/
IRAM(0x20000000,0x8000) IRAM2(0x30008000,0x10000) IROM(0x00000000,0x40000) IROM2(0x10040000,0x40000) CPUTYPE("Cortex-M23") TZ CLOCK(12000000) ESEL ELITTLE
@@ -587,6 +587,11 @@
1
..\src\nu_wwdt.c
+
+ nu_trng.c
+ 1
+ ..\src\nu_trng.c
+
diff --git a/bsp/nuvoton/libraries/m2354/StdDriver/src/nu_sdh.c b/bsp/nuvoton/libraries/m2354/StdDriver/src/nu_sdh.c
index 75102b603f..6c580cb246 100644
--- a/bsp/nuvoton/libraries/m2354/StdDriver/src/nu_sdh.c
+++ b/bsp/nuvoton/libraries/m2354/StdDriver/src/nu_sdh.c
@@ -12,7 +12,7 @@
#include "NuMicro.h"
#if defined (__ICCARM__)
-# pragma diag_suppress=Pm073, Pm143 /* Misra C 2004 rule 14.7 */
+ #pragma diag_suppress=Pm073, Pm143 /* Misra C 2004 rule 14.7 */
#endif
@@ -46,10 +46,10 @@ static uint32_t _SDH_uR7_CMD = 0UL;
static uint32_t _SDH_ReferenceClock;
#if defined ( __ICCARM__ ) /*!< IAR Compiler */
-#pragma data_alignment = 4
-static uint8_t _SDH_ucSDHCBuffer[512];
+ #pragma data_alignment = 4
+ static uint8_t _SDH_ucSDHCBuffer[512];
#else
-static __attribute__((aligned)) uint8_t _SDH_ucSDHCBuffer[512];
+ static __attribute__((aligned)) uint8_t _SDH_ucSDHCBuffer[512];
#endif
/* Declare these functions here to avoid MISRA C 2004 rule 8.1 error */
@@ -70,11 +70,11 @@ SDH_INFO_T SD0;
void SDH_CheckRB(SDH_T *sdh)
{
- while(1)
+ while (1)
{
sdh->CTL |= SDH_CTL_CLK8OEN_Msk;
- while(sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
- if(sdh->INTSTS & SDH_INTSTS_DAT0STS_Msk)
+ while (sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
+ if (sdh->INTSTS & SDH_INTSTS_DAT0STS_Msk)
{
break;
}
@@ -93,9 +93,9 @@ uint32_t SDH_SDCommand(SDH_T *sdh, uint32_t u32Cmd, uint32_t u32Arg)
sdh->CMDARG = u32Arg;
sdh->CTL = (sdh->CTL & (~SDH_CTL_CMDCODE_Msk)) | (u32Cmd << 8) | (SDH_CTL_COEN_Msk);
- while(sdh->CTL & SDH_CTL_COEN_Msk)
+ while (sdh->CTL & SDH_CTL_COEN_Msk)
{
- if(pSD->IsCardInsert == (uint32_t)FALSE)
+ if (pSD->IsCardInsert == (uint32_t)FALSE)
{
u32Status = SDH_NO_SD_CARD;
}
@@ -114,16 +114,16 @@ uint32_t SDH_SDCmdAndRsp(SDH_T *sdh, uint32_t u32Cmd, uint32_t u32Arg, uint32_t
sdh->CMDARG = u32Arg;
sdh->CTL = (sdh->CTL & (~SDH_CTL_CMDCODE_Msk)) | (u32Cmd << 8) | (SDH_CTL_COEN_Msk | SDH_CTL_RIEN_Msk);
- if(u32TickCount > 0UL)
+ if (u32TickCount > 0UL)
{
- while(sdh->CTL & SDH_CTL_RIEN_Msk)
+ while (sdh->CTL & SDH_CTL_RIEN_Msk)
{
- if(u32TickCount-- == 0UL)
+ if (u32TickCount-- == 0UL)
{
sdh->CTL |= SDH_CTL_CTLRST_Msk; /* reset SD engine */
return 2UL;
}
- if(pSD->IsCardInsert == (uint8_t)FALSE)
+ if (pSD->IsCardInsert == (uint8_t)FALSE)
{
return SDH_NO_SD_CARD;
}
@@ -131,20 +131,20 @@ uint32_t SDH_SDCmdAndRsp(SDH_T *sdh, uint32_t u32Cmd, uint32_t u32Arg, uint32_t
}
else
{
- while(sdh->CTL & SDH_CTL_RIEN_Msk)
+ while (sdh->CTL & SDH_CTL_RIEN_Msk)
{
- if(pSD->IsCardInsert == (uint8_t)FALSE)
+ if (pSD->IsCardInsert == (uint8_t)FALSE)
{
return SDH_NO_SD_CARD;
}
}
}
- if(_SDH_uR7_CMD)
+ if (_SDH_uR7_CMD)
{
- if((sdh->RESP1 & 0xffUL) != 0x55UL)
+ if ((sdh->RESP1 & 0xffUL) != 0x55UL)
{
- if((sdh->RESP0 & 0xfUL) != 0x01UL)
+ if ((sdh->RESP0 & 0xfUL) != 0x01UL)
{
_SDH_uR7_CMD = 0UL;
return SDH_CMD8_ERROR;
@@ -152,9 +152,9 @@ uint32_t SDH_SDCmdAndRsp(SDH_T *sdh, uint32_t u32Cmd, uint32_t u32Arg, uint32_t
}
}
- if(!g_u8R3Flag)
+ if (!g_u8R3Flag)
{
- if(sdh->INTSTS & SDH_INTSTS_CRC7_Msk) /* check CRC7 */
+ if (sdh->INTSTS & SDH_INTSTS_CRC7_Msk) /* check CRC7 */
{
return Successful;
}
@@ -197,21 +197,21 @@ uint32_t SDH_SDCmdAndRsp2(SDH_T *sdh, uint32_t u32Cmd, uint32_t u32Arg, uint32_t
sdh->CMDARG = u32Arg;
sdh->CTL = (sdh->CTL & (~SDH_CTL_CMDCODE_Msk)) | (u32Cmd << 8) | (SDH_CTL_COEN_Msk | SDH_CTL_R2EN_Msk);
- while(sdh->CTL & SDH_CTL_R2EN_Msk)
+ while (sdh->CTL & SDH_CTL_R2EN_Msk)
{
- if(pSD->IsCardInsert == (uint8_t)FALSE)
+ if (pSD->IsCardInsert == (uint8_t)FALSE)
{
return SDH_NO_SD_CARD;
}
}
- if(sdh->INTSTS & SDH_INTSTS_CRC7_Msk)
+ if (sdh->INTSTS & SDH_INTSTS_CRC7_Msk)
{
- for(i = 0UL; i < 5UL; i++)
+ for (i = 0UL; i < 5UL; i++)
{
au32TmpBuf[i] = SDH_Swap32(sdh->FB[i]);
}
- for(i = 0UL; i < 4UL; i++)
+ for (i = 0UL; i < 4UL; i++)
{
pu32R2ptr[i] = ((au32TmpBuf[i] & 0x00ffffffUL) << 8) | ((au32TmpBuf[i + 1UL] & 0xff000000UL) >> 24);
}
@@ -235,28 +235,28 @@ uint32_t SDH_SDCmdAndRspDataIn(SDH_T *sdh, uint32_t u32Cmd, uint32_t u32Arg)
sdh->CTL = (sdh->CTL & (~SDH_CTL_CMDCODE_Msk)) | ((uint32_t)u32Cmd << 8) |
(SDH_CTL_COEN_Msk | SDH_CTL_RIEN_Msk | SDH_CTL_DIEN_Msk);
- while(sdh->CTL & SDH_CTL_RIEN_Msk)
+ while (sdh->CTL & SDH_CTL_RIEN_Msk)
{
- if(pSD->IsCardInsert == (uint32_t)FALSE)
+ if (pSD->IsCardInsert == (uint32_t)FALSE)
{
return SDH_NO_SD_CARD;
}
}
- while(sdh->CTL & SDH_CTL_DIEN_Msk)
+ while (sdh->CTL & SDH_CTL_DIEN_Msk)
{
- if(pSD->IsCardInsert == (uint32_t)FALSE)
+ if (pSD->IsCardInsert == (uint32_t)FALSE)
{
return SDH_NO_SD_CARD;
}
}
- if(!(sdh->INTSTS & SDH_INTSTS_CRC7_Msk)) /* check CRC7 */
+ if (!(sdh->INTSTS & SDH_INTSTS_CRC7_Msk)) /* check CRC7 */
{
return SDH_CRC7_ERROR;
}
- if(!(sdh->INTSTS & SDH_INTSTS_CRC16_Msk)) /* check CRC16 */
+ if (!(sdh->INTSTS & SDH_INTSTS_CRC16_Msk)) /* check CRC16 */
{
return SDH_CRC16_ERROR;
}
@@ -270,49 +270,50 @@ uint32_t SDH_SDCmdAndRspDataIn(SDH_T *sdh, uint32_t u32Cmd, uint32_t u32Arg)
void SDH_Set_clock(SDH_T *sdh, uint32_t u32SDClockKhz)
{
(void)sdh;
- if(!(__PC() & (1UL << 28)))
+ if (!(__PC() & (1UL << 28)))
{
uint32_t u32Rate, u32Div1;
static uint32_t u32SDClkSrc = 0UL;
+ SYS_UnlockReg();
/* M2354 is only support SDH0 */
u32SDClkSrc = (CLK->CLKSEL0 & CLK_CLKSEL0_SDH0SEL_Msk);
- if(u32SDClkSrc == CLK_CLKSEL0_SDH0SEL_HXT)
+ if (u32SDClkSrc == CLK_CLKSEL0_SDH0SEL_HXT)
{
_SDH_ReferenceClock = (CLK_GetHXTFreq() / 1000UL);
}
- else if(u32SDClkSrc == CLK_CLKSEL0_SDH0SEL_HIRC)
+ else if (u32SDClkSrc == CLK_CLKSEL0_SDH0SEL_HIRC)
{
_SDH_ReferenceClock = (__HIRC / 1000UL);
}
- else if(u32SDClkSrc == CLK_CLKSEL0_SDH0SEL_PLL)
+ else if (u32SDClkSrc == CLK_CLKSEL0_SDH0SEL_PLL)
{
_SDH_ReferenceClock = (CLK_GetPLLClockFreq() / 1000UL);
}
- else if(u32SDClkSrc == CLK_CLKSEL0_SDH0SEL_HCLK)
+ else if (u32SDClkSrc == CLK_CLKSEL0_SDH0SEL_HCLK)
{
_SDH_ReferenceClock = (CLK_GetHCLKFreq() / 1000UL);
}
- if(u32SDClockKhz >= 50000UL)
+ if (u32SDClockKhz >= 50000UL)
{
u32SDClockKhz = 50000UL;
}
u32Rate = _SDH_ReferenceClock / u32SDClockKhz;
/* choose slower clock if system clock cannot divisible by wanted clock */
- if(_SDH_ReferenceClock % u32SDClockKhz != 0UL)
+ if (_SDH_ReferenceClock % u32SDClockKhz != 0UL)
{
u32Rate++;
}
- if(u32Rate >= SDH_CLK_DIV0_MAX)
+ if (u32Rate >= SDH_CLK_DIV0_MAX)
{
u32Rate = SDH_CLK_DIV0_MAX;
}
/* --- calculate the second divider CLKDIV0[SDHOST_N] */
- if(u32Rate == 0UL)
+ if (u32Rate == 0UL)
{
u32Div1 = 0UL;
}
@@ -336,9 +337,9 @@ uint32_t SDH_CardDetection(SDH_T *sdh)
/* M2354 is only support SDH0 */
pSD = &SD0;
- if(sdh->INTEN & SDH_INTEN_CDSRC_Msk) /* Card detect pin from GPIO */
+ if (sdh->INTEN & SDH_INTEN_CDSRC_Msk) /* Card detect pin from GPIO */
{
- if(sdh->INTSTS & SDH_INTSTS_CDSTS_Msk) /* Card remove */
+ if (sdh->INTSTS & SDH_INTSTS_CDSTS_Msk) /* Card remove */
{
pSD->IsCardInsert = (uint8_t)FALSE;
u32Status = (uint32_t)FALSE;
@@ -348,12 +349,12 @@ uint32_t SDH_CardDetection(SDH_T *sdh)
pSD->IsCardInsert = (uint8_t)TRUE;
}
}
- else if(!(sdh->INTEN & SDH_INTEN_CDSRC_Msk))
+ else if (!(sdh->INTEN & SDH_INTEN_CDSRC_Msk))
{
sdh->CTL |= SDH_CTL_CLKKEEP_Msk;
- for(i = 0UL; i < 5000UL; i++) {}
+ for (i = 0UL; i < 5000UL; i++) {}
- if(sdh->INTSTS & SDH_INTSTS_CDSTS_Msk) /* Card insert */
+ if (sdh->INTSTS & SDH_INTSTS_CDSTS_Msk) /* Card insert */
{
pSD->IsCardInsert = (uint8_t)TRUE;
}
@@ -388,23 +389,23 @@ uint32_t SDH_Init(SDH_T *sdh)
/* power ON 74 clock */
sdh->CTL |= SDH_CTL_CLK74OEN_Msk;
- while(sdh->CTL & SDH_CTL_CLK74OEN_Msk)
+ while (sdh->CTL & SDH_CTL_CLK74OEN_Msk)
{
- if(pSD->IsCardInsert == (uint8_t)FALSE)
+ if (pSD->IsCardInsert == (uint8_t)FALSE)
{
return SDH_NO_SD_CARD;
}
}
SDH_SDCommand(sdh, 0UL, 0UL); /* reset all cards */
- for(i = 0x1000UL; i > 0UL; i--) {}
+ for (i = 0x1000UL; i > 0UL; i--) {}
/* initial SDHC */
_SDH_uR7_CMD = 1UL;
u32CmdTimeOut = 0xFFFFFUL;
i = SDH_SDCmdAndRsp(sdh, 8UL, 0x00000155UL, u32CmdTimeOut);
- if(i == Successful)
+ if (i == Successful)
{
/* SD 2.0 */
SDH_SDCmdAndRsp(sdh, 55UL, 0x00UL, u32CmdTimeOut);
@@ -412,14 +413,14 @@ uint32_t SDH_Init(SDH_T *sdh)
SDH_SDCmdAndRsp(sdh, 41UL, 0x40ff8000UL, u32CmdTimeOut); /* 2.7v-3.6v */
u32Resp = sdh->RESP0;
- while(!(u32Resp & 0x00800000UL)) /* check if card is ready */
+ while (!(u32Resp & 0x00800000UL)) /* check if card is ready */
{
SDH_SDCmdAndRsp(sdh, 55UL, 0x00UL, u32CmdTimeOut);
g_u8R3Flag = 1UL;
SDH_SDCmdAndRsp(sdh, 41UL, 0x40ff8000UL, u32CmdTimeOut); /* 3.0v-3.4v */
u32Resp = sdh->RESP0;
}
- if(u32Resp & 0x00400000UL)
+ if (u32Resp & 0x00400000UL)
{
pSD->CardType = SDH_TYPE_SD_HIGH;
}
@@ -432,20 +433,20 @@ uint32_t SDH_Init(SDH_T *sdh)
{
/* SD 1.1 */
SDH_SDCommand(sdh, 0UL, 0UL); /* reset all cards */
- for(i = 0x100UL; i > 0UL; i--) {}
+ for (i = 0x100UL; i > 0UL; i--) {}
i = SDH_SDCmdAndRsp(sdh, 55UL, 0x00UL, u32CmdTimeOut);
- if(i == 2UL) /* MMC memory */
+ if (i == 2UL) /* MMC memory */
{
SDH_SDCommand(sdh, 0UL, 0UL); /* reset */
- for(i = 0x100UL; i > 0UL; i--) {}
+ for (i = 0x100UL; i > 0UL; i--) {}
g_u8R3Flag = 1UL;
- if(SDH_SDCmdAndRsp(sdh, 1UL, 0x40ff8000UL, u32CmdTimeOut) != 2UL) /* eMMC memory */
+ if (SDH_SDCmdAndRsp(sdh, 1UL, 0x40ff8000UL, u32CmdTimeOut) != 2UL) /* eMMC memory */
{
u32Resp = sdh->RESP0;
- while(!(u32Resp & 0x00800000UL)) /* check if card is ready */
+ while (!(u32Resp & 0x00800000UL)) /* check if card is ready */
{
g_u8R3Flag = 1UL;
@@ -453,7 +454,7 @@ uint32_t SDH_Init(SDH_T *sdh)
u32Resp = sdh->RESP0;
}
- if(u32Resp & 0x00400000UL)
+ if (u32Resp & 0x00400000UL)
{
pSD->CardType = SDH_TYPE_EMMC;
}
@@ -468,12 +469,12 @@ uint32_t SDH_Init(SDH_T *sdh)
return SDH_ERR_DEVICE;
}
}
- else if(i == 0UL) /* SD Memory */
+ else if (i == 0UL) /* SD Memory */
{
g_u8R3Flag = 1UL;
SDH_SDCmdAndRsp(sdh, 41UL, 0x00ff8000UL, u32CmdTimeOut); /* 3.0v-3.4v */
u32Resp = sdh->RESP0;
- while(!(u32Resp & 0x00800000UL)) /* check if card is ready */
+ while (!(u32Resp & 0x00800000UL)) /* check if card is ready */
{
SDH_SDCmdAndRsp(sdh, 55UL, 0x00UL, u32CmdTimeOut);
g_u8R3Flag = 1UL;
@@ -490,12 +491,12 @@ uint32_t SDH_Init(SDH_T *sdh)
}
/* CMD2, CMD3 */
- if(pSD->CardType != SDH_TYPE_UNKNOWN)
+ if (pSD->CardType != SDH_TYPE_UNKNOWN)
{
SDH_SDCmdAndRsp2(sdh, 2UL, 0x00UL, au32CIDBuffer);
- if((pSD->CardType == SDH_TYPE_MMC) || (pSD->CardType == SDH_TYPE_EMMC))
+ if ((pSD->CardType == SDH_TYPE_MMC) || (pSD->CardType == SDH_TYPE_EMMC))
{
- if((u32Status = SDH_SDCmdAndRsp(sdh, 3UL, 0x10000UL, 0UL)) != Successful) /* set RCA */
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 3UL, 0x10000UL, 0UL)) != Successful) /* set RCA */
{
return u32Status;
}
@@ -503,7 +504,7 @@ uint32_t SDH_Init(SDH_T *sdh)
}
else
{
- if((u32Status = SDH_SDCmdAndRsp(sdh, 3UL, 0x00UL, 0UL)) != Successful) /* get RCA */
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 3UL, 0x00UL, 0UL)) != Successful) /* get RCA */
{
return u32Status;
}
@@ -527,14 +528,14 @@ uint32_t SDH_SwitchToHighSpeed(SDH_T *sdh, SDH_INFO_T *pSD)
sdh->DMASA = (uint32_t)_SDH_ucSDHCBuffer; /* set DMA transfer starting address */
sdh->BLEN = 63UL; /* 512 bit */
- if((u32Status = SDH_SDCmdAndRspDataIn(sdh, 6UL, 0x00ffff01UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRspDataIn(sdh, 6UL, 0x00ffff01UL)) != Successful)
{
return Fail;
}
u16CurrentComsumption = (uint16_t)(_SDH_ucSDHCBuffer[0] << 8);
u16CurrentComsumption |= (uint16_t)_SDH_ucSDHCBuffer[1];
- if(!u16CurrentComsumption)
+ if (!u16CurrentComsumption)
{
return Fail;
}
@@ -542,23 +543,23 @@ uint32_t SDH_SwitchToHighSpeed(SDH_T *sdh, SDH_INFO_T *pSD)
u16BusyStatus0 = (uint16_t)(_SDH_ucSDHCBuffer[28] << 8);
u16BusyStatus0 |= (uint16_t)_SDH_ucSDHCBuffer[29];
- if(!u16BusyStatus0) /* function ready */
+ if (!u16BusyStatus0) /* function ready */
{
sdh->DMASA = (uint32_t)_SDH_ucSDHCBuffer; /* set DMA transfer starting address */
sdh->BLEN = 63UL; /* 512 bit */
- if((u32Status = SDH_SDCmdAndRspDataIn(sdh, 6UL, 0x80ffff01UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRspDataIn(sdh, 6UL, 0x80ffff01UL)) != Successful)
{
return Fail;
}
/* function change timing: 8 clocks */
sdh->CTL |= SDH_CTL_CLK8OEN_Msk;
- while(sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
+ while (sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
u16CurrentComsumption = (uint16_t)(_SDH_ucSDHCBuffer[0] << 8);
u16CurrentComsumption |= (uint16_t)_SDH_ucSDHCBuffer[1];
- if(!u16CurrentComsumption)
+ if (!u16CurrentComsumption)
{
return Fail;
}
@@ -581,7 +582,7 @@ uint32_t SDH_SelectCardType(SDH_T *sdh)
/* M2354 is only support SDH0 */
pSD = &SD0;
- if((u32Status = SDH_SDCmdAndRsp(sdh, 7UL, pSD->RCA, 0UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 7UL, pSD->RCA, 0UL)) != Successful)
{
return u32Status;
}
@@ -589,76 +590,76 @@ uint32_t SDH_SelectCardType(SDH_T *sdh)
SDH_CheckRB(sdh);
/* if SD card set 4bit */
- if(pSD->CardType == SDH_TYPE_SD_HIGH)
+ if (pSD->CardType == SDH_TYPE_SD_HIGH)
{
sdh->DMASA = (uint32_t)_SDH_ucSDHCBuffer; /* set DMA transfer starting address */
sdh->BLEN = 0x07UL; /* 64 bit */
- if((u32Status = SDH_SDCmdAndRsp(sdh, 55UL, pSD->RCA, 0UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 55UL, pSD->RCA, 0UL)) != Successful)
{
return u32Status;
}
sdh->DMACTL |= 0x2;
- while(sdh->DMACTL & 0x2) {}
+ while (sdh->DMACTL & 0x2) {}
- if((u32Status = SDH_SDCmdAndRspDataIn(sdh, 51UL, 0x00UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRspDataIn(sdh, 51UL, 0x00UL)) != Successful)
{
return u32Status;
}
- if((_SDH_ucSDHCBuffer[0] & 0xfUL) == 0xfUL)
+ if ((_SDH_ucSDHCBuffer[0] & 0xfUL) == 0xfUL)
{
u32Status = SDH_SwitchToHighSpeed(sdh, pSD);
- if(u32Status == Successful)
+ if (u32Status == Successful)
{
/* divider */
SDH_Set_clock(sdh, SDHC_FREQ);
}
}
- if((u32Status = SDH_SDCmdAndRsp(sdh, 55UL, pSD->RCA, 0UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 55UL, pSD->RCA, 0UL)) != Successful)
{
return u32Status;
}
- if((u32Status = SDH_SDCmdAndRsp(sdh, 6UL, 0x02UL, 0UL)) != Successful) /* set bus width */
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 6UL, 0x02UL, 0UL)) != Successful) /* set bus width */
{
return u32Status;
}
sdh->CTL |= SDH_CTL_DBW_Msk;
}
- else if(pSD->CardType == SDH_TYPE_SD_LOW)
+ else if (pSD->CardType == SDH_TYPE_SD_LOW)
{
sdh->DMASA = (uint32_t) _SDH_ucSDHCBuffer; /* set DMA transfer starting address */
sdh->BLEN = 0x07UL; /* 64 bit */
- if((u32Status = SDH_SDCmdAndRsp(sdh, 55UL, pSD->RCA, 0UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 55UL, pSD->RCA, 0UL)) != Successful)
{
return u32Status;
}
- if((u32Status = SDH_SDCmdAndRspDataIn(sdh, 51UL, 0x00UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRspDataIn(sdh, 51UL, 0x00UL)) != Successful)
{
return u32Status;
}
/* set data bus width. ACMD6 for SD card, SDCR_DBW for host. */
- if((u32Status = SDH_SDCmdAndRsp(sdh, 55UL, pSD->RCA, 0UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 55UL, pSD->RCA, 0UL)) != Successful)
{
return u32Status;
}
- if((u32Status = SDH_SDCmdAndRsp(sdh, 6UL, 0x02UL, 0UL)) != Successful) /* set bus width */
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 6UL, 0x02UL, 0UL)) != Successful) /* set bus width */
{
return u32Status;
}
sdh->CTL |= SDH_CTL_DBW_Msk;
}
- else if((pSD->CardType == SDH_TYPE_MMC) || (pSD->CardType == SDH_TYPE_EMMC))
+ else if ((pSD->CardType == SDH_TYPE_MMC) || (pSD->CardType == SDH_TYPE_EMMC))
{
- if(pSD->CardType == SDH_TYPE_MMC)
+ if (pSD->CardType == SDH_TYPE_MMC)
{
sdh->CTL &= ~SDH_CTL_DBW_Msk;
}
@@ -666,7 +667,7 @@ uint32_t SDH_SelectCardType(SDH_T *sdh)
/* --- sent CMD6 to MMC card to set bus width to 4 bits mode */
/* set CMD6 argument Access field to 3, Index to 183, Value to 1 (4-bit mode) */
u32Param = (3UL << 24) | (183UL << 16) | (1UL << 8);
- if((u32Status = SDH_SDCmdAndRsp(sdh, 6UL, u32Param, 0UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 6UL, u32Param, 0UL)) != Successful)
{
return u32Status;
}
@@ -675,7 +676,7 @@ uint32_t SDH_SelectCardType(SDH_T *sdh)
sdh->CTL |= SDH_CTL_DBW_Msk; /* set bus width to 4-bit mode for SD host controller */
}
- if((u32Status = SDH_SDCmdAndRsp(sdh, 16UL, SDH_BLOCK_SIZE, 0UL)) != Successful) /* set block length */
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 16UL, SDH_BLOCK_SIZE, 0UL)) != Successful) /* set block length */
{
return u32Status;
}
@@ -683,7 +684,7 @@ uint32_t SDH_SelectCardType(SDH_T *sdh)
SDH_SDCommand(sdh, 7UL, 0UL);
sdh->CTL |= SDH_CTL_CLK8OEN_Msk;
- while(sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
+ while (sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
sdh->INTEN |= SDH_INTEN_BLKDIEN_Msk;
@@ -701,10 +702,10 @@ void SDH_Get_SD_info(SDH_T *sdh)
SDH_SDCmdAndRsp2(sdh, 9UL, pSD->RCA, au32Buffer);
- if((pSD->CardType == SDH_TYPE_MMC) || (pSD->CardType == SDH_TYPE_EMMC))
+ if ((pSD->CardType == SDH_TYPE_MMC) || (pSD->CardType == SDH_TYPE_EMMC))
{
/* for MMC/eMMC card */
- if((au32Buffer[0] & 0xc0000000UL) == 0xc0000000UL)
+ if ((au32Buffer[0] & 0xc0000000UL) == 0xc0000000UL)
{
/* CSD_STRUCTURE [127:126] is 3 */
/* CSD version depend on EXT_CSD register in eMMC v4.4 for card size > 2GB */
@@ -713,14 +714,14 @@ void SDH_Get_SD_info(SDH_T *sdh)
sdh->DMASA = (uint32_t)_SDH_ucSDHCBuffer; /* set DMA transfer starting address */
sdh->BLEN = 511UL; /* read 512 bytes for EXT_CSD */
- if(SDH_SDCmdAndRspDataIn(sdh, 8UL, 0x00UL) != Successful)
+ if (SDH_SDCmdAndRspDataIn(sdh, 8UL, 0x00UL) != Successful)
{
return;
}
SDH_SDCommand(sdh, 7UL, 0UL);
sdh->CTL |= SDH_CTL_CLK8OEN_Msk;
- while(sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
+ while (sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
pSD->totalSectorN = (uint32_t)_SDH_ucSDHCBuffer[215] << 24;
pSD->totalSectorN |= (uint32_t)_SDH_ucSDHCBuffer[214] << 16;
@@ -742,7 +743,7 @@ void SDH_Get_SD_info(SDH_T *sdh)
}
else
{
- if(au32Buffer[0] & 0xc0000000UL)
+ if (au32Buffer[0] & 0xc0000000UL)
{
u32CSize = ((au32Buffer[1] & 0x0000003fUL) << 16) | ((au32Buffer[2] & 0xffff0000UL) >> 16);
u32Size = (u32CSize + 1UL) * 512UL; /* Kbytes */
@@ -779,20 +780,20 @@ void SDH_Open(SDH_T *sdh, uint32_t u32CardDetSrc)
{
/* enable DMAC */
sdh->DMACTL = SDH_DMACTL_DMARST_Msk;
- while(sdh->DMACTL & SDH_DMACTL_DMARST_Msk) {}
+ while (sdh->DMACTL & SDH_DMACTL_DMARST_Msk) {}
sdh->DMACTL = SDH_DMACTL_DMAEN_Msk;
/* Reset FMI */
sdh->GCTL = SDH_GCTL_GCTLRST_Msk | SDH_GCTL_SDEN_Msk; /* Start reset FMI controller. */
- while(sdh->GCTL & SDH_GCTL_GCTLRST_Msk) {}
+ while (sdh->GCTL & SDH_GCTL_GCTLRST_Msk) {}
memset(&SD0, 0, sizeof(SDH_INFO_T));
/* enable SD */
sdh->GCTL = SDH_GCTL_SDEN_Msk;
- if(u32CardDetSrc & CardDetect_From_DAT3)
+ if (u32CardDetSrc & CardDetect_From_DAT3)
{
sdh->INTEN &= ~SDH_INTEN_CDSRC_Msk;
}
@@ -803,7 +804,7 @@ void SDH_Open(SDH_T *sdh, uint32_t u32CardDetSrc)
sdh->INTEN |= SDH_INTEN_CDIEN_Msk;
sdh->CTL |= SDH_CTL_CTLRST_Msk; /* SD software reset */
- while(sdh->CTL & SDH_CTL_CTLRST_Msk) {}
+ while (sdh->CTL & SDH_CTL_CTLRST_Msk) {}
}
@@ -831,18 +832,18 @@ uint32_t SDH_Probe(SDH_T *sdh)
sdh->CTL |= 0x01UL << SDH_CTL_BLKCNT_Pos; /* set BLKCNT = 1 */
sdh->CTL &= ~SDH_CTL_DBW_Msk; /* SD 1-bit data bus */
- if(!(SDH_CardDetection(sdh)))
+ if (!(SDH_CardDetection(sdh)))
{
return SDH_NO_SD_CARD;
}
- if((u32Val = SDH_Init(sdh)) != 0UL)
+ if ((u32Val = SDH_Init(sdh)) != 0UL)
{
return u32Val;
}
/* divider */
- if(SD0.CardType == SDH_TYPE_MMC)
+ if (SD0.CardType == SDH_TYPE_MMC)
{
SDH_Set_clock(sdh, MMC_FREQ);
}
@@ -852,7 +853,7 @@ uint32_t SDH_Probe(SDH_T *sdh)
}
SDH_Get_SD_info(sdh);
- if((u32Val = SDH_SelectCardType(sdh)) != 0UL)
+ if ((u32Val = SDH_SelectCardType(sdh)) != 0UL)
{
return u32Val;
}
@@ -883,12 +884,12 @@ uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_
pSD = &SD0;
/* --- check input parameters */
- if(u32SecCount == 0UL)
+ if (u32SecCount == 0UL)
{
return SDH_SELECT_ERROR;
}
- if((u32Status = SDH_SDCmdAndRsp(sdh, 7UL, pSD->RCA, 0UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 7UL, pSD->RCA, 0UL)) != Successful)
{
return u32Status;
}
@@ -896,7 +897,7 @@ uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_
sdh->BLEN = u32BlkSize - 1UL; /* the actual byte count is equal to (SDBLEN+1) */
- if((pSD->CardType == SDH_TYPE_SD_HIGH) || (pSD->CardType == SDH_TYPE_EMMC))
+ if ((pSD->CardType == SDH_TYPE_SD_HIGH) || (pSD->CardType == SDH_TYPE_EMMC))
{
sdh->CMDARG = u32StartSec;
}
@@ -908,12 +909,12 @@ uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_
sdh->DMASA = (uint32_t)pu8BufAddr;
u32Loop = u32SecCount / 255UL;
- while(u32Loop > 0UL)
+ while (u32Loop > 0UL)
{
g_u8SDDataReadyFlag = (uint8_t)FALSE;
u32Reg = sdh->CTL & ~SDH_CTL_CMDCODE_Msk;
u32Reg = u32Reg | 0xff0000UL; /* set BLK_CNT to 255 */
- if(u32IsSendCmd == (uint32_t)FALSE)
+ if (u32IsSendCmd == (uint32_t)FALSE)
{
sdh->CTL = u32Reg | (18UL << 8) | (SDH_CTL_COEN_Msk | SDH_CTL_RIEN_Msk | SDH_CTL_DIEN_Msk);
u32IsSendCmd = (uint32_t)TRUE;
@@ -923,24 +924,24 @@ uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_
sdh->CTL = u32Reg | SDH_CTL_DIEN_Msk;
}
- while(!g_u8SDDataReadyFlag)
+ while (!g_u8SDDataReadyFlag)
{
- if(g_u8SDDataReadyFlag)
+ if (g_u8SDDataReadyFlag)
{
break;
}
- if(pSD->IsCardInsert == (uint8_t)FALSE)
+ if (pSD->IsCardInsert == (uint8_t)FALSE)
{
return SDH_NO_SD_CARD;
}
}
- if(!(sdh->INTSTS & SDH_INTSTS_CRC7_Msk)) /* check CRC7 */
+ if (!(sdh->INTSTS & SDH_INTSTS_CRC7_Msk)) /* check CRC7 */
{
return SDH_CRC7_ERROR;
}
- if(!(sdh->INTSTS & SDH_INTSTS_CRC16_Msk)) /* check CRC16 */
+ if (!(sdh->INTSTS & SDH_INTSTS_CRC16_Msk)) /* check CRC16 */
{
return SDH_CRC16_ERROR;
}
@@ -948,7 +949,7 @@ uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_
}
u32Loop = u32SecCount % 255UL;
- if(u32Loop != 0UL)
+ if (u32Loop != 0UL)
{
uint32_t u32RegTmp;
g_u8SDDataReadyFlag = (uint8_t)FALSE;
@@ -957,7 +958,7 @@ uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_
u32RegTmp = (u32Loop << 16);
u32Reg |= u32RegTmp; /* setup SDCR_BLKCNT */
- if(u32IsSendCmd == (uint32_t)FALSE)
+ if (u32IsSendCmd == (uint32_t)FALSE)
{
sdh->CTL = u32Reg | (18UL << 8) | (SDH_CTL_COEN_Msk | SDH_CTL_RIEN_Msk | SDH_CTL_DIEN_Msk);
u32IsSendCmd = (uint32_t)TRUE;
@@ -967,26 +968,26 @@ uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_
sdh->CTL = u32Reg | SDH_CTL_DIEN_Msk;
}
- while(!g_u8SDDataReadyFlag)
+ while (!g_u8SDDataReadyFlag)
{
- if(pSD->IsCardInsert == (uint8_t)FALSE)
+ if (pSD->IsCardInsert == (uint8_t)FALSE)
{
return SDH_NO_SD_CARD;
}
}
- if(!(sdh->INTSTS & SDH_INTSTS_CRC7_Msk)) /* check CRC7 */
+ if (!(sdh->INTSTS & SDH_INTSTS_CRC7_Msk)) /* check CRC7 */
{
return SDH_CRC7_ERROR;
}
- if(!(sdh->INTSTS & SDH_INTSTS_CRC16_Msk)) /* check CRC16 */
+ if (!(sdh->INTSTS & SDH_INTSTS_CRC16_Msk)) /* check CRC16 */
{
return SDH_CRC16_ERROR;
}
}
- if(SDH_SDCmdAndRsp(sdh, 12UL, 0UL, 0UL)) /* stop command */
+ if (SDH_SDCmdAndRsp(sdh, 12UL, 0UL, 0UL)) /* stop command */
{
return SDH_CRC7_ERROR;
}
@@ -994,7 +995,7 @@ uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_
SDH_SDCommand(sdh, 7UL, 0UL);
sdh->CTL |= SDH_CTL_CLK8OEN_Msk;
- while(sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
+ while (sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
return Successful;
}
@@ -1025,12 +1026,12 @@ uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32
pSD = &SD0;
/* --- check input parameters */
- if(u32SecCount == 0UL)
+ if (u32SecCount == 0UL)
{
return SDH_SELECT_ERROR;
}
- if((u32Status = SDH_SDCmdAndRsp(sdh, 7UL, pSD->RCA, 0UL)) != Successful)
+ if ((u32Status = SDH_SDCmdAndRsp(sdh, 7UL, pSD->RCA, 0UL)) != Successful)
{
return u32Status;
}
@@ -1040,7 +1041,7 @@ uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32
/* According to SD Spec v2.0, the write CMD block size MUST be 512, and the start address MUST be 512*n. */
sdh->BLEN = SDH_BLOCK_SIZE - 1UL; /* set the block size */
- if((pSD->CardType == SDH_TYPE_SD_HIGH) || (pSD->CardType == SDH_TYPE_EMMC))
+ if ((pSD->CardType == SDH_TYPE_SD_HIGH) || (pSD->CardType == SDH_TYPE_EMMC))
{
sdh->CMDARG = u32StartSec;
}
@@ -1051,12 +1052,12 @@ uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32
sdh->DMASA = (uint32_t)pu8BufAddr;
u32Loop = u32SecCount / 255UL; /* the maximum block count is 0xFF=255 for register SDCR[BLK_CNT] */
- while(u32Loop > 0UL)
+ while (u32Loop > 0UL)
{
g_u8SDDataReadyFlag = (uint8_t)FALSE;
u32Reg = sdh->CTL & 0xff00c080UL;
u32Reg = u32Reg | 0xff0000UL; /* set BLK_CNT to 0xFF=255 */
- if(!u32IsSendCmd)
+ if (!u32IsSendCmd)
{
sdh->CTL = u32Reg | (25UL << 8) | (SDH_CTL_COEN_Msk | SDH_CTL_RIEN_Msk | SDH_CTL_DOEN_Msk);
u32IsSendCmd = (uint32_t)TRUE;
@@ -1066,15 +1067,15 @@ uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32
sdh->CTL = u32Reg | SDH_CTL_DOEN_Msk;
}
- while(!g_u8SDDataReadyFlag)
+ while (!g_u8SDDataReadyFlag)
{
- if(pSD->IsCardInsert == (uint8_t)FALSE)
+ if (pSD->IsCardInsert == (uint8_t)FALSE)
{
return SDH_NO_SD_CARD;
}
}
- if((sdh->INTSTS & SDH_INTSTS_CRCIF_Msk) != 0UL) /* check CRC */
+ if ((sdh->INTSTS & SDH_INTSTS_CRCIF_Msk) != 0UL) /* check CRC */
{
sdh->INTSTS = SDH_INTSTS_CRCIF_Msk;
return SDH_CRC_ERROR;
@@ -1083,13 +1084,13 @@ uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32
}
u32Loop = u32SecCount % 255UL;
- if(u32Loop != 0UL)
+ if (u32Loop != 0UL)
{
uint32_t u32RegTmp;
g_u8SDDataReadyFlag = (uint8_t)FALSE;
u32RegTmp = (u32Loop << 16);
u32Reg = (sdh->CTL & 0xff00c080UL) | u32RegTmp;
- if(!u32IsSendCmd)
+ if (!u32IsSendCmd)
{
sdh->CTL = u32Reg | (25UL << 8) | (SDH_CTL_COEN_Msk | SDH_CTL_RIEN_Msk | SDH_CTL_DOEN_Msk);
u32IsSendCmd = (uint32_t)TRUE;
@@ -1099,15 +1100,15 @@ uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32
sdh->CTL = u32Reg | SDH_CTL_DOEN_Msk;
}
- while(!g_u8SDDataReadyFlag)
+ while (!g_u8SDDataReadyFlag)
{
- if(pSD->IsCardInsert == (uint8_t)FALSE)
+ if (pSD->IsCardInsert == (uint8_t)FALSE)
{
return SDH_NO_SD_CARD;
}
}
- if((sdh->INTSTS & SDH_INTSTS_CRCIF_Msk) != 0UL) /* check CRC */
+ if ((sdh->INTSTS & SDH_INTSTS_CRCIF_Msk) != 0UL) /* check CRC */
{
sdh->INTSTS = SDH_INTSTS_CRCIF_Msk;
return SDH_CRC_ERROR;
@@ -1115,7 +1116,7 @@ uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32
}
sdh->INTSTS = SDH_INTSTS_CRCIF_Msk;
- if(SDH_SDCmdAndRsp(sdh, 12UL, 0UL, 0UL)) /* stop command */
+ if (SDH_SDCmdAndRsp(sdh, 12UL, 0UL, 0UL)) /* stop command */
{
return SDH_CRC7_ERROR;
}
@@ -1123,7 +1124,7 @@ uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32
SDH_SDCommand(sdh, 7UL, 0UL);
sdh->CTL |= SDH_CTL_CLK8OEN_Msk;
- while(sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
+ while (sdh->CTL & SDH_CTL_CLK8OEN_Msk) {}
return Successful;
}
diff --git a/bsp/nuvoton/libraries/m2354/rtt_port/Kconfig b/bsp/nuvoton/libraries/m2354/rtt_port/Kconfig
index 0e6ace662a..bc72205ebf 100644
--- a/bsp/nuvoton/libraries/m2354/rtt_port/Kconfig
+++ b/bsp/nuvoton/libraries/m2354/rtt_port/Kconfig
@@ -470,23 +470,14 @@ config SOC_SERIES_M2354
menuconfig BSP_USING_SDH
bool "Enable Secure Digital Host Controller(SDH)"
select RT_USING_DFS
- select DFS_USING_POSIX
+ select RT_USING_SDIO
if BSP_USING_SDH
config BSP_USING_SDH0
bool "Enable SDH0"
- config NU_SDH_USING_PDMA
- bool "Using PDMA"
- select BSP_USING_PDMA
-
- config NU_SDH_HOTPLUG
- bool "Using HOTPLUG"
- default y
-
- config NU_SDH_MOUNT_ON_ROOT
- bool "Mount on root"
-
+ config BSP_USING_SDH1
+ bool "Enable SDH1"
endif
menuconfig BSP_USING_CAN
diff --git a/bsp/nuvoton/libraries/m2354/rtt_port/drv_crypto.c b/bsp/nuvoton/libraries/m2354/rtt_port/drv_crypto.c
index 543ac7f521..24f10c3506 100644
--- a/bsp/nuvoton/libraries/m2354/rtt_port/drv_crypto.c
+++ b/bsp/nuvoton/libraries/m2354/rtt_port/drv_crypto.c
@@ -7,6 +7,7 @@
* Change Logs:
* Date Author Notes
* 2020-7-3 YCHuang12 First version
+* 2022-4-17 Wayne Fix TRNG and PRNG selection
*
******************************************************************************/
@@ -15,7 +16,6 @@
#if ((defined(BSP_USING_CRYPTO) || defined(BSP_USING_TRNG) || defined(BSP_USING_CRC)) && defined(RT_USING_HWCRYPTO))
#include
-#include
#include
#include "NuMicro.h"
#include
@@ -29,6 +29,13 @@
#endif
/* Private typedef --------------------------------------------------------------*/
+#define LOG_TAG "CRYPTO"
+#define DBG_ENABLE
+#define DBG_SECTION_NAME "CRYPTO"
+#define DBG_LEVEL DBG_INFO
+#define DBG_COLOR
+#include
+
typedef struct
{
uint8_t *pu8SHATempBuf;
@@ -57,17 +64,11 @@ static const struct rt_hwcrypto_ops nu_hwcrypto_ops =
#define NU_HWCRYPTO_AES_NAME "nu_AES"
#define NU_HWCRYPTO_SHA_NAME "nu_SHA"
-#if !defined(BSP_USING_TRNG)
- #define NU_HWCRYPTO_PRNG_NAME "nu_PRNG"
-#endif
+#define NU_HWCRYPTO_PRNG_NAME "nu_PRNG"
static struct rt_mutex s_AES_mutex;
static struct rt_mutex s_SHA_mutex;
-#if !defined(BSP_USING_TRNG)
- static struct rt_mutex s_PRNG_mutex;
-#endif
-
static rt_err_t nu_crypto_init(void)
{
rt_err_t result = RT_EOK;
@@ -85,12 +86,6 @@ static rt_err_t nu_crypto_init(void)
SHA_ENABLE_INT(CRPT);
#endif
-#if defined(RT_HWCRYPTO_USING_RNG) && !defined(BSP_USING_TRNG)
- result = rt_mutex_init(&s_PRNG_mutex, NU_HWCRYPTO_PRNG_NAME, RT_IPC_FLAG_PRIO);
- RT_ASSERT(result == RT_EOK);
- PRNG_ENABLE_INT(CRPT);
-#endif
-
return result;
}
@@ -163,46 +158,33 @@ static rt_err_t nu_aes_crypt_run(
return RT_EOK;
}
-#if !defined(BSP_USING_TRNG)
-//Using PRNG instead of TRNG
-static void nu_prng_open(uint32_t u32Seed)
+static rt_err_t nu_prng_init(void)
{
- rt_err_t result;
+ uint32_t u32Seed;
- result = rt_mutex_take(&s_PRNG_mutex, RT_WAITING_FOREVER);
- RT_ASSERT(result == RT_EOK);
+#if defined(NU_PRNG_USE_SEED)
+ u32Seed = NU_PRNG_SEED_VALUE;
+#else
+ u32Seed = (uint32_t)rt_tick_get();
+#endif
//Open PRNG 128 bits.
PRNG_Open(CRPT, PRNG_KEY_SIZE_128, PRNG_SEED_RELOAD, u32Seed);
- result = rt_mutex_release(&s_PRNG_mutex);
- RT_ASSERT(result == RT_EOK);
+ return RT_EOK;
}
-static rt_uint32_t nu_prng_run(void)
+static rt_uint32_t nu_prng_rand(struct hwcrypto_rng *ctx)
{
uint32_t au32RNGValue[4];
- rt_err_t result;
-
- result = rt_mutex_take(&s_PRNG_mutex, RT_WAITING_FOREVER);
- RT_ASSERT(result == RT_EOK);
PRNG_Start(CRPT);
- while ((CRPT->PRNG_CTL & CRPT_PRNG_CTL_BUSY_Msk)) {};
-
- /* Clear PRNG interrupt status */
- PRNG_CLR_INT_FLAG(CRPT);
PRNG_Read(CRPT, &au32RNGValue[0]);
- result = rt_mutex_release(&s_PRNG_mutex);
- RT_ASSERT(result == RT_EOK);
-
return au32RNGValue[0] ^ au32RNGValue[1] ^ au32RNGValue[2] ^ au32RNGValue[3];
}
-#endif
-
static rt_err_t nu_aes_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hwcrypto_symmetric_info *symmetric_info)
{
uint32_t u32AESOpMode;
@@ -606,14 +588,6 @@ static rt_err_t nu_sha_finish(struct hwcrypto_hash *hash_ctx, rt_uint8_t *out, r
return RT_EOK;
}
-#if !defined(BSP_USING_TRNG)
-static rt_uint32_t nu_prng_rand(struct hwcrypto_rng *ctx)
-{
- return nu_prng_run();
-}
-
-#endif
-
static const struct hwcrypto_symmetric_ops nu_aes_ops =
{
.crypt = nu_aes_crypt,
@@ -624,34 +598,19 @@ static const struct hwcrypto_hash_ops nu_sha_ops =
.update = nu_sha_update,
.finish = nu_sha_finish,
};
-
#endif
/* CRC operation ------------------------------------------------------------*/
#if defined(BSP_USING_CRC)
-
static const struct hwcrypto_crc_ops nu_crc_ops =
{
.update = nu_crc_update,
};
-
#endif
-/* TRNG operation ------------------------------------------------------------*/
-#if defined(BSP_USING_TRNG)
-
-static const struct hwcrypto_rng_ops nu_rng_ops =
-{
- .update = nu_trng_rand,
-};
-
-#elif defined(BSP_USING_CRYPTO)
-
-static const struct hwcrypto_rng_ops nu_rng_ops =
-{
- .update = nu_prng_rand,
-};
-
+#if defined(RT_HWCRYPTO_USING_RNG)
+ /* RNG operation ------------------------------------------------------------*/
+ static struct hwcrypto_rng_ops nu_rng_ops;
#endif
/* Register crypto interface ----------------------------------------------------------*/
@@ -662,7 +621,7 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
switch (ctx->type & HWCRYPTO_MAIN_TYPE_MASK)
{
-#if defined(BSP_USING_TRNG)
+#if defined(RT_HWCRYPTO_USING_RNG)
case HWCRYPTO_TYPE_RNG:
{
ctx->contex = RT_NULL;
@@ -670,9 +629,9 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
((struct hwcrypto_rng *)ctx)->ops = &nu_rng_ops;
break;
}
-#endif /* BSP_USING_TRNG */
+#endif /* RT_HWCRYPTO_USING_RNG */
-#if defined(BSP_USING_CRC)
+#if defined(BSP_USING_CRC) && defined(RT_HWCRYPTO_USING_CRC)
case HWCRYPTO_TYPE_CRC:
{
ctx->contex = RT_NULL;
@@ -680,7 +639,7 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
((struct hwcrypto_crc *)ctx)->ops = &nu_crc_ops;
break;
}
-#endif /* BSP_USING_CRC */
+#endif /* BSP_USING_CRC && defined(RT_HWCRYPTO_USING_CRC) */
#if defined(BSP_USING_CRYPTO)
case HWCRYPTO_TYPE_AES:
@@ -704,21 +663,6 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
((struct hwcrypto_hash *)ctx)->ops = &nu_sha_ops;
break;
}
-
-#if !defined(BSP_USING_TRNG)
- case HWCRYPTO_TYPE_RNG:
- {
- ctx->contex = RT_NULL;
- ((struct hwcrypto_rng *)ctx)->ops = &nu_rng_ops;
-#if defined(NU_PRNG_USE_SEED)
- nu_prng_open(NU_PRNG_SEED_VALUE);
-#else
- nu_prng_open(rt_tick_get());
-#endif
- break;
- }
-#endif /* !BSP_USING_TRNG */
-
#endif /* BSP_USING_CRYPTO */
default:
@@ -758,17 +702,6 @@ static void nu_hwcrypto_reset(struct rt_hwcrypto_ctx *ctx)
{
switch (ctx->type & HWCRYPTO_MAIN_TYPE_MASK)
{
-#if !defined(BSP_USING_TRNG)
- case HWCRYPTO_TYPE_RNG:
- {
-#if defined(NU_PRNG_USE_SEED)
- nu_prng_open(NU_PRNG_SEED_VALUE);
-#else
- nu_prng_open(rt_tick_get());
-#endif
- break;
- }
-#endif /* !BSP_USING_TRNG */
#if defined(BSP_USING_CRYPTO)
case HWCRYPTO_TYPE_SHA1:
case HWCRYPTO_TYPE_SHA2:
@@ -794,15 +727,14 @@ static void nu_hwcrypto_reset(struct rt_hwcrypto_ctx *ctx)
}
break;
}
-
#endif
+
default:
break;
}
}
/* Init and register nu_hwcrypto_dev */
-
int nu_hwcrypto_device_init(void)
{
rt_err_t result;
@@ -820,8 +752,23 @@ int nu_hwcrypto_device_init(void)
nu_crc_init();
#endif
+#if defined(RT_HWCRYPTO_USING_RNG)
#if defined(BSP_USING_TRNG)
- nu_trng_init();
+ result = nu_trng_init();
+ if (result == RT_EOK)
+ {
+ LOG_I("TRNG is used as default RNG.");
+ nu_rng_ops.update = nu_trng_rand;
+ }
+ else
+#endif
+ {
+ result = nu_prng_init();
+ RT_ASSERT(result == RT_EOK);
+
+ LOG_I("PRNG is used as default RNG.");
+ nu_rng_ops.update = nu_prng_rand;
+ }
#endif
/* register hwcrypto operation */
diff --git a/bsp/nuvoton/libraries/m2354/rtt_port/drv_sdh.c b/bsp/nuvoton/libraries/m2354/rtt_port/drv_sdh.c
index e71677a917..62b599c6af 100644
--- a/bsp/nuvoton/libraries/m2354/rtt_port/drv_sdh.c
+++ b/bsp/nuvoton/libraries/m2354/rtt_port/drv_sdh.c
@@ -12,6 +12,10 @@
#include
+#define NU_SDH_HOTPLUG
+#define NU_SDH_MOUNT_ON_ROOT
+#undef BSP_USING_SDH
+
#if defined(BSP_USING_SDH)
#include
diff --git a/bsp/nuvoton/libraries/m2354/rtt_port/drv_trng.c b/bsp/nuvoton/libraries/m2354/rtt_port/drv_trng.c
index e6c0d514c4..1c6ca683d2 100644
--- a/bsp/nuvoton/libraries/m2354/rtt_port/drv_trng.c
+++ b/bsp/nuvoton/libraries/m2354/rtt_port/drv_trng.c
@@ -7,6 +7,7 @@
* Change Logs:
* Date Author Notes
* 2020-7-4 YCHuang12 First version
+* 2022-3-15 Wayne Remove SW rand function
*
******************************************************************************/
@@ -16,66 +17,34 @@
#include
#include "NuMicro.h"
-#include
#define NU_CRYPTO_TRNG_NAME "nu_TRNG"
+#define LOG_TAG "TRNG"
+#define DBG_ENABLE
+#define DBG_SECTION_NAME "TRNG"
+#define DBG_LEVEL DBG_INFO
+#define DBG_COLOR
+#include
+
/* Private variables ------------------------------------------------------------*/
-static struct rt_mutex s_TRNG_mutex;
-static int s_i32TRNGEnable = 0;
-
-static rt_uint32_t nu_trng_run(void)
-{
- uint32_t u32RNGValue;
- rt_err_t result;
-
- result = rt_mutex_take(&s_TRNG_mutex, RT_WAITING_FOREVER);
- RT_ASSERT(result == RT_EOK);
-
- RNG_Open();
-
- if (RNG_Random(&u32RNGValue, 1) < 0)
- {
- //Failed, use software rand
- u32RNGValue = rand();
- }
-
- result = rt_mutex_release(&s_TRNG_mutex);
- RT_ASSERT(result == RT_EOK);
-
- return u32RNGValue;
-}
-
rt_err_t nu_trng_init(void)
{
- rt_err_t result;
-
- result = rt_mutex_init(&s_TRNG_mutex, NU_CRYPTO_TRNG_NAME, RT_IPC_FLAG_PRIO);
- RT_ASSERT(result == RT_EOK);
-
- s_i32TRNGEnable = 1;
+ CLK_EnableModuleClock(TRNG_MODULE);
SYS_ResetModule(TRNG_RST);
- return RT_EOK;
-}
-void nu_trng_open(void)
-{
-#if defined(NU_PRNG_USE_SEED)
- srand(NU_PRNG_SEED_VALUE);
-#else
- srand(rt_tick_get());
-#endif
+ TRNG_Open();
+
+ return RT_EOK;
}
rt_uint32_t nu_trng_rand(struct hwcrypto_rng *ctx)
{
- if (!s_i32TRNGEnable)
- {
- /* Use software rand */
- return (rt_uint32_t)rand();
- }
+ uint32_t u32RNGValue;
- return nu_trng_run();
+ TRNG_GenWord(&u32RNGValue);
+
+ return u32RNGValue;
}
#endif //#if (defined(BSP_USING_TRNG) && defined(RT_HWCRYPTO_USING_RNG))
diff --git a/bsp/nuvoton/libraries/m480/Device/Nuvoton/M480/Include/sdh_reg.h b/bsp/nuvoton/libraries/m480/Device/Nuvoton/M480/Include/sdh_reg.h
index 56f42e8200..27420cbdf7 100644
--- a/bsp/nuvoton/libraries/m480/Device/Nuvoton/M480/Include/sdh_reg.h
+++ b/bsp/nuvoton/libraries/m480/Device/Nuvoton/M480/Include/sdh_reg.h
@@ -10,7 +10,7 @@
#define __SDH_REG_H__
#if defined ( __CC_ARM )
-#pragma anon_unions
+ #pragma anon_unions
#endif
/**
@@ -355,7 +355,7 @@ typedef struct
/// @endcond //HIDDEN_SYMBOLS
__IO uint32_t GCTL; /*!< [0x0800] Global Control and Status Register */
__IO uint32_t GINTEN; /*!< [0x0804] Global Interrupt Control Register */
- __I uint32_t GINTSTS; /*!< [0x0808] Global Interrupt Status Register */
+ __IO uint32_t GINTSTS; /*!< [0x0808] Global Interrupt Status Register */
/// @cond HIDDEN_SYMBOLS
__I uint32_t RESERVE3[5];
/// @endcond //HIDDEN_SYMBOLS
@@ -534,7 +534,7 @@ typedef struct
/**@}*/ /* end of REGISTER group */
#if defined ( __CC_ARM )
-#pragma no_anon_unions
+ #pragma no_anon_unions
#endif
#endif /* __SDH_REG_H__ */
diff --git a/bsp/nuvoton/libraries/m480/StdDriver/inc/nu_sdh.h b/bsp/nuvoton/libraries/m480/StdDriver/inc/nu_sdh.h
index 41d1d199f5..9a9ea574d7 100644
--- a/bsp/nuvoton/libraries/m480/StdDriver/inc/nu_sdh.h
+++ b/bsp/nuvoton/libraries/m480/StdDriver/inc/nu_sdh.h
@@ -183,7 +183,7 @@ void SDH_Open(SDH_T *sdh, uint32_t u32CardDetSrc);
uint32_t SDH_Probe(SDH_T *sdh);
uint32_t SDH_Read(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_t u32SecCount);
uint32_t SDH_Write(SDH_T *sdh, uint8_t *pu8BufAddr, uint32_t u32StartSec, uint32_t u32SecCount);
-
+void SDH_Set_clock(SDH_T *sdh, uint32_t u32SDClockKhz);
uint32_t SDH_CardDetection(SDH_T *sdh);
void SDH_Open_Disk(SDH_T *sdh, uint32_t u32CardDetSrc);
void SDH_Close_Disk(SDH_T *sdh);
diff --git a/bsp/nuvoton/libraries/m480/rtt_port/Kconfig b/bsp/nuvoton/libraries/m480/rtt_port/Kconfig
index 2fabca76de..fc573f9a4a 100644
--- a/bsp/nuvoton/libraries/m480/rtt_port/Kconfig
+++ b/bsp/nuvoton/libraries/m480/rtt_port/Kconfig
@@ -447,7 +447,7 @@ config SOC_SERIES_M480
menuconfig BSP_USING_SDH
bool "Enable Secure Digital Host Controller(SDH)"
select RT_USING_DFS
- select DFS_USING_POSIX
+ select RT_USING_SDIO
if BSP_USING_SDH
config BSP_USING_SDH0
@@ -455,18 +455,6 @@ config SOC_SERIES_M480
config BSP_USING_SDH1
bool "Enable SDH1"
-
- config NU_SDH_USING_PDMA
- bool "Using PDMA"
- select BSP_USING_PDMA
-
- config NU_SDH_HOTPLUG
- bool "Using HOTPLUG"
- default y
-
- config NU_SDH_MOUNT_ON_ROOT
- bool "Mount on root"
-
endif
menuconfig BSP_USING_CAN
diff --git a/bsp/nuvoton/libraries/m480/rtt_port/drv_crypto.c b/bsp/nuvoton/libraries/m480/rtt_port/drv_crypto.c
index 6cb252068f..cb3e491add 100644
--- a/bsp/nuvoton/libraries/m480/rtt_port/drv_crypto.c
+++ b/bsp/nuvoton/libraries/m480/rtt_port/drv_crypto.c
@@ -8,6 +8,7 @@
* Date Author Notes
* 2020-3-3 CHChen First version
* 2020-5-3 YCHuang12 Add TDES and SHA
+* 2022-4-17 Wayne Fix TRNG and PRNG selection
*
******************************************************************************/
@@ -16,7 +17,6 @@
#if ((defined(BSP_USING_CRYPTO) || defined(BSP_USING_TRNG) || defined(BSP_USING_CRC)) && defined(RT_USING_HWCRYPTO))
#include
-#include
#include
#include "NuMicro.h"
#include
@@ -30,6 +30,13 @@
#endif
/* Private typedef --------------------------------------------------------------*/
+#define LOG_TAG "CRYPTO"
+#define DBG_ENABLE
+#define DBG_SECTION_NAME "CRYPTO"
+#define DBG_LEVEL DBG_INFO
+#define DBG_COLOR
+#include
+
typedef struct
{
uint8_t *pu8SHATempBuf;
@@ -61,18 +68,12 @@ static const struct rt_hwcrypto_ops nu_hwcrypto_ops =
#define NU_HWCRYPTO_AES_NAME "nu_AES"
#define NU_HWCRYPTO_TDES_NAME "nu_TDES"
#define NU_HWCRYPTO_SHA_NAME "nu_SHA"
-#if !defined(BSP_USING_TRNG)
- #define NU_HWCRYPTO_PRNG_NAME "nu_PRNG"
-#endif
+#define NU_HWCRYPTO_PRNG_NAME "nu_PRNG"
static struct rt_mutex s_AES_mutex;
static struct rt_mutex s_TDES_mutex;
static struct rt_mutex s_SHA_mutex;
-#if !defined(BSP_USING_TRNG)
- static struct rt_mutex s_PRNG_mutex;
-#endif
-
static rt_err_t nu_crypto_init(void)
{
rt_err_t result = RT_EOK;
@@ -96,12 +97,6 @@ static rt_err_t nu_crypto_init(void)
SHA_ENABLE_INT(CRPT);
#endif
-#if defined(RT_HWCRYPTO_USING_RNG) && !defined(BSP_USING_TRNG)
- result = rt_mutex_init(&s_PRNG_mutex, NU_HWCRYPTO_PRNG_NAME, RT_IPC_FLAG_PRIO);
- RT_ASSERT(result == RT_EOK);
- PRNG_ENABLE_INT(CRPT);
-#endif
-
return result;
}
@@ -174,46 +169,33 @@ static rt_err_t nu_aes_crypt_run(
return RT_EOK;
}
-#if !defined(BSP_USING_TRNG)
-//Using PRNG instead of TRNG
-static void nu_prng_open(uint32_t u32Seed)
+static rt_err_t nu_prng_init(void)
{
- rt_err_t result;
+ uint32_t u32Seed;
- result = rt_mutex_take(&s_PRNG_mutex, RT_WAITING_FOREVER);
- RT_ASSERT(result == RT_EOK);
+#if defined(NU_PRNG_USE_SEED)
+ u32Seed = NU_PRNG_SEED_VALUE;
+#else
+ u32Seed = (uint32_t)rt_tick_get();
+#endif
- //Open PRNG 64 bits.
- PRNG_Open(CRPT, PRNG_KEY_SIZE_64, PRNG_SEED_RELOAD, u32Seed);
+ //Open PRNG 128 bits.
+ PRNG_Open(CRPT, PRNG_KEY_SIZE_128, PRNG_SEED_RELOAD, u32Seed);
- result = rt_mutex_release(&s_PRNG_mutex);
- RT_ASSERT(result == RT_EOK);
+ return RT_EOK;
}
-static rt_uint32_t nu_prng_run(void)
+static rt_uint32_t nu_prng_rand(struct hwcrypto_rng *ctx)
{
- uint32_t au32RNGValue[2];
- rt_err_t result;
-
- result = rt_mutex_take(&s_PRNG_mutex, RT_WAITING_FOREVER);
- RT_ASSERT(result == RT_EOK);
+ uint32_t au32RNGValue[4];
PRNG_Start(CRPT);
- while ((CRPT->PRNG_CTL & CRPT_PRNG_CTL_BUSY_Msk)) {};
-
- /* Clear PRNG interrupt status */
- PRNG_CLR_INT_FLAG(CRPT);
PRNG_Read(CRPT, &au32RNGValue[0]);
- result = rt_mutex_release(&s_PRNG_mutex);
- RT_ASSERT(result == RT_EOK);
-
- return au32RNGValue[0] ^ au32RNGValue[1];
+ return au32RNGValue[0] ^ au32RNGValue[1] ^ au32RNGValue[2] ^ au32RNGValue[3];
}
-#endif
-
static rt_err_t nu_aes_crypt(struct hwcrypto_symmetric *symmetric_ctx, struct hwcrypto_symmetric_info *symmetric_info)
{
uint32_t u32AESOpMode;
@@ -783,14 +765,6 @@ static rt_err_t nu_sha_finish(struct hwcrypto_hash *hash_ctx, rt_uint8_t *out, r
return RT_EOK;
}
-#if !defined(BSP_USING_TRNG)
-static rt_uint32_t nu_prng_rand(struct hwcrypto_rng *ctx)
-{
- return nu_prng_run();
-}
-
-#endif
-
static const struct hwcrypto_symmetric_ops nu_aes_ops =
{
.crypt = nu_aes_crypt,
@@ -806,34 +780,19 @@ static const struct hwcrypto_hash_ops nu_sha_ops =
.update = nu_sha_update,
.finish = nu_sha_finish,
};
-
#endif
/* CRC operation ------------------------------------------------------------*/
#if defined(BSP_USING_CRC)
-
static const struct hwcrypto_crc_ops nu_crc_ops =
{
.update = nu_crc_update,
};
-
#endif
-/* TRNG operation ------------------------------------------------------------*/
-#if defined(BSP_USING_TRNG)
-
-static const struct hwcrypto_rng_ops nu_rng_ops =
-{
- .update = nu_trng_rand,
-};
-
-#elif defined(BSP_USING_CRYPTO)
-
-static const struct hwcrypto_rng_ops nu_rng_ops =
-{
- .update = nu_prng_rand,
-};
-
+#if defined(RT_HWCRYPTO_USING_RNG)
+ /* RNG operation ------------------------------------------------------------*/
+ static struct hwcrypto_rng_ops nu_rng_ops;
#endif
/* Register crypto interface ----------------------------------------------------------*/
@@ -844,7 +803,7 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
switch (ctx->type & HWCRYPTO_MAIN_TYPE_MASK)
{
-#if defined(BSP_USING_TRNG)
+#if defined(RT_HWCRYPTO_USING_RNG)
case HWCRYPTO_TYPE_RNG:
{
ctx->contex = RT_NULL;
@@ -852,9 +811,9 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
((struct hwcrypto_rng *)ctx)->ops = &nu_rng_ops;
break;
}
-#endif /* BSP_USING_TRNG */
+#endif /* RT_HWCRYPTO_USING_RNG */
-#if defined(BSP_USING_CRC)
+#if defined(BSP_USING_CRC) && defined(RT_HWCRYPTO_USING_CRC)
case HWCRYPTO_TYPE_CRC:
{
ctx->contex = RT_NULL;
@@ -862,7 +821,7 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
((struct hwcrypto_crc *)ctx)->ops = &nu_crc_ops;
break;
}
-#endif /* BSP_USING_CRC */
+#endif /* BSP_USING_CRC && defined(RT_HWCRYPTO_USING_CRC) */
#if defined(BSP_USING_CRYPTO)
case HWCRYPTO_TYPE_AES:
@@ -896,21 +855,6 @@ static rt_err_t nu_hwcrypto_create(struct rt_hwcrypto_ctx *ctx)
((struct hwcrypto_hash *)ctx)->ops = &nu_sha_ops;
break;
}
-
-#if !defined(BSP_USING_TRNG)
- case HWCRYPTO_TYPE_RNG:
- {
- ctx->contex = RT_NULL;
- ((struct hwcrypto_rng *)ctx)->ops = &nu_rng_ops;
-#if defined(NU_PRNG_USE_SEED)
- nu_prng_open(NU_PRNG_SEED_VALUE);
-#else
- nu_prng_open(rt_tick_get());
-#endif
- break;
- }
-#endif /* !BSP_USING_TRNG */
-
#endif /* BSP_USING_CRYPTO */
default:
@@ -950,17 +894,6 @@ static void nu_hwcrypto_reset(struct rt_hwcrypto_ctx *ctx)
{
switch (ctx->type & HWCRYPTO_MAIN_TYPE_MASK)
{
-#if !defined(BSP_USING_TRNG)
- case HWCRYPTO_TYPE_RNG:
- {
-#if defined(NU_PRNG_USE_SEED)
- nu_prng_open(NU_PRNG_SEED_VALUE);
-#else
- nu_prng_open(rt_tick_get());
-#endif
- break;
- }
-#endif /* !BSP_USING_TRNG */
#if defined(BSP_USING_CRYPTO)
case HWCRYPTO_TYPE_SHA1:
case HWCRYPTO_TYPE_SHA2:
@@ -986,15 +919,14 @@ static void nu_hwcrypto_reset(struct rt_hwcrypto_ctx *ctx)
}
break;
}
-
#endif
+
default:
break;
}
}
/* Init and register nu_hwcrypto_dev */
-
int nu_hwcrypto_device_init(void)
{
rt_err_t result;
@@ -1012,8 +944,23 @@ int nu_hwcrypto_device_init(void)
nu_crc_init();
#endif
+#if defined(RT_HWCRYPTO_USING_RNG)
#if defined(BSP_USING_TRNG)
- nu_trng_init();
+ result = nu_trng_init();
+ if (result == RT_EOK)
+ {
+ LOG_I("TRNG is used as default RNG.");
+ nu_rng_ops.update = nu_trng_rand;
+ }
+ else
+#endif
+ {
+ result = nu_prng_init();
+ RT_ASSERT(result == RT_EOK);
+
+ LOG_I("PRNG is used as default RNG.");
+ nu_rng_ops.update = nu_prng_rand;
+ }
#endif
/* register hwcrypto operation */
diff --git a/bsp/nuvoton/libraries/m480/rtt_port/drv_sdh.c b/bsp/nuvoton/libraries/m480/rtt_port/drv_sdh.c
index a4f49958c4..55a1f404e6 100644
--- a/bsp/nuvoton/libraries/m480/rtt_port/drv_sdh.c
+++ b/bsp/nuvoton/libraries/m480/rtt_port/drv_sdh.c
@@ -12,6 +12,10 @@
#include
+#define NU_SDH_HOTPLUG
+#define NU_SDH_MOUNT_ON_ROOT
+#undef BSP_USING_SDH
+
#if defined(BSP_USING_SDH)
#include
diff --git a/bsp/nuvoton/libraries/m480/rtt_port/drv_trng.c b/bsp/nuvoton/libraries/m480/rtt_port/drv_trng.c
index a7bfdb4cb9..3e70d910d4 100644
--- a/bsp/nuvoton/libraries/m480/rtt_port/drv_trng.c
+++ b/bsp/nuvoton/libraries/m480/rtt_port/drv_trng.c
@@ -7,6 +7,7 @@
* Change Logs:
* Date Author Notes
* 2020-3-4 CHChen First version
+* 2022-3-15 Wayne Remove SW rand function
*
******************************************************************************/
@@ -16,72 +17,40 @@
#include
#include "NuMicro.h"
-#include
#define NU_CRYPTO_TRNG_NAME "nu_TRNG"
+#define LOG_TAG "TRNG"
+#define DBG_ENABLE
+#define DBG_SECTION_NAME "TRNG"
+#define DBG_LEVEL DBG_INFO
+#define DBG_COLOR
+#include
+
/* Private variables ------------------------------------------------------------*/
-static struct rt_mutex s_TRNG_mutex;
-static int s_i32TRNGEnable = 0;
-
-static rt_uint32_t nu_trng_run(void)
-{
- uint32_t u32RNGValue;
- rt_err_t result;
-
- result = rt_mutex_take(&s_TRNG_mutex, RT_WAITING_FOREVER);
- RT_ASSERT(result == RT_EOK);
-
- TRNG_Open();
-
- if (TRNG_GenWord(&u32RNGValue) < 0)
- {
- //Failed, use software rand
- u32RNGValue = rand();
- }
-
- result = rt_mutex_release(&s_TRNG_mutex);
- RT_ASSERT(result == RT_EOK);
-
- return u32RNGValue;
-}
-
rt_err_t nu_trng_init(void)
{
- rt_err_t result;
-
- result = rt_mutex_init(&s_TRNG_mutex, NU_CRYPTO_TRNG_NAME, RT_IPC_FLAG_PRIO);
- RT_ASSERT(result == RT_EOK);
-
if ((SYS->CSERVER & SYS_CSERVER_VERSION_Msk) == 0x0)
{
- rt_kprintf("This chip does not support TRNG!\n");
+ LOG_E("This chip does not support TRNG!");
return -RT_ERROR;
}
- s_i32TRNGEnable = 1;
+ CLK_EnableModuleClock(TRNG_MODULE);
SYS_ResetModule(TRNG_RST);
- return RT_EOK;
-}
-void nu_trng_open(void)
-{
-#if defined(NU_PRNG_USE_SEED)
- srand(NU_PRNG_SEED_VALUE);
-#else
- srand(rt_tick_get());
-#endif
+ TRNG_Open();
+
+ return RT_EOK;
}
rt_uint32_t nu_trng_rand(struct hwcrypto_rng *ctx)
{
- if (!s_i32TRNGEnable)
- {
- /* Use software rand */
- return (rt_uint32_t)rand();
- }
+ uint32_t u32RNGValue;
- return nu_trng_run();
+ TRNG_GenWord(&u32RNGValue);
+
+ return u32RNGValue;
}
#endif //#if (defined(BSP_USING_TRNG) && defined(RT_HWCRYPTO_USING_RNG))
diff --git a/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_fmi.h b/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_fmi.h
index a0b85078fc..0c0e1d6964 100644
--- a/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_fmi.h
+++ b/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_fmi.h
@@ -24,6 +24,85 @@
@{
*/
+
+#ifdef __cplusplus
+ #define __I volatile /*!< Defines 'read only' permissions */
+#else
+ #define __I volatile const /*!< Defines 'read only' permissions */
+#endif
+#define __O volatile /*!< Defines 'write only' permissions */
+#define __IO volatile /*!< Defines 'read / write' permissions */
+
+typedef struct
+{
+ __IO uint32_t FB[32]; /*!< Shared Buffer (FIFO) */
+ /// @cond HIDDEN_SYMBOLS
+ __I uint32_t RESERVE0[224];
+ /// @endcond //HIDDEN_SYMBOLS
+ __IO uint32_t DMACTL; /*!< [0x0400] DMA Control and Status Register */
+ /// @cond HIDDEN_SYMBOLS
+ __I uint32_t RESERVE1[1];
+ /// @endcond //HIDDEN_SYMBOLS
+ __IO uint32_t DMASA; /*!< [0x0408] DMA Transfer Starting Address Register */
+ __I uint32_t DMABCNT; /*!< [0x040c] DMA Transfer Byte Count Register */
+ __IO uint32_t DMAINTEN; /*!< [0x0410] DMA Interrupt Enable Control Register */
+ __IO uint32_t DMAINTSTS; /*!< [0x0414] DMA Interrupt Status Register */
+ /// @cond HIDDEN_SYMBOLS
+ __I uint32_t RESERVE2[250];
+ /// @endcond //HIDDEN_SYMBOLS
+ __IO uint32_t GCTL; /*!< [0x0800] Global Control and Status Register */
+ __IO uint32_t GINTEN; /*!< [0x0804] Global Interrupt Control Register */
+ __I uint32_t GINTSTS; /*!< [0x0808] Global Interrupt Status Register */
+ /// @cond HIDDEN_SYMBOLS
+ __I uint32_t RESERVE3[5];
+ /// @endcond //HIDDEN_SYMBOLS
+ __IO uint32_t CTL; /*!< [0x0820] SD Control and Status Register */
+ __IO uint32_t CMDARG; /*!< [0x0824] SD Command Argument Register */
+ __IO uint32_t INTEN; /*!< [0x0828] SD Interrupt Control Register */
+ __IO uint32_t INTSTS; /*!< [0x082c] SD Interrupt Status Register */
+ __I uint32_t RESP0; /*!< [0x0830] SD Receiving Response Token Register 0 */
+ __I uint32_t RESP1; /*!< [0x0834] SD Receiving Response Token Register 1 */
+ __IO uint32_t BLEN; /*!< [0x0838] SD Block Length Register */
+ __IO uint32_t TOUT; /*!< [0x083c] SD Response/Data-in Time-out Register */
+ __IO uint32_t ECTL; /*!< [0x0840] SD Host Extend Control Register */
+
+ /// @cond HIDDEN_SYMBOLS
+ __I uint32_t RESERVE4[24];
+ /// @endcond //HIDDEN_SYMBOLS
+ __IO uint32_t NANDCTL; /*!< [0x08A0] NAND Flash Control Register */
+ __IO uint32_t NANDTMCTL; /*!< [0x08A4] NAND Flash Timing Control Register */
+ __IO uint32_t NANDINTEN; /*!< [0x08A8] NAND Flash Interrupt Enable Register */
+ __IO uint32_t NANDINTSTS; /*!< [0x08AC] NAND Flash Interrupt Status Register */
+ __O uint32_t NANDCMD; /*!< [0x08B0] NAND Flash Command Port Registe */
+ __O uint32_t NANDADDR; /*!< [0x08B4] NAND Flash Address Port Register */
+ __IO uint32_t NANDDATA; /*!< [0x08B8] NAND Flash Data Port Registe */
+ __IO uint32_t NANDRACTL; /*!< [0x08BC] NAND Flash Redundant Area Control Register */
+ __IO uint32_t NANDECTL; /*!< [0x08C0] NAND Flash Extend Control Register */
+ __I uint32_t NANDECCES[4]; /*!< [0x08D0] NAND Flash ECC Error Status Register */
+ __IO uint32_t NANDPROTA[2]; /*!< [0x08E0] NAND Flash Protect Region End Address Register */
+
+ /// @cond HIDDEN_SYMBOLS
+ __I uint32_t RESERVE5[6];
+ /// @endcond //HIDDEN_SYMBOLS
+
+ __I uint32_t NANDECCEA[12]; /*!< [0x0900] NAND Flash ECC Error Byte Address n Register */
+
+ /// @cond HIDDEN_SYMBOLS
+ __I uint32_t RESERVE6[12];
+ /// @endcond //HIDDEN_SYMBOLS
+
+ __I uint32_t NANDECCED[6]; /*!< [0x0960] NAND Flash ECC Error Data Register N */
+
+ /// @cond HIDDEN_SYMBOLS
+ __I uint32_t RESERVE7[34];
+ /// @endcond //HIDDEN_SYMBOLS
+
+ __IO uint32_t NANDRA[118]; /*!< [0x0A00]NAND Flash Redundant Area Word n = 0, 1..117 */
+
+} FMI_T;
+
+#define FMI0 ((FMI_T *) FMI_BA)
+
/**
@addtogroup FMI_CONST FMI Bit Field Definition
Constant Definitions for FMI Controller
diff --git a/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_sdh.h b/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_sdh.h
index 6a7d548c17..3902650271 100644
--- a/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_sdh.h
+++ b/bsp/nuvoton/libraries/n9h30/Driver/Include/nu_sdh.h
@@ -375,8 +375,8 @@ typedef struct
__I uint32_t RESP1; /*!< [0x0834] SD Receiving Response Token Register 1 */
__IO uint32_t BLEN; /*!< [0x0838] SD Block Length Register */
__IO uint32_t TOUT; /*!< [0x083c] SD Response/Data-in Time-out Register */
-
__IO uint32_t ECTL; /*!< [0x0840] SD Host Extend Control Register */
+
} SDH_T;
diff --git a/bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig b/bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig
index 8d480dacf1..5739233cb5 100644
--- a/bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig
+++ b/bsp/nuvoton/libraries/n9h30/rtt_port/Kconfig
@@ -180,6 +180,11 @@ config SOC_SERIES_N9H30
endif
+ config BSP_USING_FMINAND
+ bool "Enable FMI NAND Controller"
+ select RT_USING_MTD_NAND
+ default y
+
menuconfig BSP_USING_TMR
bool "Enable Timer Controller(TIMER)"
diff --git a/bsp/nuvoton/libraries/n9h30/rtt_port/SConscript b/bsp/nuvoton/libraries/n9h30/rtt_port/SConscript
index e1b907cc3c..8e375e6708 100644
--- a/bsp/nuvoton/libraries/n9h30/rtt_port/SConscript
+++ b/bsp/nuvoton/libraries/n9h30/rtt_port/SConscript
@@ -1,14 +1,21 @@
# RT-Thread building script for component
+import os
Import('RTT_ROOT')
from building import *
-cwd = GetCurrentDir()
+cwd = GetCurrentDir()
+objs = []
+list = os.listdir(cwd)
src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd]
-group = []
-
-# USB driver constrain
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
-Return('group')
+for d in list:
+ path = os.path.join(cwd, d)
+ if os.path.isfile(os.path.join(path, 'SConscript')):
+ objs = objs + SConscript(os.path.join(d, 'SConscript'))
+
+objs += group
+
+Return('objs')
diff --git a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_sys.c b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_sys.c
index 78b660ea3e..21937596c5 100644
--- a/bsp/nuvoton/libraries/n9h30/rtt_port/drv_sys.c
+++ b/bsp/nuvoton/libraries/n9h30/rtt_port/drv_sys.c
@@ -74,8 +74,9 @@ void rt_hw_interrupt_init(void)
{
int i;
- *((volatile unsigned int *)REG_AIC_ISR) = 0xFFFFFFFF; // disable all interrupt channel
- *((volatile unsigned int *)REG_AIC_ISRH) = 0xFFFFFFFF; // disable all interrupt channel
+ outpw(REG_AIC_ISR, 0xFFFFFFFF); // disable all interrupt channel
+ outpw(REG_AIC_ISRH, 0xFFFFFFFF); // disable all interrupt channel
+ outpw(REG_AIC_EOSCR, 1);
/* init interrupt nest, and context in thread sp */
rt_interrupt_nest = 0;
diff --git a/bsp/nuvoton/libraries/nu_packages/Kconfig b/bsp/nuvoton/libraries/nu_packages/Kconfig
index 1c7f4d7953..de9028da87 100644
--- a/bsp/nuvoton/libraries/nu_packages/Kconfig
+++ b/bsp/nuvoton/libraries/nu_packages/Kconfig
@@ -7,6 +7,10 @@ menu "Nuvoton Packages Config"
bool "Enable demos"
default y
+ config NU_PKG_USING_LVGL
+ bool "Enable LVGL demos"
+ default n
+
config NU_PKG_USING_BMX055
bool "BMX055 9-axis sensor."
select RT_USING_I2C
@@ -136,6 +140,48 @@ menu "Nuvoton Packages Config"
endif
+ config NU_PKG_USING_FSA506
+ bool "FSA506 LCD Panel"
+ select BSP_USING_GPIO
+ default n
+
+ if NU_PKG_USING_FSA506
+
+ choice
+ prompt "Select FSA506 interface"
+
+ config NU_PKG_USING_FSA506_EBI
+ select BSP_USING_EBI
+ bool "FSA506_EBI"
+ help
+ Choose this option if you the FSA506 device is with EBI interface.
+ endchoice
+
+ config NU_PKG_FSA506_WITH_OFFSCREEN_FRAMEBUFFER
+ bool "Create an offscreen framebuffer."
+ default n
+
+ if NU_PKG_FSA506_WITH_OFFSCREEN_FRAMEBUFFER
+ config NU_PKG_FSA506_LINE_BUFFER_NUMBER
+ int "Allocate Line buffer number."
+ range 16 272
+ default 272
+ endif
+
+ config BSP_LCD_BPP
+ int
+ default 16 if NU_PKG_USING_FSA506
+
+ config BSP_LCD_WIDTH
+ int
+ default 480 if NU_PKG_USING_FSA506
+
+ config BSP_LCD_HEIGHT
+ int
+ default 272 if NU_PKG_USING_FSA506
+
+ endif
+
config NU_PKG_USING_TPC
bool "Support Touch Panel Controller over I2C"
select RT_USING_TOUCH
@@ -152,7 +198,21 @@ menu "Nuvoton Packages Config"
config NU_PKG_USING_TPC_GT911
bool "GT911 TPC"
default n
+
+ config NU_PKG_USING_TPC_FT5446
+ bool "FT5446 TPC"
+ default n
+
+ config NU_PKG_USING_TPC_ST1663I
+ bool "ST1663I TPC"
+ default n
+
endchoice
+
+ config NU_PKG_TPC_REVERSE_XY
+ bool "Reverse X-Y coordinate"
+ default n
+
endif
config NU_PKG_USING_ADC_TOUCH
diff --git a/bsp/nuvoton/libraries/nu_packages/NuUtils/inc/nu_bitutil.h b/bsp/nuvoton/libraries/nu_packages/NuUtils/inc/nu_bitutil.h
index 4286d5efcb..fa06734837 100644
--- a/bsp/nuvoton/libraries/nu_packages/NuUtils/inc/nu_bitutil.h
+++ b/bsp/nuvoton/libraries/nu_packages/NuUtils/inc/nu_bitutil.h
@@ -14,17 +14,15 @@
#if defined(__ICCARM__)
#include
-#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler 6 */
+#elif defined (__ARMCC_VERSION)
#ifdef __has_include
- #if __has_include("cmsis_armclang.h")
- #include "cmsis_armclang.h"
+ #if __has_include("cmsis_compiler.h")
+ #include "cmsis_compiler.h"
#endif
#endif
-#elif defined(__ARMCC_VERSION)
- #ifdef __has_include
- #if __has_include("cmsis_armcc.h")
- #include "cmsis_armcc.h"
- #endif
+
+ #if !defined(__CLZ)
+ #define __CLZ __clz
#endif
#endif
diff --git a/bsp/nuvoton/libraries/nu_packages/TPC/SConscript b/bsp/nuvoton/libraries/nu_packages/TPC/SConscript
index 5040a9a811..f429ad7bf4 100644
--- a/bsp/nuvoton/libraries/nu_packages/TPC/SConscript
+++ b/bsp/nuvoton/libraries/nu_packages/TPC/SConscript
@@ -11,6 +11,10 @@ if GetDepend('NU_PKG_USING_TPC_ILI'):
src += Glob('ili.c')
elif GetDepend('NU_PKG_USING_TPC_GT911'):
src += Glob('gt911.c')
+elif GetDepend('NU_PKG_USING_TPC_FT5446'):
+ src += Glob('ft5446.c')
+elif GetDepend('NU_PKG_USING_TPC_ST1663I'):
+ src += Glob('st1663i.c')
else:
src = []
diff --git a/bsp/nuvoton/libraries/nu_packages/TPC/gt911.c b/bsp/nuvoton/libraries/nu_packages/TPC/gt911.c
index ef5620ffd1..5e59f3abc9 100644
--- a/bsp/nuvoton/libraries/nu_packages/TPC/gt911.c
+++ b/bsp/nuvoton/libraries/nu_packages/TPC/gt911.c
@@ -12,12 +12,11 @@
#include
#include
-#include
-
#define DBG_TAG "gt911"
#define DBG_LVL DBG_INFO
#include
+#include "touch.h"
#include "gt911.h"
static struct rt_i2c_client gt911_client;
@@ -113,7 +112,7 @@ static rt_err_t gt911_get_info(struct rt_i2c_client *dev, struct rt_touch_info *
reg[0] = (rt_uint8_t)(GT911_CONFIG_REG >> 8);
reg[1] = (rt_uint8_t)(GT911_CONFIG_REG & 0xFF);
- if(gt911_read_regs(dev, reg, out_info, out_len) != RT_EOK)
+ if (gt911_read_regs(dev, reg, out_info, out_len) != RT_EOK)
{
LOG_E("read info failed");
return -RT_ERROR;
@@ -134,7 +133,7 @@ static rt_err_t gt911_soft_reset(struct rt_i2c_client *dev)
buf[1] = (rt_uint8_t)(GT911_COMMAND_REG & 0xFF);
buf[2] = 0x02;
- if(gt911_write_reg(dev, buf, 3) != RT_EOK)
+ if (gt911_write_reg(dev, buf, 3) != RT_EOK)
{
LOG_E("soft reset failed");
return -RT_ERROR;
@@ -142,16 +141,16 @@ static rt_err_t gt911_soft_reset(struct rt_i2c_client *dev)
return RT_EOK;
}
-static rt_int16_t pre_x[GT911_MAX_TOUCH] = {-1, -1, -1, -1, -1};
-static rt_int16_t pre_y[GT911_MAX_TOUCH] = {-1, -1, -1, -1, -1};
-static rt_int16_t pre_w[GT911_MAX_TOUCH] = {-1, -1, -1, -1, -1};
+static rt_int16_t pre_x[GT911_MAX_TOUCH];
+static rt_int16_t pre_y[GT911_MAX_TOUCH];
+static rt_int16_t pre_w[GT911_MAX_TOUCH];
static rt_uint8_t s_tp_dowm[GT911_MAX_TOUCH];
static void gt911_touch_up(void *buf, rt_int8_t id)
{
struct rt_touch_data *read_data = (struct rt_touch_data *)buf;
- if(s_tp_dowm[id] == 1)
+ if (s_tp_dowm[id] == 1)
{
s_tp_dowm[id] = 0;
read_data[id].event = RT_TOUCH_EVENT_UP;
@@ -198,6 +197,9 @@ static void gt911_touch_down(void *buf, rt_int8_t id, rt_int16_t x, rt_int16_t y
pre_w[id] = w;
}
+static rt_int8_t pre_id[GT911_MAX_TOUCH];
+static rt_uint8_t pre_touch = 0;
+
static rt_size_t gt911_read_point(struct rt_touch_device *touch, void *buf, rt_size_t read_num)
{
rt_uint8_t point_status = 0;
@@ -205,15 +207,12 @@ static rt_size_t gt911_read_point(struct rt_touch_device *touch, void *buf, rt_s
rt_uint8_t write_buf[3];
rt_uint8_t cmd[2];
rt_uint8_t read_buf[8 * GT911_MAX_TOUCH] = {0};
- rt_uint8_t read_index;
+ rt_uint8_t i;
rt_int8_t read_id = 0;
rt_int16_t input_x = 0;
rt_int16_t input_y = 0;
rt_int16_t input_w = 0;
- static rt_uint8_t pre_touch = 0;
- static rt_int8_t pre_id[GT911_MAX_TOUCH] = {0};
-
/* point status register */
cmd[0] = (rt_uint8_t)((GT911_READ_STATUS >> 8) & 0xFF);
cmd[1] = (rt_uint8_t)(GT911_READ_STATUS & 0xFF);
@@ -249,16 +248,16 @@ static rt_size_t gt911_read_point(struct rt_touch_device *touch, void *buf, rt_s
cmd[1] = (rt_uint8_t)(GT911_POINT1_REG & 0xFF);
/* read point num is touch_num */
- if(gt911_read_regs(>911_client, cmd, read_buf, read_num * GT911_POINT_INFO_NUM) !=RT_EOK)
+ if (gt911_read_regs(>911_client, cmd, read_buf, read_num * GT911_POINT_INFO_NUM) != RT_EOK)
{
LOG_D("read point failed\n");
read_num = 0;
goto exit_;
}
- if(pre_touch > touch_num) /* point up */
+ if (pre_touch > touch_num) /* point up */
{
- for (read_index = 0; read_index < pre_touch; read_index++)
+ for (i = 0; i < GT911_MAX_TOUCH; i++)
{
rt_uint8_t j;
@@ -266,42 +265,35 @@ static rt_size_t gt911_read_point(struct rt_touch_device *touch, void *buf, rt_s
{
read_id = read_buf[j * 8] & 0x0F;
- if (pre_id[read_index] == read_id) /* this id is not free */
+ if (pre_id[i] == read_id) /* this id is not free */
break;
- if (j >= touch_num - 1)
- {
- rt_uint8_t up_id;
- up_id = pre_id[read_index];
- gt911_touch_up(buf, up_id);
- }
+ }
+ if ((j == touch_num) && (pre_id[i] != -1)) /* free this node */
+ {
+ gt911_touch_up(buf, pre_id[i]);
+ pre_id[i] = -1;
}
}
}
- if(touch_num) /* point down */
+ if (touch_num > 0) /* point down */
{
rt_uint8_t off_set;
- for(read_index = 0; read_index < touch_num; read_index++)
+ for (i = 0; i < touch_num; i++)
{
- off_set = read_index * 8;
+ off_set = i * 8;
read_id = read_buf[off_set] & 0x0f;
- pre_id[read_index] = read_id;
- input_x = read_buf[off_set + 1] | (read_buf[off_set + 2] << 8); /* x */
- input_y = read_buf[off_set + 3] | (read_buf[off_set + 4] << 8); /* y */
- input_w = read_buf[off_set + 5] | (read_buf[off_set + 6] << 8); /* size */
+ pre_id[i] = read_id;
+
+ input_x = read_buf[off_set + 1] | (read_buf[off_set + 2] << 8); /* x */
+ input_y = read_buf[off_set + 3] | (read_buf[off_set + 4] << 8); /* y */
+ input_w = read_buf[off_set + 5] | (read_buf[off_set + 6] << 8); /* size */
gt911_touch_down(buf, read_id, input_x, input_y, input_w);
}
}
- else if (pre_touch)
- {
- for(read_index = 0; read_index < pre_touch; read_index++)
- {
- gt911_touch_up(buf, pre_id[read_index]);
- }
- }
pre_touch = touch_num;
@@ -331,7 +323,7 @@ static rt_err_t gt911_control(struct rt_touch_device *touch, int cmd, void *arg)
rt_uint8_t *config;
config = (rt_uint8_t *)rt_calloc(1, sizeof(GT911_CFG_TBL) + GT911_REGITER_LEN);
- if(config == RT_NULL)
+ if (config == RT_NULL)
{
LOG_D("malloc config memory failed\n");
return -RT_ERROR;
@@ -340,65 +332,65 @@ static rt_err_t gt911_control(struct rt_touch_device *touch, int cmd, void *arg)
config[0] = (rt_uint8_t)((GT911_CONFIG_REG >> 8) & 0xFF);
config[1] = (rt_uint8_t)(GT911_CONFIG_REG & 0xFF);
- memcpy(&config[2], GT911_CFG_TBL, sizeof(GT911_CFG_TBL));
+ rt_memcpy(&config[2], GT911_CFG_TBL, sizeof(GT911_CFG_TBL));
- switch(cmd)
+ switch (cmd)
{
- case RT_TOUCH_CTRL_SET_X_RANGE:
+ case RT_TOUCH_CTRL_SET_X_RANGE:
+ {
+ rt_uint16_t x_range;
+
+ x_range = *(rt_uint16_t *)arg;
+ config[4] = (rt_uint8_t)(x_range >> 8);
+ config[3] = (rt_uint8_t)(x_range & 0xff);
+
+ GT911_CFG_TBL[2] = config[4];
+ GT911_CFG_TBL[1] = config[3];
+ break;
+ }
+ case RT_TOUCH_CTRL_SET_Y_RANGE:
+ {
+ rt_uint16_t y_range;
+
+ y_range = *(rt_uint16_t *)arg;
+ config[6] = (rt_uint8_t)(y_range >> 8);
+ config[5] = (rt_uint8_t)(y_range & 0xff);
+
+ GT911_CFG_TBL[4] = config[6];
+ GT911_CFG_TBL[3] = config[5];
+ break;
+ }
+ case RT_TOUCH_CTRL_SET_X_TO_Y:
+ {
+ config[8] ^= (1 << 3);
+ break;
+ }
+ case RT_TOUCH_CTRL_SET_MODE:
+ {
+ rt_uint16_t trig_type;
+ trig_type = *(rt_uint16_t *)arg;
+
+ switch (trig_type)
{
- rt_uint16_t x_range;
-
- x_range = *(rt_uint16_t *)arg;
- config[4] = (rt_uint8_t)(x_range >> 8);
- config[3] = (rt_uint8_t)(x_range & 0xff);
-
- GT911_CFG_TBL[2] = config[4];
- GT911_CFG_TBL[1] = config[3];
+ case RT_DEVICE_FLAG_INT_RX:
+ config[8] &= 0xFC;
break;
- }
- case RT_TOUCH_CTRL_SET_Y_RANGE:
- {
- rt_uint16_t y_range;
-
- y_range = *(rt_uint16_t *)arg;
- config[6] = (rt_uint8_t)(y_range >> 8);
- config[5] = (rt_uint8_t)(y_range & 0xff);
-
- GT911_CFG_TBL[4] = config[6];
- GT911_CFG_TBL[3] = config[5];
+ case RT_DEVICE_FLAG_RDONLY:
+ config[8] &= 0xFC;
+ config[8] |= 0x02;
break;
- }
- case RT_TOUCH_CTRL_SET_X_TO_Y:
- {
- config[8] ^= (1 << 3);
- break;
- }
- case RT_TOUCH_CTRL_SET_MODE:
- {
- rt_uint16_t trig_type;
- trig_type = *(rt_uint16_t *)arg;
-
- switch (trig_type)
- {
- case RT_DEVICE_FLAG_INT_RX:
- config[8] &= 0xFC;
- break;
- case RT_DEVICE_FLAG_RDONLY:
- config[8] &= 0xFC;
- config[8] |= 0x02;
- break;
- default:
- break;
- }
- break;
- }
default:
- {
break;
}
+ break;
+ }
+ default:
+ {
+ break;
+ }
}
- if(gt911_write_reg(>911_client, config, sizeof(GT911_CFG_TBL) + GT911_ADDR_LEN) != RT_EOK)
+ if (gt911_write_reg(>911_client, config, sizeof(GT911_CFG_TBL) + GT911_ADDR_LEN) != RT_EOK)
{
LOG_D("send config failed");
return -1;
@@ -408,7 +400,7 @@ static rt_err_t gt911_control(struct rt_touch_device *touch, int cmd, void *arg)
buf[1] = (rt_uint8_t)(GT911_CHECK_SUM & 0xFF);
buf[2] = 0;
- for(i = GT911_ADDR_LEN; i < sizeof(GT911_CFG_TBL) + GT911_ADDR_LEN; i++)
+ for (i = GT911_ADDR_LEN; i < sizeof(GT911_CFG_TBL) + GT911_ADDR_LEN; i++)
{
buf[GT911_ADDR_LEN] += config[i];
}
@@ -434,7 +426,7 @@ int rt_hw_gt911_init(const char *name, struct rt_touch_config *cfg)
rt_uint32_t bus_speed = 400000;
touch_device = (struct rt_touch_device *)rt_malloc(sizeof(struct rt_touch_device));
- if(touch_device == RT_NULL)
+ if (touch_device == RT_NULL)
{
LOG_E("touch device malloc fail");
return -RT_ERROR;
@@ -455,19 +447,19 @@ int rt_hw_gt911_init(const char *name, struct rt_touch_config *cfg)
gt911_client.bus = (struct rt_i2c_bus_device *)rt_device_find(cfg->dev_name);
- if(gt911_client.bus == RT_NULL)
+ if (gt911_client.bus == RT_NULL)
{
LOG_E("Can't find %s device", cfg->dev_name);
return -RT_ERROR;
}
- if(rt_device_open((rt_device_t)gt911_client.bus, RT_DEVICE_FLAG_RDWR) != RT_EOK)
+ if (rt_device_open((rt_device_t)gt911_client.bus, RT_DEVICE_FLAG_RDWR) != RT_EOK)
{
LOG_E("open %s device failed", cfg->dev_name);
return -RT_ERROR;
}
- if ( rt_device_control((rt_device_t)gt911_client.bus, RT_I2C_DEV_CTRL_CLK, &bus_speed) != RT_EOK )
+ if (rt_device_control((rt_device_t)gt911_client.bus, RT_I2C_DEV_CTRL_CLK, &bus_speed) != RT_EOK)
{
LOG_E("control %s device failed", cfg->dev_name);
return -RT_ERROR;
@@ -476,6 +468,12 @@ int rt_hw_gt911_init(const char *name, struct rt_touch_config *cfg)
gt911_client.client_addr = GT911_ADDRESS_HIGH;
gt911_soft_reset(>911_client);
+ rt_memset(&pre_x[0], 0xff, GT911_MAX_TOUCH * sizeof(rt_int16_t));
+ rt_memset(&pre_y[0], 0xff, GT911_MAX_TOUCH * sizeof(rt_int16_t));
+ rt_memset(&pre_w[0], 0xff, GT911_MAX_TOUCH * sizeof(rt_int16_t));
+ rt_memset(&s_tp_dowm[0], 0, GT911_MAX_TOUCH * sizeof(rt_int16_t));
+ rt_memset(&pre_id[0], 0xff, GT911_MAX_TOUCH * sizeof(rt_uint8_t));
+
/* register touch device */
touch_device->info.type = RT_TOUCH_TYPE_CAPACITANCE;
touch_device->info.vendor = RT_TOUCH_VENDOR_GT;
diff --git a/bsp/nuvoton/libraries/nu_packages/TPC/ili.c b/bsp/nuvoton/libraries/nu_packages/TPC/ili.c
index f8cb0237b4..08c743a5f7 100644
--- a/bsp/nuvoton/libraries/nu_packages/TPC/ili.c
+++ b/bsp/nuvoton/libraries/nu_packages/TPC/ili.c
@@ -325,9 +325,9 @@ static void ili_info_dump(ili_ts_data_t psIliTs)
rt_kprintf("ic_mode: %d\n", psIliTs->ic_mode);
}
-static rt_int16_t pre_x[ILI_MAX_TOUCH] = {-1, -1, -1, -1, -1};
-static rt_int16_t pre_y[ILI_MAX_TOUCH] = {-1, -1, -1, -1, -1};
-static rt_int16_t pre_w[ILI_MAX_TOUCH] = {-1, -1, -1, -1, -1};
+static rt_int16_t pre_x[ILI_MAX_TOUCH];
+static rt_int16_t pre_y[ILI_MAX_TOUCH];
+static rt_int16_t pre_w[ILI_MAX_TOUCH];
static rt_uint8_t s_tp_dowm[ILI_MAX_TOUCH];
static void ili_touch_up(void *buf, int8_t id)
@@ -381,6 +381,8 @@ static void ili_touch_down(void *buf, int8_t id, int16_t x, int16_t y, int16_t w
pre_w[id] = w;
}
+static int8_t pre_id[ILI_MAX_TOUCH];
+static rt_uint8_t pre_touch = 0;
static rt_size_t ili_read_point(struct rt_touch_device *touch, void *buf, rt_size_t read_num)
{
#define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
@@ -395,8 +397,10 @@ static rt_size_t ili_read_point(struct rt_touch_device *touch, void *buf, rt_siz
rt_uint16_t x, y;
rt_int32_t tip, point_id;
- static rt_uint8_t pre_touch = 0;
- static int8_t pre_id[ILI_MAX_TOUCH] = {0};
+ RT_ASSERT(touch);
+ RT_ASSERT(buf);
+ RT_ASSERT(read_num != 0);
+ RT_ASSERT(read_num <= ILI_MAX_TOUCH);
error = ili_i2c_write_and_read(ts->client, NULL, 0, 0, tmpbuf, 64);
if (error)
@@ -425,7 +429,7 @@ static rt_size_t ili_read_point(struct rt_touch_device *touch, void *buf, rt_siz
if (pre_touch > touch_num) /* point up */
{
- for (i = 0; i < pre_touch; i++)
+ for (i = 0; i < ILI_MAX_TOUCH; i++)
{
rt_uint8_t j;
for (j = 0; j < touch_num; j++) /* this time touch num */
@@ -435,13 +439,15 @@ static rt_size_t ili_read_point(struct rt_touch_device *touch, void *buf, rt_siz
if (pre_id[i] == point_id) /* this id is not free */
break;
- if (j >= touch_num - 1)
- {
- ili_touch_up(buf, pre_id[i]);
- }
+ }
+ if ((j == touch_num) && (pre_id[i] != -1))
+ {
+ ili_touch_up(buf, pre_id[i]);
+ pre_id[i] = -1;
}
}
}
+
if (touch_num > 0)
{
uint32_t range_x = touch->info.range_x;
@@ -483,6 +489,8 @@ static rt_size_t ili_read_point(struct rt_touch_device *touch, void *buf, rt_siz
exit_ili_read_point:
+ pre_touch = 0;
+
return 0;
}
@@ -607,6 +615,12 @@ int rt_hw_ili_tpc_init(const char *name, struct rt_touch_config *cfg)
goto exit_rt_hw_ili_tpc_init;
}
+ rt_memset(&pre_x[0], 0xff, ILI_MAX_TOUCH * sizeof(int16_t));
+ rt_memset(&pre_y[0], 0xff, ILI_MAX_TOUCH * sizeof(int16_t));
+ rt_memset(&pre_w[0], 0xff, ILI_MAX_TOUCH * sizeof(int16_t));
+ rt_memset(&s_tp_dowm[0], 0, ILI_MAX_TOUCH * sizeof(int16_t));
+ rt_memset(&pre_id[0], 0xff, ILI_MAX_TOUCH * sizeof(int8_t));
+
/* register touch device */
rt_memcpy(&touch_device->config, cfg, sizeof(struct rt_touch_config));
touch_device->ops = &ili_touch_ops;
diff --git a/bsp/nuvoton/libraries/nu_packages/TPC/tpc_worker.c b/bsp/nuvoton/libraries/nu_packages/TPC/tpc_worker.c
index f053df1dce..9c9a5891af 100644
--- a/bsp/nuvoton/libraries/nu_packages/TPC/tpc_worker.c
+++ b/bsp/nuvoton/libraries/nu_packages/TPC/tpc_worker.c
@@ -34,7 +34,7 @@ static void tpc_entry(void *parameter)
struct rt_touch_info info;
rt_device_t dev = RT_NULL;
- const char *name = "ili_tpc";
+ const char *name = (const char *)parameter;
rt_uint32_t x_range = BSP_LCD_WIDTH;
rt_uint32_t y_range = BSP_LCD_HEIGHT;
@@ -87,9 +87,19 @@ static void tpc_entry(void *parameter)
|| read_data[i].event == RT_TOUCH_EVENT_UP
|| read_data[i].event == RT_TOUCH_EVENT_MOVE)
{
- //rt_kprintf("[%d] %d %d\n", read_data[i].event, read_data[i].x_coordinate, read_data[i].y_coordinate);
+ rt_uint16_t u16X, u16Y;
- nu_touch_inputevent_cb(read_data[i].x_coordinate, read_data[i].y_coordinate, read_data[i].event);
+ u16X = read_data[i].x_coordinate;
+ u16Y = read_data[i].y_coordinate;
+
+ #if defined(NU_PKG_TPC_REVERSE_XY)
+ u16X = info.range_x - u16X;
+ u16Y = info.range_y - u16Y;
+ #endif
+
+ //rt_kprintf("[%d] %d %d\n", read_data[i].event, u16X, u16Y);
+
+ nu_touch_inputevent_cb(u16X, u16Y, read_data[i].event);
}
}
}
@@ -99,12 +109,12 @@ static void tpc_entry(void *parameter)
/* Test function */
-int tpc_sample(void)
+int tpc_sample(const char *tpc_name)
{
rt_thread_t tpc_thread;
tpc_thread = rt_thread_create("tpc",
tpc_entry,
- RT_NULL,
+ (void *)tpc_name,
THREAD_STACK_SIZE,
THREAD_PRIORITY,
THREAD_TIMESLICE);
@@ -114,4 +124,3 @@ int tpc_sample(void)
return 0;
}
-INIT_APP_EXPORT(tpc_sample);
diff --git a/bsp/nuvoton/nk-980iot/.config b/bsp/nuvoton/nk-980iot/.config
index f1de939527..6ea6774e9d 100644
--- a/bsp/nuvoton/nk-980iot/.config
+++ b/bsp/nuvoton/nk-980iot/.config
@@ -29,7 +29,7 @@ CONFIG_IDLE_THREAD_STACK_SIZE=2048
# 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_KPRINTF_USING_LONGLONG 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
@@ -80,7 +80,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=0x40101
+CONFIG_RT_VER_NUM=0x40100
CONFIG_ARCH_ARM=y
# CONFIG_RT_USING_CPU_FFS is not set
CONFIG_ARCH_ARM_ARM9=y
@@ -617,7 +617,6 @@ CONFIG_PKG_WAVPLAYER_VER="latest"
# CONFIG_PKG_USING_FDT is not set
# CONFIG_PKG_USING_CBOX is not set
# CONFIG_PKG_USING_SNOWFLAKE is not set
-# CONFIG_PKG_USING_HASH_MATCH is not set
#
# system packages
@@ -989,3 +988,5 @@ CONFIG_NU_PKG_USING_NAU8822=y
# CONFIG_NU_PKG_USING_TPC is not set
# CONFIG_NU_PKG_USING_ADC_TOUCH is not set
CONFIG_NU_PKG_USING_SPINAND=y
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
+CONFIG_BOARD_USE_UTEST=y
diff --git a/bsp/nuvoton/nk-980iot/applications/lvgl/lv_conf.h b/bsp/nuvoton/nk-980iot/applications/lvgl/lv_conf.h
index 2d960ffe30..a6769583c9 100644
--- a/bsp/nuvoton/nk-980iot/applications/lvgl/lv_conf.h
+++ b/bsp/nuvoton/nk-980iot/applications/lvgl/lv_conf.h
@@ -5,22 +5,33 @@
*
* Change Logs:
* Date Author Notes
- * 2021-10-18 Meco Man First version
+ * 2022-2-17 Wayne First version
*/
#ifndef LV_CONF_H
#define LV_CONF_H
-#define LV_USE_PERF_MONITOR 1
-#define LV_COLOR_DEPTH 16
+#include "rtconfig.h"
-#define LV_HOR_RES_MAX (320)
-#define LV_VER_RES_MAX (240)
+#define LV_COLOR_DEPTH BSP_LCD_BPP
+#define LV_HOR_RES_MAX BSP_LCD_WIDTH
+#define LV_VER_RES_MAX BSP_LCD_HEIGHT
#define LV_FONT_MONTSERRAT_12 1
#define LV_FONT_MONTSERRAT_16 1
-#define LV_USE_DEMO_RTT_MUSIC 1
-#define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
-
+#define LV_USE_PERF_MONITOR 1
//#define CONFIG_LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
+
+//#define LV_USE_DEMO_RTT_MUSIC 1
+#if LV_USE_DEMO_RTT_MUSIC
+ #define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
+
+ #define LV_USE_DEMO_MUSIC 1
+ #define LV_DEMO_MUSIC_AUTO_PLAY 1
+#endif
+
+/* Please comment LV_USE_DEMO_RTT_MUSIC declaration before un-comment below */
+#define LV_USE_DEMO_WIDGETS 1
+//#define LV_USE_DEMO_BENCHMARK 1
+
#endif
diff --git a/bsp/nuvoton/nk-980iot/applications/lvgl/lv_demo.c b/bsp/nuvoton/nk-980iot/applications/lvgl/lv_demo.c
index 7ac1eab9e5..dc0010780f 100644
--- a/bsp/nuvoton/nk-980iot/applications/lvgl/lv_demo.c
+++ b/bsp/nuvoton/nk-980iot/applications/lvgl/lv_demo.c
@@ -5,45 +5,28 @@
*
* Change Logs:
* Date Author Notes
- * 2021-10-17 Meco Man First version
+ * 2022-6-1 Wayne First version
*/
-#include
+
#include
-#define DBG_TAG "LVGL"
-#define DBG_LVL DBG_INFO
-#include
-#ifndef LV_THREAD_STACK_SIZE
- #define LV_THREAD_STACK_SIZE 4096
-#endif
-
-#ifndef LV_THREAD_PRIO
- #define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
-#endif
-
-static void lvgl_thread(void *parameter)
+void lv_user_gui_init(void)
{
+ /* display demo; you may replace with your LVGL application at here and disable related definitions. */
+
+#if LV_USE_DEMO_BENCHMARK
+ extern void lv_demo_benchmark(void);
+ lv_demo_benchmark();
+#endif
+
+#if LV_USE_DEMO_WIDGETS
+ extern void lv_demo_widgets(void);
+ lv_demo_widgets();
+#endif
+
+#if LV_USE_DEMO_MUSIC || LV_USE_DEMO_RTT_MUSIC
extern void lv_demo_music(void);
lv_demo_music();
+#endif
- while (1)
- {
- lv_task_handler();
- rt_thread_mdelay(1);
- }
}
-
-static int lvgl_demo_init(void)
-{
- rt_thread_t tid;
-
- tid = rt_thread_create("LVGL", lvgl_thread, RT_NULL, LV_THREAD_STACK_SIZE, LV_THREAD_PRIO, 10);
- if (tid == RT_NULL)
- {
- LOG_E("Fail to create 'LVGL' thread");
- }
- rt_thread_startup(tid);
-
- return 0;
-}
-INIT_APP_EXPORT(lvgl_demo_init);
diff --git a/bsp/nuvoton/nk-980iot/applications/lvgl/lv_port_disp.c b/bsp/nuvoton/nk-980iot/applications/lvgl/lv_port_disp.c
index cee304eb09..72133debb8 100644
--- a/bsp/nuvoton/nk-980iot/applications/lvgl/lv_port_disp.c
+++ b/bsp/nuvoton/nk-980iot/applications/lvgl/lv_port_disp.c
@@ -67,10 +67,10 @@ void lv_port_disp_init(void)
info.bits_per_pixel == 24 || info.bits_per_pixel == 32);
buf1 = (void *)info.framebuffer;
- rt_kprintf("LVGL: Use one buffers - buf1@%08x\n", buf1);
+ rt_kprintf("LVGL: Use one buffers - buf1@%08x, size: %d bytes\n", buf1, info.smem_len);
/*Initialize `disp_buf` with the buffer(s).*/
- lv_disp_draw_buf_init(&disp_buf, buf1, RT_NULL, info.width * info.height);
+ lv_disp_draw_buf_init(&disp_buf, buf1, RT_NULL, info.smem_len / (info.bits_per_pixel / 8));
result = rt_device_open(lcd_device, 0);
if (result != RT_EOK)
diff --git a/bsp/nuvoton/nk-980iot/applications/lvgl/lv_port_indev.c b/bsp/nuvoton/nk-980iot/applications/lvgl/lv_port_indev.c
index 4451ad4f84..f0b21f6241 100644
--- a/bsp/nuvoton/nk-980iot/applications/lvgl/lv_port_indev.c
+++ b/bsp/nuvoton/nk-980iot/applications/lvgl/lv_port_indev.c
@@ -31,15 +31,12 @@ void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
case RT_TOUCH_EVENT_UP:
last_state = LV_INDEV_STATE_RELEASED;
break;
+ case RT_TOUCH_EVENT_MOVE:
case RT_TOUCH_EVENT_DOWN:
last_x = x;
last_y = y;
last_state = LV_INDEV_STATE_PRESSED;
break;
- case RT_TOUCH_EVENT_MOVE:
- last_x = x;
- last_y = y;
- break;
}
}
diff --git a/bsp/nuvoton/nk-980iot/applications/mnt.c b/bsp/nuvoton/nk-980iot/applications/mnt.c
index 2d45dc84e7..4335036714 100644
--- a/bsp/nuvoton/nk-980iot/applications/mnt.c
+++ b/bsp/nuvoton/nk-980iot/applications/mnt.c
@@ -55,8 +55,12 @@ const void *data;
const struct dfs_mount_tbl mount_table[] =
{
+#if defined(PKG_USING_RAMDISK)
{ RAMDISK_UDC, "/mnt/ram_usbd", "elm", 0, RT_NULL },
-#if defined(RT_USING_DFS_UFFS)
+#endif
+#if defined(PKG_USING_DFS_YAFFS)
+ { "nand1", "/mnt/filesystem", "yaffs", 0, RT_NULL },
+#elif defined(RT_USING_DFS_UFFS)
{ "nand1", "/mnt/filesystem", "uffs", 0, RT_NULL },
#endif
{0},
@@ -211,6 +215,28 @@ exit_filesystem_init:
INIT_ENV_EXPORT(filesystem_init);
#endif
+#if defined(PKG_USING_DFS_YAFFS) && defined(RT_USING_DFS_MNTTABLE)
+#include "yaffs_guts.h"
+int yaffs_dev_init(void)
+{
+ int i;
+ for (i=0; i
+
#include
-#define DBG_TAG "LVGL"
-#define DBG_LVL DBG_INFO
-#include
-#ifndef LV_THREAD_STACK_SIZE
- #define LV_THREAD_STACK_SIZE 4096
-#endif
-
-#ifndef LV_THREAD_PRIO
- #define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
-#endif
-
-static void lvgl_thread(void *parameter)
+void lv_user_gui_init(void)
{
+ /* display demo; you may replace with your LVGL application at here and disable related definitions. */
+
+#if LV_USE_DEMO_BENCHMARK
+ extern void lv_demo_benchmark(void);
+ lv_demo_benchmark();
+#endif
+
+#if LV_USE_DEMO_WIDGETS
+ extern void lv_demo_widgets(void);
+ lv_demo_widgets();
+#endif
+
+#if LV_USE_DEMO_MUSIC || LV_USE_DEMO_RTT_MUSIC
extern void lv_demo_music(void);
lv_demo_music();
+#endif
- while (1)
- {
- lv_task_handler();
- rt_thread_mdelay(1);
- }
}
-
-static int lvgl_demo_init(void)
-{
- rt_thread_t tid;
-
- tid = rt_thread_create("LVGL", lvgl_thread, RT_NULL, LV_THREAD_STACK_SIZE, LV_THREAD_PRIO, 10);
- if (tid == RT_NULL)
- {
- LOG_E("Fail to create 'LVGL' thread");
- }
- rt_thread_startup(tid);
-
- return 0;
-}
-INIT_APP_EXPORT(lvgl_demo_init);
diff --git a/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_disp.c b/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_disp.c
index 97a646012a..c36a6635ee 100644
--- a/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_disp.c
+++ b/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_disp.c
@@ -11,6 +11,10 @@
#include "nu_2d.h"
#include "mmu.h"
+#if (LV_USE_GPU_N9H30_GE2D && LV_VERSION_CHECK(8, 2, 0))
+ #include "lv_gpu_n9h30_ge2d.h"
+#endif
+
#define LOG_TAG "lvgl.disp"
#define DBG_ENABLE
#define DBG_SECTION_NAME LOG_TAG
@@ -48,51 +52,10 @@ static void nu_antitearing(lv_disp_draw_buf_t *draw_buf, lv_color_t *color_p)
}
}
-static void nu_flush_direct(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
-{
- void *pvDstReDraw;
-
-#if (LV_USE_GPU_N9H30_GE2D==0)
- mmu_clean_dcache((uint32_t)color_p, disp_drv->draw_buf->size * sizeof(lv_color_t));
-#endif
-
- /* Use PANDISPLAY */
- rt_device_control(lcd_device, RTGRAPHIC_CTRL_PAN_DISPLAY, color_p);
-
- /* Need to do on-/off- screen buffer synchronization. Here, we do a source-copying using GE2D engine. */
- if (disp_drv->draw_buf->buf1 == color_p)
- pvDstReDraw = disp_drv->draw_buf->buf2;
- else
- pvDstReDraw = disp_drv->draw_buf->buf1;
-
- // Enter GE2D ->
- ge2dInit(sizeof(lv_color_t) * 8, info.width, info.height, pvDstReDraw);
- ge2dBitblt_SetAlphaMode(-1, 0, 0);
- ge2dBitblt_SetDrawMode(-1, 0, 0);
- ge2dSpriteBlt_Screen(0, 0, info.width, info.height, (void *)color_p);
- // -> Leave GE2D
-
-#if (LV_USE_GPU_N9H30_GE2D==0)
- mmu_invalidate_dcache((uint32_t)pvDstReDraw, disp_drv->draw_buf->size * sizeof(lv_color_t));
-#endif
-
- 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);
-}
-
static void nu_flush_full_refresh(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
{
-#if (LV_USE_GPU_N9H30_GE2D==0)
- mmu_clean_dcache((uint32_t)color_p, disp_drv->draw_buf->size * sizeof(lv_color_t));
-#endif
+ if (IS_CACHEABLE_VRAM(color_p))
+ mmu_clean_dcache((uint32_t)color_p, disp_drv->draw_buf->size * sizeof(lv_color_t));
/* Use PANDISPLAY without H/W copying */
rt_device_control(lcd_device, RTGRAPHIC_CTRL_PAN_DISPLAY, color_p);
@@ -111,10 +74,29 @@ static void nu_flush_full_refresh(lv_disp_drv_t *disp_drv, const lv_area_t *area
static void nu_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
{
+#if (LV_USE_GPU_N9H30_GE2D==1)
+ lv_draw_sw_blend_dsc_t blend_flush = {0};
+ lv_draw_ctx_t draw_flush = {0};
+ lv_area_t flush_area = {0, 0, info.width - 1, info.height - 1 };
+
+ blend_flush.blend_area = area;
+ blend_flush.src_buf = color_p;
+ blend_flush.mask_buf = NULL;
+ blend_flush.opa = LV_OPA_MAX;
+ blend_flush.blend_mode = LV_BLEND_MODE_NORMAL;
+
+ draw_flush.buf = info.framebuffer;
+ draw_flush.clip_area = &flush_area;
+ draw_flush.buf_area = &flush_area;
+
+ lv_draw_n9h30_ge2d_blend(&draw_flush, (const lv_draw_sw_blend_dsc_t *)&blend_flush);
+
+#else
int32_t flush_area_w = lv_area_get_width(area);
int32_t flush_area_h = lv_area_get_height(area);
- //rt_kprintf("[%s %08x] %dx%d %d %d %d %d\n", __func__, color_p, flush_area_w, flush_area_h, area->x1, area->y1, area->x2, area->y2 );
+ //if ( flush_area_w&0x3 != 0 )
+ // rt_kprintf("[%s %08x] %dx%d %d %d\n", __func__, color_p, flush_area_w, flush_area_h, area->x1, area->y1 );
/* Update dirty region. */
// Enter GE2D ->
@@ -124,6 +106,7 @@ 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
+#endif
if (!u32FirstFlush)
{
@@ -142,7 +125,6 @@ static void nu_fill_cb(struct _lv_disp_drv_t *disp_drv, lv_color_t *dest_buf, lv
int32_t fill_area_w = lv_area_get_width(fill_area);
int32_t fill_area_h = lv_area_get_height(fill_area);
- //rt_kprintf("[%s %08x] %dx%d %d %d %d %d\n", __func__, dest_buf, fill_area_w, fill_area_h, fill_area->x1, fill_area->y1, fill_area->x2, fill_area->y2 );
if (lv_area_get_size(fill_area) < 3600)
{
@@ -157,31 +139,22 @@ static void nu_fill_cb(struct _lv_disp_drv_t *disp_drv, lv_color_t *dest_buf, lv
}
else
{
-#if (LV_USE_GPU_N9H30_GE2D==0)
- mmu_clean_invalidated_dcache((uint32_t)dest_buf, disp_drv->draw_buf->size * sizeof(lv_color_t));
-#endif
+ //rt_kprintf("[blend_fill %d %08x] %dx%d %d %d\n", lv_area_get_size(fill_area), dest_buf, fill_area_w, fill_area_h, fill_area->x1, fill_area->y1 );
+
+ if (IS_CACHEABLE_VRAM(dest_buf))
+ mmu_clean_invalidated_dcache((uint32_t)dest_buf, sizeof(lv_color_t) * (dest_width * fill_area_h + fill_area_w));
/*Hardware filling*/
- if (disp_drv->direct_mode || disp_drv->full_refresh)
- {
- // Enter GE2D ->
- ge2dInit(sizeof(lv_color_t) * 8, info.width, info.height, (void *)dest_buf);
- }
- else
- {
- // Enter GE2D ->
- ge2dInit(sizeof(lv_color_t) * 8, fill_area_w, fill_area_h, (void *)dest_buf);
- }
+ // Enter GE2D ->
+ ge2dInit(sizeof(lv_color_t) * 8, fill_area_w, fill_area_h, (void *)dest_buf);
ge2dClip_SetClip(fill_area->x1, fill_area->y1, fill_area->x2, fill_area->y2);
+
if (sizeof(lv_color_t) == 4)
- {
ge2dFill_Solid(fill_area->x1, fill_area->y1, fill_area_w, fill_area_h, color.full);
- }
else if (sizeof(lv_color_t) == 2)
- {
ge2dFill_Solid_RGB565(fill_area->x1, fill_area->y1, fill_area_w, fill_area_h, color.full);
- }
+
ge2dClip_SetClip(-1, 0, 0, 0);
// -> Leave GE2D
}
@@ -229,26 +202,22 @@ void lv_port_disp_init(void)
disp_drv.ver_res = info.height;
u32FBSize = info.height * info.width * (info.bits_per_pixel / 8);
-#if (LV_USE_GPU_N9H30_GE2D==0)
+#if (LV_USE_ANTI_TEARING==1)
disp_drv.full_refresh = 1;
- //disp_drv.direct_mode = 1;
#endif
- if (disp_drv.full_refresh || disp_drv.direct_mode)
+ if (disp_drv.full_refresh)
{
#if (LV_USE_GPU_N9H30_GE2D==1)
buf1 = (void *)info.framebuffer; // Use Non-cacheable VRAM
#else
- buf1 = (void *)((uint32_t)info.framebuffer & ~0x80000000); // Use Cacheable VRAM
+ buf1 = (void *)((uint32_t)info.framebuffer & ~BIT31); // Use Cacheable VRAM
#endif
buf2 = (void *)((uint32_t)buf1 + u32FBSize);
buf3_next = (void *)((uint32_t)buf2 + u32FBSize);
- rt_kprintf("LVGL: Use triple screen-sized buffers(%s) - buf1@%08x, buf2@%08x, buf3_next@%08x\n", (disp_drv.full_refresh == 1) ? "full_refresh" : "direct_mode", buf1, buf2, buf3_next);
+ rt_kprintf("LVGL: Use triple screen-sized buffers(full_refresh) - buf1@%08x, buf2@%08x, buf3_next@%08x\n", buf1, buf2, buf3_next);
- if (disp_drv.direct_mode)
- disp_drv.flush_cb = nu_flush_direct;
- else
- disp_drv.flush_cb = nu_flush_full_refresh;
+ disp_drv.flush_cb = nu_flush_full_refresh;
}
else
{
@@ -278,6 +247,12 @@ void lv_port_disp_init(void)
disp_drv.gpu_fill_cb = nu_fill_cb;
#endif
+#if (LV_USE_GPU_N9H30_GE2D && LV_VERSION_CHECK(8, 2, 0))
+ disp_drv.draw_ctx_init = lv_draw_n9h30_ge2d_ctx_init;
+ disp_drv.draw_ctx_deinit = lv_draw_n9h30_ge2d_ctx_init;
+ disp_drv.draw_ctx_size = sizeof(lv_draw_n9h30_ge2d_ctx_t);
+#endif
+
/*Called after every refresh cycle to tell the rendering and flushing time + the number of flushed pixels*/
//disp_drv.monitor_cb = nu_perf_monitor;
diff --git a/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_indev.c b/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_indev.c
index 4451ad4f84..f0b21f6241 100644
--- a/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_indev.c
+++ b/bsp/nuvoton/nk-n9h30/applications/lvgl/lv_port_indev.c
@@ -31,15 +31,12 @@ void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
case RT_TOUCH_EVENT_UP:
last_state = LV_INDEV_STATE_RELEASED;
break;
+ case RT_TOUCH_EVENT_MOVE:
case RT_TOUCH_EVENT_DOWN:
last_x = x;
last_y = y;
last_state = LV_INDEV_STATE_PRESSED;
break;
- case RT_TOUCH_EVENT_MOVE:
- last_x = x;
- last_y = y;
- break;
}
}
diff --git a/bsp/nuvoton/nk-n9h30/applications/mnt.c b/bsp/nuvoton/nk-n9h30/applications/mnt.c
index feb455316c..6499cae5e8 100644
--- a/bsp/nuvoton/nk-n9h30/applications/mnt.c
+++ b/bsp/nuvoton/nk-n9h30/applications/mnt.c
@@ -58,6 +58,14 @@ const struct dfs_mount_tbl mount_table[] =
#if defined(PKG_USING_RAMDISK)
{ RAMDISK_UDC, "/mnt/ram_usbd", "elm", 0, RT_NULL },
#endif
+
+#if defined(BOARD_USING_STORAGE_SPIFLASH)
+ { PARTITION_NAME_FILESYSTEM, "/mnt/filesystem", "elm", 0, RT_NULL },
+#endif
+#if defined(PKG_USING_DFS_YAFFS)
+ { "nand1", "/mnt/fminand", "yaffs", 0, RT_NULL },
+#endif
+
{0},
};
#endif
@@ -152,15 +160,41 @@ exit_mkdir_p:
return ret;
}
+#if defined(PKG_USING_DFS_YAFFS) && defined(RT_USING_DFS_MNTTABLE)
+#include "yaffs_guts.h"
+void yaffs_dev_init(void)
+{
+ int i;
+ for (i = 0; i < sizeof(mount_table) / sizeof(struct dfs_mount_tbl); i++)
+ {
+ if (mount_table[i].filesystemtype && !rt_strcmp(mount_table[i].filesystemtype, "yaffs"))
+ {
+ struct rt_mtd_nand_device *psMtdNandDev = RT_MTD_NAND_DEVICE(rt_device_find(mount_table[i].device_name));
+ if (psMtdNandDev)
+ {
+ yaffs_start_up(psMtdNandDev, (const char *)mount_table[i].path);
+ }
+ }
+ }
+}
+#endif
+
/* Initialize the filesystem */
int filesystem_init(void)
{
rt_err_t result = RT_EOK;
+#if defined(RT_USING_FAL)
+ extern int fal_init_check(void);
+ if (!fal_init_check())
+ fal_init();
+#endif
+
// ramdisk as root
if (!rt_device_find(RAMDISK_NAME))
{
LOG_E("cannot find %s device", RAMDISK_NAME);
+ result = -RT_ERROR;
goto exit_filesystem_init;
}
else
@@ -179,6 +213,8 @@ int filesystem_init(void)
mkdir_p("/cache", 0x777);
mkdir_p("/download", 0x777);
mkdir_p("/mnt/ram_usbd", 0x777);
+ mkdir_p("/mnt/filesystem", 0x777);
+ mkdir_p("/mnt/fminand", 0x777);
#if defined(RT_USBH_MSTORAGE) && defined(UDISK_MOUNTPOINT)
mkdir_p(UDISK_MOUNTPOINT, 0x777);
#endif
@@ -202,44 +238,23 @@ int filesystem_init(void)
RT_ASSERT(result == RT_EOK);
}
+#if defined(BOARD_USING_STORAGE_SPIFLASH)
+ {
+ struct rt_device *psNorFlash = fal_blk_device_create(PARTITION_NAME_FILESYSTEM);
+ if (!psNorFlash)
+ {
+ rt_kprintf("Failed to create block device for %s.\n", PARTITION_NAME_FILESYSTEM);
+ }
+ }
+#endif
+
+#if defined(PKG_USING_DFS_YAFFS) && defined(RT_USING_DFS_MNTTABLE)
+ yaffs_dev_init();
+#endif
+
exit_filesystem_init:
return -result;
}
INIT_ENV_EXPORT(filesystem_init);
#endif
-
-#if defined(BOARD_USING_STORAGE_SPIFLASH)
-int mnt_init_spiflash0(void)
-{
-#if defined(RT_USING_FAL)
- extern int fal_init_check(void);
- if (!fal_init_check())
- fal_init();
-#endif
- struct rt_device *psNorFlash = fal_blk_device_create(PARTITION_NAME_FILESYSTEM);
- if (!psNorFlash)
- {
- rt_kprintf("Failed to create block device for %s.\n", PARTITION_NAME_FILESYSTEM);
- goto exit_mnt_init_spiflash0;
- }
- else if (mkdir(MOUNT_POINT_SPIFLASH0, 0x777) < 0)
- {
- rt_kprintf("Failed to make folder for %s.\n", MOUNT_POINT_SPIFLASH0);
- goto exit_mnt_init_spiflash0;
- }
- else if (dfs_mount(psNorFlash->parent.name, MOUNT_POINT_SPIFLASH0, "elm", 0, 0) != 0)
- {
- rt_kprintf("Failed to mount elm on %s.\n", MOUNT_POINT_SPIFLASH0);
- rt_kprintf("Try to execute 'mkfs -t elm %s' first, then reboot.\n", PARTITION_NAME_FILESYSTEM);
- goto exit_mnt_init_spiflash0;
- }
- rt_kprintf("mount %s with elmfat type: ok\n", PARTITION_NAME_FILESYSTEM);
-
-exit_mnt_init_spiflash0:
-
- return 0;
-}
-INIT_APP_EXPORT(mnt_init_spiflash0);
-#endif
-
diff --git a/bsp/nuvoton/nk-n9h30/board/Kconfig b/bsp/nuvoton/nk-n9h30/board/Kconfig
index a44c6a5454..7f9b675dbf 100644
--- a/bsp/nuvoton/nk-n9h30/board/Kconfig
+++ b/bsp/nuvoton/nk-n9h30/board/Kconfig
@@ -110,9 +110,20 @@ menu "Hardware Drivers Config"
bool "GT911 TSC"
select BSP_USING_I2C
select BSP_USING_I2C0
- select PKG_USING_GT911
+ select NU_PKG_USING_TPC
+ select NU_PKG_USING_TPC_GT911
help
Choose this option if you use GT911 external TSC touching function.
+
+ config BOARD_USING_FT5446
+ bool "FT5446 TSC"
+ select BSP_USING_I2C
+ select BSP_USING_I2C0
+ select NU_PKG_USING_TPC
+ select NU_PKG_USING_TPC_FT5446
+ help
+ Choose this option if you use FT5446 external TSC touching function.
+
endchoice
endif
diff --git a/bsp/nuvoton/nk-n9h30/board/board.h b/bsp/nuvoton/nk-n9h30/board/board.h
index ea06d85742..2f780a72f6 100644
--- a/bsp/nuvoton/nk-n9h30/board/board.h
+++ b/bsp/nuvoton/nk-n9h30/board/board.h
@@ -28,6 +28,12 @@
#define BOARD_SDRAM_SIZE 0x04000000
#define BOARD_HEAP_END ((void*)BOARD_SDRAM_SIZE)
+#if defined(RT_USING_MTD_NAND)
+ #include
+ #define MTD_FMINAND_PARTITION_NUM 3
+ extern struct rt_mtd_nand_device mtd_partitions[MTD_FMINAND_PARTITION_NUM];
+#endif
+
extern void rt_hw_board_init(void);
extern void nu_clock_init(void);
extern void nu_clock_deinit(void);
diff --git a/bsp/nuvoton/nk-n9h30/board/board_dev.c b/bsp/nuvoton/nk-n9h30/board/board_dev.c
index ba21df17dd..d48432affa 100644
--- a/bsp/nuvoton/nk-n9h30/board/board_dev.c
+++ b/bsp/nuvoton/nk-n9h30/board/board_dev.c
@@ -12,16 +12,15 @@
#include
#include
+#include "board.h"
#if defined(BOARD_USING_STORAGE_SPIFLASH)
-
-#include
-
#if defined(RT_USING_SFUD)
#include "spi_flash.h"
#include "spi_flash_sfud.h"
#endif
+#include "drv_qspi.h"
#define W25X_REG_READSTATUS (0x05)
#define W25X_REG_READSTATUS2 (0x35)
@@ -150,6 +149,33 @@ static int rt_hw_spiflash_init(void)
INIT_COMPONENT_EXPORT(rt_hw_spiflash_init);
#endif /* BOARD_USING_STORAGE_SPIFLASH */
+#if defined(RT_USING_MTD_NAND) && defined(BSP_USING_FMINAND)
+struct rt_mtd_nand_device mtd_partitions[MTD_FMINAND_PARTITION_NUM] =
+{
+ [0] =
+ {
+ /*nand0: U-boot, env, rtthread*/
+ .block_start = 0,
+ .block_end = 63,
+ .block_total = 64,
+ },
+ [1] =
+ {
+ /*nand1: for filesystem mounting*/
+ .block_start = 64,
+ .block_end = 1023,
+ .block_total = 960,
+ },
+ [2] =
+ {
+ /*nand2: Whole blocks size, overlay*/
+ .block_start = 0,
+ .block_end = 1023,
+ .block_total = 1024,
+ }
+};
+#endif
+
#if defined(BOARD_USING_NAU8822) && defined(NU_PKG_USING_NAU8822)
#include
S_NU_NAU8822_CONFIG sCodecConfig =
@@ -173,33 +199,63 @@ 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)
+#if defined(NU_PKG_USING_ADC_TOUCH)
+#include "adc_touch.h"
+S_CALIBRATION_MATRIX g_sCalMat = { 13321, -53, -1069280, 96, 8461, -1863312, 65536 };
+#endif
+
+#if defined(NU_PKG_USING_TPC_GT911) && defined(BOARD_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)
+#define TPC_RST_PIN NU_GET_PININDEX(NU_PG, 4)
+#define TPC_IRQ_PIN NU_GET_PININDEX(NU_PG, 5)
-extern int gt911_sample(const char *name, rt_uint16_t x, rt_uint16_t y);
+extern int tpc_sample(const char *name);
int rt_hw_gt911_port(void)
{
struct rt_touch_config cfg;
rt_uint8_t rst_pin;
- rst_pin = GT911_RST_PIN;
+ rst_pin = TPC_RST_PIN;
cfg.dev_name = "i2c0";
- cfg.irq_pin.pin = GT911_IRQ_PIN;
+ cfg.irq_pin.pin = TPC_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;
+ return tpc_sample("gt911");
}
INIT_ENV_EXPORT(rt_hw_gt911_port);
-#endif /* if defined(BOARD_USING_GT911) && defined(PKG_USING_GT911) */
+#endif /* if defined(NU_PKG_USING_TPC_GT911) && defined(BOARD_USING_GT911) */
+
+#if defined(NU_PKG_USING_TPC_FT5446) && defined(BOARD_USING_FT5446)
+#include "drv_gpio.h"
+#include "ft5446.h"
+
+#define TPC_RST_PIN NU_GET_PININDEX(NU_PG, 4)
+#define TPC_IRQ_PIN NU_GET_PININDEX(NU_PG, 5)
+
+extern int tpc_sample(const char *name);
+int rt_hw_gt911_port(void)
+{
+ struct rt_touch_config cfg;
+ rt_uint8_t rst_pin;
+
+ rst_pin = TPC_RST_PIN;
+ cfg.dev_name = "i2c0";
+ cfg.irq_pin.pin = TPC_IRQ_PIN;
+ cfg.irq_pin.mode = PIN_MODE_INPUT;//PIN_MODE_INPUT_PULLDOWN;
+ cfg.user_data = &rst_pin;
+
+ rt_hw_ft5446_init("ft5446", &cfg);
+
+ return tpc_sample("ft5446");
+}
+INIT_ENV_EXPORT(rt_hw_gt911_port);
+#endif /* if defined(NU_PKG_USING_TPC_FT5446) && defined(BOARD_USING_FT5446) */
+
#if defined(BOARD_USING_BUZZER)
diff --git a/bsp/nuvoton/nk-n9h30/board/nu_pin_init.c b/bsp/nuvoton/nk-n9h30/board/nu_pin_init.c
index 719df0d252..5ca259fea5 100644
--- a/bsp/nuvoton/nk-n9h30/board/nu_pin_init.c
+++ b/bsp/nuvoton/nk-n9h30/board/nu_pin_init.c
@@ -123,9 +123,19 @@ static void nu_pin_vpost_init(void)
static void nu_pin_fmi_init(void)
{
- /* NAND: PC[0, 14] */
- outpw(REG_SYS_GPC_MFPL, 0x55555555);
- outpw(REG_SYS_GPC_MFPH, 0x05555555);
+ /* select NAND function pins */
+ if (inpw(REG_SYS_PWRON) & 0x08000000)
+ {
+ /* NAND: PI[0, 14] */
+ outpw(REG_SYS_GPI_MFPL, 0x55555550);
+ outpw(REG_SYS_GPI_MFPH, 0x55555555);
+ }
+ else
+ {
+ /* NAND: PC[0, 14] */
+ outpw(REG_SYS_GPC_MFPL, 0x55555555);
+ outpw(REG_SYS_GPC_MFPH, 0x05555555);
+ }
}
static void nu_pin_usbh_init(void)
diff --git a/bsp/nuvoton/nk-rtu980/.config b/bsp/nuvoton/nk-rtu980/.config
index 3b8c666b97..36885aade1 100644
--- a/bsp/nuvoton/nk-rtu980/.config
+++ b/bsp/nuvoton/nk-rtu980/.config
@@ -692,6 +692,7 @@ CONFIG_PKG_RAMDISK_VER="latest"
# CONFIG_PKG_USING_TINYUSB is not set
# CONFIG_PKG_USING_CHERRYUSB is not set
# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+# CONFIG_PKG_USING_TFDB is not set
#
# peripheral libraries and drivers
@@ -967,3 +968,5 @@ CONFIG_NU_PKG_USING_DEMO=y
# CONFIG_NU_PKG_USING_TPC is not set
# CONFIG_NU_PKG_USING_ADC_TOUCH is not set
# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
+CONFIG_BOARD_USE_UTEST=y
diff --git a/bsp/nuvoton/numaker-iot-m487/.config b/bsp/nuvoton/numaker-iot-m487/.config
index f5fc42693e..d8b8ca38a1 100644
--- a/bsp/nuvoton/numaker-iot-m487/.config
+++ b/bsp/nuvoton/numaker-iot-m487/.config
@@ -114,7 +114,7 @@ CONFIG_DFS_USING_WORKDIR=y
CONFIG_DFS_FILESYSTEMS_MAX=8
CONFIG_DFS_FILESYSTEM_TYPES_MAX=4
CONFIG_DFS_FD_MAX=32
-# CONFIG_RT_USING_DFS_MNTTABLE is not set
+CONFIG_RT_USING_DFS_MNTTABLE=y
CONFIG_RT_USING_DFS_ELMFAT=y
#
@@ -184,7 +184,13 @@ CONFIG_PM_TICKLESS_THRESHOLD_TIME=2
CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_ALARM is not set
# CONFIG_RT_USING_SOFT_RTC is not set
-# CONFIG_RT_USING_SDIO is not set
+CONFIG_RT_USING_SDIO=y
+CONFIG_RT_SDIO_STACK_SIZE=2048
+CONFIG_RT_SDIO_THREAD_PRIORITY=15
+CONFIG_RT_MMCSD_STACK_SIZE=2048
+CONFIG_RT_MMCSD_THREAD_PREORITY=22
+CONFIG_RT_MMCSD_MAX_PARTITION=16
+# CONFIG_RT_SDIO_DEBUG is not set
CONFIG_RT_USING_SPI=y
# CONFIG_RT_USING_SPI_BITOPS is not set
CONFIG_RT_USING_QSPI=y
@@ -596,6 +602,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_FDT is not set
# CONFIG_PKG_USING_CBOX is not set
# CONFIG_PKG_USING_SNOWFLAKE is not set
+# CONFIG_PKG_USING_HASH_MATCH is not set
#
# system packages
@@ -669,6 +676,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_TINYUSB is not set
# CONFIG_PKG_USING_CHERRYUSB is not set
# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+# CONFIG_PKG_USING_TFDB is not set
#
# peripheral libraries and drivers
@@ -881,9 +889,6 @@ CONFIG_BSP_USING_UUART0_RX_DMA=y
CONFIG_BSP_USING_SDH=y
CONFIG_BSP_USING_SDH0=y
# CONFIG_BSP_USING_SDH1 is not set
-CONFIG_NU_SDH_USING_PDMA=y
-CONFIG_NU_SDH_HOTPLUG=y
-# CONFIG_NU_SDH_MOUNT_ON_ROOT is not set
# CONFIG_BSP_USING_CAN is not set
# CONFIG_BSP_USING_BPWM is not set
# CONFIG_BSP_USING_EPWM is not set
@@ -966,3 +971,5 @@ CONFIG_NU_PKG_USING_NAU88L25=y
# CONFIG_NU_PKG_USING_TPC is not set
# CONFIG_NU_PKG_USING_ADC_TOUCH is not set
# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
+CONFIG_BOARD_USE_UTEST=y
diff --git a/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_conf.h b/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_conf.h
index 28f69a5cc5..a6769583c9 100644
--- a/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_conf.h
+++ b/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_conf.h
@@ -11,17 +11,27 @@
#ifndef LV_CONF_H
#define LV_CONF_H
-#define LV_USE_PERF_MONITOR 1
-#define LV_COLOR_DEPTH 16
+#include "rtconfig.h"
-#define LV_HOR_RES_MAX (320)
-#define LV_VER_RES_MAX (240)
+#define LV_COLOR_DEPTH BSP_LCD_BPP
+#define LV_HOR_RES_MAX BSP_LCD_WIDTH
+#define LV_VER_RES_MAX BSP_LCD_HEIGHT
#define LV_FONT_MONTSERRAT_12 1
#define LV_FONT_MONTSERRAT_16 1
-//#define LV_USE_DEMO_BENCHMARK 1
-#define LV_USE_DEMO_WIDGETS 1
-#define LV_DEMO_WIDGETS_SLIDESHOW 1
-
+#define LV_USE_PERF_MONITOR 1
//#define CONFIG_LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
+
+//#define LV_USE_DEMO_RTT_MUSIC 1
+#if LV_USE_DEMO_RTT_MUSIC
+ #define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
+
+ #define LV_USE_DEMO_MUSIC 1
+ #define LV_DEMO_MUSIC_AUTO_PLAY 1
+#endif
+
+/* Please comment LV_USE_DEMO_RTT_MUSIC declaration before un-comment below */
+#define LV_USE_DEMO_WIDGETS 1
+//#define LV_USE_DEMO_BENCHMARK 1
+
#endif
diff --git a/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_demo.c b/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_demo.c
index 69832d1f04..dc0010780f 100644
--- a/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_demo.c
+++ b/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_demo.c
@@ -5,50 +5,28 @@
*
* Change Logs:
* Date Author Notes
- * 2021-10-17 Meco Man First version
+ * 2022-6-1 Wayne First version
*/
-#include
+
#include
-#define DBG_TAG "LVGL"
-#define DBG_LVL DBG_INFO
-#include
-#ifndef LV_THREAD_STACK_SIZE
- #define LV_THREAD_STACK_SIZE 4096
-#endif
-
-#ifndef LV_THREAD_PRIO
- #define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
-#endif
-
-static void lvgl_thread(void *parameter)
+void lv_user_gui_init(void)
{
+ /* display demo; you may replace with your LVGL application at here and disable related definitions. */
+
#if LV_USE_DEMO_BENCHMARK
extern void lv_demo_benchmark(void);
lv_demo_benchmark();
#endif
+
#if LV_USE_DEMO_WIDGETS
extern void lv_demo_widgets(void);
lv_demo_widgets();
#endif
- while (1)
- {
- lv_task_handler();
- rt_thread_mdelay(1);
- }
+
+#if LV_USE_DEMO_MUSIC || LV_USE_DEMO_RTT_MUSIC
+ extern void lv_demo_music(void);
+ lv_demo_music();
+#endif
+
}
-
-static int lvgl_demo_init(void)
-{
- rt_thread_t tid;
-
- tid = rt_thread_create("LVGL", lvgl_thread, RT_NULL, LV_THREAD_STACK_SIZE, LV_THREAD_PRIO, 10);
- if (tid == RT_NULL)
- {
- LOG_E("Fail to create 'LVGL' thread");
- }
- rt_thread_startup(tid);
-
- return 0;
-}
-INIT_APP_EXPORT(lvgl_demo_init);
diff --git a/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_port_indev.c b/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_port_indev.c
index 4451ad4f84..f0b21f6241 100644
--- a/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_port_indev.c
+++ b/bsp/nuvoton/numaker-iot-m487/applications/lvgl/lv_port_indev.c
@@ -31,15 +31,12 @@ void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
case RT_TOUCH_EVENT_UP:
last_state = LV_INDEV_STATE_RELEASED;
break;
+ case RT_TOUCH_EVENT_MOVE:
case RT_TOUCH_EVENT_DOWN:
last_x = x;
last_y = y;
last_state = LV_INDEV_STATE_PRESSED;
break;
- case RT_TOUCH_EVENT_MOVE:
- last_x = x;
- last_y = y;
- break;
}
}
diff --git a/bsp/nuvoton/numaker-iot-m487/applications/mnt.c b/bsp/nuvoton/numaker-iot-m487/applications/mnt.c
index 85ced8cdab..9189a23197 100644
--- a/bsp/nuvoton/numaker-iot-m487/applications/mnt.c
+++ b/bsp/nuvoton/numaker-iot-m487/applications/mnt.c
@@ -12,6 +12,13 @@
#include
+#define LOG_TAG "mnt"
+#define DBG_ENABLE
+#define DBG_SECTION_NAME "mnt"
+#define DBG_LEVEL DBG_ERROR
+#define DBG_COLOR
+#include
+
#include
#include
#include
@@ -27,6 +34,29 @@
#define MOUNT_POINT_SPIFLASH0 "/"
#endif
+#ifdef RT_USING_DFS_MNTTABLE
+
+/*
+const char *device_name;
+const char *path;
+const char *filesystemtype;
+unsigned long rwflag;
+const void *data;
+*/
+
+const struct dfs_mount_tbl mount_table[] =
+{
+ { "sd0", "/mnt/sd0", "elm", 0, RT_NULL },
+ { "sd0p0", "/mnt/sd0p0", "elm", 0, RT_NULL },
+ { "sd0p1", "/mnt/sd0p1", "elm", 0, RT_NULL },
+ { "sd1", "/mnt/sd1", "elm", 0, RT_NULL },
+ { "sd1p0", "/mnt/sd1p0", "elm", 0, RT_NULL },
+ { "sd1p1", "/mnt/sd1p1", "elm", 0, RT_NULL },
+ {0},
+};
+#endif
+
+
#if defined(BOARD_USING_STORAGE_SPIFLASH)
#if defined(RT_USB_DEVICE_MSTORAGE)
@@ -107,6 +137,7 @@ exit_mkdir_p:
return ret;
}
+
#endif
int mnt_init_spiflash0(void)
@@ -118,6 +149,12 @@ int mnt_init_spiflash0(void)
goto exit_mnt_init_spiflash0;
}
rt_kprintf("mount flash0 with elmfat type: ok\n");
+ mkdir_p("/mnt/sd0", 0x777);
+ mkdir_p("/mnt/sd0p0", 0x777);
+ mkdir_p("/mnt/sd0p1", 0x777);
+ mkdir_p("/mnt/sd1", 0x777);
+ mkdir_p("/mnt/sd1p0", 0x777);
+ mkdir_p("/mnt/sd1p1", 0x777);
#if defined(RT_USBH_MSTORAGE) && defined(UDISK_MOUNTPOINT)
if (mkdir_p(UDISK_MOUNTPOINT, 0) < 0)
@@ -133,3 +170,4 @@ exit_mnt_init_spiflash0:
#endif
INIT_ENV_EXPORT(mnt_init_spiflash0);
#endif
+
diff --git a/bsp/nuvoton/numaker-iot-m487/board/Kconfig b/bsp/nuvoton/numaker-iot-m487/board/Kconfig
index 39e4a94dbe..2f3bf4a475 100644
--- a/bsp/nuvoton/numaker-iot-m487/board/Kconfig
+++ b/bsp/nuvoton/numaker-iot-m487/board/Kconfig
@@ -119,8 +119,6 @@ menu "Hardware Drivers Config"
select NU_PKG_USING_ILI9341_SPI
select NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER
select NU_PKG_ILI9341_HORIZONTAL
- select PKG_USING_LVGL
- select PKG_USING_LVGL_DEMOS
default n
if BOARD_USING_LCD_ILI9341
diff --git a/bsp/nuvoton/numaker-iot-m487/board/NuClockConfig/nutool_modclkcfg.c b/bsp/nuvoton/numaker-iot-m487/board/NuClockConfig/nutool_modclkcfg.c
index 59af4901f9..e0df3180e5 100644
--- a/bsp/nuvoton/numaker-iot-m487/board/NuClockConfig/nutool_modclkcfg.c
+++ b/bsp/nuvoton/numaker-iot-m487/board/NuClockConfig/nutool_modclkcfg.c
@@ -561,7 +561,7 @@ void nutool_modclkcfg_deinit_sc2(void)
void nutool_modclkcfg_init_sdh0(void)
{
CLK_EnableModuleClock(SDH0_MODULE);
- CLK_SetModuleClock(SDH0_MODULE, CLK_CLKSEL0_SDH0SEL_HCLK, CLK_CLKDIV0_SDH0(1));
+ CLK_SetModuleClock(SDH0_MODULE, CLK_CLKSEL0_SDH0SEL_HCLK, CLK_CLKDIV0_SDH0(4));
return;
}
diff --git a/bsp/nuvoton/numaker-iot-m487/config_lvgl b/bsp/nuvoton/numaker-iot-m487/config_lvgl
index 1d96e5853f..c1aa4fd6bb 100644
--- a/bsp/nuvoton/numaker-iot-m487/config_lvgl
+++ b/bsp/nuvoton/numaker-iot-m487/config_lvgl
@@ -29,7 +29,7 @@ CONFIG_IDLE_THREAD_STACK_SIZE=1024
# 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_KPRINTF_USING_LONGLONG is not set
CONFIG_RT_DEBUG=y
CONFIG_RT_DEBUG_COLOR=y
# CONFIG_RT_DEBUG_INIT_CONFIG is not set
@@ -78,7 +78,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=0x40100
+CONFIG_RT_VER_NUM=0x40101
CONFIG_ARCH_ARM=y
CONFIG_RT_USING_CPU_FFS=y
CONFIG_ARCH_ARM_CORTEX_M=y
@@ -93,17 +93,8 @@ 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
-#
-# CONFIG_RT_USING_CPLUSPLUS is not set
-
-#
-# Command shell
-#
-CONFIG_RT_USING_FINSH=y
CONFIG_RT_USING_MSH=y
+CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_USING_MSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_THREAD_PRIORITY=20
@@ -117,10 +108,6 @@ CONFIG_FINSH_USING_DESCRIPTION=y
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
# CONFIG_FINSH_USING_AUTH 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
@@ -154,6 +141,8 @@ 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_FAL is not set
+# CONFIG_RT_USING_LWP is not set
#
# Device Drivers
@@ -193,6 +182,7 @@ CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_SOFT_RTC is not set
# CONFIG_RT_USING_SDIO is not set
CONFIG_RT_USING_SPI=y
+# CONFIG_RT_USING_SPI_BITOPS is not set
CONFIG_RT_USING_QSPI=y
# CONFIG_RT_USING_SPI_MSD is not set
CONFIG_RT_USING_SFUD=y
@@ -275,7 +265,7 @@ CONFIG_RT_USB_DEVICE_HID_MOUSE=y
# CONFIG_RT_USB_DEVICE_HID_MEDIA is not set
#
-# POSIX layer and C standard library
+# C/C++ and POSIX layer
#
CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
@@ -287,6 +277,7 @@ CONFIG_RT_USING_POSIX_DEVIO=y
# CONFIG_RT_USING_POSIX_STDIO is not set
CONFIG_RT_USING_POSIX_POLL=y
CONFIG_RT_USING_POSIX_SELECT=y
+# CONFIG_RT_USING_POSIX_SOCKET is not set
# CONFIG_RT_USING_POSIX_TERMIOS is not set
# CONFIG_RT_USING_POSIX_AIO is not set
# CONFIG_RT_USING_POSIX_MMAN is not set
@@ -306,36 +297,16 @@ CONFIG_RT_USING_POSIX_SELECT=y
#
# Socket is in the 'Network' category
#
+# CONFIG_RT_USING_CPLUSPLUS is not set
#
# Network
#
-
-#
-# Socket abstraction layer
-#
# CONFIG_RT_USING_SAL is not set
-
-#
-# Network interface device
-#
# CONFIG_RT_USING_NETDEV is not set
-
-#
-# light weight TCP/IP stack
-#
# CONFIG_RT_USING_LWIP is not set
-
-#
-# AT commands
-#
# CONFIG_RT_USING_AT is not set
-#
-# VBUS(Virtual Software BUS)
-#
-# CONFIG_RT_USING_VBUS is not set
-
#
# Utilities
#
@@ -346,7 +317,7 @@ 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
+# CONFIG_RT_USING_VBUS is not set
#
# RT-Thread Utestcases
@@ -360,6 +331,7 @@ CONFIG_UTEST_THR_PRIORITY=20
#
# IoT - internet of things
#
+# CONFIG_PKG_USING_LWIP is not set
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
# CONFIG_PKG_USING_PAHOMQTT is not set
# CONFIG_PKG_USING_UMQTT is not set
@@ -370,12 +342,8 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_KAWAII_MQTT is not set
# CONFIG_PKG_USING_BC28_MQTT is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set
-# CONFIG_PKG_USING_CJSON is not set
-# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_LIBMODBUS is not set
# CONFIG_PKG_USING_FREEMODBUS is not set
-# CONFIG_PKG_USING_LJSON is not set
-# CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
#
@@ -414,6 +382,7 @@ CONFIG_UTEST_THR_PRIORITY=20
# 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_IOTSHARP_SDK is not set
# CONFIG_PKG_USING_NIMBLE is not set
# CONFIG_PKG_USING_LLSYNC_SDK_ADAPTER is not set
# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
@@ -429,16 +398,13 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_ABUP_FOTA is not set
# CONFIG_PKG_USING_LIBCURL2RTT is not set
# CONFIG_PKG_USING_CAPNP is not set
-# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
# CONFIG_PKG_USING_AGILE_TELNET is not set
# CONFIG_PKG_USING_NMEALIB is not set
-# CONFIG_PKG_USING_AGILE_JSMN is not set
# 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
@@ -450,12 +416,14 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_HM is not set
# CONFIG_PKG_USING_SMALL_MODBUS is not set
# CONFIG_PKG_USING_NET_SERVER is not set
+# CONFIG_PKG_USING_ZFTP is not set
#
# security packages
#
# CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_LIBSODIUM is not set
+# CONFIG_PKG_USING_LIBHYDROGEN 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
@@ -463,11 +431,28 @@ CONFIG_UTEST_THR_PRIORITY=20
#
# language packages
#
+
+#
+# JSON: JavaScript Object Notation, a lightweight data-interchange format
+#
+# CONFIG_PKG_USING_CJSON is not set
+# CONFIG_PKG_USING_LJSON is not set
+# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
+# CONFIG_PKG_USING_RAPIDJSON is not set
+# CONFIG_PKG_USING_JSMN is not set
+# CONFIG_PKG_USING_AGILE_JSMN is not set
+
+#
+# XML: Extensible Markup Language
+#
+# CONFIG_PKG_USING_SIMPLE_XML is not set
+# CONFIG_PKG_USING_EZXML is not set
# 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
+# CONFIG_PKG_USING_RTT_RUST is not set
#
# multimedia packages
@@ -478,15 +463,16 @@ CONFIG_UTEST_THR_PRIORITY=20
#
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_DEMOS=y
-CONFIG_PKG_USING_LVGL_V820=y
-# CONFIG_PKG_USING_LVGL_V810 is not set
-# CONFIG_PKG_USING_LVGL_LATEST_VERSION is not set
-CONFIG_PKG_LVGL_VER="v8.2.0"
-CONFIG_PKG_LVGL_VER_NUM=0x08020
+CONFIG_PKG_LVGL_THREAD_PRIO=20
+CONFIG_PKG_LVGL_THREAD_STACK_SIZE=4096
+CONFIG_PKG_LVGL_DISP_REFR_PERIOD=30
+# CONFIG_PKG_LVGL_USING_EXAMPLES is not set
+CONFIG_PKG_LVGL_USING_DEMOS=y
+CONFIG_PKG_LVGL_VER_NUM=0x99999
+CONFIG_PKG_LVGL_VER="latest"
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
+# CONFIG_PKG_USING_GUI_GUIDER_DEMO is not set
#
# u8g2: a monochrome graphic library
@@ -516,6 +502,8 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_TERMBOX is not set
# CONFIG_PKG_USING_VT100 is not set
# CONFIG_PKG_USING_QRCODE is not set
+# CONFIG_PKG_USING_GUIENGINE is not set
+# CONFIG_PKG_USING_PERSIMMON is not set
#
# tools packages
@@ -558,6 +546,10 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_SOLAR_TERMS is not set
# CONFIG_PKG_USING_GAN_ZHI is not set
# CONFIG_PKG_USING_FDT is not set
+# CONFIG_PKG_USING_CBOX is not set
+# CONFIG_PKG_USING_SNOWFLAKE is not set
+# CONFIG_PKG_USING_HASH_MATCH is not set
+# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
#
# system packages
@@ -589,6 +581,7 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
#
# CONFIG_PKG_USING_CMSIS_5 is not set
+# CONFIG_PKG_USING_CMSIS_RTOS1 is not set
# CONFIG_PKG_USING_CMSIS_RTOS2 is not set
#
@@ -600,13 +593,10 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# 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_RTDUINO is not set
# CONFIG_PKG_USING_CAIRO is not set
# CONFIG_PKG_USING_PIXMAN is not set
# CONFIG_PKG_USING_PARTITION is not set
-# CONFIG_PKG_USING_FAL is not set
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
@@ -633,6 +623,9 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_MCUBOOT is not set
# CONFIG_PKG_USING_TINYUSB is not set
# CONFIG_PKG_USING_CHERRYUSB is not set
+# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+# CONFIG_PKG_USING_TFDB is not set
+# CONFIG_PKG_USING_QPC is not set
#
# peripheral libraries and drivers
@@ -656,6 +649,7 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# 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_MULTI_INFRARED 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
@@ -712,6 +706,7 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_SOFT_SERIAL is not set
# CONFIG_PKG_USING_MB85RS16 is not set
# CONFIG_PKG_USING_CW2015 is not set
+# CONFIG_PKG_USING_RFM300 is not set
#
# AI packages
@@ -730,6 +725,10 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# miscellaneous packages
#
+#
+# project laboratory
+#
+
#
# samples: kernel and components samples
#
@@ -780,6 +779,9 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_DESIGN_PATTERN is not set
# CONFIG_PKG_USING_CONTROLLER is not set
# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
+# CONFIG_PKG_USING_MFBD is not set
+# CONFIG_PKG_USING_SLCAN2RTT is not set
+# CONFIG_PKG_USING_SOEM is not set
#
# Hardware Drivers Config
@@ -897,6 +899,7 @@ CONFIG_BOARD_USING_ILI9341_PIN_DC=18
#
CONFIG_NU_PKG_USING_UTILS=y
# CONFIG_NU_PKG_USING_DEMO is not set
+# CONFIG_NU_PKG_USING_LVGL 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
@@ -912,8 +915,11 @@ CONFIG_NU_PKG_ILI9341_HORIZONTAL=y
CONFIG_BSP_LCD_BPP=16
CONFIG_BSP_LCD_WIDTH=320
CONFIG_BSP_LCD_HEIGHT=240
+# CONFIG_NU_PKG_USING_SSD1963 is not set
+# CONFIG_NU_PKG_USING_FSA506 is not set
+# CONFIG_NU_PKG_USING_TPC is not set
CONFIG_NU_PKG_USING_ADC_TOUCH=y
CONFIG_NU_PKG_USING_ADC_TOUCH_SW=y
# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
CONFIG_BOARD_USE_UTEST=y
-CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.numaker-iot-m487.test.utest."
diff --git a/bsp/nuvoton/numaker-iot-m487/template.uvprojx b/bsp/nuvoton/numaker-iot-m487/template.uvprojx
index dc049f4075..9e246ac49b 100644
--- a/bsp/nuvoton/numaker-iot-m487/template.uvprojx
+++ b/bsp/nuvoton/numaker-iot-m487/template.uvprojx
@@ -15,8 +15,8 @@
M487JIDAE
Nuvoton
- Nuvoton.NuMicro_DFP.1.3.5
- http://www.nuvoton.com/hq/enu/Documents/KEILSoftwarePack
+ Nuvoton.NuMicro_DFP.1.3.13
+ https://github.com/OpenNuvoton/cmsis-packs/raw/master/
IRAM(0x20000000,0x28000) IROM(0x00000000,0x80000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000)
@@ -136,7 +136,7 @@
4103
1
- NULink\Nu_Link.dll
+ BIN\UL2CM3.DLL
"" ()
@@ -311,7 +311,7 @@
1
- 1
+ 3
0
0
0
diff --git a/bsp/nuvoton/numaker-m032ki/.config b/bsp/nuvoton/numaker-m032ki/.config
index c66fd910f2..6ff71a489c 100644
--- a/bsp/nuvoton/numaker-m032ki/.config
+++ b/bsp/nuvoton/numaker-m032ki/.config
@@ -427,6 +427,7 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_TERMBOX is not set
# CONFIG_PKG_USING_VT100 is not set
# CONFIG_PKG_USING_QRCODE is not set
+# CONFIG_PKG_USING_GUIENGINE is not set
#
# tools packages
@@ -514,7 +515,6 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_UC_COMMON is not set
# CONFIG_PKG_USING_UC_MODBUS is not set
# CONFIG_PKG_USING_RTDUINO is not set
-# CONFIG_PKG_USING_GUIENGINE is not set
# CONFIG_PKG_USING_CAIRO is not set
# CONFIG_PKG_USING_PIXMAN is not set
# CONFIG_PKG_USING_PARTITION is not set
@@ -545,6 +545,7 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_TINYUSB is not set
# CONFIG_PKG_USING_CHERRYUSB is not set
# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+# CONFIG_PKG_USING_TFDB is not set
#
# peripheral libraries and drivers
@@ -795,3 +796,5 @@ CONFIG_NU_PKG_USING_DEMO=y
# CONFIG_NU_PKG_USING_TPC is not set
# CONFIG_NU_PKG_USING_ADC_TOUCH is not set
# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
+CONFIG_BOARD_USE_UTEST=y
diff --git a/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_conf.h b/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_conf.h
index 28f69a5cc5..a6769583c9 100644
--- a/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_conf.h
+++ b/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_conf.h
@@ -11,17 +11,27 @@
#ifndef LV_CONF_H
#define LV_CONF_H
-#define LV_USE_PERF_MONITOR 1
-#define LV_COLOR_DEPTH 16
+#include "rtconfig.h"
-#define LV_HOR_RES_MAX (320)
-#define LV_VER_RES_MAX (240)
+#define LV_COLOR_DEPTH BSP_LCD_BPP
+#define LV_HOR_RES_MAX BSP_LCD_WIDTH
+#define LV_VER_RES_MAX BSP_LCD_HEIGHT
#define LV_FONT_MONTSERRAT_12 1
#define LV_FONT_MONTSERRAT_16 1
-//#define LV_USE_DEMO_BENCHMARK 1
-#define LV_USE_DEMO_WIDGETS 1
-#define LV_DEMO_WIDGETS_SLIDESHOW 1
-
+#define LV_USE_PERF_MONITOR 1
//#define CONFIG_LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
+
+//#define LV_USE_DEMO_RTT_MUSIC 1
+#if LV_USE_DEMO_RTT_MUSIC
+ #define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
+
+ #define LV_USE_DEMO_MUSIC 1
+ #define LV_DEMO_MUSIC_AUTO_PLAY 1
+#endif
+
+/* Please comment LV_USE_DEMO_RTT_MUSIC declaration before un-comment below */
+#define LV_USE_DEMO_WIDGETS 1
+//#define LV_USE_DEMO_BENCHMARK 1
+
#endif
diff --git a/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_demo.c b/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_demo.c
index 69832d1f04..dc0010780f 100644
--- a/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_demo.c
+++ b/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_demo.c
@@ -5,50 +5,28 @@
*
* Change Logs:
* Date Author Notes
- * 2021-10-17 Meco Man First version
+ * 2022-6-1 Wayne First version
*/
-#include
+
#include
-#define DBG_TAG "LVGL"
-#define DBG_LVL DBG_INFO
-#include
-#ifndef LV_THREAD_STACK_SIZE
- #define LV_THREAD_STACK_SIZE 4096
-#endif
-
-#ifndef LV_THREAD_PRIO
- #define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
-#endif
-
-static void lvgl_thread(void *parameter)
+void lv_user_gui_init(void)
{
+ /* display demo; you may replace with your LVGL application at here and disable related definitions. */
+
#if LV_USE_DEMO_BENCHMARK
extern void lv_demo_benchmark(void);
lv_demo_benchmark();
#endif
+
#if LV_USE_DEMO_WIDGETS
extern void lv_demo_widgets(void);
lv_demo_widgets();
#endif
- while (1)
- {
- lv_task_handler();
- rt_thread_mdelay(1);
- }
+
+#if LV_USE_DEMO_MUSIC || LV_USE_DEMO_RTT_MUSIC
+ extern void lv_demo_music(void);
+ lv_demo_music();
+#endif
+
}
-
-static int lvgl_demo_init(void)
-{
- rt_thread_t tid;
-
- tid = rt_thread_create("LVGL", lvgl_thread, RT_NULL, LV_THREAD_STACK_SIZE, LV_THREAD_PRIO, 10);
- if (tid == RT_NULL)
- {
- LOG_E("Fail to create 'LVGL' thread");
- }
- rt_thread_startup(tid);
-
- return 0;
-}
-INIT_APP_EXPORT(lvgl_demo_init);
diff --git a/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_port_indev.c b/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_port_indev.c
index 4451ad4f84..f0b21f6241 100644
--- a/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_port_indev.c
+++ b/bsp/nuvoton/numaker-m032ki/applications/lvgl/lv_port_indev.c
@@ -31,15 +31,12 @@ void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
case RT_TOUCH_EVENT_UP:
last_state = LV_INDEV_STATE_RELEASED;
break;
+ case RT_TOUCH_EVENT_MOVE:
case RT_TOUCH_EVENT_DOWN:
last_x = x;
last_y = y;
last_state = LV_INDEV_STATE_PRESSED;
break;
- case RT_TOUCH_EVENT_MOVE:
- last_x = x;
- last_y = y;
- break;
}
}
diff --git a/bsp/nuvoton/numaker-m032ki/board/Kconfig b/bsp/nuvoton/numaker-m032ki/board/Kconfig
index 386b9028b6..16b72088fc 100644
--- a/bsp/nuvoton/numaker-m032ki/board/Kconfig
+++ b/bsp/nuvoton/numaker-m032ki/board/Kconfig
@@ -35,8 +35,6 @@ menu "Hardware Drivers Config"
select NU_PKG_USING_ILI9341_SPI
select NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER
select NU_PKG_ILI9341_HORIZONTAL
- select PKG_USING_LVGL
- select PKG_USING_LVGL_DEMOS
default n
if BOARD_USING_LCD_ILI9341
diff --git a/bsp/nuvoton/numaker-m032ki/config_lvgl b/bsp/nuvoton/numaker-m032ki/config_lvgl
index 187cd4ecd8..91429945c3 100644
--- a/bsp/nuvoton/numaker-m032ki/config_lvgl
+++ b/bsp/nuvoton/numaker-m032ki/config_lvgl
@@ -31,7 +31,7 @@ CONFIG_RT_TIMER_THREAD_STACK_SIZE=512
# 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_KPRINTF_USING_LONGLONG is not set
CONFIG_RT_DEBUG=y
# CONFIG_RT_DEBUG_COLOR is not set
# CONFIG_RT_DEBUG_INIT_CONFIG is not set
@@ -80,7 +80,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=0x40100
+CONFIG_RT_VER_NUM=0x40101
CONFIG_ARCH_ARM=y
# CONFIG_RT_USING_CPU_FFS is not set
CONFIG_ARCH_ARM_CORTEX_M=y
@@ -95,17 +95,8 @@ 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
-#
-# CONFIG_RT_USING_CPLUSPLUS is not set
-
-#
-# Command shell
-#
-CONFIG_RT_USING_FINSH=y
CONFIG_RT_USING_MSH=y
+CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_USING_MSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_THREAD_PRIORITY=20
@@ -119,10 +110,6 @@ CONFIG_FINSH_USING_DESCRIPTION=y
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
# CONFIG_FINSH_USING_AUTH 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
@@ -134,6 +121,8 @@ CONFIG_DFS_FD_MAX=16
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_FAL is not set
+# CONFIG_RT_USING_LWP is not set
#
# Device Drivers
@@ -167,6 +156,7 @@ CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_SOFT_RTC is not set
# CONFIG_RT_USING_SDIO is not set
CONFIG_RT_USING_SPI=y
+# CONFIG_RT_USING_SPI_BITOPS is not set
# CONFIG_RT_USING_QSPI is not set
# CONFIG_RT_USING_SPI_MSD is not set
# CONFIG_RT_USING_SFUD is not set
@@ -190,7 +180,7 @@ CONFIG_RT_USING_TOUCH=y
# CONFIG_RT_USING_USB_DEVICE is not set
#
-# POSIX layer and C standard library
+# C/C++ and POSIX layer
#
CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
@@ -214,36 +204,16 @@ CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
#
# Socket is in the 'Network' category
#
+# CONFIG_RT_USING_CPLUSPLUS is not set
#
# Network
#
-
-#
-# Socket abstraction layer
-#
# CONFIG_RT_USING_SAL is not set
-
-#
-# Network interface device
-#
# CONFIG_RT_USING_NETDEV is not set
-
-#
-# light weight TCP/IP stack
-#
# CONFIG_RT_USING_LWIP is not set
-
-#
-# AT commands
-#
# CONFIG_RT_USING_AT is not set
-#
-# VBUS(Virtual Software BUS)
-#
-# CONFIG_RT_USING_VBUS is not set
-
#
# Utilities
#
@@ -254,7 +224,7 @@ 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
+# CONFIG_RT_USING_VBUS is not set
#
# RT-Thread Utestcases
@@ -280,6 +250,11 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_UTEST_MAILBOX_TC is not set
# CONFIG_UTEST_THREAD_TC is not set
+#
+# CPP11 Testcase
+#
+# CONFIG_UTEST_CPP11_THREAD_TC is not set
+
#
# Utest Serial Testcase
#
@@ -292,6 +267,7 @@ CONFIG_UTEST_SMALL_MEM_TC=y
#
# IoT - internet of things
#
+# CONFIG_PKG_USING_LWIP is not set
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
# CONFIG_PKG_USING_PAHOMQTT is not set
# CONFIG_PKG_USING_UMQTT is not set
@@ -302,12 +278,8 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_KAWAII_MQTT is not set
# CONFIG_PKG_USING_BC28_MQTT is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set
-# CONFIG_PKG_USING_CJSON is not set
-# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_LIBMODBUS is not set
# CONFIG_PKG_USING_FREEMODBUS is not set
-# CONFIG_PKG_USING_LJSON is not set
-# CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
#
@@ -346,6 +318,7 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# 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_IOTSHARP_SDK is not set
# CONFIG_PKG_USING_NIMBLE is not set
# CONFIG_PKG_USING_LLSYNC_SDK_ADAPTER is not set
# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
@@ -361,16 +334,13 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_ABUP_FOTA is not set
# CONFIG_PKG_USING_LIBCURL2RTT is not set
# CONFIG_PKG_USING_CAPNP is not set
-# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
# CONFIG_PKG_USING_AGILE_TELNET is not set
# CONFIG_PKG_USING_NMEALIB is not set
-# CONFIG_PKG_USING_AGILE_JSMN is not set
# 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
@@ -382,12 +352,14 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_HM is not set
# CONFIG_PKG_USING_SMALL_MODBUS is not set
# CONFIG_PKG_USING_NET_SERVER is not set
+# CONFIG_PKG_USING_ZFTP is not set
#
# security packages
#
# CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_LIBSODIUM is not set
+# CONFIG_PKG_USING_LIBHYDROGEN 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
@@ -395,11 +367,28 @@ CONFIG_UTEST_SMALL_MEM_TC=y
#
# language packages
#
+
+#
+# JSON: JavaScript Object Notation, a lightweight data-interchange format
+#
+# CONFIG_PKG_USING_CJSON is not set
+# CONFIG_PKG_USING_LJSON is not set
+# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
+# CONFIG_PKG_USING_RAPIDJSON is not set
+# CONFIG_PKG_USING_JSMN is not set
+# CONFIG_PKG_USING_AGILE_JSMN is not set
+
+#
+# XML: Extensible Markup Language
+#
+# CONFIG_PKG_USING_SIMPLE_XML is not set
+# CONFIG_PKG_USING_EZXML is not set
# 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
+# CONFIG_PKG_USING_RTT_RUST is not set
#
# multimedia packages
@@ -410,15 +399,16 @@ CONFIG_UTEST_SMALL_MEM_TC=y
#
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_DEMOS=y
-CONFIG_PKG_USING_LVGL_V820=y
-# CONFIG_PKG_USING_LVGL_V810 is not set
-# CONFIG_PKG_USING_LVGL_LATEST_VERSION is not set
-CONFIG_PKG_LVGL_VER="v8.2.0"
-CONFIG_PKG_LVGL_VER_NUM=0x08020
+CONFIG_PKG_LVGL_THREAD_PRIO=20
+CONFIG_PKG_LVGL_THREAD_STACK_SIZE=4096
+CONFIG_PKG_LVGL_DISP_REFR_PERIOD=30
+# CONFIG_PKG_LVGL_USING_EXAMPLES is not set
+CONFIG_PKG_LVGL_USING_DEMOS=y
+CONFIG_PKG_LVGL_VER_NUM=0x99999
+CONFIG_PKG_LVGL_VER="latest"
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
+# CONFIG_PKG_USING_GUI_GUIDER_DEMO is not set
#
# u8g2: a monochrome graphic library
@@ -448,6 +438,7 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_TERMBOX is not set
# CONFIG_PKG_USING_VT100 is not set
# CONFIG_PKG_USING_QRCODE is not set
+# CONFIG_PKG_USING_GUIENGINE is not set
#
# tools packages
@@ -490,6 +481,10 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_SOLAR_TERMS is not set
# CONFIG_PKG_USING_GAN_ZHI is not set
# CONFIG_PKG_USING_FDT is not set
+# CONFIG_PKG_USING_CBOX is not set
+# CONFIG_PKG_USING_SNOWFLAKE is not set
+# CONFIG_PKG_USING_HASH_MATCH is not set
+# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
#
# system packages
@@ -521,6 +516,7 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
#
# CONFIG_PKG_USING_CMSIS_5 is not set
+# CONFIG_PKG_USING_CMSIS_RTOS1 is not set
# CONFIG_PKG_USING_CMSIS_RTOS2 is not set
#
@@ -532,12 +528,10 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# 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_RTDUINO is not set
# CONFIG_PKG_USING_CAIRO is not set
# CONFIG_PKG_USING_PIXMAN is not set
# CONFIG_PKG_USING_PARTITION is not set
-# CONFIG_PKG_USING_FAL is not set
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
@@ -564,6 +558,9 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_MCUBOOT is not set
# CONFIG_PKG_USING_TINYUSB is not set
# CONFIG_PKG_USING_CHERRYUSB is not set
+# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+# CONFIG_PKG_USING_TFDB is not set
+# CONFIG_PKG_USING_QPC is not set
#
# peripheral libraries and drivers
@@ -587,6 +584,7 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# 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_MULTI_INFRARED 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
@@ -643,6 +641,7 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_SOFT_SERIAL is not set
# CONFIG_PKG_USING_MB85RS16 is not set
# CONFIG_PKG_USING_CW2015 is not set
+# CONFIG_PKG_USING_RFM300 is not set
#
# AI packages
@@ -661,6 +660,10 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# miscellaneous packages
#
+#
+# project laboratory
+#
+
#
# samples: kernel and components samples
#
@@ -711,6 +714,9 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_DESIGN_PATTERN is not set
# CONFIG_PKG_USING_CONTROLLER is not set
# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
+# CONFIG_PKG_USING_MFBD is not set
+# CONFIG_PKG_USING_SLCAN2RTT is not set
+# CONFIG_PKG_USING_SOEM is not set
#
# Hardware Drivers Config
@@ -813,6 +819,7 @@ CONFIG_BOARD_USING_ILI9341_PIN_DC=18
#
CONFIG_NU_PKG_USING_UTILS=y
# CONFIG_NU_PKG_USING_DEMO is not set
+# CONFIG_NU_PKG_USING_LVGL 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
@@ -828,8 +835,11 @@ CONFIG_NU_PKG_ILI9341_HORIZONTAL=y
CONFIG_BSP_LCD_BPP=16
CONFIG_BSP_LCD_WIDTH=320
CONFIG_BSP_LCD_HEIGHT=240
+# CONFIG_NU_PKG_USING_SSD1963 is not set
+# CONFIG_NU_PKG_USING_FSA506 is not set
+# CONFIG_NU_PKG_USING_TPC is not set
CONFIG_NU_PKG_USING_ADC_TOUCH=y
CONFIG_NU_PKG_USING_ADC_TOUCH_SW=y
# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
CONFIG_BOARD_USE_UTEST=y
-CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.numaker-m032ki.test.utest."
diff --git a/bsp/nuvoton/numaker-m2354/.config b/bsp/nuvoton/numaker-m2354/.config
index fad14f9c0d..ba541813e4 100644
--- a/bsp/nuvoton/numaker-m2354/.config
+++ b/bsp/nuvoton/numaker-m2354/.config
@@ -111,7 +111,7 @@ CONFIG_DFS_USING_WORKDIR=y
CONFIG_DFS_FILESYSTEMS_MAX=4
CONFIG_DFS_FILESYSTEM_TYPES_MAX=4
CONFIG_DFS_FD_MAX=32
-# CONFIG_RT_USING_DFS_MNTTABLE is not set
+CONFIG_RT_USING_DFS_MNTTABLE=y
CONFIG_RT_USING_DFS_ELMFAT=y
#
@@ -180,7 +180,13 @@ CONFIG_PM_TICKLESS_THRESHOLD_TIME=2
CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_ALARM is not set
# CONFIG_RT_USING_SOFT_RTC is not set
-# CONFIG_RT_USING_SDIO is not set
+CONFIG_RT_USING_SDIO=y
+CONFIG_RT_SDIO_STACK_SIZE=2048
+CONFIG_RT_SDIO_THREAD_PRIORITY=15
+CONFIG_RT_MMCSD_STACK_SIZE=2048
+CONFIG_RT_MMCSD_THREAD_PREORITY=22
+CONFIG_RT_MMCSD_MAX_PARTITION=16
+CONFIG_RT_SDIO_DEBUG=y
CONFIG_RT_USING_SPI=y
# CONFIG_RT_USING_SPI_BITOPS is not set
CONFIG_RT_USING_QSPI=y
@@ -591,6 +597,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_FDT is not set
# CONFIG_PKG_USING_CBOX is not set
# CONFIG_PKG_USING_SNOWFLAKE is not set
+# CONFIG_PKG_USING_HASH_MATCH is not set
#
# system packages
@@ -664,6 +671,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_TINYUSB is not set
# CONFIG_PKG_USING_CHERRYUSB is not set
# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+# CONFIG_PKG_USING_TFDB is not set
#
# peripheral libraries and drivers
@@ -866,9 +874,7 @@ CONFIG_BSP_USING_I2C1=y
# CONFIG_BSP_USING_USCI is not set
CONFIG_BSP_USING_SDH=y
CONFIG_BSP_USING_SDH0=y
-CONFIG_NU_SDH_USING_PDMA=y
-CONFIG_NU_SDH_HOTPLUG=y
-CONFIG_NU_SDH_MOUNT_ON_ROOT=y
+# CONFIG_BSP_USING_SDH1 is not set
# CONFIG_BSP_USING_CAN is not set
# CONFIG_BSP_USING_BPWM is not set
# CONFIG_BSP_USING_EPWM is not set
@@ -940,3 +946,5 @@ CONFIG_NU_PKG_USING_DEMO=y
# CONFIG_NU_PKG_USING_TPC is not set
# CONFIG_NU_PKG_USING_ADC_TOUCH is not set
# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
+CONFIG_BOARD_USE_UTEST=y
diff --git a/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_conf.h b/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_conf.h
index 2d960ffe30..a6769583c9 100644
--- a/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_conf.h
+++ b/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_conf.h
@@ -5,22 +5,33 @@
*
* Change Logs:
* Date Author Notes
- * 2021-10-18 Meco Man First version
+ * 2022-2-17 Wayne First version
*/
#ifndef LV_CONF_H
#define LV_CONF_H
-#define LV_USE_PERF_MONITOR 1
-#define LV_COLOR_DEPTH 16
+#include "rtconfig.h"
-#define LV_HOR_RES_MAX (320)
-#define LV_VER_RES_MAX (240)
+#define LV_COLOR_DEPTH BSP_LCD_BPP
+#define LV_HOR_RES_MAX BSP_LCD_WIDTH
+#define LV_VER_RES_MAX BSP_LCD_HEIGHT
#define LV_FONT_MONTSERRAT_12 1
#define LV_FONT_MONTSERRAT_16 1
-#define LV_USE_DEMO_RTT_MUSIC 1
-#define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
-
+#define LV_USE_PERF_MONITOR 1
//#define CONFIG_LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
+
+//#define LV_USE_DEMO_RTT_MUSIC 1
+#if LV_USE_DEMO_RTT_MUSIC
+ #define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
+
+ #define LV_USE_DEMO_MUSIC 1
+ #define LV_DEMO_MUSIC_AUTO_PLAY 1
+#endif
+
+/* Please comment LV_USE_DEMO_RTT_MUSIC declaration before un-comment below */
+#define LV_USE_DEMO_WIDGETS 1
+//#define LV_USE_DEMO_BENCHMARK 1
+
#endif
diff --git a/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_demo.c b/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_demo.c
index 7ac1eab9e5..dc0010780f 100644
--- a/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_demo.c
+++ b/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_demo.c
@@ -5,45 +5,28 @@
*
* Change Logs:
* Date Author Notes
- * 2021-10-17 Meco Man First version
+ * 2022-6-1 Wayne First version
*/
-#include
+
#include
-#define DBG_TAG "LVGL"
-#define DBG_LVL DBG_INFO
-#include
-#ifndef LV_THREAD_STACK_SIZE
- #define LV_THREAD_STACK_SIZE 4096
-#endif
-
-#ifndef LV_THREAD_PRIO
- #define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
-#endif
-
-static void lvgl_thread(void *parameter)
+void lv_user_gui_init(void)
{
+ /* display demo; you may replace with your LVGL application at here and disable related definitions. */
+
+#if LV_USE_DEMO_BENCHMARK
+ extern void lv_demo_benchmark(void);
+ lv_demo_benchmark();
+#endif
+
+#if LV_USE_DEMO_WIDGETS
+ extern void lv_demo_widgets(void);
+ lv_demo_widgets();
+#endif
+
+#if LV_USE_DEMO_MUSIC || LV_USE_DEMO_RTT_MUSIC
extern void lv_demo_music(void);
lv_demo_music();
+#endif
- while (1)
- {
- lv_task_handler();
- rt_thread_mdelay(1);
- }
}
-
-static int lvgl_demo_init(void)
-{
- rt_thread_t tid;
-
- tid = rt_thread_create("LVGL", lvgl_thread, RT_NULL, LV_THREAD_STACK_SIZE, LV_THREAD_PRIO, 10);
- if (tid == RT_NULL)
- {
- LOG_E("Fail to create 'LVGL' thread");
- }
- rt_thread_startup(tid);
-
- return 0;
-}
-INIT_APP_EXPORT(lvgl_demo_init);
diff --git a/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_port_disp.c b/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_port_disp.c
index a34694ed7e..72133debb8 100644
--- a/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_port_disp.c
+++ b/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_port_disp.c
@@ -70,7 +70,7 @@ void lv_port_disp_init(void)
rt_kprintf("LVGL: Use one buffers - buf1@%08x, size: %d bytes\n", buf1, info.smem_len);
/*Initialize `disp_buf` with the buffer(s).*/
- lv_disp_draw_buf_init(&disp_buf, buf1, RT_NULL, info.smem_len/(info.bits_per_pixel/8));
+ lv_disp_draw_buf_init(&disp_buf, buf1, RT_NULL, info.smem_len / (info.bits_per_pixel / 8));
result = rt_device_open(lcd_device, 0);
if (result != RT_EOK)
diff --git a/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_port_indev.c b/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_port_indev.c
index 4451ad4f84..f0b21f6241 100644
--- a/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_port_indev.c
+++ b/bsp/nuvoton/numaker-m2354/applications/lvgl/lv_port_indev.c
@@ -31,15 +31,12 @@ void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
case RT_TOUCH_EVENT_UP:
last_state = LV_INDEV_STATE_RELEASED;
break;
+ case RT_TOUCH_EVENT_MOVE:
case RT_TOUCH_EVENT_DOWN:
last_x = x;
last_y = y;
last_state = LV_INDEV_STATE_PRESSED;
break;
- case RT_TOUCH_EVENT_MOVE:
- last_x = x;
- last_y = y;
- break;
}
}
diff --git a/bsp/nuvoton/numaker-m2354/applications/mnt.c b/bsp/nuvoton/numaker-m2354/applications/mnt.c
index 6762e067b1..128b48a33b 100644
--- a/bsp/nuvoton/numaker-m2354/applications/mnt.c
+++ b/bsp/nuvoton/numaker-m2354/applications/mnt.c
@@ -10,3 +10,36 @@
*
******************************************************************************/
+#include
+
+#define LOG_TAG "mnt"
+#define DBG_ENABLE
+#define DBG_SECTION_NAME "mnt"
+#define DBG_LEVEL DBG_ERROR
+#define DBG_COLOR
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#ifdef RT_USING_DFS_MNTTABLE
+
+/*
+const char *device_name;
+const char *path;
+const char *filesystemtype;
+unsigned long rwflag;
+const void *data;
+*/
+
+const struct dfs_mount_tbl mount_table[] =
+{
+ { "sd0", "/", "elm", 0, RT_NULL },
+ {0},
+};
+#endif
+
diff --git a/bsp/nuvoton/numaker-m2354/board/Kconfig b/bsp/nuvoton/numaker-m2354/board/Kconfig
index 247791b537..79e9311f89 100644
--- a/bsp/nuvoton/numaker-m2354/board/Kconfig
+++ b/bsp/nuvoton/numaker-m2354/board/Kconfig
@@ -73,8 +73,6 @@ menu "Hardware Drivers Config"
select NU_PKG_USING_ILI9341_SPI
select NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER
select NU_PKG_ILI9341_HORIZONTAL
- select PKG_USING_LVGL
- select PKG_USING_LV_MUSIC_DEMO
default n
if BOARD_USING_LCD_ILI9341
diff --git a/bsp/nuvoton/numaker-m2354/board/NuClockConfig/nutool_modclkcfg.c b/bsp/nuvoton/numaker-m2354/board/NuClockConfig/nutool_modclkcfg.c
index b0bf9c80e4..93e5a147c0 100644
--- a/bsp/nuvoton/numaker-m2354/board/NuClockConfig/nutool_modclkcfg.c
+++ b/bsp/nuvoton/numaker-m2354/board/NuClockConfig/nutool_modclkcfg.c
@@ -718,7 +718,7 @@ void nutool_modclkcfg_deinit_sc2(void)
void nutool_modclkcfg_init_sdh0(void)
{
CLK_EnableModuleClock(SDH0_MODULE);
- CLK_SetModuleClock(SDH0_MODULE, CLK_CLKSEL0_SDH0SEL_HCLK, CLK_CLKDIV0_SDH0(1));
+ CLK_SetModuleClock(SDH0_MODULE, CLK_CLKSEL0_SDH0SEL_HCLK, CLK_CLKDIV0_SDH0(2));
return;
}
diff --git a/bsp/nuvoton/numaker-m2354/config_lvgl b/bsp/nuvoton/numaker-m2354/config_lvgl
index ecb2c684f9..a613fecc39 100644
--- a/bsp/nuvoton/numaker-m2354/config_lvgl
+++ b/bsp/nuvoton/numaker-m2354/config_lvgl
@@ -29,7 +29,7 @@ CONFIG_IDLE_THREAD_STACK_SIZE=2048
# 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_KPRINTF_USING_LONGLONG is not set
CONFIG_RT_DEBUG=y
CONFIG_RT_DEBUG_COLOR=y
# CONFIG_RT_DEBUG_INIT_CONFIG is not set
@@ -78,7 +78,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=0x40100
+CONFIG_RT_VER_NUM=0x40101
# CONFIG_RT_USING_CPU_FFS is not set
# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
@@ -90,17 +90,8 @@ 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
-#
-# CONFIG_RT_USING_CPLUSPLUS is not set
-
-#
-# Command shell
-#
-CONFIG_RT_USING_FINSH=y
CONFIG_RT_USING_MSH=y
+CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_USING_MSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_THREAD_PRIORITY=20
@@ -114,10 +105,6 @@ CONFIG_FINSH_USING_DESCRIPTION=y
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
# CONFIG_FINSH_USING_AUTH 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
@@ -151,6 +138,11 @@ 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_FAL=y
+CONFIG_FAL_DEBUG_CONFIG=y
+CONFIG_FAL_DEBUG=1
+CONFIG_FAL_PART_HAS_TABLE_CFG=y
+# CONFIG_FAL_USING_SFUD_PORT is not set
#
# Device Drivers
@@ -190,6 +182,7 @@ CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_SOFT_RTC is not set
# CONFIG_RT_USING_SDIO is not set
CONFIG_RT_USING_SPI=y
+# CONFIG_RT_USING_SPI_BITOPS is not set
CONFIG_RT_USING_QSPI=y
# CONFIG_RT_USING_SPI_MSD is not set
CONFIG_RT_USING_SFUD=y
@@ -272,7 +265,7 @@ CONFIG_RT_USB_DEVICE_HID_MOUSE=y
# CONFIG_RT_USB_DEVICE_HID_MEDIA is not set
#
-# POSIX layer and C standard library
+# C/C++ and POSIX layer
#
CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
@@ -284,6 +277,7 @@ CONFIG_RT_USING_POSIX_DEVIO=y
# CONFIG_RT_USING_POSIX_STDIO is not set
CONFIG_RT_USING_POSIX_POLL=y
CONFIG_RT_USING_POSIX_SELECT=y
+# CONFIG_RT_USING_POSIX_SOCKET is not set
# CONFIG_RT_USING_POSIX_TERMIOS is not set
# CONFIG_RT_USING_POSIX_AIO is not set
# CONFIG_RT_USING_POSIX_MMAN is not set
@@ -303,26 +297,21 @@ CONFIG_RT_USING_POSIX_SELECT=y
#
# Socket is in the 'Network' category
#
+# CONFIG_RT_USING_CPLUSPLUS is not set
#
# Network
#
-
-#
-# Socket abstraction layer
-#
CONFIG_RT_USING_SAL=y
CONFIG_SAL_INTERNET_CHECK=y
#
-# protocol stack implement
+# Docking with protocol stacks
#
+# CONFIG_SAL_USING_LWIP is not set
CONFIG_SAL_USING_AT=y
+# CONFIG_SAL_USING_TLS is not set
CONFIG_SAL_USING_POSIX=y
-
-#
-# Network interface device
-#
CONFIG_RT_USING_NETDEV=y
CONFIG_NETDEV_USING_IFCONFIG=y
CONFIG_NETDEV_USING_PING=y
@@ -332,15 +321,7 @@ CONFIG_NETDEV_USING_AUTO_DEFAULT=y
CONFIG_NETDEV_IPV4=1
CONFIG_NETDEV_IPV6=0
# CONFIG_NETDEV_IPV6_SCOPES is not set
-
-#
-# light weight TCP/IP stack
-#
# CONFIG_RT_USING_LWIP is not set
-
-#
-# AT commands
-#
CONFIG_RT_USING_AT=y
# CONFIG_AT_DEBUG is not set
# CONFIG_AT_USING_SERVER is not set
@@ -352,11 +333,6 @@ CONFIG_AT_USING_CLI=y
CONFIG_AT_CMD_MAX_LEN=2048
CONFIG_AT_SW_VERSION_NUM=0x10301
-#
-# VBUS(Virtual Software BUS)
-#
-# CONFIG_RT_USING_VBUS is not set
-
#
# Utilities
#
@@ -367,6 +343,7 @@ 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_VBUS is not set
#
# RT-Thread Utestcases
@@ -380,6 +357,7 @@ CONFIG_UTEST_THR_PRIORITY=20
#
# IoT - internet of things
#
+# CONFIG_PKG_USING_LWIP is not set
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
# CONFIG_PKG_USING_PAHOMQTT is not set
# CONFIG_PKG_USING_UMQTT is not set
@@ -390,12 +368,8 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_KAWAII_MQTT is not set
# CONFIG_PKG_USING_BC28_MQTT is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set
-# CONFIG_PKG_USING_CJSON is not set
-# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_LIBMODBUS is not set
# CONFIG_PKG_USING_FREEMODBUS is not set
-# CONFIG_PKG_USING_LJSON is not set
-# CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
#
@@ -468,6 +442,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# 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_IOTSHARP_SDK is not set
# CONFIG_PKG_USING_NIMBLE is not set
# CONFIG_PKG_USING_LLSYNC_SDK_ADAPTER is not set
# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
@@ -483,16 +458,13 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_ABUP_FOTA is not set
# CONFIG_PKG_USING_LIBCURL2RTT is not set
# CONFIG_PKG_USING_CAPNP is not set
-# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
# CONFIG_PKG_USING_AGILE_TELNET is not set
# CONFIG_PKG_USING_NMEALIB is not set
-# CONFIG_PKG_USING_AGILE_JSMN is not set
# 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
@@ -504,12 +476,14 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_HM is not set
# CONFIG_PKG_USING_SMALL_MODBUS is not set
# CONFIG_PKG_USING_NET_SERVER is not set
+# CONFIG_PKG_USING_ZFTP is not set
#
# security packages
#
# CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_LIBSODIUM is not set
+# CONFIG_PKG_USING_LIBHYDROGEN 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
@@ -517,11 +491,28 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
#
# language packages
#
+
+#
+# JSON: JavaScript Object Notation, a lightweight data-interchange format
+#
+# CONFIG_PKG_USING_CJSON is not set
+# CONFIG_PKG_USING_LJSON is not set
+# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
+# CONFIG_PKG_USING_RAPIDJSON is not set
+# CONFIG_PKG_USING_JSMN is not set
+# CONFIG_PKG_USING_AGILE_JSMN is not set
+
+#
+# XML: Extensible Markup Language
+#
+# CONFIG_PKG_USING_SIMPLE_XML is not set
+# CONFIG_PKG_USING_EZXML is not set
# 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
+# CONFIG_PKG_USING_RTT_RUST is not set
#
# multimedia packages
@@ -532,17 +523,16 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
#
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_DEMOS is not set
-CONFIG_PKG_USING_LVGL_V820=y
-# CONFIG_PKG_USING_LVGL_V810 is not set
-# CONFIG_PKG_USING_LVGL_LATEST_VERSION is not set
-CONFIG_PKG_LVGL_VER="v8.2.0"
-CONFIG_PKG_LVGL_VER_NUM=0x08020
+CONFIG_PKG_LVGL_THREAD_PRIO=20
+CONFIG_PKG_LVGL_THREAD_STACK_SIZE=4096
+CONFIG_PKG_LVGL_DISP_REFR_PERIOD=30
+# CONFIG_PKG_LVGL_USING_EXAMPLES is not set
+CONFIG_PKG_LVGL_USING_DEMOS=y
+CONFIG_PKG_LVGL_VER_NUM=0x99999
+CONFIG_PKG_LVGL_VER="latest"
# 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.2.0"
+# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
+# CONFIG_PKG_USING_GUI_GUIDER_DEMO is not set
#
# u8g2: a monochrome graphic library
@@ -572,6 +562,7 @@ CONFIG_PKG_LV_MUSIC_DEMO_VER="v0.2.0"
# CONFIG_PKG_USING_TERMBOX is not set
# CONFIG_PKG_USING_VT100 is not set
# CONFIG_PKG_USING_QRCODE is not set
+# CONFIG_PKG_USING_GUIENGINE is not set
#
# tools packages
@@ -614,6 +605,10 @@ CONFIG_PKG_LV_MUSIC_DEMO_VER="v0.2.0"
# CONFIG_PKG_USING_SOLAR_TERMS is not set
# CONFIG_PKG_USING_GAN_ZHI is not set
# CONFIG_PKG_USING_FDT is not set
+# CONFIG_PKG_USING_CBOX is not set
+# CONFIG_PKG_USING_SNOWFLAKE is not set
+# CONFIG_PKG_USING_HASH_MATCH is not set
+# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
#
# system packages
@@ -645,6 +640,7 @@ CONFIG_PKG_LV_MUSIC_DEMO_VER="v0.2.0"
# CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
#
# CONFIG_PKG_USING_CMSIS_5 is not set
+# CONFIG_PKG_USING_CMSIS_RTOS1 is not set
# CONFIG_PKG_USING_CMSIS_RTOS2 is not set
#
@@ -656,26 +652,10 @@ CONFIG_PKG_LV_MUSIC_DEMO_VER="v0.2.0"
# 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_RTDUINO is not set
# CONFIG_PKG_USING_CAIRO is not set
# CONFIG_PKG_USING_PIXMAN is not set
# CONFIG_PKG_USING_PARTITION is not set
-CONFIG_PKG_USING_FAL=y
-CONFIG_PKG_FAL_PATH="/packages/system/fal"
-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_V10000 is not set
-# 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=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
@@ -702,6 +682,9 @@ CONFIG_PKG_FAL_VER_NUM=0x99999
# CONFIG_PKG_USING_MCUBOOT is not set
# CONFIG_PKG_USING_TINYUSB is not set
# CONFIG_PKG_USING_CHERRYUSB is not set
+# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+# CONFIG_PKG_USING_TFDB is not set
+# CONFIG_PKG_USING_QPC is not set
#
# peripheral libraries and drivers
@@ -725,6 +708,7 @@ CONFIG_PKG_FAL_VER_NUM=0x99999
# 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_MULTI_INFRARED 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
@@ -781,6 +765,7 @@ CONFIG_PKG_FAL_VER_NUM=0x99999
# CONFIG_PKG_USING_SOFT_SERIAL is not set
# CONFIG_PKG_USING_MB85RS16 is not set
# CONFIG_PKG_USING_CW2015 is not set
+# CONFIG_PKG_USING_RFM300 is not set
#
# AI packages
@@ -799,6 +784,10 @@ CONFIG_PKG_FAL_VER_NUM=0x99999
# miscellaneous packages
#
+#
+# project laboratory
+#
+
#
# samples: kernel and components samples
#
@@ -849,6 +838,9 @@ CONFIG_PKG_FAL_VER_NUM=0x99999
# CONFIG_PKG_USING_DESIGN_PATTERN is not set
# CONFIG_PKG_USING_CONTROLLER is not set
# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
+# CONFIG_PKG_USING_MFBD is not set
+# CONFIG_PKG_USING_SLCAN2RTT is not set
+# CONFIG_PKG_USING_SOEM is not set
#
# Hardware Drivers Config
@@ -957,6 +949,7 @@ CONFIG_BOARD_USING_ILI9341_PIN_DC=8
#
CONFIG_NU_PKG_USING_UTILS=y
# CONFIG_NU_PKG_USING_DEMO is not set
+# CONFIG_NU_PKG_USING_LVGL 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
@@ -972,8 +965,11 @@ CONFIG_NU_PKG_ILI9341_HORIZONTAL=y
CONFIG_BSP_LCD_BPP=16
CONFIG_BSP_LCD_WIDTH=320
CONFIG_BSP_LCD_HEIGHT=240
+# CONFIG_NU_PKG_USING_SSD1963 is not set
+# CONFIG_NU_PKG_USING_FSA506 is not set
+# CONFIG_NU_PKG_USING_TPC is not set
CONFIG_NU_PKG_USING_ADC_TOUCH=y
CONFIG_NU_PKG_USING_ADC_TOUCH_SW=y
# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
CONFIG_BOARD_USE_UTEST=y
-CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.numaker-m2354.test.utest."
diff --git a/bsp/nuvoton/numaker-pfm-m487/.config b/bsp/nuvoton/numaker-pfm-m487/.config
index 2524bf05cd..04f76f1051 100644
--- a/bsp/nuvoton/numaker-pfm-m487/.config
+++ b/bsp/nuvoton/numaker-pfm-m487/.config
@@ -114,7 +114,7 @@ CONFIG_DFS_USING_WORKDIR=y
CONFIG_DFS_FILESYSTEMS_MAX=8
CONFIG_DFS_FILESYSTEM_TYPES_MAX=4
CONFIG_DFS_FD_MAX=32
-# CONFIG_RT_USING_DFS_MNTTABLE is not set
+CONFIG_RT_USING_DFS_MNTTABLE=y
CONFIG_RT_USING_DFS_ELMFAT=y
#
@@ -185,7 +185,13 @@ CONFIG_PM_TICKLESS_THRESHOLD_TIME=2
CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_ALARM is not set
# CONFIG_RT_USING_SOFT_RTC is not set
-# CONFIG_RT_USING_SDIO is not set
+CONFIG_RT_USING_SDIO=y
+CONFIG_RT_SDIO_STACK_SIZE=2048
+CONFIG_RT_SDIO_THREAD_PRIORITY=15
+CONFIG_RT_MMCSD_STACK_SIZE=2048
+CONFIG_RT_MMCSD_THREAD_PREORITY=22
+CONFIG_RT_MMCSD_MAX_PARTITION=16
+# CONFIG_RT_SDIO_DEBUG is not set
CONFIG_RT_USING_SPI=y
# CONFIG_RT_USING_SPI_BITOPS is not set
CONFIG_RT_USING_QSPI=y
@@ -612,6 +618,7 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_FDT is not set
# CONFIG_PKG_USING_CBOX is not set
# CONFIG_PKG_USING_SNOWFLAKE is not set
+# CONFIG_PKG_USING_HASH_MATCH is not set
#
# system packages
@@ -685,6 +692,7 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_TINYUSB is not set
# CONFIG_PKG_USING_CHERRYUSB is not set
# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+# CONFIG_PKG_USING_TFDB is not set
#
# peripheral libraries and drivers
@@ -886,9 +894,6 @@ CONFIG_BSP_USING_I2C2=y
CONFIG_BSP_USING_SDH=y
CONFIG_BSP_USING_SDH0=y
# CONFIG_BSP_USING_SDH1 is not set
-CONFIG_NU_SDH_USING_PDMA=y
-CONFIG_NU_SDH_HOTPLUG=y
-# CONFIG_NU_SDH_MOUNT_ON_ROOT is not set
# CONFIG_BSP_USING_CAN is not set
# CONFIG_BSP_USING_BPWM is not set
# CONFIG_BSP_USING_EPWM is not set
@@ -967,3 +972,5 @@ CONFIG_NU_PKG_USING_NAU88L25=y
# CONFIG_NU_PKG_USING_TPC is not set
# CONFIG_NU_PKG_USING_ADC_TOUCH is not set
# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
+CONFIG_BOARD_USE_UTEST=y
diff --git a/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_conf.h b/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_conf.h
index 28f69a5cc5..a6769583c9 100644
--- a/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_conf.h
+++ b/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_conf.h
@@ -11,17 +11,27 @@
#ifndef LV_CONF_H
#define LV_CONF_H
-#define LV_USE_PERF_MONITOR 1
-#define LV_COLOR_DEPTH 16
+#include "rtconfig.h"
-#define LV_HOR_RES_MAX (320)
-#define LV_VER_RES_MAX (240)
+#define LV_COLOR_DEPTH BSP_LCD_BPP
+#define LV_HOR_RES_MAX BSP_LCD_WIDTH
+#define LV_VER_RES_MAX BSP_LCD_HEIGHT
#define LV_FONT_MONTSERRAT_12 1
#define LV_FONT_MONTSERRAT_16 1
-//#define LV_USE_DEMO_BENCHMARK 1
-#define LV_USE_DEMO_WIDGETS 1
-#define LV_DEMO_WIDGETS_SLIDESHOW 1
-
+#define LV_USE_PERF_MONITOR 1
//#define CONFIG_LV_LOG_LEVEL LV_LOG_LEVEL_TRACE
+
+//#define LV_USE_DEMO_RTT_MUSIC 1
+#if LV_USE_DEMO_RTT_MUSIC
+ #define LV_DEMO_RTT_MUSIC_AUTO_PLAY 1
+
+ #define LV_USE_DEMO_MUSIC 1
+ #define LV_DEMO_MUSIC_AUTO_PLAY 1
+#endif
+
+/* Please comment LV_USE_DEMO_RTT_MUSIC declaration before un-comment below */
+#define LV_USE_DEMO_WIDGETS 1
+//#define LV_USE_DEMO_BENCHMARK 1
+
#endif
diff --git a/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_demo.c b/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_demo.c
index 69832d1f04..dc0010780f 100644
--- a/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_demo.c
+++ b/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_demo.c
@@ -5,50 +5,28 @@
*
* Change Logs:
* Date Author Notes
- * 2021-10-17 Meco Man First version
+ * 2022-6-1 Wayne First version
*/
-#include
+
#include
-#define DBG_TAG "LVGL"
-#define DBG_LVL DBG_INFO
-#include
-#ifndef LV_THREAD_STACK_SIZE
- #define LV_THREAD_STACK_SIZE 4096
-#endif
-
-#ifndef LV_THREAD_PRIO
- #define LV_THREAD_PRIO (RT_THREAD_PRIORITY_MAX*2/3)
-#endif
-
-static void lvgl_thread(void *parameter)
+void lv_user_gui_init(void)
{
+ /* display demo; you may replace with your LVGL application at here and disable related definitions. */
+
#if LV_USE_DEMO_BENCHMARK
extern void lv_demo_benchmark(void);
lv_demo_benchmark();
#endif
+
#if LV_USE_DEMO_WIDGETS
extern void lv_demo_widgets(void);
lv_demo_widgets();
#endif
- while (1)
- {
- lv_task_handler();
- rt_thread_mdelay(1);
- }
+
+#if LV_USE_DEMO_MUSIC || LV_USE_DEMO_RTT_MUSIC
+ extern void lv_demo_music(void);
+ lv_demo_music();
+#endif
+
}
-
-static int lvgl_demo_init(void)
-{
- rt_thread_t tid;
-
- tid = rt_thread_create("LVGL", lvgl_thread, RT_NULL, LV_THREAD_STACK_SIZE, LV_THREAD_PRIO, 10);
- if (tid == RT_NULL)
- {
- LOG_E("Fail to create 'LVGL' thread");
- }
- rt_thread_startup(tid);
-
- return 0;
-}
-INIT_APP_EXPORT(lvgl_demo_init);
diff --git a/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_port_indev.c b/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_port_indev.c
index 4451ad4f84..f0b21f6241 100644
--- a/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_port_indev.c
+++ b/bsp/nuvoton/numaker-pfm-m487/applications/lvgl/lv_port_indev.c
@@ -31,15 +31,12 @@ void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
case RT_TOUCH_EVENT_UP:
last_state = LV_INDEV_STATE_RELEASED;
break;
+ case RT_TOUCH_EVENT_MOVE:
case RT_TOUCH_EVENT_DOWN:
last_x = x;
last_y = y;
last_state = LV_INDEV_STATE_PRESSED;
break;
- case RT_TOUCH_EVENT_MOVE:
- last_x = x;
- last_y = y;
- break;
}
}
diff --git a/bsp/nuvoton/numaker-pfm-m487/applications/mnt.c b/bsp/nuvoton/numaker-pfm-m487/applications/mnt.c
index 30728692d0..9189a23197 100644
--- a/bsp/nuvoton/numaker-pfm-m487/applications/mnt.c
+++ b/bsp/nuvoton/numaker-pfm-m487/applications/mnt.c
@@ -12,6 +12,13 @@
#include
+#define LOG_TAG "mnt"
+#define DBG_ENABLE
+#define DBG_SECTION_NAME "mnt"
+#define DBG_LEVEL DBG_ERROR
+#define DBG_COLOR
+#include
+
#include
#include
#include
@@ -27,6 +34,29 @@
#define MOUNT_POINT_SPIFLASH0 "/"
#endif
+#ifdef RT_USING_DFS_MNTTABLE
+
+/*
+const char *device_name;
+const char *path;
+const char *filesystemtype;
+unsigned long rwflag;
+const void *data;
+*/
+
+const struct dfs_mount_tbl mount_table[] =
+{
+ { "sd0", "/mnt/sd0", "elm", 0, RT_NULL },
+ { "sd0p0", "/mnt/sd0p0", "elm", 0, RT_NULL },
+ { "sd0p1", "/mnt/sd0p1", "elm", 0, RT_NULL },
+ { "sd1", "/mnt/sd1", "elm", 0, RT_NULL },
+ { "sd1p0", "/mnt/sd1p0", "elm", 0, RT_NULL },
+ { "sd1p1", "/mnt/sd1p1", "elm", 0, RT_NULL },
+ {0},
+};
+#endif
+
+
#if defined(BOARD_USING_STORAGE_SPIFLASH)
#if defined(RT_USB_DEVICE_MSTORAGE)
@@ -107,6 +137,7 @@ exit_mkdir_p:
return ret;
}
+
#endif
int mnt_init_spiflash0(void)
@@ -118,6 +149,12 @@ int mnt_init_spiflash0(void)
goto exit_mnt_init_spiflash0;
}
rt_kprintf("mount flash0 with elmfat type: ok\n");
+ mkdir_p("/mnt/sd0", 0x777);
+ mkdir_p("/mnt/sd0p0", 0x777);
+ mkdir_p("/mnt/sd0p1", 0x777);
+ mkdir_p("/mnt/sd1", 0x777);
+ mkdir_p("/mnt/sd1p0", 0x777);
+ mkdir_p("/mnt/sd1p1", 0x777);
#if defined(RT_USBH_MSTORAGE) && defined(UDISK_MOUNTPOINT)
if (mkdir_p(UDISK_MOUNTPOINT, 0) < 0)
diff --git a/bsp/nuvoton/numaker-pfm-m487/board/Kconfig b/bsp/nuvoton/numaker-pfm-m487/board/Kconfig
index 21d3cb0fac..5390958a63 100644
--- a/bsp/nuvoton/numaker-pfm-m487/board/Kconfig
+++ b/bsp/nuvoton/numaker-pfm-m487/board/Kconfig
@@ -117,8 +117,6 @@ menu "Hardware Drivers Config"
select NU_PKG_USING_ILI9341_EBI
select NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER
select NU_PKG_ILI9341_HORIZONTAL
- select PKG_USING_LVGL
- select PKG_USING_LVGL_DEMOS
default n
if BOARD_USING_LCD_ILI9341
diff --git a/bsp/nuvoton/numaker-pfm-m487/config_lvgl b/bsp/nuvoton/numaker-pfm-m487/config_lvgl
index 158e2692b5..c9af6e9498 100644
--- a/bsp/nuvoton/numaker-pfm-m487/config_lvgl
+++ b/bsp/nuvoton/numaker-pfm-m487/config_lvgl
@@ -29,7 +29,7 @@ CONFIG_IDLE_THREAD_STACK_SIZE=1024
# 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_KPRINTF_USING_LONGLONG is not set
CONFIG_RT_DEBUG=y
CONFIG_RT_DEBUG_COLOR=y
# CONFIG_RT_DEBUG_INIT_CONFIG is not set
@@ -80,7 +80,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=0x40100
+CONFIG_RT_VER_NUM=0x40101
CONFIG_ARCH_ARM=y
CONFIG_RT_USING_CPU_FFS=y
CONFIG_ARCH_ARM_CORTEX_M=y
@@ -95,17 +95,8 @@ 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
-#
-# CONFIG_RT_USING_CPLUSPLUS is not set
-
-#
-# Command shell
-#
-CONFIG_RT_USING_FINSH=y
CONFIG_RT_USING_MSH=y
+CONFIG_RT_USING_FINSH=y
CONFIG_FINSH_USING_MSH=y
CONFIG_FINSH_THREAD_NAME="tshell"
CONFIG_FINSH_THREAD_PRIORITY=20
@@ -119,10 +110,6 @@ CONFIG_FINSH_USING_DESCRIPTION=y
# CONFIG_FINSH_ECHO_DISABLE_DEFAULT is not set
# CONFIG_FINSH_USING_AUTH 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
@@ -156,6 +143,8 @@ 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_FAL is not set
+# CONFIG_RT_USING_LWP is not set
#
# Device Drivers
@@ -194,6 +183,7 @@ CONFIG_RT_USING_RTC=y
# CONFIG_RT_USING_SOFT_RTC is not set
# CONFIG_RT_USING_SDIO is not set
CONFIG_RT_USING_SPI=y
+# CONFIG_RT_USING_SPI_BITOPS is not set
# CONFIG_RT_USING_QSPI is not set
# CONFIG_RT_USING_SPI_MSD is not set
# CONFIG_RT_USING_SFUD is not set
@@ -249,7 +239,7 @@ CONFIG_RT_HWCRYPTO_USING_CRC_04C11DB7=y
# CONFIG_RT_USING_USB_DEVICE is not set
#
-# POSIX layer and C standard library
+# C/C++ and POSIX layer
#
CONFIG_RT_LIBC_DEFAULT_TIMEZONE=8
@@ -261,6 +251,7 @@ CONFIG_RT_USING_POSIX_DEVIO=y
# CONFIG_RT_USING_POSIX_STDIO is not set
# CONFIG_RT_USING_POSIX_POLL is not set
# CONFIG_RT_USING_POSIX_SELECT is not set
+# CONFIG_RT_USING_POSIX_SOCKET is not set
# CONFIG_RT_USING_POSIX_TERMIOS is not set
# CONFIG_RT_USING_POSIX_AIO is not set
# CONFIG_RT_USING_POSIX_MMAN is not set
@@ -280,6 +271,7 @@ CONFIG_RT_USING_POSIX_DEVIO=y
#
# Socket is in the 'Network' category
#
+# CONFIG_RT_USING_CPLUSPLUS is not set
#
# Network
@@ -289,11 +281,6 @@ CONFIG_RT_USING_POSIX_DEVIO=y
# CONFIG_RT_USING_LWIP is not set
# CONFIG_RT_USING_AT is not set
-#
-# VBUS(Virtual Software BUS)
-#
-# CONFIG_RT_USING_VBUS is not set
-
#
# Utilities
#
@@ -304,7 +291,7 @@ 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
+# CONFIG_RT_USING_VBUS is not set
#
# RT-Thread Utestcases
@@ -318,6 +305,7 @@ CONFIG_UTEST_THR_PRIORITY=20
#
# IoT - internet of things
#
+# CONFIG_PKG_USING_LWIP is not set
# CONFIG_PKG_USING_LORAWAN_DRIVER is not set
# CONFIG_PKG_USING_PAHOMQTT is not set
# CONFIG_PKG_USING_UMQTT is not set
@@ -328,12 +316,8 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_KAWAII_MQTT is not set
# CONFIG_PKG_USING_BC28_MQTT is not set
# CONFIG_PKG_USING_WEBTERMINAL is not set
-# CONFIG_PKG_USING_CJSON is not set
-# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_LIBMODBUS is not set
# CONFIG_PKG_USING_FREEMODBUS is not set
-# CONFIG_PKG_USING_LJSON is not set
-# CONFIG_PKG_USING_EZXML is not set
# CONFIG_PKG_USING_NANOPB is not set
#
@@ -372,6 +356,7 @@ CONFIG_UTEST_THR_PRIORITY=20
# 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_IOTSHARP_SDK is not set
# CONFIG_PKG_USING_NIMBLE is not set
# CONFIG_PKG_USING_LLSYNC_SDK_ADAPTER is not set
# CONFIG_PKG_USING_OTA_DOWNLOADER is not set
@@ -387,16 +372,13 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_ABUP_FOTA is not set
# CONFIG_PKG_USING_LIBCURL2RTT is not set
# CONFIG_PKG_USING_CAPNP is not set
-# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
# CONFIG_PKG_USING_AGILE_TELNET is not set
# CONFIG_PKG_USING_NMEALIB is not set
-# CONFIG_PKG_USING_AGILE_JSMN is not set
# 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
@@ -408,12 +390,14 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_HM is not set
# CONFIG_PKG_USING_SMALL_MODBUS is not set
# CONFIG_PKG_USING_NET_SERVER is not set
+# CONFIG_PKG_USING_ZFTP is not set
#
# security packages
#
# CONFIG_PKG_USING_MBEDTLS is not set
# CONFIG_PKG_USING_LIBSODIUM is not set
+# CONFIG_PKG_USING_LIBHYDROGEN 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
@@ -421,11 +405,28 @@ CONFIG_UTEST_THR_PRIORITY=20
#
# language packages
#
+
+#
+# JSON: JavaScript Object Notation, a lightweight data-interchange format
+#
+# CONFIG_PKG_USING_CJSON is not set
+# CONFIG_PKG_USING_LJSON is not set
+# CONFIG_PKG_USING_RT_CJSON_TOOLS is not set
+# CONFIG_PKG_USING_RAPIDJSON is not set
+# CONFIG_PKG_USING_JSMN is not set
+# CONFIG_PKG_USING_AGILE_JSMN is not set
+
+#
+# XML: Extensible Markup Language
+#
+# CONFIG_PKG_USING_SIMPLE_XML is not set
+# CONFIG_PKG_USING_EZXML is not set
# 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
+# CONFIG_PKG_USING_RTT_RUST is not set
#
# multimedia packages
@@ -436,15 +437,16 @@ CONFIG_UTEST_THR_PRIORITY=20
#
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_DEMOS=y
-CONFIG_PKG_USING_LVGL_V820=y
-# CONFIG_PKG_USING_LVGL_V810 is not set
-# CONFIG_PKG_USING_LVGL_LATEST_VERSION is not set
-CONFIG_PKG_LVGL_VER="v8.2.0"
-CONFIG_PKG_LVGL_VER_NUM=0x08020
+CONFIG_PKG_LVGL_THREAD_PRIO=20
+CONFIG_PKG_LVGL_THREAD_STACK_SIZE=4096
+CONFIG_PKG_LVGL_DISP_REFR_PERIOD=30
+# CONFIG_PKG_LVGL_USING_EXAMPLES is not set
+CONFIG_PKG_LVGL_USING_DEMOS=y
+CONFIG_PKG_LVGL_VER_NUM=0x99999
+CONFIG_PKG_LVGL_VER="latest"
# CONFIG_PKG_USING_LITTLEVGL2RTT is not set
# CONFIG_PKG_USING_LV_MUSIC_DEMO is not set
+# CONFIG_PKG_USING_GUI_GUIDER_DEMO is not set
#
# u8g2: a monochrome graphic library
@@ -474,6 +476,8 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_TERMBOX is not set
# CONFIG_PKG_USING_VT100 is not set
# CONFIG_PKG_USING_QRCODE is not set
+# CONFIG_PKG_USING_GUIENGINE is not set
+# CONFIG_PKG_USING_PERSIMMON is not set
#
# tools packages
@@ -516,6 +520,10 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_SOLAR_TERMS is not set
# CONFIG_PKG_USING_GAN_ZHI is not set
# CONFIG_PKG_USING_FDT is not set
+# CONFIG_PKG_USING_CBOX is not set
+# CONFIG_PKG_USING_SNOWFLAKE is not set
+# CONFIG_PKG_USING_HASH_MATCH is not set
+# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
#
# system packages
@@ -547,6 +555,7 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CMSIS: ARM Cortex-M Microcontroller Software Interface Standard
#
# CONFIG_PKG_USING_CMSIS_5 is not set
+# CONFIG_PKG_USING_CMSIS_RTOS1 is not set
# CONFIG_PKG_USING_CMSIS_RTOS2 is not set
#
@@ -558,13 +567,10 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# 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_RTDUINO is not set
# CONFIG_PKG_USING_CAIRO is not set
# CONFIG_PKG_USING_PIXMAN is not set
# CONFIG_PKG_USING_PARTITION is not set
-# CONFIG_PKG_USING_FAL is not set
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
@@ -592,6 +598,8 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_TINYUSB is not set
# CONFIG_PKG_USING_CHERRYUSB is not set
# CONFIG_PKG_USING_KMULTI_RTIMER is not set
+# CONFIG_PKG_USING_TFDB is not set
+# CONFIG_PKG_USING_QPC is not set
#
# peripheral libraries and drivers
@@ -746,6 +754,8 @@ CONFIG_PKG_LVGL_VER_NUM=0x08020
# CONFIG_PKG_USING_CONTROLLER is not set
# CONFIG_PKG_USING_PHASE_LOCKED_LOOP is not set
# CONFIG_PKG_USING_MFBD is not set
+# CONFIG_PKG_USING_SLCAN2RTT is not set
+# CONFIG_PKG_USING_SOEM is not set
#
# Hardware Drivers Config
@@ -858,6 +868,7 @@ CONFIG_BOARD_USING_SRAM0_AS_MEMHEAP=y
#
CONFIG_NU_PKG_USING_UTILS=y
# CONFIG_NU_PKG_USING_DEMO is not set
+# CONFIG_NU_PKG_USING_LVGL 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
@@ -873,7 +884,10 @@ CONFIG_BSP_LCD_BPP=16
CONFIG_BSP_LCD_WIDTH=320
CONFIG_BSP_LCD_HEIGHT=240
# CONFIG_NU_PKG_USING_SSD1963 is not set
-# CONFIG_NU_PKG_USING_ILI_TPC is not set
+# CONFIG_NU_PKG_USING_FSA506 is not set
+# CONFIG_NU_PKG_USING_TPC is not set
CONFIG_NU_PKG_USING_ADC_TOUCH=y
CONFIG_NU_PKG_USING_ADC_TOUCH_SW=y
# CONFIG_NU_PKG_USING_SPINAND is not set
+CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
+CONFIG_BOARD_USE_UTEST=y
diff --git a/bsp/nuvoton/numaker-pfm-m487/template.uvprojx b/bsp/nuvoton/numaker-pfm-m487/template.uvprojx
index dc049f4075..9e246ac49b 100644
--- a/bsp/nuvoton/numaker-pfm-m487/template.uvprojx
+++ b/bsp/nuvoton/numaker-pfm-m487/template.uvprojx
@@ -15,8 +15,8 @@
M487JIDAE
Nuvoton
- Nuvoton.NuMicro_DFP.1.3.5
- http://www.nuvoton.com/hq/enu/Documents/KEILSoftwarePack
+ Nuvoton.NuMicro_DFP.1.3.13
+ https://github.com/OpenNuvoton/cmsis-packs/raw/master/
IRAM(0x20000000,0x28000) IROM(0x00000000,0x80000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000)
@@ -136,7 +136,7 @@
4103
1
- NULink\Nu_Link.dll
+ BIN\UL2CM3.DLL
"" ()
@@ -311,7 +311,7 @@
1
- 1
+ 3
0
0
0