[bsp/nuvoton] Support NuMaker-IoT-M467 board (#6448)

Co-authored-by: Wayne Lin <wclin@nuvoton.com>
This commit is contained in:
Wayne 2022-09-20 22:30:21 +08:00 committed by GitHub
parent 4e9786cdab
commit 746d7a01bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
68 changed files with 10302 additions and 892 deletions

View File

@ -11,3 +11,4 @@ Current supported BSP shown in below table:
| [nk-n9h30](nk-n9h30) | Nuvoton NK-N9H30 |
| [numaker-m032ki](numaker-m032ki) | Nuvoton NuMaker-M032KI |
| [numaker-m467hj](numaker-m467hj) | Nuvoton NuMaker-M467HJ |
| [numaker-iot-m467](numaker-iot-m467) | Nuvoton NuMaker-IoT-M467 |

View File

@ -11,6 +11,7 @@ Current supported LVGL running environment on Nuvoton's boards shown in below ta
| nk-n9h30 | Music | No | .config |
| numaker-m032ki | Widgets | Nu-TFT v1.3 | config_lvgl |
| numaker-m467hj | Widgets | NuMaker-TFT-LCD43 v1.0 | config_lvgl |
| numaker-iot-m467 | Widgets | Nu-TFT v1.3 | config_lvgl |
## Download related packages

View File

@ -130,7 +130,7 @@ typedef enum
{
eCANFD_NORMAL = 0, /*!< None, Normal mode. */
/*
/*
Support:
(1) to receive data frames
(2) to receive remote frames
@ -139,34 +139,34 @@ typedef enum
(1) data frames sending
(2) remote frames sending
(3) active error frames or overload frames sending
*/
*/
eCANFD_RESTRICTED_OPERATION, /*!< Receive external RX frame and always keep recessive state or send dominate bit on ACK bit on TX pin. */
/*
/*
Support:
(1) to receive valid data frames
(2) to receive valid remote frames
Not support:
(1) transmission start
(2) acknowledge to valid frames
*/
*/
eCANFD_BUS_MONITOR, /*!< Receive external RX frame and always keep recessive state on TX pin. */
/*
/*
Support:
(1) Loopback
(2) Also send out frames
Not support:
(1) to receive external frame
*/
*/
eCANFD_LOOPBACK_EXTERNAL, /*!< Won't receive external RX frame. */
/*
/*
Support:
(1) Loopback
Not support:
(1) to receive external frame
(2) transmission start
*/
*/
eCANFD_LOOPBACK_INTERNAL /*!< Won't receive external RX frame and always keep recessive state on TX pin */
} E_CANFD_TEST_MODE;
@ -458,7 +458,7 @@ int32_t CANFD_RunToNormal(CANFD_T *canfd, uint8_t u8Enable);
void CANFD_GetDefaultConfig(CANFD_FD_T *psConfig, uint8_t u8OpMode);
void CANFD_ClearStatusFlag(CANFD_T *canfd, uint32_t u32InterruptFlag);
uint32_t CANFD_GetStatusFlag(CANFD_T *canfd, uint32_t u32IntTypeFlag);
uint32_t CANFD_ReadReg(__I uint32_t* pu32RegAddr);
uint32_t CANFD_ReadReg(__I uint32_t *pu32RegAddr);
/*@}*/ /* end of group CANFD_EXPORTED_FUNCTIONS */

View File

@ -137,6 +137,8 @@ extern int32_t g_CCAP_i32ErrCode;
*/
#define CCAP_GET_INT_STS(ccap) (ccap->INT)
#define CCAP_SET_CTL(ccap, u32IntMask) (ccap->CTL |= u32IntMask)
#define CCAP_CLR_CTL(ccap, u32IntMask) (ccap->CTL &= ~u32IntMask)
void CCAP_Open(CCAP_T *ccap, uint32_t u32InFormat, uint32_t u32OutFormat);
void CCAP_SetCroppingWindow(CCAP_T *ccap, uint32_t u32VStart, uint32_t u32HStart, uint32_t u32Height, uint32_t u32Width);

View File

@ -117,39 +117,39 @@ static void nu_bpwmcap_isr(nu_bpwmcap_t psNuBpwmCapBase)
for (i = 0; i < BPWM_CHANNEL_NUM ; i++)
{
nu_bpwmcap_t psNuBpwmCap = psNuBpwmCapBase + i;
if (psNuBpwmCap->u8DummyData < NU_DUMMY_DATA)
{
psNuBpwmCap->u8DummyData++;
}
else
{
u32Status = BPWM_GetCaptureIntFlag(psNuBpwmCap->base, psNuBpwmCap->u8Channel);
if (psNuBpwmCap->u8DummyData < NU_DUMMY_DATA)
{
psNuBpwmCap->u8DummyData++;
}
else
{
u32Status = BPWM_GetCaptureIntFlag(psNuBpwmCap->base, psNuBpwmCap->u8Channel);
switch (u32Status)
{
case NU_NO_EDGE:
break;
switch (u32Status)
{
case NU_NO_EDGE:
break;
case NU_RISING_EDGE:
BPWM_ClearCaptureIntFlag(psNuBpwmCap->base, psNuBpwmCap->u8Channel, BPWM_CAPTURE_INT_RISING_LATCH);
psNuBpwmCap->u32CurrentRisingCnt = BPWM_GET_CAPTURE_RISING_DATA(psNuBpwmCap->base, psNuBpwmCap->u8Channel);
rt_hw_inputcapture_isr(&psNuBpwmCap->parent, psNuBpwmCap->input_data_level);
break;
case NU_RISING_EDGE:
BPWM_ClearCaptureIntFlag(psNuBpwmCap->base, psNuBpwmCap->u8Channel, BPWM_CAPTURE_INT_RISING_LATCH);
psNuBpwmCap->u32CurrentRisingCnt = BPWM_GET_CAPTURE_RISING_DATA(psNuBpwmCap->base, psNuBpwmCap->u8Channel);
rt_hw_inputcapture_isr(&psNuBpwmCap->parent, psNuBpwmCap->input_data_level);
break;
case NU_FALLING_EDGE:
BPWM_ClearCaptureIntFlag(psNuBpwmCap->base, psNuBpwmCap->u8Channel, BPWM_CAPTURE_INT_FALLING_LATCH);
psNuBpwmCap->u32CurrentFallingCnt = BPWM_GET_CAPTURE_FALLING_DATA(psNuBpwmCap->base, psNuBpwmCap->u8Channel);
rt_hw_inputcapture_isr(&psNuBpwmCap->parent, psNuBpwmCap->input_data_level);
break;
case NU_FALLING_EDGE:
BPWM_ClearCaptureIntFlag(psNuBpwmCap->base, psNuBpwmCap->u8Channel, BPWM_CAPTURE_INT_FALLING_LATCH);
psNuBpwmCap->u32CurrentFallingCnt = BPWM_GET_CAPTURE_FALLING_DATA(psNuBpwmCap->base, psNuBpwmCap->u8Channel);
rt_hw_inputcapture_isr(&psNuBpwmCap->parent, psNuBpwmCap->input_data_level);
break;
default:
BPWM_ClearCaptureIntFlag(psNuBpwmCap->base, psNuBpwmCap->u8Channel, BPWM_CAPTURE_INT_RISING_LATCH | BPWM_CAPTURE_INT_FALLING_LATCH);
BPWM_GET_CAPTURE_RISING_DATA(psNuBpwmCap->base, psNuBpwmCap->u8Channel);
BPWM_GET_CAPTURE_FALLING_DATA(psNuBpwmCap->base, psNuBpwmCap->u8Channel);
default:
BPWM_ClearCaptureIntFlag(psNuBpwmCap->base, psNuBpwmCap->u8Channel, BPWM_CAPTURE_INT_RISING_LATCH | BPWM_CAPTURE_INT_FALLING_LATCH);
BPWM_GET_CAPTURE_RISING_DATA(psNuBpwmCap->base, psNuBpwmCap->u8Channel);
BPWM_GET_CAPTURE_FALLING_DATA(psNuBpwmCap->base, psNuBpwmCap->u8Channel);
break;
}
}
break;
}
}
}
}
@ -185,7 +185,7 @@ static rt_err_t nu_bpwmcap_get_pulsewidth(struct rt_inputcapture_device *inputca
nu_bpwmcap_t psNuBpwmCap;
float fTempCnt;
psNuBpwmCap = (nu_bpwmcap_t )inputcapture;
psNuBpwmCap = (nu_bpwmcap_t)inputcapture;
if (psNuBpwmCap->u32CurrentFallingCnt)
{
@ -225,14 +225,14 @@ static rt_err_t nu_bpwmcap_init(struct rt_inputcapture_device *inputcapture)
RT_ASSERT(inputcapture);
psNuBpwmCap = (nu_bpwmcap_t ) inputcapture;
psNuBpwmCap = (nu_bpwmcap_t) inputcapture;
psNuBpwmCap->u8DummyData = 0;
psNuBpwmCap->u32CurrentFallingCnt = 0;
psNuBpwmCap->u32CurrentRisingCnt = 0;
psNuBpwmCap->u32LastRisingCnt = 0;
psNuBpwmCap->u32LastFallingCnt = 0;
psNuBpwmCap->parent.ops = &nu_bpwmcap_ops;
psNuBpwmCap->u8DummyData = 0;
psNuBpwmCap->u32CurrentFallingCnt = 0;
psNuBpwmCap->u32CurrentRisingCnt = 0;
psNuBpwmCap->u32LastRisingCnt = 0;
psNuBpwmCap->u32LastFallingCnt = 0;
psNuBpwmCap->parent.ops = &nu_bpwmcap_ops;
if ((psNuBpwmCap->u8Channel % BPWM_CHANNEL_NUM) == 0)
{
@ -250,9 +250,9 @@ static rt_err_t nu_bpwmcap_open(struct rt_inputcapture_device *inputcapture)
RT_ASSERT(inputcapture);
psNuBpwmCap = (nu_bpwmcap_t ) inputcapture;
psNuBpwmCap = (nu_bpwmcap_t) inputcapture;
/* Set capture time as 500 nano second */
/* Set capture time as 500 nano second */
psNuBpwmCap->fUsPerTick = (float)BPWM_ConfigCaptureChannel(psNuBpwmCap->base, 0, 500, 0) / 1000;
/* Set counter type as up count */
@ -268,7 +268,7 @@ static rt_err_t nu_bpwmcap_open(struct rt_inputcapture_device *inputcapture)
BPWM_EnableCapture(psNuBpwmCap->base, 0x1 << psNuBpwmCap->u8Channel);
/* Enable BPWM NVIC interrupt */
if ( (psNuBpwmCap->base->CAPCTL & ((0x1 << BPWM_CHANNEL_NUM)-1) ) != 0u)
if ((psNuBpwmCap->base->CAPCTL & ((0x1 << BPWM_CHANNEL_NUM) - 1)) != 0u)
NVIC_EnableIRQ(psNuBpwmCap->irqn);
return RT_EOK;
@ -280,7 +280,7 @@ static rt_err_t nu_bpwmcap_close(struct rt_inputcapture_device *inputcapture)
RT_ASSERT(inputcapture);
psNuBpwmCap = (nu_bpwmcap_t ) inputcapture;
psNuBpwmCap = (nu_bpwmcap_t) inputcapture;
/* Enable Capture Function for BPWM */
BPWM_DisableCapture(psNuBpwmCap->base, 0x1 << psNuBpwmCap->u8Channel);
@ -289,7 +289,7 @@ static rt_err_t nu_bpwmcap_close(struct rt_inputcapture_device *inputcapture)
BPWM_DisableCaptureInt(psNuBpwmCap->base, psNuBpwmCap->u8Channel, BPWM_CAPTURE_INT_FALLING_LATCH | BPWM_CAPTURE_INT_RISING_LATCH);
/* Disable BPWM NVIC interrupt */
if ( (psNuBpwmCap->base->CAPCTL & ((0x1 << BPWM_CHANNEL_NUM)-1) ) == 0u)
if ((psNuBpwmCap->base->CAPCTL & ((0x1 << BPWM_CHANNEL_NUM) - 1)) == 0u)
NVIC_DisableIRQ(psNuBpwmCap->irqn);
return RT_EOK;
@ -301,17 +301,17 @@ static int nu_bpwm_capture_device_init(void)
int i;
rt_err_t ret = RT_EOK;
for (i = (BPWM_START+1); i < BPWM_CNT; i++)
for (i = (BPWM_START + 1); i < BPWM_CNT; i++)
{
nu_bpwmcap_t psNuBpwmCap = &nu_bpwmcap_arr[i];
psNuBpwmCap->u8Channel = i % BPWM_CHANNEL_NUM;
psNuBpwmCap->u8DummyData = 0;
psNuBpwmCap->u32CurrentFallingCnt = 0;
psNuBpwmCap->u32CurrentRisingCnt = 0;
psNuBpwmCap->u32LastRisingCnt = 0;
psNuBpwmCap->u32LastFallingCnt = 0;
psNuBpwmCap->parent.ops = &nu_bpwmcap_ops;
psNuBpwmCap->u8Channel = i % BPWM_CHANNEL_NUM;
psNuBpwmCap->u8DummyData = 0;
psNuBpwmCap->u32CurrentFallingCnt = 0;
psNuBpwmCap->u32CurrentRisingCnt = 0;
psNuBpwmCap->u32LastRisingCnt = 0;
psNuBpwmCap->u32LastFallingCnt = 0;
psNuBpwmCap->parent.ops = &nu_bpwmcap_ops;
if ((psNuBpwmCap->u8Channel % BPWM_CHANNEL_NUM) == 0)
{
@ -320,8 +320,8 @@ static int nu_bpwm_capture_device_init(void)
SYS_ResetModule(psNuBpwmCap->rstidx);
}
/* register inputcapture device */
ret = rt_device_inputcapture_register(&psNuBpwmCap->parent, psNuBpwmCap->name, psNuBpwmCap);
/* register inputcapture device */
ret = rt_device_inputcapture_register(&psNuBpwmCap->parent, psNuBpwmCap->name, psNuBpwmCap);
RT_ASSERT(ret == RT_EOK);
}

View File

@ -182,14 +182,14 @@ static rt_err_t ccap_pipe_configure(nu_ccap_t psNuCcap, ccap_view_info_t psViewI
/* Set Packet Scaling Vertical/Horizontal Factor Register */
if (psCcapConf->sPipeInfo_Packet.u32Height < psRectCropping->height)
{
u32HN = psRectCropping->height;
u32HM = psCcapConf->sPipeInfo_Packet.u32Height;
u32HN = psCcapConf->sPipeInfo_Packet.u32Height;
u32HM = psRectCropping->height;
}
if (psCcapConf->sPipeInfo_Packet.u32Width < psRectCropping->width)
{
u32WN = psRectCropping->width;
u32WM = psCcapConf->sPipeInfo_Packet.u32Width;
u32WN = psCcapConf->sPipeInfo_Packet.u32Width;
u32WM = psRectCropping->width;
}
CCAP_SetPacketScaling(psNuCcap->base,
@ -217,23 +217,23 @@ static rt_err_t ccap_pipe_configure(nu_ccap_t psNuCcap, ccap_view_info_t psViewI
/* Set System Memory Planar U Base Address Register */
CCAP_SetPlanarUBuf(psNuCcap->base, (uint32_t)psCcapConf->sPipeInfo_Planar.pu8FarmAddr + u32Offset);
u32Offset += (psCcapConf->sPipeInfo_Planar.u32Height * psCcapConf->sPipeInfo_Planar.u32Width) / 2;
u32Offset += ((psCcapConf->sPipeInfo_Planar.u32Height * psCcapConf->sPipeInfo_Planar.u32Width) / 2);
/* Set System Memory Planar V Base Address Register */
CCAP_SetPlanarVBuf(psNuCcap->base, (uint32_t)psCcapConf->sPipeInfo_Planar.pu8FarmAddr + u32Offset);
u32WM = u32WN = u32HM = u32HN = 0;
/* Set Packet Scaling Vertical/Horizontal Factor Register */
/* Set Planar Scaling Vertical/Horizontal Factor Register */
if (psCcapConf->sPipeInfo_Planar.u32Height < psRectCropping->height)
{
u32HN = psRectCropping->height;
u32HM = psCcapConf->sPipeInfo_Planar.u32Height;
u32HN = psCcapConf->sPipeInfo_Planar.u32Height;
u32HM = psRectCropping->height;
}
if (psCcapConf->sPipeInfo_Planar.u32Width < psRectCropping->width)
{
u32WN = psRectCropping->width;
u32WM = psCcapConf->sPipeInfo_Planar.u32Width;
u32WN = psCcapConf->sPipeInfo_Planar.u32Width;
u32WM = psRectCropping->width;
}
/* Set Planar Scaling Vertical/Horizontal Factor Register */
@ -368,6 +368,38 @@ static rt_err_t ccap_control(rt_device_t dev, int cmd, void *args)
}
break;
case CCAP_CMD_SET_OPMODE:
{
RT_ASSERT(args);
int i32IsOneSutterMode = *((int *)args);
/* Set shutter or continuous mode */
CCAP_SET_CTL(psNuCcap->base, (i32IsOneSutterMode > 0) ? CCAP_CTL_SHUTTER_Msk : 0);
}
break;
case CCAP_CMD_SET_BASEADDR:
{
uint32_t u32Offset = 0;
ccap_config_t psCcapConf;
RT_ASSERT(args);
psCcapConf = (ccap_config_t)args;
/* Set System Memory Packet Base Address Register */
CCAP_SetPacketBuf(psNuCcap->base, (uint32_t)psCcapConf->sPipeInfo_Packet.pu8FarmAddr);
/* Set System Memory Planar Y Base Address Register */
CCAP_SetPlanarYBuf(psNuCcap->base, (uint32_t)psCcapConf->sPipeInfo_Planar.pu8FarmAddr + u32Offset);
u32Offset = psCcapConf->sPipeInfo_Planar.u32Height * psCcapConf->sPipeInfo_Planar.u32Width;
/* Set System Memory Planar U Base Address Register */
CCAP_SetPlanarUBuf(psNuCcap->base, (uint32_t)psCcapConf->sPipeInfo_Planar.pu8FarmAddr + u32Offset);
u32Offset += ((psCcapConf->sPipeInfo_Planar.u32Height * psCcapConf->sPipeInfo_Planar.u32Width) / 2);
/* Set System Memory Planar V Base Address Register */
CCAP_SetPlanarVBuf(psNuCcap->base, (uint32_t)psCcapConf->sPipeInfo_Planar.pu8FarmAddr + u32Offset);
}
break;
default:
return -RT_ENOSYS;
}

View File

@ -29,6 +29,8 @@ typedef enum
CCAP_CMD_STOP_CAPTURE,
CCAP_CMD_SET_SENCLK,
CCAP_CMD_SET_PIPES,
CCAP_CMD_SET_OPMODE,
CCAP_CMD_SET_BASEADDR,
} ccap_cmd;
typedef struct

View File

@ -165,14 +165,14 @@ void EPWM1P2_IRQHandler(void)
static void nu_epwmcap_isr(nu_epwmcap_t psNuEpwmCap)
{
if (EPWM_GetCaptureIntFlag(psNuEpwmCap->base, psNuEpwmCap->u8Channel) != 0)
if (EPWM_GetCaptureIntFlag(psNuEpwmCap->base, psNuEpwmCap->u8Channel) != 0)
{
/* Calculate pulse width */
if (CalPulseWidth(psNuEpwmCap) == RT_EOK)
{
/* Calculate pulse width */
if (CalPulseWidth(psNuEpwmCap) == RT_EOK)
{
rt_hw_inputcapture_isr(&psNuEpwmCap->parent, psNuEpwmCap->input_data_level);
}
rt_hw_inputcapture_isr(&psNuEpwmCap->parent, psNuEpwmCap->input_data_level);
}
}
}
static rt_err_t CalPulseWidth(nu_epwmcap_t psNuEpwmCap)

View File

@ -242,20 +242,20 @@ static rt_err_t vpost_layer_init(rt_device_t dev)
static void nu_vpost_calculate_fps(void)
{
#define DEF_PERIOD_SEC 10
static uint32_t u32LastTick=0;
static uint32_t u32VSyncBlank=0;
static uint32_t u32UnderRun=0;
#define DEF_PERIOD_SEC 10
static uint32_t u32LastTick = 0;
static uint32_t u32VSyncBlank = 0;
static uint32_t u32UnderRun = 0;
uint32_t u32CurrTick = rt_tick_get();
if ( (u32CurrTick-u32LastTick) > (DEF_PERIOD_SEC*RT_TICK_PER_SECOND) )
if ((u32CurrTick - u32LastTick) > (DEF_PERIOD_SEC * RT_TICK_PER_SECOND))
{
rt_kprintf("VPOST: %d FPS, URPS: %d\n",
(s_u32VSyncBlank-u32VSyncBlank)/DEF_PERIOD_SEC,
(s_u32UnderRun-u32UnderRun)/DEF_PERIOD_SEC);
rt_kprintf("VPOST: %d FPS, URPS: %d\n",
(s_u32VSyncBlank - u32VSyncBlank) / DEF_PERIOD_SEC,
(s_u32UnderRun - u32UnderRun) / DEF_PERIOD_SEC);
u32LastTick = u32CurrTick;
u32VSyncBlank = s_u32VSyncBlank;
u32UnderRun = s_u32UnderRun;
u32UnderRun = s_u32UnderRun;
}
}

View File

@ -13,6 +13,7 @@
#include <rtthread.h>
#include "drv_ccap.h"
#include <dfs_posix.h>
#define DBG_ENABLE
#define DBG_LEVEL DBG_LOG
@ -20,34 +21,51 @@
#define DBG_COLOR
#include <rtdbg.h>
#define THREAD_NAME "ccap_demo"
#define THREAD_PRIORITY 5
#define THREAD_STACK_SIZE 4096
#define THREAD_TIMESLICE 5
#define DEVNAME_LCD "lcd"
#define DEF_CROP_PACKET_RECT
#define DEF_DURATION 5
#define DEF_ENABLE_PLANAR_PIPE 0
#define DEF_DURATION 10
#if defined(BSP_USING_CCAP0) && defined(BSP_USING_CCAP1)
#define DEF_GRID_VIEW 1
#elif defined(BSP_USING_CCAP0) || defined(BSP_USING_CCAP1)
#define DEF_GRID_VIEW 0
#endif
static volatile uint32_t s_u32FrameGrabbed = 0;
static rt_sem_t preview_sem = RT_NULL;
typedef struct
{
char *thread_name;
char *devname_ccap;
char *devname_sensor;
char *devname_lcd;
} ccap_grabber_param;
typedef ccap_grabber_param *ccap_grabber_param_t;
typedef struct
{
ccap_config sCcapConfig;
struct rt_device_graphic_info sLcdInfo;
uint32_t u32CurFBPointer;
uint32_t u32FrameEnd;
rt_sem_t semFrameEnd;
} ccap_grabber_context;
typedef ccap_grabber_context *ccap_grabber_context_t;
static void nu_ccap_event_hook(void *pvData, uint32_t u32EvtMask)
{
ccap_grabber_context_t psGrabberContext = (ccap_grabber_context_t)pvData;
if (u32EvtMask & NU_CCAP_FRAME_END)
{
s_u32FrameGrabbed++;
rt_sem_release(preview_sem);
rt_sem_release(psGrabberContext->semFrameEnd);
}
if (u32EvtMask & NU_CCAP_ADDRESS_MATCH)
{
LOG_E("Address matched");
LOG_I("Address matched");
}
if (u32EvtMask & NU_CCAP_MEMORY_ERROR)
@ -56,41 +74,85 @@ static void nu_ccap_event_hook(void *pvData, uint32_t u32EvtMask)
}
}
static rt_device_t ccap_sensor_init(ccap_config *psCcapConf, const char *pcCcapDevName, const char *pcSensorDevName)
static rt_device_t ccap_sensor_init(ccap_grabber_context_t psGrabberContext, ccap_grabber_param_t psGrabberParam)
{
rt_err_t ret;
ccap_view_info_t psViewInfo;
sensor_mode_info *psSensorModeInfo;
rt_device_t psDevSensor = RT_NULL;
rt_device_t psDevCcap = RT_NULL;
struct rt_device_graphic_info *psLcdInfo = &psGrabberContext->sLcdInfo;
ccap_config_t psCcapConfig = &psGrabberContext->sCcapConfig;
psDevCcap = rt_device_find(pcCcapDevName);
psDevCcap = rt_device_find(psGrabberParam->devname_ccap);
if (psDevCcap == RT_NULL)
{
LOG_E("Can't find %s", pcCcapDevName);
LOG_E("Can't find %s", psGrabberParam->devname_ccap);
goto exit_ccap_sensor_init;
}
psDevSensor = rt_device_find(pcSensorDevName);
psDevSensor = rt_device_find(psGrabberParam->devname_sensor);
if (psDevSensor == RT_NULL)
{
LOG_E("Can't find %s", pcSensorDevName);
LOG_E("Can't find %s", psGrabberParam->devname_sensor);
goto exit_ccap_sensor_init;
}
/* Packet pipe for preview */
if (DEF_GRID_VIEW)
{
psCcapConfig->sPipeInfo_Packet.u32Width = psLcdInfo->width / 2;
psCcapConfig->sPipeInfo_Packet.u32Height = psLcdInfo->height / 2;
psCcapConfig->sPipeInfo_Packet.u32PixFmt = (psLcdInfo->pixel_format == RTGRAPHIC_PIXEL_FORMAT_RGB565) ? CCAP_PAR_OUTFMT_RGB565 : 0;
psCcapConfig->u32Stride_Packet = psLcdInfo->width;
if (!rt_strcmp(psGrabberParam->devname_ccap, "ccap1"))
psCcapConfig->sPipeInfo_Packet.pu8FarmAddr = psLcdInfo->framebuffer + (psCcapConfig->sPipeInfo_Packet.u32Width * 2);
else
psCcapConfig->sPipeInfo_Packet.pu8FarmAddr = psLcdInfo->framebuffer;
}
else
{
psCcapConfig->sPipeInfo_Packet.pu8FarmAddr = psLcdInfo->framebuffer;
psCcapConfig->sPipeInfo_Packet.u32Height = psLcdInfo->height;
psCcapConfig->sPipeInfo_Packet.u32Width = psLcdInfo->width;
psCcapConfig->sPipeInfo_Packet.u32PixFmt = (psLcdInfo->pixel_format == RTGRAPHIC_PIXEL_FORMAT_RGB565) ? CCAP_PAR_OUTFMT_RGB565 : 0;
psCcapConfig->u32Stride_Packet = psLcdInfo->width;
}
/* Planar pipe for encoding */
#if DEF_ENABLE_PLANAR_PIPE
psCcapConfig->sPipeInfo_Planar.u32Width = psLcdInfo->width / 2;
psCcapConfig->sPipeInfo_Planar.u32Height = psLcdInfo->height / 2;
psCcapConfig->sPipeInfo_Planar.pu8FarmAddr = rt_malloc_align(psCcapConfig->sPipeInfo_Planar.u32Height * psCcapConfig->sPipeInfo_Planar.u32Width * 2, 32);
psCcapConfig->sPipeInfo_Planar.u32PixFmt = CCAP_PAR_PLNFMT_YUV422;
psCcapConfig->u32Stride_Planar = psCcapConfig->sPipeInfo_Planar.u32Width;
if (psCcapConfig->sPipeInfo_Planar.pu8FarmAddr == RT_NULL)
{
psCcapConfig->sPipeInfo_Planar.u32Height = 0;
psCcapConfig->sPipeInfo_Planar.u32Width = 0;
psCcapConfig->sPipeInfo_Planar.u32PixFmt = 0;
psCcapConfig->u32Stride_Planar = 0;
}
LOG_I("Planar.FarmAddr@0x%08X", psCcapConfig->sPipeInfo_Planar.pu8FarmAddr);
LOG_I("Planar.FarmWidth: %d", psCcapConfig->sPipeInfo_Planar.u32Width);
LOG_I("Planar.FarmHeight: %d", psCcapConfig->sPipeInfo_Planar.u32Height);
#endif
/* open CCAP */
ret = rt_device_open(psDevCcap, 0);
if (ret != RT_EOK)
{
LOG_E("Can't open %s", pcCcapDevName);
LOG_E("Can't open %s", psGrabberParam->devname_ccap);
goto exit_ccap_sensor_init;
}
/* Find suit mode for packet pipe */
if (psCcapConf->sPipeInfo_Packet.pu8FarmAddr != RT_NULL)
if (psCcapConfig->sPipeInfo_Packet.pu8FarmAddr != RT_NULL)
{
/* Check view window of packet pipe */
psViewInfo = &psCcapConf->sPipeInfo_Packet;
psViewInfo = &psCcapConfig->sPipeInfo_Packet;
if ((rt_device_control(psDevSensor, CCAP_SENSOR_CMD_GET_SUIT_MODE, (void *)&psViewInfo) != RT_EOK)
|| (psViewInfo == RT_NULL))
@ -101,21 +163,21 @@ static rt_device_t ccap_sensor_init(ccap_config *psCcapConf, const char *pcCcapD
}
/* Find suit mode for planner pipe */
if (psCcapConf->sPipeInfo_Planar.pu8FarmAddr != RT_NULL)
if (psCcapConfig->sPipeInfo_Planar.pu8FarmAddr != RT_NULL)
{
int recheck = 1;
if (psViewInfo != RT_NULL)
{
if ((psCcapConf->sPipeInfo_Planar.u32Width <= psViewInfo->u32Width) ||
(psCcapConf->sPipeInfo_Planar.u32Height <= psViewInfo->u32Height))
if ((psCcapConfig->sPipeInfo_Planar.u32Width <= psViewInfo->u32Width) ||
(psCcapConfig->sPipeInfo_Planar.u32Height <= psViewInfo->u32Height))
recheck = 0;
}
if (recheck)
{
/* Check view window of planner pipe */
psViewInfo = &psCcapConf->sPipeInfo_Planar;
psViewInfo = &psCcapConfig->sPipeInfo_Planar;
/* Find suit mode */
if ((rt_device_control(psDevSensor, CCAP_SENSOR_CMD_GET_SUIT_MODE, (void *)&psViewInfo) != RT_EOK)
@ -129,55 +191,65 @@ static rt_device_t ccap_sensor_init(ccap_config *psCcapConf, const char *pcCcapD
#if defined(DEF_CROP_PACKET_RECT)
/* Set cropping rectangle */
if (psViewInfo->u32Width >= psCcapConf->sPipeInfo_Packet.u32Width)
if (psViewInfo->u32Width >= psCcapConfig->sPipeInfo_Packet.u32Width)
{
/* sensor.width >= preview.width */
psCcapConf->sRectCropping.x = (psViewInfo->u32Width - psCcapConf->sPipeInfo_Packet.u32Width) / 2;
psCcapConf->sRectCropping.width = psCcapConf->sPipeInfo_Packet.u32Width;
psCcapConfig->sRectCropping.x = (psViewInfo->u32Width - psCcapConfig->sPipeInfo_Packet.u32Width) / 2;
psCcapConfig->sRectCropping.width = psCcapConfig->sPipeInfo_Packet.u32Width;
}
else
{
/* sensor.width < preview.width */
psCcapConf->sRectCropping.x = 0;
psCcapConf->sRectCropping.width = psViewInfo->u32Width;
psCcapConfig->sRectCropping.x = 0;
psCcapConfig->sRectCropping.width = psViewInfo->u32Width;
}
if (psViewInfo->u32Height >= psCcapConf->sPipeInfo_Packet.u32Height)
if (psViewInfo->u32Height >= psCcapConfig->sPipeInfo_Packet.u32Height)
{
/* sensor.height >= preview.height */
psCcapConf->sRectCropping.y = (psViewInfo->u32Height - psCcapConf->sPipeInfo_Packet.u32Height) / 2;
psCcapConf->sRectCropping.height = psCcapConf->sPipeInfo_Packet.u32Height;
psCcapConfig->sRectCropping.y = (psViewInfo->u32Height - psCcapConfig->sPipeInfo_Packet.u32Height) / 2;
psCcapConfig->sRectCropping.height = psCcapConfig->sPipeInfo_Packet.u32Height;
}
else
{
/* sensor.height < preview.height */
psCcapConf->sRectCropping.y = 0;
psCcapConf->sRectCropping.height = psViewInfo->u32Height;
psCcapConfig->sRectCropping.y = 0;
psCcapConfig->sRectCropping.height = psViewInfo->u32Height;
}
#else
/* Set cropping rectangle */
psCcapConf->sRectCropping.x = 0;
psCcapConf->sRectCropping.y = 0;
psCcapConf->sRectCropping.width = psViewInfo->u32Width;
psCcapConf->sRectCropping.height = psViewInfo->u32Height;
psCcapConfig->sRectCropping.x = 0;
psCcapConfig->sRectCropping.y = 0;
psCcapConfig->sRectCropping.width = psViewInfo->u32Width;
psCcapConfig->sRectCropping.height = psViewInfo->u32Height;
#endif
/* ISR Hook */
psCcapConfig->pfnEvHndler = nu_ccap_event_hook;
psCcapConfig->pvData = (void *)psGrabberContext;
/* Get Suitable mode. */
psSensorModeInfo = (sensor_mode_info *)psViewInfo;
/* Feed CCAP configuration */
ret = rt_device_control(psDevCcap, CCAP_CMD_CONFIG, (void *)psCcapConf);
ret = rt_device_control(psDevCcap, CCAP_CMD_CONFIG, (void *)psCcapConfig);
if (ret != RT_EOK)
{
LOG_E("Can't feed configuration %s", pcCcapDevName);
LOG_E("Can't feed configuration %s", psGrabberParam->devname_ccap);
goto fail_ccap_init;
}
/* speed up pixel clock */
if (rt_device_control(psDevCcap, CCAP_CMD_SET_SENCLK, (void *)&psSensorModeInfo->u32SenClk) != RT_EOK)
{
LOG_E("Can't feed setting.");
goto fail_ccap_init;
int i32SenClk = psSensorModeInfo->u32SenClk;
if (DEF_GRID_VIEW && DEF_ENABLE_PLANAR_PIPE)
i32SenClk = 45000000; /* Bandwidth limitation: Slow down sensor clock */
/* speed up pixel clock */
if (rt_device_control(psDevCcap, CCAP_CMD_SET_SENCLK, (void *)&i32SenClk) != RT_EOK)
{
LOG_E("Can't feed setting.");
goto fail_ccap_init;
}
}
/* Initial CCAP sensor */
@ -197,7 +269,7 @@ static rt_device_t ccap_sensor_init(ccap_config *psCcapConf, const char *pcCcapD
ret = rt_device_control(psDevCcap, CCAP_CMD_SET_PIPES, (void *)psViewInfo);
if (ret != RT_EOK)
{
LOG_E("Can't set pipes %s", pcCcapDevName);
LOG_E("Can't set pipes %s", psGrabberParam->devname_ccap);
goto fail_ccap_init;
}
@ -229,36 +301,67 @@ static void ccap_sensor_fini(rt_device_t psDevCcap, rt_device_t psDevSensor)
rt_device_close(psDevCcap);
}
#if DEF_ENABLE_PLANAR_PIPE
static int ccap_save_planar_frame(char *name, rt_tick_t timestamp, const void *data, size_t size)
{
int fd;
char szFilename[32];
int wrote_size = 0;
rt_snprintf(szFilename, sizeof(szFilename), "/%s-%08d.yuv", name, timestamp);
fd = open(szFilename, O_WRONLY | O_CREAT);
if (fd < 0)
{
LOG_E("Could not open %s for writing.", szFilename);
goto exit_ccap_save_planar_frame;
}
if ((wrote_size = write(fd, data, size)) != size)
{
LOG_E("Could not write to %s (%d != %d).", szFilename, wrote_size, size);
goto exit_ccap_save_planar_frame;
}
wrote_size = size;
exit_ccap_save_planar_frame:
if (fd >= 0)
close(fd);
return wrote_size;
}
#endif
static void ccap_grabber(void *parameter)
{
rt_err_t ret;
ccap_grabber_param_t psGrabberParam = (ccap_grabber_param_t)parameter;
ccap_grabber_context sGrabberContext;
rt_device_t psDevLcd;
struct rt_device_graphic_info sLcdInfo;
rt_device_t psDevCcap = RT_NULL;
rt_device_t psDevLcd = RT_NULL;
ccap_config sCcapConfig;
rt_tick_t last_tick;
rt_tick_t last, now;
rt_bool_t bDrawDirect;
rt_bool_t i32PingPong = 0;
rt_device_t psDevCcap0 = RT_NULL;
rt_device_t psDevCcap1 = RT_NULL;
rt_memset((void *)&sGrabberContext, 0, sizeof(ccap_grabber_context));
psDevLcd = rt_device_find(DEVNAME_LCD);
psDevLcd = rt_device_find(psGrabberParam->devname_lcd);
if (psDevLcd == RT_NULL)
{
LOG_E("Can't find %s", DEVNAME_LCD);
LOG_E("Can't find %s", psGrabberParam->devname_lcd);
goto exit_ccap_grabber;
}
ret = rt_device_control(psDevLcd, RTGRAPHIC_CTRL_GET_INFO, &sLcdInfo);
ret = rt_device_control(psDevLcd, RTGRAPHIC_CTRL_GET_INFO, &sGrabberContext.sLcdInfo);
if (ret != RT_EOK)
{
LOG_E("Can't get LCD info %s", DEVNAME_LCD);
LOG_E("Can't get LCD info %s", psGrabberParam->devname_lcd);
goto exit_ccap_grabber;
}
if (rt_device_control(psDevLcd, RTGRAPHIC_CTRL_PAN_DISPLAY, (void *)sLcdInfo.framebuffer) == RT_EOK)
if (rt_device_control(psDevLcd, RTGRAPHIC_CTRL_PAN_DISPLAY, (void *)sGrabberContext.sLcdInfo.framebuffer) == RT_EOK)
{
/* Sync-type LCD panel, will draw to VRAM directly. */
bDrawDirect = RT_TRUE;
@ -270,98 +373,51 @@ static void ccap_grabber(void *parameter)
}
LOG_I("LCD Type: %s-type", bDrawDirect ? "Sync" : "MPU");
LOG_I("LCD Width: %d", sLcdInfo.width);
LOG_I("LCD Height: %d", sLcdInfo.height);
LOG_I("LCD bpp:%d", sLcdInfo.bits_per_pixel);
LOG_I("LCD pixel format:%d", sLcdInfo.pixel_format);
LOG_I("LCD frame buffer@0x%08x", sLcdInfo.framebuffer);
LOG_I("LCD frame buffer size:%d", sLcdInfo.smem_len);
LOG_I("LCD Width: %d", sGrabberContext.sLcdInfo.width);
LOG_I("LCD Height: %d", sGrabberContext.sLcdInfo.height);
LOG_I("LCD bpp:%d", sGrabberContext.sLcdInfo.bits_per_pixel);
LOG_I("LCD pixel format:%d", sGrabberContext.sLcdInfo.pixel_format);
LOG_I("LCD frame buffer@0x%08x", sGrabberContext.sLcdInfo.framebuffer);
LOG_I("LCD frame buffer size:%d", sGrabberContext.sLcdInfo.smem_len);
/* Packet pipe for preview */
if (DEF_GRID_VIEW)
sGrabberContext.semFrameEnd = rt_sem_create(psGrabberParam->devname_ccap, 0, RT_IPC_FLAG_FIFO);
if (sGrabberContext.semFrameEnd == RT_NULL)
{
sCcapConfig.sPipeInfo_Packet.pu8FarmAddr = sLcdInfo.framebuffer;
sCcapConfig.sPipeInfo_Packet.u32Height = sLcdInfo.height / 2;
sCcapConfig.sPipeInfo_Packet.u32Width = sLcdInfo.width / 2;
sCcapConfig.sPipeInfo_Packet.u32PixFmt = (sLcdInfo.pixel_format == RTGRAPHIC_PIXEL_FORMAT_RGB565) ? CCAP_PAR_OUTFMT_RGB565 : 0;
sCcapConfig.u32Stride_Packet = sLcdInfo.width;
}
else
{
sCcapConfig.sPipeInfo_Packet.pu8FarmAddr = sLcdInfo.framebuffer;
sCcapConfig.sPipeInfo_Packet.u32Height = sLcdInfo.height;
sCcapConfig.sPipeInfo_Packet.u32Width = sLcdInfo.width;
sCcapConfig.sPipeInfo_Packet.u32PixFmt = (sLcdInfo.pixel_format == RTGRAPHIC_PIXEL_FORMAT_RGB565) ? CCAP_PAR_OUTFMT_RGB565 : 0;
sCcapConfig.u32Stride_Packet = sLcdInfo.width;
LOG_E("Can't allocate sem resource %s", psGrabberParam->devname_ccap);
goto exit_ccap_grabber;
}
/* Planar pipe for encoding */
sCcapConfig.sPipeInfo_Planar.pu8FarmAddr = RT_NULL;
sCcapConfig.sPipeInfo_Planar.u32Height = 0;
sCcapConfig.sPipeInfo_Planar.u32Width = 0;
sCcapConfig.sPipeInfo_Planar.u32PixFmt = 0;
sCcapConfig.u32Stride_Planar = 0;
preview_sem = rt_sem_create("cdsem", 0, RT_IPC_FLAG_FIFO);
/* ISR Hook */
sCcapConfig.pfnEvHndler = nu_ccap_event_hook;
sCcapConfig.pvData = (void *)&sCcapConfig;
/* initial ccap0 & sensor0 */
#if defined(BSP_USING_CCAP0)
psDevCcap0 = ccap_sensor_init(&sCcapConfig, "ccap0", "sensor0");
if (psDevCcap0 == RT_NULL)
/* initial ccap & sensor*/
psDevCcap = ccap_sensor_init(&sGrabberContext, psGrabberParam);
if (psDevCcap == RT_NULL)
{
LOG_E("Can't init ccap and sensor");
LOG_E("Can't init %s and %s", psGrabberParam->devname_ccap, psGrabberParam->devname_sensor);
goto exit_ccap_grabber;
}
/* Start to capture */
if (rt_device_control(psDevCcap0, CCAP_CMD_START_CAPTURE, RT_NULL) != RT_EOK)
if (rt_device_control(psDevCcap, CCAP_CMD_START_CAPTURE, RT_NULL) != RT_EOK)
{
LOG_E("Can't start ccap0 capture.");
LOG_E("Can't start %s", psGrabberParam->devname_ccap);
goto exit_ccap_grabber;
}
#endif
/* initial ccap1 & sensor1 */
#if defined(BSP_USING_CCAP1)
if (DEF_GRID_VIEW)
sCcapConfig.sPipeInfo_Packet.pu8FarmAddr += (sCcapConfig.sPipeInfo_Packet.u32Width * 2);
psDevCcap1 = ccap_sensor_init(&sCcapConfig, "ccap1", "sensor1");
if (psDevCcap1 == RT_NULL)
{
LOG_E("Can't init ccap and sensor");
goto exit_ccap_grabber;
}
#if !defined(BSP_USING_CCAP0) || defined(DEF_GRID_VIEW)
/* Start to capture */
if (rt_device_control(psDevCcap1, CCAP_CMD_START_CAPTURE, RT_NULL) != RT_EOK)
{
LOG_E("Can't start ccap1 capture.");
goto exit_ccap_grabber;
}
if (!DEF_GRID_VIEW)
i32PingPong = 1;
#endif
#endif
/* open lcd */
ret = rt_device_open(psDevLcd, 0);
if (ret != RT_EOK)
{
LOG_E("Can't open %s", DEVNAME_LCD);
LOG_E("Can't open %s", psGrabberParam->devname_lcd);
goto exit_ccap_grabber;
}
last_tick = rt_tick_get();
last = now = rt_tick_get();
while (1)
{
rt_sem_take(preview_sem, RT_WAITING_FOREVER);
if (sGrabberContext.semFrameEnd)
{
rt_sem_take(sGrabberContext.semFrameEnd, RT_WAITING_FOREVER);
}
if (!bDrawDirect)
{
//MPU type
@ -370,78 +426,77 @@ static void ccap_grabber(void *parameter)
/* Update fullscreen region. */
sRectInfo.x = 0;
sRectInfo.y = 0;
sRectInfo.height = sLcdInfo.height;
sRectInfo.width = sLcdInfo.width;
sRectInfo.height = sGrabberContext.sLcdInfo.height;
sRectInfo.width = sGrabberContext.sLcdInfo.width;
rt_device_control(psDevLcd, RTGRAPHIC_CTRL_RECT_UPDATE, &sRectInfo);
}
else
{
// Sync type
int i32FBSize = sGrabberContext.sLcdInfo.width * sGrabberContext.sLcdInfo.height * (sGrabberContext.sLcdInfo.bits_per_pixel / 8);
int i32VRAMPiece = sGrabberContext.sLcdInfo.smem_len / i32FBSize;
ccap_config sCcapConfig = {0};
// Pan to next view by grab0
if (!DEF_GRID_VIEW || !rt_strcmp(psGrabberParam->thread_name, "grab0"))
{
uint32_t u32BufPtr = (uint32_t)sGrabberContext.sCcapConfig.sPipeInfo_Packet.pu8FarmAddr
+ (sGrabberContext.u32FrameEnd % i32VRAMPiece) * i32FBSize;
rt_device_control(psDevLcd, RTGRAPHIC_CTRL_PAN_DISPLAY, (void *)u32BufPtr);
}
sCcapConfig.sPipeInfo_Packet.pu8FarmAddr = sGrabberContext.sCcapConfig.sPipeInfo_Packet.pu8FarmAddr
+ ((sGrabberContext.u32FrameEnd + 1) % i32VRAMPiece) * i32FBSize ;
#if DEF_ENABLE_PLANAR_PIPE
sCcapConfig.sPipeInfo_Planar.pu8FarmAddr = sGrabberContext.sCcapConfig.sPipeInfo_Planar.pu8FarmAddr;
sCcapConfig.sPipeInfo_Planar.u32Width = sGrabberContext.sCcapConfig.sPipeInfo_Planar.u32Width;
sCcapConfig.sPipeInfo_Planar.u32Height = sGrabberContext.sCcapConfig.sPipeInfo_Planar.u32Height;
sCcapConfig.sPipeInfo_Planar.u32PixFmt = sGrabberContext.sCcapConfig.sPipeInfo_Planar.u32PixFmt;
#endif
rt_device_control(psDevCcap, CCAP_CMD_SET_BASEADDR, &sCcapConfig);
#if DEF_ENABLE_PLANAR_PIPE
{
int OpModeShutter = 1;
/* One-shot mode, trigger next frame */
rt_device_control(psDevCcap, CCAP_CMD_SET_OPMODE, &OpModeShutter);
}
#endif
}
sGrabberContext.u32FrameEnd++;
/* FPS */
if ((rt_tick_get() - last_tick) >= (DEF_DURATION * 1000))
now = rt_tick_get();
if ((now - last) >= (DEF_DURATION * 1000))
{
if (i32PingPong == 0)
{
if (!DEF_GRID_VIEW)
LOG_I("%s: %d FPS", psDevCcap0->parent.name, (s_u32FrameGrabbed / DEF_DURATION));
if (!DEF_GRID_VIEW && psDevCcap0 && psDevCcap1)
{
rt_device_control(psDevCcap0, CCAP_CMD_STOP_CAPTURE, RT_NULL);
rt_device_control(psDevCcap1, CCAP_CMD_START_CAPTURE, RT_NULL);
}
}
else if (i32PingPong == 1)
{
if (!DEF_GRID_VIEW)
LOG_I("%s: %d FPS", psDevCcap1->parent.name, (s_u32FrameGrabbed / DEF_DURATION));
if (!DEF_GRID_VIEW && psDevCcap0 && psDevCcap1)
{
rt_device_control(psDevCcap1, CCAP_CMD_STOP_CAPTURE, RT_NULL);
rt_device_control(psDevCcap0, CCAP_CMD_START_CAPTURE, RT_NULL);
}
}
if (DEF_GRID_VIEW)
LOG_I("GridView: %s+%s: %d FPS", psDevCcap0->parent.name,
psDevCcap1->parent.name,
(s_u32FrameGrabbed / DEF_DURATION) / 2);
/* Ping-pong rendering */
if (!DEF_GRID_VIEW && psDevCcap0 && psDevCcap1)
i32PingPong = (i32PingPong + 1) % 2;
s_u32FrameGrabbed = 0;
last_tick = rt_tick_get();
#if DEF_ENABLE_PLANAR_PIPE
ccap_save_planar_frame(psGrabberParam->thread_name, now, (const void *)sGrabberContext.sCcapConfig.sPipeInfo_Planar.pu8FarmAddr, sGrabberContext.sCcapConfig.sPipeInfo_Planar.u32Width * sGrabberContext.sCcapConfig.sPipeInfo_Planar.u32Height * 2);
#endif
LOG_I("%s: %d FPS", psGrabberParam->devname_ccap, sGrabberContext.u32FrameEnd / DEF_DURATION);
sGrabberContext.u32FrameEnd = 0;
last = now;
}
}
exit_ccap_grabber:
#if defined(BSP_USING_CCAP0)
ccap_sensor_fini(rt_device_find("ccap0"), rt_device_find("sensor0"));
#endif
#if defined(BSP_USING_CCAP1)
ccap_sensor_fini(rt_device_find("ccap1"), rt_device_find("sensor1"));
#endif
ccap_sensor_fini(rt_device_find(psGrabberParam->devname_ccap), rt_device_find(psGrabberParam->devname_sensor));
rt_device_close(psDevLcd);
return;
}
int ccap_demo(void)
static void ccap_grabber_create(ccap_grabber_param_t psGrabberParam)
{
rt_thread_t ccap_thread = rt_thread_find(THREAD_NAME);
rt_thread_t ccap_thread = rt_thread_find(psGrabberParam->thread_name);
if (ccap_thread == RT_NULL)
{
ccap_thread = rt_thread_create(THREAD_NAME,
ccap_thread = rt_thread_create(psGrabberParam->thread_name,
ccap_grabber,
RT_NULL,
psGrabberParam,
THREAD_STACK_SIZE,
THREAD_PRIORITY,
THREAD_TIMESLICE);
@ -449,7 +504,18 @@ int ccap_demo(void)
if (ccap_thread != RT_NULL)
rt_thread_startup(ccap_thread);
}
}
int ccap_demo(void)
{
#if defined(BSP_USING_CCAP0)
static ccap_grabber_param ccap0_grabber_param = {"grab0", "ccap0", "sensor0", "lcd"};
ccap_grabber_create(&ccap0_grabber_param);
#endif
#if defined(BSP_USING_CCAP1)
static ccap_grabber_param ccap1_grabber_param = {"grab1", "ccap1", "sensor1", "lcd"};
ccap_grabber_create(&ccap1_grabber_param);
#endif
return 0;
}
MSH_CMD_EXPORT(ccap_demo, camera capture demo);

View File

@ -1,14 +1,13 @@
Import('RTT_ROOT')
from building import *
cwd = GetCurrentDir()
group = []
if GetDepend('NU_PKG_USING_DEMO'):
src = Split("""
CPPPATH = [cwd]
src = Split("""
usbd_hid_dance_mouse.c
slcd_show_tick.c
usbd_cdc_vcom_echo.c
atdev_utils.c
""")
CPPPATH = [cwd]
group = DefineGroup('nu_pkgs_demo', src, depend = [''], CPPPATH = CPPPATH)
group = DefineGroup('nu_pkgs_demo', src, depend = ['NU_PKG_USING_DEMO'], CPPPATH = CPPPATH)
Return('group')

View File

@ -0,0 +1,48 @@
/**************************************************************************//**
*
* @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-9-19 Wayne First version
*
******************************************************************************/
#include <rtthread.h>
#if defined(PKG_USING_AT_DEVICE)
#include <at_device.h>
static void at_wifi_set(int argc, char **argv)
{
struct at_device_ssid_pwd sATDConf;
struct at_device *at_dev = RT_NULL;
/* If the number of arguments less than 2 */
if (argc != 3)
{
rt_kprintf("\n");
rt_kprintf("at_wifi_set <ssid> <password>\n");
return ;
}
sATDConf.ssid = argv[1]; //ssid
sATDConf.password = argv[2]; //password
if ((at_dev = at_device_get_first_initialized()) != RT_NULL)
at_device_control(at_dev, AT_DEVICE_CTRL_SET_WIFI_INFO, &sATDConf);
else
{
rt_kprintf("Can't find any initialized AT device.\n");
}
}
#ifdef FINSH_USING_MSH
MSH_CMD_EXPORT(at_wifi_set, AT device wifi set ssid / password function);
#endif
#endif /* #if defined(PKG_USING_AT_DEVICE) */

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 KiB

View File

@ -92,10 +92,10 @@ static void tpc_entry(void *parameter)
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
#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);

View File

@ -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=0x50000
CONFIG_ARCH_ARM=y
# CONFIG_RT_USING_CPU_FFS is not set
CONFIG_ARCH_ARM_ARM9=y
@ -423,23 +423,8 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_RW007 is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
CONFIG_PKG_USING_NETUTILS=y
CONFIG_PKG_NETUTILS_PATH="/packages/iot/netutils"
CONFIG_PKG_NETUTILS_TFTP=y
CONFIG_PKG_NETUTILS_IPERF=y
# CONFIG_PKG_NETUTILS_NETIO is not set
CONFIG_PKG_NETUTILS_NTP=y
CONFIG_NTP_USING_AUTO_SYNC=y
CONFIG_NTP_AUTO_SYNC_FIRST_DELAY=30
CONFIG_NTP_AUTO_SYNC_PERIOD=3600
CONFIG_NETUTILS_NTP_HOSTNAME="0.tw.pool.ntp.org"
CONFIG_NETUTILS_NTP_HOSTNAME2="1.tw.pool.ntp.org"
CONFIG_NETUTILS_NTP_HOSTNAME3="2.tw.pool.ntp.org"
# CONFIG_PKG_NETUTILS_TELNET is not set
# CONFIG_PKG_NETUTILS_TCPDUMP is not set
CONFIG_PKG_USING_NETUTILS_LATEST_VERSION=y
CONFIG_PKG_NETUTILS_VER="latest"
CONFIG_PKG_NETUTILS_VER_NUM=0x99999
# CONFIG_PKG_USING_NETUTILS is not set
# CONFIG_PKG_USING_NETUTILS_LATEST_VERSION is not set
# CONFIG_PKG_USING_CMUX is not set
# CONFIG_PKG_USING_PPP_DEVICE is not set
# CONFIG_PKG_USING_AT_DEVICE is not set
@ -881,66 +866,6 @@ CONFIG_PKG_OPTPARSE_VER="latest"
# CONFIG_PKG_USING_MFBD is not set
# CONFIG_PKG_USING_SLCAN2RTT is not set
# CONFIG_PKG_USING_SOEM is not set
# CONFIG_PKG_USING_QPARAM is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
# CONFIG_PKG_USING_MPLAYER is not set
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
# CONFIG_PKG_USING_JS_PERSIMMON is not set
# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_MDNS is not set
# CONFIG_PKG_USING_UPNP is not set
# CONFIG_PKG_USING_WICED is not set
# CONFIG_PKG_USING_CLOUDSDK is not set
# CONFIG_PKG_USING_POWER_MANAGER is not set
# CONFIG_PKG_USING_RT_OTA is not set
# CONFIG_PKG_USING_RTINSIGHT is not set
# CONFIG_PKG_USING_SMARTCONFIG is not set
# CONFIG_PKG_USING_RTX is not set
# CONFIG_RT_USING_TESTCASE is not set
# CONFIG_PKG_USING_NGHTTP2 is not set
# CONFIG_PKG_USING_AVS is not set
# CONFIG_PKG_USING_ALI_LINKKIT is not set
# CONFIG_PKG_USING_STS is not set
# CONFIG_PKG_USING_DLMS is not set
# CONFIG_PKG_USING_AUDIO_FRAMEWORK is not set
# CONFIG_PKG_USING_ZBAR is not set
# CONFIG_PKG_USING_MCF is not set
# CONFIG_PKG_USING_URPC is not set
# CONFIG_PKG_USING_DCM is not set
# CONFIG_PKG_USING_EMQ is not set
# CONFIG_PKG_USING_CFGM is not set
# CONFIG_PKG_USING_RT_CMSIS_DAP is not set
# CONFIG_PKG_USING_SMODULE is not set
# CONFIG_PKG_USING_SNFD is not set
# CONFIG_PKG_USING_UDBD is not set
# CONFIG_PKG_USING_BENCHMARK is not set
# CONFIG_PKG_USING_UBJSON is not set
# CONFIG_PKG_USING_DATATYPE is not set
# CONFIG_PKG_USING_FASTFS is not set
# CONFIG_PKG_USING_RIL is not set
# CONFIG_PKG_USING_WATCH_DCM_SVC is not set
# CONFIG_PKG_USING_WATCH_APP_FWK is not set
# CONFIG_PKG_USING_GUI_TEST is not set
# CONFIG_PKG_USING_PMEM is not set
# CONFIG_PKG_USING_LWRDP is not set
# CONFIG_PKG_USING_MASAN is not set
# CONFIG_PKG_USING_BSDIFF_LIB is not set
# CONFIG_PKG_USING_PRC_DIFF is not set
#
# RT-Thread Smart
#
# CONFIG_PKG_USING_UKERNEL is not set
# CONFIG_PKG_USING_TRACE_AGENT is not set
#
# Hardware Drivers Config
@ -1060,6 +985,7 @@ CONFIG_NU_PKG_USING_DEMO=y
# 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_NCT7717U is not set
# CONFIG_NU_PKG_USING_NAU88L25 is not set
CONFIG_NU_PKG_USING_NAU8822=y
# CONFIG_NU_PKG_USING_DA9062 is not set
@ -1069,3 +995,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

View File

@ -254,35 +254,6 @@ static int rt_hw_esp8266_port(void)
(void *) esp8266);
}
INIT_APP_EXPORT(rt_hw_esp8266_port);
static int at_wifi_set(int argc, char **argv)
{
struct at_device_ssid_pwd sATDConf;
struct at_device *at_dev = RT_NULL;
/* If the number of arguments less than 2 */
if (argc != 3)
{
rt_kprintf("\n");
rt_kprintf("at_wifi_set <ssid> <password>\n");
return -1;
}
sATDConf.ssid = argv[1]; //ssid
sATDConf.password = argv[2]; //password
if ((at_dev = at_device_get_first_initialized()) != RT_NULL)
at_device_control(at_dev, AT_DEVICE_CTRL_SET_WIFI_INFO, &sATDConf);
else
{
rt_kprintf("Can't find any initialized AT device.\n");
}
return 0;
}
#ifdef FINSH_USING_MSH
MSH_CMD_EXPORT(at_wifi_set, AT device wifi set ssid / password function);
#endif
#endif /* BOARD_USING_ESP8266 */

View File

@ -85,8 +85,8 @@ static void nu_pin_can_init(void)
static void nu_pin_adc_init(void)
{
#if defined(BSP_USING_ADC_TOUCH)
GPIO_SetMode(PB, BIT4|BIT5|BIT6|BIT7, GPIO_MODE_INPUT);
GPIO_DISABLE_DIGITAL_PATH(PB, BIT4|BIT5|BIT6|BIT7);
GPIO_SetMode(PB, BIT4 | BIT5 | BIT6 | BIT7, GPIO_MODE_INPUT);
GPIO_DISABLE_DIGITAL_PATH(PB, BIT4 | BIT5 | BIT6 | BIT7);
#endif
}

View File

@ -165,7 +165,6 @@ CONFIG_RT_USING_SERIAL_V1=y
CONFIG_RT_SERIAL_RB_BUFSZ=2048
CONFIG_RT_USING_CAN=y
# CONFIG_RT_CAN_USING_HDR is not set
# CONFIG_RT_CAN_USING_CANFD is not set
CONFIG_RT_USING_HWTIMER=y
# CONFIG_RT_USING_CPUTIME is not set
CONFIG_RT_USING_I2C=y
@ -491,7 +490,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_RAPIDJSON is not set
# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_AGILE_JSMN is not set
# CONFIG_PKG_USING_PARSON is not set
#
# XML: Extensible Markup Language
@ -517,15 +515,10 @@ CONFIG_PKG_LVGL_PATH="/packages/multimedia/LVGL/LVGL"
CONFIG_PKG_LVGL_THREAD_PRIO=20
CONFIG_PKG_LVGL_THREAD_STACK_SIZE=4096
CONFIG_PKG_LVGL_DISP_REFR_PERIOD=30
# CONFIG_PKG_USING_LVGL_SQUARELINE is not set
# CONFIG_PKG_LVGL_USING_EXAMPLES is not set
CONFIG_PKG_LVGL_USING_DEMOS=y
# CONFIG_PKG_LVGL_USING_V08020 is not set
# CONFIG_PKG_LVGL_USING_V08030 is not set
CONFIG_PKG_LVGL_USING_V08031=y
# CONFIG_PKG_LVGL_USING_LATEST_VERSION is not set
CONFIG_PKG_LVGL_VER_NUM=0x08031
CONFIG_PKG_LVGL_VER="v8.3.1"
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
@ -606,7 +599,6 @@ CONFIG_PKG_LVGL_VER="v8.3.1"
# CONFIG_PKG_USING_SNOWFLAKE is not set
# CONFIG_PKG_USING_HASH_MATCH is not set
# CONFIG_PKG_USING_FIRE_PID_CURVE is not set
# CONFIG_PKG_USING_ARMV7M_DWT_TOOL is not set
#
# system packages
@ -619,6 +611,14 @@ CONFIG_PKG_LVGL_VER="v8.3.1"
# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
#
# POSIX extension functions
#
# CONFIG_PKG_USING_POSIX_GETLINE is not set
# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
# CONFIG_PKG_USING_POSIX_ITOA is not set
# CONFIG_PKG_USING_POSIX_STRINGS is not set
#
# acceleration: Assembly language or algorithmic acceleration packages
#
@ -643,11 +643,9 @@ CONFIG_PKG_LVGL_VER="v8.3.1"
# 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_FREERTOS_WRAPPER 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_PERF_COUNTER is not set
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
@ -689,10 +687,8 @@ CONFIG_PKG_RAMDISK_VER="latest"
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_SHT3X is not set
# CONFIG_PKG_USING_ADT74XX is not set
# CONFIG_PKG_USING_AS7341 is not set
# CONFIG_PKG_USING_STM32_SDIO is not set
# CONFIG_PKG_USING_ESP_IDF is not set
# CONFIG_PKG_USING_ICM20608 is not set
# CONFIG_PKG_USING_BUTTON is not set
# CONFIG_PKG_USING_PCF8574 is not set
@ -704,11 +700,6 @@ CONFIG_PKG_RAMDISK_VER="latest"
# CONFIG_PKG_USING_NRF5X_SDK is not set
# CONFIG_PKG_USING_NRFX is not set
# CONFIG_PKG_USING_WM_LIBRARIES is not set
#
# Kendryte SDK
#
# CONFIG_PKG_USING_K210_SDK 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
@ -769,8 +760,6 @@ CONFIG_PKG_RAMDISK_VER="latest"
# CONFIG_PKG_USING_MB85RS16 is not set
# CONFIG_PKG_USING_CW2015 is not set
# CONFIG_PKG_USING_RFM300 is not set
# CONFIG_PKG_USING_IO_INPUT_FILTER is not set
# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set
#
# AI packages
@ -846,66 +835,6 @@ CONFIG_PKG_RAMDISK_VER="latest"
# CONFIG_PKG_USING_MFBD is not set
# CONFIG_PKG_USING_SLCAN2RTT is not set
# CONFIG_PKG_USING_SOEM is not set
# CONFIG_PKG_USING_QPARAM is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
# CONFIG_PKG_USING_MPLAYER is not set
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
# CONFIG_PKG_USING_JS_PERSIMMON is not set
# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_MDNS is not set
# CONFIG_PKG_USING_UPNP is not set
# CONFIG_PKG_USING_WICED is not set
# CONFIG_PKG_USING_CLOUDSDK is not set
# CONFIG_PKG_USING_POWER_MANAGER is not set
# CONFIG_PKG_USING_RT_OTA is not set
# CONFIG_PKG_USING_RTINSIGHT is not set
# CONFIG_PKG_USING_SMARTCONFIG is not set
# CONFIG_PKG_USING_RTX is not set
# CONFIG_RT_USING_TESTCASE is not set
# CONFIG_PKG_USING_NGHTTP2 is not set
# CONFIG_PKG_USING_AVS is not set
# CONFIG_PKG_USING_ALI_LINKKIT is not set
# CONFIG_PKG_USING_STS is not set
# CONFIG_PKG_USING_DLMS is not set
# CONFIG_PKG_USING_AUDIO_FRAMEWORK is not set
# CONFIG_PKG_USING_ZBAR is not set
# CONFIG_PKG_USING_MCF is not set
# CONFIG_PKG_USING_URPC is not set
# CONFIG_PKG_USING_DCM is not set
# CONFIG_PKG_USING_EMQ is not set
# CONFIG_PKG_USING_CFGM is not set
# CONFIG_PKG_USING_RT_CMSIS_DAP is not set
# CONFIG_PKG_USING_SMODULE is not set
# CONFIG_PKG_USING_SNFD is not set
# CONFIG_PKG_USING_UDBD is not set
# CONFIG_PKG_USING_BENCHMARK is not set
# CONFIG_PKG_USING_UBJSON is not set
# CONFIG_PKG_USING_DATATYPE is not set
# CONFIG_PKG_USING_FASTFS is not set
# CONFIG_PKG_USING_RIL is not set
# CONFIG_PKG_USING_WATCH_DCM_SVC is not set
# CONFIG_PKG_USING_WATCH_APP_FWK is not set
# CONFIG_PKG_USING_GUI_TEST is not set
# CONFIG_PKG_USING_PMEM is not set
# CONFIG_PKG_USING_LWRDP is not set
# CONFIG_PKG_USING_MASAN is not set
# CONFIG_PKG_USING_BSDIFF_LIB is not set
# CONFIG_PKG_USING_PRC_DIFF is not set
#
# RT-Thread Smart
#
# CONFIG_PKG_USING_UKERNEL is not set
# CONFIG_PKG_USING_TRACE_AGENT is not set
#
# Hardware Drivers Config

View File

@ -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=0x50000
CONFIG_ARCH_ARM=y
# CONFIG_RT_USING_CPU_FFS is not set
CONFIG_ARCH_ARM_ARM9=y
@ -429,23 +429,8 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_RW007 is not set
# CONFIG_PKG_USING_COAP is not set
# CONFIG_PKG_USING_NOPOLL is not set
CONFIG_PKG_USING_NETUTILS=y
CONFIG_PKG_NETUTILS_PATH="/packages/iot/netutils"
CONFIG_PKG_NETUTILS_TFTP=y
CONFIG_PKG_NETUTILS_IPERF=y
# CONFIG_PKG_NETUTILS_NETIO is not set
CONFIG_PKG_NETUTILS_NTP=y
CONFIG_NTP_USING_AUTO_SYNC=y
CONFIG_NTP_AUTO_SYNC_FIRST_DELAY=30
CONFIG_NTP_AUTO_SYNC_PERIOD=3600
CONFIG_NETUTILS_NTP_HOSTNAME="0.tw.pool.ntp.org"
CONFIG_NETUTILS_NTP_HOSTNAME2="1.tw.pool.ntp.org"
CONFIG_NETUTILS_NTP_HOSTNAME3="2.tw.pool.ntp.org"
# CONFIG_PKG_NETUTILS_TELNET is not set
# CONFIG_PKG_NETUTILS_TCPDUMP is not set
CONFIG_PKG_USING_NETUTILS_LATEST_VERSION=y
CONFIG_PKG_NETUTILS_VER="latest"
CONFIG_PKG_NETUTILS_VER_NUM=0x99999
# CONFIG_PKG_USING_NETUTILS is not set
# CONFIG_PKG_USING_NETUTILS_LATEST_VERSION is not set
# CONFIG_PKG_USING_CMUX is not set
# CONFIG_PKG_USING_PPP_DEVICE is not set
# CONFIG_PKG_USING_AT_DEVICE is not set
@ -870,66 +855,6 @@ CONFIG_PKG_OPTPARSE_VER="latest"
# CONFIG_PKG_USING_MFBD is not set
# CONFIG_PKG_USING_SLCAN2RTT is not set
# CONFIG_PKG_USING_SOEM is not set
# CONFIG_PKG_USING_QPARAM is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
# CONFIG_PKG_USING_MPLAYER is not set
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
# CONFIG_PKG_USING_JS_PERSIMMON is not set
# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_MDNS is not set
# CONFIG_PKG_USING_UPNP is not set
# CONFIG_PKG_USING_WICED is not set
# CONFIG_PKG_USING_CLOUDSDK is not set
# CONFIG_PKG_USING_POWER_MANAGER is not set
# CONFIG_PKG_USING_RT_OTA is not set
# CONFIG_PKG_USING_RTINSIGHT is not set
# CONFIG_PKG_USING_SMARTCONFIG is not set
# CONFIG_PKG_USING_RTX is not set
# CONFIG_RT_USING_TESTCASE is not set
# CONFIG_PKG_USING_NGHTTP2 is not set
# CONFIG_PKG_USING_AVS is not set
# CONFIG_PKG_USING_ALI_LINKKIT is not set
# CONFIG_PKG_USING_STS is not set
# CONFIG_PKG_USING_DLMS is not set
# CONFIG_PKG_USING_AUDIO_FRAMEWORK is not set
# CONFIG_PKG_USING_ZBAR is not set
# CONFIG_PKG_USING_MCF is not set
# CONFIG_PKG_USING_URPC is not set
# CONFIG_PKG_USING_DCM is not set
# CONFIG_PKG_USING_EMQ is not set
# CONFIG_PKG_USING_CFGM is not set
# CONFIG_PKG_USING_RT_CMSIS_DAP is not set
# CONFIG_PKG_USING_SMODULE is not set
# CONFIG_PKG_USING_SNFD is not set
# CONFIG_PKG_USING_UDBD is not set
# CONFIG_PKG_USING_BENCHMARK is not set
# CONFIG_PKG_USING_UBJSON is not set
# CONFIG_PKG_USING_DATATYPE is not set
# CONFIG_PKG_USING_FASTFS is not set
# CONFIG_PKG_USING_RIL is not set
# CONFIG_PKG_USING_WATCH_DCM_SVC is not set
# CONFIG_PKG_USING_WATCH_APP_FWK is not set
# CONFIG_PKG_USING_GUI_TEST is not set
# CONFIG_PKG_USING_PMEM is not set
# CONFIG_PKG_USING_LWRDP is not set
# CONFIG_PKG_USING_MASAN is not set
# CONFIG_PKG_USING_BSDIFF_LIB is not set
# CONFIG_PKG_USING_PRC_DIFF is not set
#
# RT-Thread Smart
#
# CONFIG_PKG_USING_UKERNEL is not set
# CONFIG_PKG_USING_TRACE_AGENT is not set
#
# Hardware Drivers Config
@ -1040,6 +965,7 @@ CONFIG_NU_PKG_USING_DEMO=y
# 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_NCT7717U is not set
# CONFIG_NU_PKG_USING_NAU88L25 is not set
# CONFIG_NU_PKG_USING_NAU8822 is not set
# CONFIG_NU_PKG_USING_DA9062 is not set
@ -1049,3 +975,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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
mainmenu "RT-Thread Configuration"
config BSP_DIR
string
option env="BSP_ROOT"
default "."
config RTT_DIR
string
option env="RTT_ROOT"
default "../../.."
# you can change the RTT_ROOT default "../../.." to your rtthread_root,
# example : default "F:/git_repositories/rt-thread"
config PKGS_DIR
string
option env="PKGS_ROOT"
default "packages"
source "$RTT_DIR/Kconfig"
source "$PKGS_DIR/Kconfig"
source "$BSP_DIR/board/Kconfig"

View File

@ -0,0 +1,100 @@
# NuMaker-IoT-M467
## 1. Introduction
NuMaker-IoT-M467 provides multiple networking, interfaces, and flexible extended data storage. Whether you need a sensor node or a light-weight gateway, the NuMaker-IoT-M467 is an ideal choice for IoT applications.
The M467HJ target board is based on NuMicro M467HJHAN. For the development flexibility, the M467HJ target board provides the extension connectors, the Arduino UNO, mikroBUS compatible headers and the capability of adopting multiple power supplies.
The NuMaker-IoT-M467 is an evaluation board for Nuvoton NuMicro M467HJ microcontrollers. The NuMaker-IoT-M467 consists of two parts: an M467HJ target board and an on-board Nu-Link2-Me debugger and programmer. The NuMaker-IoT-M467 is designed for project evaluation, prototype development and validation with power consumption monitoring function.
![NuMaker-IoT-M467](./figures/NuMaker-IoT-M467-V1_F.png)
### 1.1 MCU specification
| | Features |
| -- | -- |
| MCU | M467HJHAN |
| Operation frequency | 200 MHz |
| embedded Flash size | 1 MB, Dual Bank |
| SRAM size | 512 kB |
| Crypto engine | TRNG, PRNG, AES, SHA/HMAC, RSA, and ECC crypto accelerator |
| RMII interface | Support 10/100 Mbps Ethernet |
### 1.2 Interface
| Interface |
| -- |
| An Arduino UNO compatible extension connector |
| Two mikroBUS compatible extension connector |
| RJ45 Ethernet port |
| USB 1.1/2.0 OTG ports |
| A microSD slot |
| A CAN FD communication port |
| Debug through SWD interface |
### 1.3 On-board devices
| Device | Description | Driver supporting status |
| -- | -- | -- |
| SPI flash | 32Mb, W25Q32 | Supported |
| Wi-Fi | ESP8266 | Supported |
| Ethernet PHY | RTL8201F | Supported |
| Thermal Sensor | NCT7717U | Supported |
| 6-axis MotionTracking Sensor | MPU6500 | Supported |
### 1.4 Board extended module
| Device | Description | Driver supporting status |
| -- | -- | -- |
| LCD Panel(NuTFT V1.2) | ILI9341(over spi2) | Supported |
| Touch screen | ADC S/W touch(over eadc0) | Supported |
## 2. Supported compiler
Support GCC, MDK5, IAR IDE/compilers. More information of these compiler version as following:
| IDE/Compiler | Tested version |
| ---------- | ---------------------------- |
| MDK5 | 5.26.2 |
| IAR | 8.2 |
| GCC | GCC 5.4.1 20160919 (release) |
Notice: Please install Nu-Link_Keil_Driver or Nu-Link_IAR_Driver for development.
## 3. Program firmware
### Step 1
At first, you need to configure switch on the NuMaker-IoT-M467 board. Set the No.1/2 switches to ON position. After the configuration is done, connect the NuMaker-IoT-M467 board and your computer using the USB Micro cable. After that, window manager will show a NuMicro MCU virtual disk. Finally, you will use this virtual disk to burn firmware.
![NuLinkMe2_SwitchSetting](./figures/NuLinkMe_SwitchSetting.png)
![NuMicro MCU](./figures/NuMicro_MCU_Disk.png)
### Step 2
A simple firmware burning method is that you can drag and drop the binary image file to NuMicro MCU virtual disk or copy the binary file to NuMicro MCU disk to burn firmware.
![Sendto](./figures/Sendto.png)
## 4. Test
You can use Tera Term terminate emulator (or other software) to type commands of RTT. All parameters of serial communication are shown in below image. Here, you can find out the corresponding port number of Nuvoton Virtual Com Port in window device manager.
![Serial settings](./figures/SerialSetting.png)
## 5. Purchase
* [Nuvoton Direct][1]
## 6. Resources
* [Download Board User Manual][2]
* [Download MCU TRM][3]
* [Download MCU Datasheet][4]
[1]: https://direct.nuvoton.com/en/numaker-iot-m467
[2]: https://Coming_soon
[3]: https://www.nuvoton.com/resource-download.jsp?tp_GUID=DA05-M460
[4]: https://www.nuvoton.com/resource-download.jsp?tp_GUID=DA00-M460

View File

@ -0,0 +1,14 @@
# for module compiling
import os
Import('RTT_ROOT')
cwd = str(Dir('#'))
objs = []
list = os.listdir(cwd)
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'))
Return('objs')

View File

@ -0,0 +1,59 @@
import os
import sys
import rtconfig
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
else:
RTT_ROOT = os.path.normpath(os.getcwd() + '/../../..')
sys.path = sys.path + [os.path.join(RTT_ROOT, 'tools')]
try:
from building import *
except:
print('Cannot found RT-Thread root directory, please check RTT_ROOT')
print(RTT_ROOT)
exit(-1)
TARGET = 'rtthread.' + rtconfig.TARGET_EXT
DefaultEnvironment(tools=[])
env = Environment(tools = ['mingw'],
AS = rtconfig.AS, ASFLAGS = rtconfig.AFLAGS,
CC = rtconfig.CC, CFLAGS = rtconfig.CFLAGS,
AR = rtconfig.AR, ARFLAGS = '-rc',
LINK = rtconfig.LINK, LINKFLAGS = rtconfig.LFLAGS)
env.PrependENVPath('PATH', rtconfig.EXEC_PATH)
if rtconfig.PLATFORM in ['iccarm']:
env.Replace(CCCOM = ['$CC $CFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -o $TARGET $SOURCES'])
env.Replace(ARFLAGS = [''])
env.Replace(LINKCOM = env["LINKCOM"] + ' --map rt-thread.map')
Export('RTT_ROOT')
Export('rtconfig')
SDK_ROOT = os.path.abspath('./')
if os.path.exists(SDK_ROOT + '/libraries'):
libraries_path_prefix = SDK_ROOT + '/libraries'
else:
libraries_path_prefix = os.path.dirname(SDK_ROOT) + '/libraries'
SDK_LIB = libraries_path_prefix
Export('SDK_LIB')
# prepare building environment
objs = PrepareBuilding(env, RTT_ROOT, has_libcpu=False)
nuvoton_library = 'm460'
rtconfig.BSP_LIBRARY_TYPE = nuvoton_library
# include libraries
objs.extend(SConscript(os.path.join(libraries_path_prefix, nuvoton_library, 'SConscript')))
# include nu_pkgs
objs.extend(SConscript(os.path.join(libraries_path_prefix, 'nu_packages', 'SConscript')))
# make a building
DoBuilding(TARGET, objs)

View File

@ -0,0 +1,21 @@
# RT-Thread building script for component
from building import *
cwd = GetCurrentDir()
objs = []
list = os.listdir(cwd)
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'))
src = Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd, str(Dir('#'))]
group = DefineGroup('Applications', src, depend = [''], CPPPATH = CPPPATH)
objs = objs + group
Return('objs')

View File

@ -0,0 +1,10 @@
from building import *
cwd = GetCurrentDir()
src = Glob('*.c')
CPPPATH = [cwd]
group = DefineGroup('LVGL-port', src, depend = ['PKG_USING_LVGL'], CPPPATH = CPPPATH)
Return('group')

View File

@ -0,0 +1,38 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-2-17 Wayne First version
*/
#ifndef LV_CONF_H
#define LV_CONF_H
#include "rtconfig.h"
#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_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_COLOR_SCREEN_TRANSP 1
#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

View File

@ -0,0 +1,32 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-6-1 Wayne First version
*/
#include <lvgl.h>
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
}

View File

@ -0,0 +1,99 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-12-17 Wayne The first version
*/
#include <lvgl.h>
#define LOG_TAG "lvgl.disp"
#define DBG_ENABLE
#define DBG_SECTION_NAME LOG_TAG
#define DBG_LEVEL DBG_ERROR
#define DBG_COLOR
#include <rtdbg.h>
/*A static or global variable to store the buffers*/
static lv_disp_draw_buf_t disp_buf;
static lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
static rt_device_t lcd_device = 0;
static struct rt_device_graphic_info info;
static void lcd_fb_flush(lv_disp_drv_t *disp_drv, const lv_area_t *area, lv_color_t *color_p)
{
/* Rendering */
struct rt_device_rect_info rect;
rect.x = area->x1;
rect.y = area->y1;
rect.width = area->x2 - area->x1 + 1;
rect.height = area->y2 - area->y1 + 1;
rt_device_control(lcd_device, RTGRAPHIC_CTRL_RECT_UPDATE, &rect);
lv_disp_flush_ready(disp_drv);
}
void lcd_perf_monitor(struct _lv_disp_drv_t *disp_drv, uint32_t time, uint32_t px)
{
rt_kprintf("Elapsed: %dms, Pixel: %d, Bytes:%d\n", time, px, px * sizeof(lv_color_t));
}
void lv_port_disp_init(void)
{
rt_err_t result;
void *buf1 = RT_NULL;
lcd_device = rt_device_find("lcd");
if (lcd_device == 0)
{
LOG_E("error!");
return;
}
/* get framebuffer address */
result = rt_device_control(lcd_device, RTGRAPHIC_CTRL_GET_INFO, &info);
if (result != RT_EOK && info.framebuffer == RT_NULL)
{
LOG_E("error!");
/* get device information failed */
return;
}
RT_ASSERT(info.bits_per_pixel == 8 || info.bits_per_pixel == 16 ||
info.bits_per_pixel == 24 || info.bits_per_pixel == 32);
buf1 = (void *)info.framebuffer;
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));
result = rt_device_open(lcd_device, 0);
if (result != RT_EOK)
{
LOG_E("error!");
return;
}
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
/*Set the resolution of the display*/
disp_drv.hor_res = info.width;
disp_drv.ver_res = info.height;
/*Set a display buffer*/
disp_drv.draw_buf = &disp_buf;
/*Write the internal buffer (draw_buf) to the display*/
disp_drv.flush_cb = lcd_fb_flush;
/* Called after every refresh cycle to tell the rendering and flushing time + the number of flushed pixels */
//disp_drv.monitor_cb = lcd_perf_monitor;
/*Finally register the driver*/
lv_disp_drv_register(&disp_drv);
}

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-18 Meco Man The first version
*/
#ifndef LV_PORT_DISP_H
#define LV_PORT_DISP_H
#ifdef __cplusplus
extern "C" {
#endif
void lv_port_disp_init(void);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif

View File

@ -0,0 +1,54 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-18 Meco Man The first version
* 2021-12-17 Wayne Add input event
*/
#include <lvgl.h>
#include <stdbool.h>
#include <rtdevice.h>
#include "touch.h"
static lv_indev_state_t last_state = LV_INDEV_STATE_REL;
static rt_int16_t last_x = 0;
static rt_int16_t last_y = 0;
static void input_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data)
{
data->point.x = last_x;
data->point.y = last_y;
data->state = last_state;
}
void nu_touch_inputevent_cb(rt_int16_t x, rt_int16_t y, rt_uint8_t state)
{
switch (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;
}
}
void lv_port_indev_init(void)
{
static lv_indev_drv_t indev_drv;
/* Basic initialization */
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = input_read;
/* Register the driver in LVGL and save the created input device object */
lv_indev_drv_register(&indev_drv);
}

View File

@ -0,0 +1,28 @@
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2021-10-18 Meco Man The first version
*/
#ifndef LV_PORT_INDEV_H
#define LV_PORT_INDEV_H
#ifdef __cplusplus
extern "C" {
#endif
#include <lv_hal_indev.h>
extern lv_indev_t *button_indev;
void lv_port_indev_init(void);
void lv_port_indev_input(rt_int16_t x, rt_int16_t y, lv_indev_state_t state);
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif

View File

@ -0,0 +1,44 @@
/**************************************************************************//**
* @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-1-16 Wayne First version
*
******************************************************************************/
#include <rtconfig.h>
#include <rtdevice.h>
#include <drv_gpio.h>
/* defined the LEDR pin: PH4 */
#define LEDR NU_GET_PININDEX(NU_PH, 4)
/* defined the LEDG pin: PH6 */
#define LEDG NU_GET_PININDEX(NU_PH, 6)
int main(int argc, char **argv)
{
#if defined(RT_USING_PIN)
int counter = 0;
/* set pin mode to output */
rt_pin_mode(LEDR, PIN_MODE_OUTPUT);
rt_pin_mode(LEDG, PIN_MODE_OUTPUT);
while (counter++ < 10)
{
rt_pin_write(LEDR, PIN_HIGH);
rt_pin_write(LEDG, PIN_LOW);
rt_thread_mdelay(500);
rt_pin_write(LEDR, PIN_LOW);
rt_pin_write(LEDG, PIN_HIGH);
rt_thread_mdelay(500);
}
#endif
return 0;
}

View File

@ -0,0 +1,172 @@
/**************************************************************************//**
*
* @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-3-12 Wayne First version
*
******************************************************************************/
#include <rtthread.h>
#define LOG_TAG "mnt"
#define DBG_ENABLE
#define DBG_SECTION_NAME "mnt"
#define DBG_LEVEL DBG_ERROR
#define DBG_COLOR
#include <rtdbg.h>
#include <dfs_fs.h>
#include <dfs_file.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/statfs.h>
#if defined(RT_USING_FAL)
#include <fal.h>
#endif
#if defined(BOARD_USING_STORAGE_SPIFLASH)
#define PARTITION_NAME_FILESYSTEM "filesystem"
#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
/* Recursive mkdir */
#if defined(RT_USBH_MSTORAGE) && defined(UDISK_MOUNTPOINT)
static int mkdir_p(const char *dir, const mode_t mode)
{
int ret = -1;
char *tmp = NULL;
char *p = NULL;
struct stat sb;
rt_size_t len;
if (!dir)
goto exit_mkdir_p;
/* Copy path */
/* Get the string length */
len = strlen(dir);
tmp = rt_strdup(dir);
/* Remove trailing slash */
if (tmp[len - 1] == '/')
{
tmp[len - 1] = '\0';
len--;
}
/* check if path exists and is a directory */
if (stat(tmp, &sb) == 0)
{
if (S_ISDIR(sb.st_mode))
{
ret = 0;
goto exit_mkdir_p;
}
}
/* Recursive mkdir */
for (p = tmp + 1; p - tmp <= len; p++)
{
if ((*p == '/') || (p - tmp == len))
{
*p = 0;
/* Test path */
if (stat(tmp, &sb) != 0)
{
/* Path does not exist - create directory */
if (mkdir(tmp, mode) < 0)
{
goto exit_mkdir_p;
}
}
else if (!S_ISDIR(sb.st_mode))
{
/* Not a directory */
goto exit_mkdir_p;
}
if (p - tmp != len)
*p = '/';
}
}
ret = 0;
exit_mkdir_p:
if (tmp)
rt_free(tmp);
return ret;
}
#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 (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);
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)
{
rt_kprintf("Failed to create directory on %s for RT_USBH_MSTORAGE.\n", UDISK_MOUNTPOINT);
}
#endif
exit_mnt_init_spiflash0:
return 0;
}
INIT_APP_EXPORT(mnt_init_spiflash0);
#endif

View File

@ -0,0 +1,146 @@
menu "Hardware Drivers Config"
menu "On-chip Peripheral Drivers"
source "$BSP_DIR/../libraries/m460/rtt_port/Kconfig"
endmenu
menu "On-board Peripheral Drivers"
config BSP_USING_NULINKME
bool "Enable UART0 for RTT Console(uart0)"
select BSP_USING_UART
select BSP_USING_UART0
default y
config BOARD_USING_RTL8201FI
bool "Enable Ethernet phy supporting(over emac/mdio)"
select BSP_USING_EMAC
default n
config BOARD_USING_ESP8266
bool "ESP8266 Wi-Fi module supporting(over uart2)"
select BSP_USING_UART
select BSP_USING_UART2
select BSP_USING_UART2_RX_DMA
select BSP_USING_UART2_TX_DMA
select PKG_USING_AT_DEVICE
select AT_DEVICE_USING_ESP8266
select AT_DEVICE_ESP8266_INIT_ASYN
default y
config BOARD_USING_STORAGE_SDCARD
bool "SDCARD supporting(over sdh0)"
select BSP_USING_SDH
select BSP_USING_SDH0
default y
config BOARD_USING_STORAGE_SPIFLASH
bool "SPIFLASH supporting(over qspi0)"
select BSP_USING_QSPI
select BSP_USING_QSPI0
default y
config BOARD_USING_CANFD0
bool "CAN-FD supporting(over canfd0)"
select BSP_USING_CANFD
select BSP_USING_CANFD0
default y
config BOARD_USING_NCT7717U
bool "Thermal Sensor(over i2c2)"
select NU_PKG_USING_NCT7717U
select BSP_USING_I2C
select BSP_USING_I2C2
default y
config BOARD_USING_MPU6500
bool "MPU6500 6-axis MotionTracking Sensor(over i2c2)"
select PKG_USING_MPU6XXX
select BSP_USING_I2C
select BSP_USING_I2C2
default y
config BOARD_USING_USB_D_H
bool "Enable USB Device or Host function"
help
Choose this option if you need USB function.
if BOARD_USING_USB_D_H
choice
prompt "Select FS/HS USB Ports"
config BOARD_USING_HSUSBD
select BSP_USING_HSUSBD
bool "Enable HSUSBD(over USB2.0)"
help
Choose this option if you need HSUSBD function mode.
config BOARD_USING_HSUSBD_USBH
select BSP_USING_USBH
select BSP_USING_HSUSBD
bool "Enable HSUSBD(over USB2.0) and USBH(over USB1.1)"
help
Choose this option if you need HSUSBD and USBH function mode at the same time.
config BOARD_USING_HSUSBH
select BSP_USING_HSUSBH
bool "Enable HSUSBH(over USB2.0)"
help
Choose this option if you need HSUSBH function mode.
config BOARD_USING_HSUSBH_USBD
select BSP_USING_HSUSBH
select BSP_USING_USBD
bool "Enable HSUSBH(over USB2.0) and USBD(over USB1.1)"
help
Choose this option if you need HSUSBH and USBD function mode at the same time.
config BOARD_USING_HSOTG
select BSP_USING_HSOTG
bool "Enable HSOTG(over USB2.0)"
help
Choose this option if you need HSOTG function mode.
endchoice
endif
endmenu
menu "Board extended module drivers"
config BOARD_USING_LCD_ILI9341
bool "LCD ILI9341 (over spi2)"
select RT_USING_TOUCH
select BSP_USING_SPI2
select BSP_USING_EADC
select BSP_USING_EADC0
select NU_PKG_USING_ADC_TOUCH
select NU_PKG_USING_ADC_TOUCH_SW
select NU_PKG_USING_ILI9341
select NU_PKG_USING_ILI9341_SPI
select NU_PKG_ILI9341_WITH_OFFSCREEN_FRAMEBUFFER
select NU_PKG_ILI9341_HORIZONTAL
default n
if BOARD_USING_LCD_ILI9341
config BOARD_USING_ILI9341_PIN_BACKLIGHT
int "Specify the pin index of backlight pin index"
range 0 127
default 21
config BOARD_USING_ILI9341_PIN_RESET
int "Specify the pin index of reset pin index"
range 0 127
default 19
config BOARD_USING_ILI9341_PIN_DC
int "Specify the pin index of data&command switching"
range 0 127
default 18
endif
endmenu
source "$BSP_DIR/../libraries/nu_packages/Kconfig"
endmenu

View File

@ -0,0 +1,919 @@
/****************************************************************************
* @file nutool_pincfg.c
* @version V1.24
* @Date 2022/09/15-10:20:52
* @brief NuMicro generated code file
*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (C) 2013-2022 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
/********************
MCU:M467HJHAE(LQFP176)
Pin Configuration:
Pin1:EPWM0_CH0
Pin2:EPWM0_CH1
Pin3:UART1_TXD
Pin4:UART1_RXD
Pin5:EPWM1_CH0
Pin6:EPWM1_CH1
Pin7:EPWM1_CH2
Pin8:EPWM1_CH3
Pin9:EADC0_CH1
Pin10:EADC0_CH0
Pin13:SPI2_SS
Pin14:SPI2_CLK
Pin15:SPI2_MISO
Pin16:SPI2_MOSI
Pin19:EADC1_CH1
Pin20:EADC1_CH0
Pin23:I2C3_SCL
Pin24:I2C3_SDA
Pin25:I2C1_SCL
Pin26:I2C1_SDA
Pin27:PG.4
Pin28:PI.6
Pin29:SPI1_MISO
Pin30:SPI1_MOSI
Pin31:SPI1_CLK
Pin32:SPI1_SS
Pin34:UART5_TXD
Pin35:UART5_RXD
Pin36:PF.9
Pin37:PF.8
Pin38:UART4_TXD
Pin39:UART4_RXD
Pin41:X32_IN
Pin42:X32_OUT
Pin45:PH.2
Pin46:PH.3
Pin47:PH.4
Pin48:PH.5
Pin49:PH.6
Pin50:PH.7
Pin51:XT1_IN
Pin52:XT1_OUT
Pin55:EMAC0_RMII_MDC
Pin56:EMAC0_RMII_MDIO
Pin57:EMAC0_RMII_TXD0
Pin58:EMAC0_RMII_TXD1
Pin59:EMAC0_RMII_TXEN
Pin61:EMAC0_RMII_REFCLK
Pin62:EMAC0_RMII_RXD0
Pin63:EMAC0_RMII_RXD1
Pin64:EMAC0_RMII_CRSDV
Pin65:EMAC0_RMII_RXERR
Pin66:SPIM_SS
Pin67:SPIM_MISO
Pin68:SPIM_D2
Pin69:SPIM_D3
Pin70:SPIM_CLK
Pin71:SPIM_MOSI
Pin75:QSPI0_MISO1
Pin76:QSPI0_MOSI1
Pin77:QSPI0_SS
Pin78:QSPI0_CLK
Pin79:QSPI0_MISO0
Pin80:QSPI0_MOSI0
Pin82:PE.14
Pin83:PE.15
Pin85:ICE_DAT
Pin86:ICE_CLK
Pin87:PD.9
Pin88:PD.8
Pin89:PC.5
Pin90:PC.4
Pin91:UART2_nRTS
Pin92:UART2_nCTS
Pin93:UART2_TXD
Pin94:UART2_RXD
Pin97:I2C4_SCL
Pin98:I2C4_SDA
Pin99:PG.11
Pin100:PG.12
Pin101:PG.13
Pin102:PG.14
Pin103:PG.15
Pin104:PJ.2
Pin105:PJ.3
Pin106:PJ.4
Pin107:PJ.5
Pin108:PJ.6
Pin109:PJ.7
Pin110:PH.12
Pin111:PH.13
Pin112:PH.14
Pin113:PH.15
Pin114:PD.7
Pin115:PD.6
Pin116:PD.5
Pin117:PD.4
Pin118:PD.3
Pin119:PD.2
Pin120:I2C2_SCL
Pin121:I2C2_SDA
Pin122:SD0_nCD
Pin123:USB_VBUS
Pin124:USB_D-
Pin125:USB_D+
Pin126:USB_OTG_ID
Pin135:SD0_CMD
Pin136:SD0_CLK
Pin137:SD0_DAT3
Pin138:SD0_DAT2
Pin139:SD0_DAT1
Pin140:SD0_DAT0
Pin143:PE.1
Pin144:PE.0
Pin145:PH.8
Pin146:PH.9
Pin147:PH.10
Pin148:EPWM0_CH5
Pin149:EPWM0_CH4
Pin150:PJ.8
Pin151:PJ.9
Pin152:CAN0_TXD
Pin153:CAN0_RXD
Pin154:HSUSB_VBUS_ST
Pin155:HSUSB_VBUS_EN
Pin156:SPI3_SS
Pin157:SPI3_CLK
Pin158:SPI3_MISO
Pin159:SPI3_MOSI
Pin163:USB_VBUS_ST
Pin164:USB_VBUS_EN
Pin166:UART0_TXD
Pin167:UART0_RXD
Pin173:EADC0_CH9
Pin174:EADC0_CH8
Pin175:EADC0_CH7
Pin176:EADC0_CH6
********************/
#include "M460.h"
#include "rtconfig.h"
void nutool_pincfg_init_can0(void)
{
SYS->GPJ_MFP2 &= ~(SYS_GPJ_MFP2_PJ11MFP_Msk | SYS_GPJ_MFP2_PJ10MFP_Msk);
SYS->GPJ_MFP2 |= (SYS_GPJ_MFP2_PJ11MFP_CAN0_RXD | SYS_GPJ_MFP2_PJ10MFP_CAN0_TXD);
return;
}
void nutool_pincfg_deinit_can0(void)
{
SYS->GPJ_MFP2 &= ~(SYS_GPJ_MFP2_PJ11MFP_Msk | SYS_GPJ_MFP2_PJ10MFP_Msk);
return;
}
void nutool_pincfg_init_eadc0(void)
{
SYS->GPB_MFP0 &= ~(SYS_GPB_MFP0_PB1MFP_Msk | SYS_GPB_MFP0_PB0MFP_Msk);
SYS->GPB_MFP0 |= (SYS_GPB_MFP0_PB1MFP_EADC0_CH1 | SYS_GPB_MFP0_PB0MFP_EADC0_CH0);
SYS->GPB_MFP1 &= ~(SYS_GPB_MFP1_PB7MFP_Msk | SYS_GPB_MFP1_PB6MFP_Msk);
SYS->GPB_MFP1 |= (SYS_GPB_MFP1_PB7MFP_EADC0_CH7 | SYS_GPB_MFP1_PB6MFP_EADC0_CH6);
SYS->GPB_MFP2 &= ~(SYS_GPB_MFP2_PB9MFP_Msk | SYS_GPB_MFP2_PB8MFP_Msk);
SYS->GPB_MFP2 |= (SYS_GPB_MFP2_PB9MFP_EADC0_CH9 | SYS_GPB_MFP2_PB8MFP_EADC0_CH8);
/* Disable digital path on these EADC pins */
GPIO_DISABLE_DIGITAL_PATH(PB, BIT0 | BIT1 | BIT6 | BIT7 | BIT8 | BIT9);
return;
}
void nutool_pincfg_deinit_eadc0(void)
{
SYS->GPB_MFP0 &= ~(SYS_GPB_MFP0_PB1MFP_Msk | SYS_GPB_MFP0_PB0MFP_Msk);
SYS->GPB_MFP1 &= ~(SYS_GPB_MFP1_PB7MFP_Msk | SYS_GPB_MFP1_PB6MFP_Msk);
SYS->GPB_MFP2 &= ~(SYS_GPB_MFP2_PB9MFP_Msk | SYS_GPB_MFP2_PB8MFP_Msk);
/* Enable digital path on these EADC pins */
GPIO_ENABLE_DIGITAL_PATH(PB, BIT0 | BIT1 | BIT6 | BIT7 | BIT8 | BIT9);
return;
}
void nutool_pincfg_init_eadc1(void)
{
SYS->GPD_MFP2 &= ~(SYS_GPD_MFP2_PD11MFP_Msk | SYS_GPD_MFP2_PD10MFP_Msk);
SYS->GPD_MFP2 |= (SYS_GPD_MFP2_PD11MFP_EADC1_CH1 | SYS_GPD_MFP2_PD10MFP_EADC1_CH0);
/* Disable digital path on these EADC pins */
GPIO_DISABLE_DIGITAL_PATH(PD, BIT10 | BIT11);
return;
}
void nutool_pincfg_deinit_eadc1(void)
{
SYS->GPD_MFP2 &= ~(SYS_GPD_MFP2_PD11MFP_Msk | SYS_GPD_MFP2_PD10MFP_Msk);
/* Enable digital path on these EADC pins */
GPIO_ENABLE_DIGITAL_PATH(PD, BIT10 | BIT11);
return;
}
void nutool_pincfg_init_emac0(void)
{
SYS->GPA_MFP1 &= ~(SYS_GPA_MFP1_PA7MFP_Msk | SYS_GPA_MFP1_PA6MFP_Msk);
SYS->GPA_MFP1 |= (SYS_GPA_MFP1_PA7MFP_EMAC0_RMII_CRSDV | SYS_GPA_MFP1_PA6MFP_EMAC0_RMII_RXERR);
SYS->GPC_MFP1 &= ~(SYS_GPC_MFP1_PC7MFP_Msk | SYS_GPC_MFP1_PC6MFP_Msk);
SYS->GPC_MFP1 |= (SYS_GPC_MFP1_PC7MFP_EMAC0_RMII_RXD0 | SYS_GPC_MFP1_PC6MFP_EMAC0_RMII_RXD1);
SYS->GPC_MFP2 &= ~(SYS_GPC_MFP2_PC8MFP_Msk);
SYS->GPC_MFP2 |= (SYS_GPC_MFP2_PC8MFP_EMAC0_RMII_REFCLK);
SYS->GPE_MFP2 &= ~(SYS_GPE_MFP2_PE11MFP_Msk | SYS_GPE_MFP2_PE10MFP_Msk | SYS_GPE_MFP2_PE9MFP_Msk | SYS_GPE_MFP2_PE8MFP_Msk);
SYS->GPE_MFP2 |= (SYS_GPE_MFP2_PE11MFP_EMAC0_RMII_TXD1 | SYS_GPE_MFP2_PE10MFP_EMAC0_RMII_TXD0 | SYS_GPE_MFP2_PE9MFP_EMAC0_RMII_MDIO | SYS_GPE_MFP2_PE8MFP_EMAC0_RMII_MDC);
SYS->GPE_MFP3 &= ~(SYS_GPE_MFP3_PE12MFP_Msk);
SYS->GPE_MFP3 |= (SYS_GPE_MFP3_PE12MFP_EMAC0_RMII_TXEN);
return;
}
void nutool_pincfg_deinit_emac0(void)
{
SYS->GPA_MFP1 &= ~(SYS_GPA_MFP1_PA7MFP_Msk | SYS_GPA_MFP1_PA6MFP_Msk);
SYS->GPC_MFP1 &= ~(SYS_GPC_MFP1_PC7MFP_Msk | SYS_GPC_MFP1_PC6MFP_Msk);
SYS->GPC_MFP2 &= ~(SYS_GPC_MFP2_PC8MFP_Msk);
SYS->GPE_MFP2 &= ~(SYS_GPE_MFP2_PE11MFP_Msk | SYS_GPE_MFP2_PE10MFP_Msk | SYS_GPE_MFP2_PE9MFP_Msk | SYS_GPE_MFP2_PE8MFP_Msk);
SYS->GPE_MFP3 &= ~(SYS_GPE_MFP3_PE12MFP_Msk);
return;
}
void nutool_pincfg_init_epwm0(void)
{
#if defined(BOARD_USING_LCD_ILI9341) && defined(NU_PKG_USING_ILI9341_SPI)
/* NuTFT LED Pin is PB.5 */
SYS->GPB_MFP1 &= ~(SYS_GPB_MFP1_PB5MFP_Msk | SYS_GPB_MFP1_PB4MFP_Msk);
SYS->GPB_MFP1 |= (SYS_GPB_MFP1_PB4MFP_EPWM0_CH1);
#else
SYS->GPB_MFP1 &= ~(SYS_GPB_MFP1_PB5MFP_Msk | SYS_GPB_MFP1_PB4MFP_Msk);
SYS->GPB_MFP1 |= (SYS_GPB_MFP1_PB5MFP_EPWM0_CH0 | SYS_GPB_MFP1_PB4MFP_EPWM0_CH1);
#endif
SYS->GPD_MFP3 &= ~(SYS_GPD_MFP3_PD14MFP_Msk);
SYS->GPD_MFP3 |= (SYS_GPD_MFP3_PD14MFP_EPWM0_CH4);
SYS->GPH_MFP2 &= ~(SYS_GPH_MFP2_PH11MFP_Msk);
SYS->GPH_MFP2 |= (SYS_GPH_MFP2_PH11MFP_EPWM0_CH5);
return;
}
void nutool_pincfg_deinit_epwm0(void)
{
#if defined(BOARD_USING_LCD_ILI9341) && defined(NU_PKG_USING_ILI9341_SPI)
SYS->GPB_MFP1 &= ~(SYS_GPB_MFP1_PB4MFP_Msk);
#else
SYS->GPB_MFP1 &= ~(SYS_GPB_MFP1_PB5MFP_Msk | SYS_GPB_MFP1_PB4MFP_Msk);
#endif
SYS->GPD_MFP3 &= ~(SYS_GPD_MFP3_PD14MFP_Msk);
SYS->GPH_MFP2 &= ~(SYS_GPH_MFP2_PH11MFP_Msk);
return;
}
void nutool_pincfg_init_epwm1(void)
{
SYS->GPC_MFP2 &= ~(SYS_GPC_MFP2_PC11MFP_Msk | SYS_GPC_MFP2_PC10MFP_Msk | SYS_GPC_MFP2_PC9MFP_Msk);
SYS->GPC_MFP2 |= (SYS_GPC_MFP2_PC11MFP_EPWM1_CH1 | SYS_GPC_MFP2_PC10MFP_EPWM1_CH2 | SYS_GPC_MFP2_PC9MFP_EPWM1_CH3);
SYS->GPC_MFP3 &= ~(SYS_GPC_MFP3_PC12MFP_Msk);
SYS->GPC_MFP3 |= (SYS_GPC_MFP3_PC12MFP_EPWM1_CH0);
return;
}
void nutool_pincfg_deinit_epwm1(void)
{
SYS->GPC_MFP2 &= ~(SYS_GPC_MFP2_PC11MFP_Msk | SYS_GPC_MFP2_PC10MFP_Msk | SYS_GPC_MFP2_PC9MFP_Msk);
SYS->GPC_MFP3 &= ~(SYS_GPC_MFP3_PC12MFP_Msk);
return;
}
void nutool_pincfg_init_hsusb(void)
{
SYS->GPJ_MFP3 &= ~(SYS_GPJ_MFP3_PJ13MFP_Msk | SYS_GPJ_MFP3_PJ12MFP_Msk);
SYS->GPJ_MFP3 |= (SYS_GPJ_MFP3_PJ13MFP_HSUSB_VBUS_EN | SYS_GPJ_MFP3_PJ12MFP_HSUSB_VBUS_ST);
return;
}
void nutool_pincfg_deinit_hsusb(void)
{
SYS->GPJ_MFP3 &= ~(SYS_GPJ_MFP3_PJ13MFP_Msk | SYS_GPJ_MFP3_PJ12MFP_Msk);
return;
}
void nutool_pincfg_init_i2c1(void)
{
SYS->GPG_MFP0 &= ~(SYS_GPG_MFP0_PG3MFP_Msk | SYS_GPG_MFP0_PG2MFP_Msk);
SYS->GPG_MFP0 |= (SYS_GPG_MFP0_PG3MFP_I2C1_SDA | SYS_GPG_MFP0_PG2MFP_I2C1_SCL);
//GPIO_SetPullCtl(PG, BIT2 | BIT3, GPIO_PUSEL_PULL_UP);
return;
}
void nutool_pincfg_deinit_i2c1(void)
{
SYS->GPG_MFP0 &= ~(SYS_GPG_MFP0_PG3MFP_Msk | SYS_GPG_MFP0_PG2MFP_Msk);
return;
}
void nutool_pincfg_init_i2c2(void)
{
SYS->GPD_MFP0 &= ~(SYS_GPD_MFP0_PD1MFP_Msk | SYS_GPD_MFP0_PD0MFP_Msk);
SYS->GPD_MFP0 |= (SYS_GPD_MFP0_PD1MFP_I2C2_SCL | SYS_GPD_MFP0_PD0MFP_I2C2_SDA);
return;
}
void nutool_pincfg_deinit_i2c2(void)
{
SYS->GPD_MFP0 &= ~(SYS_GPD_MFP0_PD1MFP_Msk | SYS_GPD_MFP0_PD0MFP_Msk);
return;
}
void nutool_pincfg_init_i2c3(void)
{
SYS->GPG_MFP0 &= ~(SYS_GPG_MFP0_PG1MFP_Msk | SYS_GPG_MFP0_PG0MFP_Msk);
SYS->GPG_MFP0 |= (SYS_GPG_MFP0_PG1MFP_I2C3_SDA | SYS_GPG_MFP0_PG0MFP_I2C3_SCL);
return;
}
void nutool_pincfg_deinit_i2c3(void)
{
SYS->GPG_MFP0 &= ~(SYS_GPG_MFP0_PG1MFP_Msk | SYS_GPG_MFP0_PG0MFP_Msk);
return;
}
void nutool_pincfg_init_i2c4(void)
{
SYS->GPG_MFP2 &= ~(SYS_GPG_MFP2_PG10MFP_Msk | SYS_GPG_MFP2_PG9MFP_Msk);
SYS->GPG_MFP2 |= (SYS_GPG_MFP2_PG10MFP_I2C4_SDA | SYS_GPG_MFP2_PG9MFP_I2C4_SCL);
//GPIO_SetPullCtl(PG, BIT9 | BIT10, GPIO_PUSEL_PULL_UP);
return;
}
void nutool_pincfg_deinit_i2c4(void)
{
SYS->GPG_MFP2 &= ~(SYS_GPG_MFP2_PG10MFP_Msk | SYS_GPG_MFP2_PG9MFP_Msk);
return;
}
void nutool_pincfg_init_ice(void)
{
SYS->GPF_MFP0 &= ~(SYS_GPF_MFP0_PF1MFP_Msk | SYS_GPF_MFP0_PF0MFP_Msk);
SYS->GPF_MFP0 |= (SYS_GPF_MFP0_PF1MFP_ICE_CLK | SYS_GPF_MFP0_PF0MFP_ICE_DAT);
return;
}
void nutool_pincfg_deinit_ice(void)
{
SYS->GPF_MFP0 &= ~(SYS_GPF_MFP0_PF1MFP_Msk | SYS_GPF_MFP0_PF0MFP_Msk);
return;
}
void nutool_pincfg_init_pc(void)
{
SYS->GPC_MFP1 &= ~(SYS_GPC_MFP1_PC5MFP_Msk | SYS_GPC_MFP1_PC4MFP_Msk);
SYS->GPC_MFP1 |= (SYS_GPC_MFP1_PC5MFP_GPIO | SYS_GPC_MFP1_PC4MFP_GPIO);
return;
}
void nutool_pincfg_deinit_pc(void)
{
SYS->GPC_MFP1 &= ~(SYS_GPC_MFP1_PC5MFP_Msk | SYS_GPC_MFP1_PC4MFP_Msk);
return;
}
void nutool_pincfg_init_pd(void)
{
SYS->GPD_MFP0 &= ~(SYS_GPD_MFP0_PD3MFP_Msk | SYS_GPD_MFP0_PD2MFP_Msk);
SYS->GPD_MFP0 |= (SYS_GPD_MFP0_PD3MFP_GPIO | SYS_GPD_MFP0_PD2MFP_GPIO);
SYS->GPD_MFP1 &= ~(SYS_GPD_MFP1_PD7MFP_Msk | SYS_GPD_MFP1_PD6MFP_Msk | SYS_GPD_MFP1_PD5MFP_Msk | SYS_GPD_MFP1_PD4MFP_Msk);
SYS->GPD_MFP1 |= (SYS_GPD_MFP1_PD7MFP_GPIO | SYS_GPD_MFP1_PD6MFP_GPIO | SYS_GPD_MFP1_PD5MFP_GPIO | SYS_GPD_MFP1_PD4MFP_GPIO);
SYS->GPD_MFP2 &= ~(SYS_GPD_MFP2_PD9MFP_Msk | SYS_GPD_MFP2_PD8MFP_Msk);
SYS->GPD_MFP2 |= (SYS_GPD_MFP2_PD9MFP_GPIO | SYS_GPD_MFP2_PD8MFP_GPIO);
return;
}
void nutool_pincfg_deinit_pd(void)
{
SYS->GPD_MFP0 &= ~(SYS_GPD_MFP0_PD3MFP_Msk | SYS_GPD_MFP0_PD2MFP_Msk);
SYS->GPD_MFP1 &= ~(SYS_GPD_MFP1_PD7MFP_Msk | SYS_GPD_MFP1_PD6MFP_Msk | SYS_GPD_MFP1_PD5MFP_Msk | SYS_GPD_MFP1_PD4MFP_Msk);
SYS->GPD_MFP2 &= ~(SYS_GPD_MFP2_PD9MFP_Msk | SYS_GPD_MFP2_PD8MFP_Msk);
return;
}
void nutool_pincfg_init_pe(void)
{
SYS->GPE_MFP0 &= ~(SYS_GPE_MFP0_PE1MFP_Msk | SYS_GPE_MFP0_PE0MFP_Msk);
SYS->GPE_MFP0 |= (SYS_GPE_MFP0_PE1MFP_GPIO | SYS_GPE_MFP0_PE0MFP_GPIO);
SYS->GPE_MFP3 &= ~(SYS_GPE_MFP3_PE15MFP_Msk | SYS_GPE_MFP3_PE14MFP_Msk);
SYS->GPE_MFP3 |= (SYS_GPE_MFP3_PE15MFP_GPIO | SYS_GPE_MFP3_PE14MFP_GPIO);
return;
}
void nutool_pincfg_deinit_pe(void)
{
SYS->GPE_MFP0 &= ~(SYS_GPE_MFP0_PE1MFP_Msk | SYS_GPE_MFP0_PE0MFP_Msk);
SYS->GPE_MFP3 &= ~(SYS_GPE_MFP3_PE15MFP_Msk | SYS_GPE_MFP3_PE14MFP_Msk);
return;
}
void nutool_pincfg_init_pf(void)
{
SYS->GPF_MFP2 &= ~(SYS_GPF_MFP2_PF9MFP_Msk | SYS_GPF_MFP2_PF8MFP_Msk);
SYS->GPF_MFP2 |= (SYS_GPF_MFP2_PF9MFP_GPIO | SYS_GPF_MFP2_PF8MFP_GPIO);
return;
}
void nutool_pincfg_deinit_pf(void)
{
SYS->GPF_MFP2 &= ~(SYS_GPF_MFP2_PF9MFP_Msk | SYS_GPF_MFP2_PF8MFP_Msk);
return;
}
void nutool_pincfg_init_pg(void)
{
SYS->GPG_MFP1 &= ~(SYS_GPG_MFP1_PG4MFP_Msk);
SYS->GPG_MFP1 |= (SYS_GPG_MFP1_PG4MFP_GPIO);
SYS->GPG_MFP2 &= ~(SYS_GPG_MFP2_PG11MFP_Msk);
SYS->GPG_MFP2 |= (SYS_GPG_MFP2_PG11MFP_GPIO);
SYS->GPG_MFP3 &= ~(SYS_GPG_MFP3_PG15MFP_Msk | SYS_GPG_MFP3_PG14MFP_Msk | SYS_GPG_MFP3_PG13MFP_Msk | SYS_GPG_MFP3_PG12MFP_Msk);
SYS->GPG_MFP3 |= (SYS_GPG_MFP3_PG15MFP_GPIO | SYS_GPG_MFP3_PG14MFP_GPIO | SYS_GPG_MFP3_PG13MFP_GPIO | SYS_GPG_MFP3_PG12MFP_GPIO);
return;
}
void nutool_pincfg_deinit_pg(void)
{
SYS->GPG_MFP1 &= ~(SYS_GPG_MFP1_PG4MFP_Msk);
SYS->GPG_MFP2 &= ~(SYS_GPG_MFP2_PG11MFP_Msk);
SYS->GPG_MFP3 &= ~(SYS_GPG_MFP3_PG15MFP_Msk | SYS_GPG_MFP3_PG14MFP_Msk | SYS_GPG_MFP3_PG13MFP_Msk | SYS_GPG_MFP3_PG12MFP_Msk);
return;
}
void nutool_pincfg_init_ph(void)
{
SYS->GPH_MFP0 &= ~(SYS_GPH_MFP0_PH3MFP_Msk | SYS_GPH_MFP0_PH2MFP_Msk);
SYS->GPH_MFP0 |= (SYS_GPH_MFP0_PH3MFP_GPIO | SYS_GPH_MFP0_PH2MFP_GPIO);
SYS->GPH_MFP1 &= ~(SYS_GPH_MFP1_PH7MFP_Msk | SYS_GPH_MFP1_PH6MFP_Msk | SYS_GPH_MFP1_PH5MFP_Msk | SYS_GPH_MFP1_PH4MFP_Msk);
SYS->GPH_MFP1 |= (SYS_GPH_MFP1_PH7MFP_GPIO | SYS_GPH_MFP1_PH6MFP_GPIO | SYS_GPH_MFP1_PH5MFP_GPIO | SYS_GPH_MFP1_PH4MFP_GPIO);
SYS->GPH_MFP2 &= ~(SYS_GPH_MFP2_PH10MFP_Msk | SYS_GPH_MFP2_PH9MFP_Msk | SYS_GPH_MFP2_PH8MFP_Msk);
SYS->GPH_MFP2 |= (SYS_GPH_MFP2_PH10MFP_GPIO | SYS_GPH_MFP2_PH9MFP_GPIO | SYS_GPH_MFP2_PH8MFP_GPIO);
SYS->GPH_MFP3 &= ~(SYS_GPH_MFP3_PH15MFP_Msk | SYS_GPH_MFP3_PH14MFP_Msk | SYS_GPH_MFP3_PH13MFP_Msk | SYS_GPH_MFP3_PH12MFP_Msk);
SYS->GPH_MFP3 |= (SYS_GPH_MFP3_PH15MFP_GPIO | SYS_GPH_MFP3_PH14MFP_GPIO | SYS_GPH_MFP3_PH13MFP_GPIO | SYS_GPH_MFP3_PH12MFP_GPIO);
return;
}
void nutool_pincfg_deinit_ph(void)
{
SYS->GPH_MFP0 &= ~(SYS_GPH_MFP0_PH3MFP_Msk | SYS_GPH_MFP0_PH2MFP_Msk);
SYS->GPH_MFP1 &= ~(SYS_GPH_MFP1_PH7MFP_Msk | SYS_GPH_MFP1_PH6MFP_Msk | SYS_GPH_MFP1_PH5MFP_Msk | SYS_GPH_MFP1_PH4MFP_Msk);
SYS->GPH_MFP2 &= ~(SYS_GPH_MFP2_PH10MFP_Msk | SYS_GPH_MFP2_PH9MFP_Msk | SYS_GPH_MFP2_PH8MFP_Msk);
SYS->GPH_MFP3 &= ~(SYS_GPH_MFP3_PH15MFP_Msk | SYS_GPH_MFP3_PH14MFP_Msk | SYS_GPH_MFP3_PH13MFP_Msk | SYS_GPH_MFP3_PH12MFP_Msk);
return;
}
void nutool_pincfg_init_pi(void)
{
SYS->GPI_MFP1 &= ~(SYS_GPI_MFP1_PI6MFP_Msk);
SYS->GPI_MFP1 |= (SYS_GPI_MFP1_PI6MFP_GPIO);
return;
}
void nutool_pincfg_deinit_pi(void)
{
SYS->GPI_MFP1 &= ~(SYS_GPI_MFP1_PI6MFP_Msk);
return;
}
void nutool_pincfg_init_pj(void)
{
SYS->GPJ_MFP0 &= ~(SYS_GPJ_MFP0_PJ3MFP_Msk | SYS_GPJ_MFP0_PJ2MFP_Msk);
SYS->GPJ_MFP0 |= (SYS_GPJ_MFP0_PJ3MFP_GPIO | SYS_GPJ_MFP0_PJ2MFP_GPIO);
SYS->GPJ_MFP1 &= ~(SYS_GPJ_MFP1_PJ7MFP_Msk | SYS_GPJ_MFP1_PJ6MFP_Msk | SYS_GPJ_MFP1_PJ5MFP_Msk | SYS_GPJ_MFP1_PJ4MFP_Msk);
SYS->GPJ_MFP1 |= (SYS_GPJ_MFP1_PJ7MFP_GPIO | SYS_GPJ_MFP1_PJ6MFP_GPIO | SYS_GPJ_MFP1_PJ5MFP_GPIO | SYS_GPJ_MFP1_PJ4MFP_GPIO);
SYS->GPJ_MFP2 &= ~(SYS_GPJ_MFP2_PJ9MFP_Msk | SYS_GPJ_MFP2_PJ8MFP_Msk);
SYS->GPJ_MFP2 |= (SYS_GPJ_MFP2_PJ9MFP_GPIO | SYS_GPJ_MFP2_PJ8MFP_GPIO);
return;
}
void nutool_pincfg_deinit_pj(void)
{
SYS->GPJ_MFP0 &= ~(SYS_GPJ_MFP0_PJ3MFP_Msk | SYS_GPJ_MFP0_PJ2MFP_Msk);
SYS->GPJ_MFP1 &= ~(SYS_GPJ_MFP1_PJ7MFP_Msk | SYS_GPJ_MFP1_PJ6MFP_Msk | SYS_GPJ_MFP1_PJ5MFP_Msk | SYS_GPJ_MFP1_PJ4MFP_Msk);
SYS->GPJ_MFP2 &= ~(SYS_GPJ_MFP2_PJ9MFP_Msk | SYS_GPJ_MFP2_PJ8MFP_Msk);
return;
}
#if 1
// Use on-board SPI NOR flash
void nutool_pincfg_init_qspi0(void)
{
SYS->GPI_MFP3 &= ~(SYS_GPI_MFP3_PI15MFP_Msk | SYS_GPI_MFP3_PI14MFP_Msk | SYS_GPI_MFP3_PI13MFP_Msk | SYS_GPI_MFP3_PI12MFP_Msk);
SYS->GPI_MFP3 |= (SYS_GPI_MFP3_PI15MFP_QSPI0_CLK | SYS_GPI_MFP3_PI14MFP_QSPI0_SS | SYS_GPI_MFP3_PI13MFP_QSPI0_MOSI1 | SYS_GPI_MFP3_PI12MFP_QSPI0_MISO1);
SYS->GPJ_MFP0 &= ~(SYS_GPJ_MFP0_PJ1MFP_Msk | SYS_GPJ_MFP0_PJ0MFP_Msk);
SYS->GPJ_MFP0 |= (SYS_GPJ_MFP0_PJ1MFP_QSPI0_MOSI0 | SYS_GPJ_MFP0_PJ0MFP_QSPI0_MISO0);
return;
}
void nutool_pincfg_deinit_qspi0(void)
{
SYS->GPI_MFP3 &= ~(SYS_GPI_MFP3_PI15MFP_Msk | SYS_GPI_MFP3_PI14MFP_Msk | SYS_GPI_MFP3_PI13MFP_Msk | SYS_GPI_MFP3_PI12MFP_Msk);
SYS->GPJ_MFP0 &= ~(SYS_GPJ_MFP0_PJ1MFP_Msk | SYS_GPJ_MFP0_PJ0MFP_Msk);
return;
}
#else
//UNO interface pins
void nutool_pincfg_init_qspi0(void)
{
SYS->GPA_MFP0 &= ~(SYS_GPA_MFP0_PA3MFP_Msk | SYS_GPA_MFP0_PA2MFP_Msk | SYS_GPA_MFP0_PA1MFP_Msk | SYS_GPA_MFP0_PA0MFP_Msk);
SYS->GPA_MFP0 |= (SYS_GPA_MFP0_PA3MFP_QSPI0_SS | SYS_GPA_MFP0_PA2MFP_QSPI0_CLK | SYS_GPA_MFP0_PA1MFP_QSPI0_MISO0 | SYS_GPA_MFP0_PA0MFP_QSPI0_MOSI0);
SYS->GPA_MFP1 &= ~(SYS_GPA_MFP1_PA5MFP_Msk | SYS_GPA_MFP1_PA4MFP_Msk);
SYS->GPA_MFP1 |= (SYS_GPA_MFP1_PA5MFP_QSPI0_MISO1 | SYS_GPA_MFP1_PA4MFP_QSPI0_MOSI1);
return;
}
void nutool_pincfg_deinit_qspi0(void)
{
SYS->GPA_MFP0 &= ~(SYS_GPA_MFP0_PA3MFP_Msk | SYS_GPA_MFP0_PA2MFP_Msk | SYS_GPA_MFP0_PA1MFP_Msk | SYS_GPA_MFP0_PA0MFP_Msk);
SYS->GPA_MFP1 &= ~(SYS_GPA_MFP1_PA5MFP_Msk | SYS_GPA_MFP1_PA4MFP_Msk);
return;
}
#endif
void nutool_pincfg_init_sd0(void)
{
SYS->GPD_MFP3 &= ~(SYS_GPD_MFP3_PD13MFP_Msk);
SYS->GPD_MFP3 |= (SYS_GPD_MFP3_PD13MFP_SD0_nCD);
SYS->GPE_MFP0 &= ~(SYS_GPE_MFP0_PE3MFP_Msk | SYS_GPE_MFP0_PE2MFP_Msk);
SYS->GPE_MFP0 |= (SYS_GPE_MFP0_PE3MFP_SD0_DAT1 | SYS_GPE_MFP0_PE2MFP_SD0_DAT0);
SYS->GPE_MFP1 &= ~(SYS_GPE_MFP1_PE7MFP_Msk | SYS_GPE_MFP1_PE6MFP_Msk | SYS_GPE_MFP1_PE5MFP_Msk | SYS_GPE_MFP1_PE4MFP_Msk);
SYS->GPE_MFP1 |= (SYS_GPE_MFP1_PE7MFP_SD0_CMD | SYS_GPE_MFP1_PE6MFP_SD0_CLK | SYS_GPE_MFP1_PE5MFP_SD0_DAT3 | SYS_GPE_MFP1_PE4MFP_SD0_DAT2);
return;
}
void nutool_pincfg_deinit_sd0(void)
{
SYS->GPD_MFP3 &= ~(SYS_GPD_MFP3_PD13MFP_Msk);
SYS->GPE_MFP0 &= ~(SYS_GPE_MFP0_PE3MFP_Msk | SYS_GPE_MFP0_PE2MFP_Msk);
SYS->GPE_MFP1 &= ~(SYS_GPE_MFP1_PE7MFP_Msk | SYS_GPE_MFP1_PE6MFP_Msk | SYS_GPE_MFP1_PE5MFP_Msk | SYS_GPE_MFP1_PE4MFP_Msk);
return;
}
void nutool_pincfg_init_spi1(void)
{
SYS->GPI_MFP1 &= ~(SYS_GPI_MFP1_PI7MFP_Msk);
SYS->GPI_MFP1 |= (SYS_GPI_MFP1_PI7MFP_SPI1_MISO);
SYS->GPI_MFP2 &= ~(SYS_GPI_MFP2_PI10MFP_Msk | SYS_GPI_MFP2_PI9MFP_Msk | SYS_GPI_MFP2_PI8MFP_Msk);
SYS->GPI_MFP2 |= (SYS_GPI_MFP2_PI10MFP_SPI1_SS | SYS_GPI_MFP2_PI9MFP_SPI1_CLK | SYS_GPI_MFP2_PI8MFP_SPI1_MOSI);
return;
}
void nutool_pincfg_deinit_spi1(void)
{
SYS->GPI_MFP1 &= ~(SYS_GPI_MFP1_PI7MFP_Msk);
SYS->GPI_MFP2 &= ~(SYS_GPI_MFP2_PI10MFP_Msk | SYS_GPI_MFP2_PI9MFP_Msk | SYS_GPI_MFP2_PI8MFP_Msk);
return;
}
void nutool_pincfg_init_spi2(void)
{
SYS->GPA_MFP2 &= ~(SYS_GPA_MFP2_PA11MFP_Msk | SYS_GPA_MFP2_PA10MFP_Msk | SYS_GPA_MFP2_PA9MFP_Msk | SYS_GPA_MFP2_PA8MFP_Msk);
SYS->GPA_MFP2 |= (SYS_GPA_MFP2_PA11MFP_SPI2_SS | SYS_GPA_MFP2_PA10MFP_SPI2_CLK | SYS_GPA_MFP2_PA9MFP_SPI2_MISO | SYS_GPA_MFP2_PA8MFP_SPI2_MOSI);
return;
}
void nutool_pincfg_deinit_spi2(void)
{
SYS->GPA_MFP2 &= ~(SYS_GPA_MFP2_PA11MFP_Msk | SYS_GPA_MFP2_PA10MFP_Msk | SYS_GPA_MFP2_PA9MFP_Msk | SYS_GPA_MFP2_PA8MFP_Msk);
return;
}
void nutool_pincfg_init_spi3(void)
{
SYS->GPG_MFP1 &= ~(SYS_GPG_MFP1_PG7MFP_Msk | SYS_GPG_MFP1_PG6MFP_Msk | SYS_GPG_MFP1_PG5MFP_Msk);
SYS->GPG_MFP1 |= (SYS_GPG_MFP1_PG7MFP_SPI3_MISO | SYS_GPG_MFP1_PG6MFP_SPI3_CLK | SYS_GPG_MFP1_PG5MFP_SPI3_SS);
SYS->GPG_MFP2 &= ~(SYS_GPG_MFP2_PG8MFP_Msk);
SYS->GPG_MFP2 |= (SYS_GPG_MFP2_PG8MFP_SPI3_MOSI);
return;
}
void nutool_pincfg_deinit_spi3(void)
{
SYS->GPG_MFP1 &= ~(SYS_GPG_MFP1_PG7MFP_Msk | SYS_GPG_MFP1_PG6MFP_Msk | SYS_GPG_MFP1_PG5MFP_Msk);
SYS->GPG_MFP2 &= ~(SYS_GPG_MFP2_PG8MFP_Msk);
return;
}
#if 0
void nutool_pincfg_init_spim(void)
{
SYS->GPI_MFP3 &= ~(SYS_GPI_MFP3_PI15MFP_Msk | SYS_GPI_MFP3_PI14MFP_Msk | SYS_GPI_MFP3_PI13MFP_Msk | SYS_GPI_MFP3_PI12MFP_Msk);
SYS->GPI_MFP3 |= (SYS_GPI_MFP3_PI15MFP_SPIM_D3 | SYS_GPI_MFP3_PI14MFP_SPIM_D2 | SYS_GPI_MFP3_PI13MFP_SPIM_MISO | SYS_GPI_MFP3_PI12MFP_SPIM_SS);
SYS->GPJ_MFP0 &= ~(SYS_GPJ_MFP0_PJ1MFP_Msk | SYS_GPJ_MFP0_PJ0MFP_Msk);
SYS->GPJ_MFP0 |= (SYS_GPJ_MFP0_PJ1MFP_SPIM_MOSI | SYS_GPJ_MFP0_PJ0MFP_SPIM_CLK);
return;
}
void nutool_pincfg_deinit_spim(void)
{
SYS->GPI_MFP3 &= ~(SYS_GPI_MFP3_PI15MFP_Msk | SYS_GPI_MFP3_PI14MFP_Msk | SYS_GPI_MFP3_PI13MFP_Msk | SYS_GPI_MFP3_PI12MFP_Msk);
SYS->GPJ_MFP0 &= ~(SYS_GPJ_MFP0_PJ1MFP_Msk | SYS_GPJ_MFP0_PJ0MFP_Msk);
return;
}
#endif
void nutool_pincfg_init_uart0(void)
{
SYS->GPB_MFP3 &= ~(SYS_GPB_MFP3_PB13MFP_Msk | SYS_GPB_MFP3_PB12MFP_Msk);
SYS->GPB_MFP3 |= (SYS_GPB_MFP3_PB13MFP_UART0_TXD | SYS_GPB_MFP3_PB12MFP_UART0_RXD);
return;
}
void nutool_pincfg_deinit_uart0(void)
{
SYS->GPB_MFP3 &= ~(SYS_GPB_MFP3_PB13MFP_Msk | SYS_GPB_MFP3_PB12MFP_Msk);
return;
}
void nutool_pincfg_init_uart1(void)
{
SYS->GPB_MFP0 &= ~(SYS_GPB_MFP0_PB3MFP_Msk | SYS_GPB_MFP0_PB2MFP_Msk);
SYS->GPB_MFP0 |= (SYS_GPB_MFP0_PB3MFP_UART1_TXD | SYS_GPB_MFP0_PB2MFP_UART1_RXD);
return;
}
void nutool_pincfg_deinit_uart1(void)
{
SYS->GPB_MFP0 &= ~(SYS_GPB_MFP0_PB3MFP_Msk | SYS_GPB_MFP0_PB2MFP_Msk);
return;
}
void nutool_pincfg_init_uart2(void)
{
SYS->GPC_MFP0 &= ~(SYS_GPC_MFP0_PC3MFP_Msk | SYS_GPC_MFP0_PC2MFP_Msk | SYS_GPC_MFP0_PC1MFP_Msk | SYS_GPC_MFP0_PC0MFP_Msk);
SYS->GPC_MFP0 |= (SYS_GPC_MFP0_PC3MFP_UART2_nRTS | SYS_GPC_MFP0_PC2MFP_UART2_nCTS | SYS_GPC_MFP0_PC1MFP_UART2_TXD | SYS_GPC_MFP0_PC0MFP_UART2_RXD);
return;
}
void nutool_pincfg_deinit_uart2(void)
{
SYS->GPC_MFP0 &= ~(SYS_GPC_MFP0_PC3MFP_Msk | SYS_GPC_MFP0_PC2MFP_Msk | SYS_GPC_MFP0_PC1MFP_Msk | SYS_GPC_MFP0_PC0MFP_Msk);
return;
}
void nutool_pincfg_init_uart4(void)
{
SYS->GPF_MFP1 &= ~(SYS_GPF_MFP1_PF7MFP_Msk | SYS_GPF_MFP1_PF6MFP_Msk);
SYS->GPF_MFP1 |= (SYS_GPF_MFP1_PF7MFP_UART4_TXD | SYS_GPF_MFP1_PF6MFP_UART4_RXD);
return;
}
void nutool_pincfg_deinit_uart4(void)
{
SYS->GPF_MFP1 &= ~(SYS_GPF_MFP1_PF7MFP_Msk | SYS_GPF_MFP1_PF6MFP_Msk);
return;
}
void nutool_pincfg_init_uart5(void)
{
SYS->GPF_MFP2 &= ~(SYS_GPF_MFP2_PF11MFP_Msk | SYS_GPF_MFP2_PF10MFP_Msk);
SYS->GPF_MFP2 |= (SYS_GPF_MFP2_PF11MFP_UART5_TXD | SYS_GPF_MFP2_PF10MFP_UART5_RXD);
return;
}
void nutool_pincfg_deinit_uart5(void)
{
SYS->GPF_MFP2 &= ~(SYS_GPF_MFP2_PF11MFP_Msk | SYS_GPF_MFP2_PF10MFP_Msk);
return;
}
void nutool_pincfg_init_usb(void)
{
SYS->GPA_MFP3 &= ~(SYS_GPA_MFP3_PA15MFP_Msk | SYS_GPA_MFP3_PA14MFP_Msk | SYS_GPA_MFP3_PA13MFP_Msk | SYS_GPA_MFP3_PA12MFP_Msk);
SYS->GPA_MFP3 |= (SYS_GPA_MFP3_PA15MFP_USB_OTG_ID | SYS_GPA_MFP3_PA14MFP_USB_D_P | SYS_GPA_MFP3_PA13MFP_USB_D_N | SYS_GPA_MFP3_PA12MFP_USB_VBUS);
SYS->GPB_MFP3 &= ~(SYS_GPB_MFP3_PB15MFP_Msk);
SYS->GPB_MFP3 |= (SYS_GPB_MFP3_PB15MFP_USB_VBUS_EN);
SYS->GPC_MFP3 &= ~(SYS_GPC_MFP3_PC14MFP_Msk);
SYS->GPC_MFP3 |= (SYS_GPC_MFP3_PC14MFP_USB_VBUS_ST);
return;
}
void nutool_pincfg_deinit_usb(void)
{
SYS->GPA_MFP3 &= ~(SYS_GPA_MFP3_PA15MFP_Msk | SYS_GPA_MFP3_PA14MFP_Msk | SYS_GPA_MFP3_PA13MFP_Msk | SYS_GPA_MFP3_PA12MFP_Msk);
SYS->GPB_MFP3 &= ~(SYS_GPB_MFP3_PB15MFP_Msk);
SYS->GPC_MFP3 &= ~(SYS_GPC_MFP3_PC14MFP_Msk);
return;
}
void nutool_pincfg_init_x32(void)
{
SYS->GPF_MFP1 &= ~(SYS_GPF_MFP1_PF5MFP_Msk | SYS_GPF_MFP1_PF4MFP_Msk);
SYS->GPF_MFP1 |= (SYS_GPF_MFP1_PF5MFP_X32_IN | SYS_GPF_MFP1_PF4MFP_X32_OUT);
return;
}
void nutool_pincfg_deinit_x32(void)
{
SYS->GPF_MFP1 &= ~(SYS_GPF_MFP1_PF5MFP_Msk | SYS_GPF_MFP1_PF4MFP_Msk);
return;
}
void nutool_pincfg_init_xt1(void)
{
SYS->GPF_MFP0 &= ~(SYS_GPF_MFP0_PF3MFP_Msk | SYS_GPF_MFP0_PF2MFP_Msk);
SYS->GPF_MFP0 |= (SYS_GPF_MFP0_PF3MFP_XT1_IN | SYS_GPF_MFP0_PF2MFP_XT1_OUT);
return;
}
void nutool_pincfg_deinit_xt1(void)
{
SYS->GPF_MFP0 &= ~(SYS_GPF_MFP0_PF3MFP_Msk | SYS_GPF_MFP0_PF2MFP_Msk);
return;
}
void nutool_pincfg_init(void)
{
//SYS->GPA_MFP0 = 0x03030303UL;
//SYS->GPA_MFP1 = 0x03030303UL;
//SYS->GPA_MFP2 = 0x04040404UL;
//SYS->GPA_MFP3 = 0x0E0E0E0EUL;
//SYS->GPB_MFP0 = 0x06060101UL;
//SYS->GPB_MFP1 = 0x01010B0BUL;
//SYS->GPB_MFP2 = 0x00000101UL;
//SYS->GPB_MFP3 = 0x0E000606UL;
//SYS->GPC_MFP0 = 0x08080808UL;
//SYS->GPC_MFP1 = 0x03030000UL;
//SYS->GPC_MFP2 = 0x0C0C0C03UL;
//SYS->GPC_MFP3 = 0x000E000CUL;
//SYS->GPD_MFP0 = 0x00000606UL;
//SYS->GPD_MFP1 = 0x00000000UL;
//SYS->GPD_MFP2 = 0x01010000UL;
//SYS->GPD_MFP3 = 0x000B0300UL;
//SYS->GPE_MFP0 = 0x03030000UL;
//SYS->GPE_MFP1 = 0x03030303UL;
//SYS->GPE_MFP2 = 0x03030303UL;
//SYS->GPE_MFP3 = 0x00000003UL;
//SYS->GPF_MFP0 = 0x0A0A0E0EUL;
//SYS->GPF_MFP1 = 0x06060A0AUL;
//SYS->GPF_MFP2 = 0x06060000UL;
//SYS->GPG_MFP0 = 0x05050909UL;
//SYS->GPG_MFP1 = 0x03030300UL;
//SYS->GPG_MFP2 = 0x00080803UL;
//SYS->GPG_MFP3 = 0x00000000UL;
//SYS->GPH_MFP0 = 0x00000000UL;
//SYS->GPH_MFP1 = 0x00000000UL;
//SYS->GPH_MFP2 = 0x0B000000UL;
//SYS->GPH_MFP3 = 0x00000000UL;
//SYS->GPI_MFP1 = 0x07000000UL;
//SYS->GPI_MFP2 = 0x00070707UL;
//SYS->GPI_MFP3 = 0x03030303UL;
//SYS->GPJ_MFP0 = 0x00000303UL;
//SYS->GPJ_MFP1 = 0x00000000UL;
//SYS->GPJ_MFP2 = 0x0B0B0000UL;
//SYS->GPJ_MFP3 = 0x00000F0FUL;
nutool_pincfg_init_can0();
nutool_pincfg_init_eadc0();
nutool_pincfg_init_eadc1();
nutool_pincfg_init_emac0();
nutool_pincfg_init_epwm0();
nutool_pincfg_init_epwm1();
nutool_pincfg_init_hsusb();
nutool_pincfg_init_i2c1();
nutool_pincfg_init_i2c2();
nutool_pincfg_init_i2c3();
nutool_pincfg_init_i2c4();
nutool_pincfg_init_ice();
nutool_pincfg_init_pc();
nutool_pincfg_init_pd();
nutool_pincfg_init_pe();
nutool_pincfg_init_pf();
nutool_pincfg_init_pg();
nutool_pincfg_init_ph();
nutool_pincfg_init_pi();
nutool_pincfg_init_pj();
nutool_pincfg_init_qspi0();
nutool_pincfg_init_sd0();
nutool_pincfg_init_spi1();
nutool_pincfg_init_spi2();
nutool_pincfg_init_spi3();
//nutool_pincfg_init_spim();
nutool_pincfg_init_uart0();
#if !(defined(BOARD_USING_LCD_ILI9341) && defined(NU_PKG_USING_ILI9341_SPI))
nutool_pincfg_init_uart1();
#endif
nutool_pincfg_init_uart2();
nutool_pincfg_init_uart4();
nutool_pincfg_init_uart5();
nutool_pincfg_init_usb();
nutool_pincfg_init_x32();
nutool_pincfg_init_xt1();
return;
}
void nutool_pincfg_deinit(void)
{
nutool_pincfg_deinit_can0();
nutool_pincfg_deinit_eadc0();
nutool_pincfg_deinit_eadc1();
nutool_pincfg_deinit_emac0();
nutool_pincfg_deinit_epwm0();
nutool_pincfg_deinit_epwm1();
nutool_pincfg_deinit_hsusb();
nutool_pincfg_deinit_i2c1();
nutool_pincfg_deinit_i2c2();
nutool_pincfg_deinit_i2c3();
nutool_pincfg_deinit_i2c4();
nutool_pincfg_deinit_ice();
nutool_pincfg_deinit_pc();
nutool_pincfg_deinit_pd();
nutool_pincfg_deinit_pe();
nutool_pincfg_deinit_pf();
nutool_pincfg_deinit_pg();
nutool_pincfg_deinit_ph();
nutool_pincfg_deinit_pi();
nutool_pincfg_deinit_pj();
nutool_pincfg_deinit_qspi0();
nutool_pincfg_deinit_sd0();
nutool_pincfg_deinit_spi1();
nutool_pincfg_deinit_spi2();
nutool_pincfg_deinit_spi3();
//nutool_pincfg_deinit_spim();
nutool_pincfg_deinit_uart0();
#if !(defined(BOARD_USING_LCD_ILI9341) && defined(NU_PKG_USING_ILI9341_SPI))
nutool_pincfg_deinit_uart1();
#endif
nutool_pincfg_deinit_uart2();
nutool_pincfg_deinit_uart4();
nutool_pincfg_deinit_uart5();
nutool_pincfg_deinit_usb();
nutool_pincfg_deinit_x32();
nutool_pincfg_deinit_xt1();
return;
}
/*** (C) COPYRIGHT 2013-2022 Nuvoton Technology Corp. ***/

View File

@ -0,0 +1,273 @@
/****************************************************************************
* @file nutool_pincfg.cfg
* @version V1.24
* @Date 2022/09/15-10:20:54
* @brief NuMicro config file
*
* @note Please do not modify this file.
* Otherwise, it may not be loaded successfully.
*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (C) 2013-2022 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
MCU:M467HJHAE(LQFP176)
Pin1:EPWM0_CH0
Pin2:EPWM0_CH1
Pin3:UART1_TXD
Pin4:UART1_RXD
Pin5:EPWM1_CH0
Pin6:EPWM1_CH1
Pin7:EPWM1_CH2
Pin8:EPWM1_CH3
Pin9:EADC0_CH1
Pin10:EADC0_CH0
Pin11:VSS
Pin12:VDD
Pin13:SPI2_SS
Pin14:SPI2_CLK
Pin15:SPI2_MISO
Pin16:SPI2_MOSI
Pin17:PC.13
Pin18:PD.12
Pin19:EADC1_CH1
Pin20:EADC1_CH0
Pin21:VSS
Pin22:VDD
Pin23:I2C3_SCL
Pin24:I2C3_SDA
Pin25:I2C1_SCL
Pin26:I2C1_SDA
Pin27:PG.4
Pin28:PI.6
Pin29:SPI1_MISO
Pin30:SPI1_MOSI
Pin31:SPI1_CLK
Pin32:SPI1_SS
Pin33:PI.11
Pin34:UART5_TXD
Pin35:UART5_RXD
Pin36:PF.9
Pin37:PF.8
Pin38:UART4_TXD
Pin39:UART4_RXD
Pin40:VBAT
Pin41:X32_IN
Pin42:X32_OUT
Pin43:PH.0
Pin44:PH.1
Pin45:PH.2
Pin46:PH.3
Pin47:PH.4
Pin48:PH.5
Pin49:PH.6
Pin50:PH.7
Pin51:XT1_IN
Pin52:XT1_OUT
Pin53:VSS
Pin54:VDD
Pin55:EMAC0_RMII_MDC
Pin56:EMAC0_RMII_MDIO
Pin57:EMAC0_RMII_TXD0
Pin58:EMAC0_RMII_TXD1
Pin59:EMAC0_RMII_TXEN
Pin60:PE.13
Pin61:EMAC0_RMII_REFCLK
Pin62:EMAC0_RMII_RXD0
Pin63:EMAC0_RMII_RXD1
Pin64:EMAC0_RMII_CRSDV
Pin65:EMAC0_RMII_RXERR
Pin66:SPIM_SS
Pin67:SPIM_MISO
Pin68:SPIM_D2
Pin69:SPIM_D3
Pin70:SPIM_CLK
Pin71:SPIM_MOSI
Pin72:VSS
Pin73:VDD
Pin74:LDO_CAP
Pin75:QSPI0_MISO1
Pin76:QSPI0_MOSI1
Pin77:QSPI0_SS
Pin78:QSPI0_CLK
Pin79:QSPI0_MISO0
Pin80:QSPI0_MOSI0
Pin81:VDDIO
Pin82:PE.14
Pin83:PE.15
Pin84:nRESET
Pin85:ICE_DAT
Pin86:ICE_CLK
Pin87:PD.9
Pin88:PD.8
Pin89:PC.5
Pin90:PC.4
Pin91:UART2_nRTS
Pin92:UART2_nCTS
Pin93:UART2_TXD
Pin94:UART2_RXD
Pin95:VSS
Pin96:VDD
Pin97:I2C4_SCL
Pin98:I2C4_SDA
Pin99:PG.11
Pin100:PG.12
Pin101:PG.13
Pin102:PG.14
Pin103:PG.15
Pin104:PJ.2
Pin105:PJ.3
Pin106:PJ.4
Pin107:PJ.5
Pin108:PJ.6
Pin109:PJ.7
Pin110:PH.12
Pin111:PH.13
Pin112:PH.14
Pin113:PH.15
Pin114:PD.7
Pin115:PD.6
Pin116:PD.5
Pin117:PD.4
Pin118:PD.3
Pin119:PD.2
Pin120:I2C2_SCL
Pin121:I2C2_SDA
Pin122:SD0_nCD
Pin123:USB_VBUS
Pin124:USB_D-
Pin125:USB_D+
Pin126:USB_OTG_ID
Pin127:HSUSB_VRES
Pin128:HSUSB_VDD33
Pin129:HSUSB_VBUS
Pin130:HSUSB_D-
Pin131:HSUSB_VSS
Pin132:HSUSB_D+
Pin133:HSUSB_VDD12_CAP
Pin134:HSUSB_ID
Pin135:SD0_CMD
Pin136:SD0_CLK
Pin137:SD0_DAT3
Pin138:SD0_DAT2
Pin139:SD0_DAT1
Pin140:SD0_DAT0
Pin141:VSS
Pin142:VDD
Pin143:PE.1
Pin144:PE.0
Pin145:PH.8
Pin146:PH.9
Pin147:PH.10
Pin148:EPWM0_CH5
Pin149:EPWM0_CH4
Pin150:PJ.8
Pin151:PJ.9
Pin152:CAN0_TXD
Pin153:CAN0_RXD
Pin154:HSUSB_VBUS_ST
Pin155:HSUSB_VBUS_EN
Pin156:SPI3_SS
Pin157:SPI3_CLK
Pin158:SPI3_MISO
Pin159:SPI3_MOSI
Pin160:VSS
Pin161:LDO_CAP
Pin162:VDD
Pin163:USB_VBUS_ST
Pin164:USB_VBUS_EN
Pin165:PB.14
Pin166:UART0_TXD
Pin167:UART0_RXD
Pin168:AVDD
Pin169:VREF
Pin170:AVSS
Pin171:PB.11
Pin172:PB.10
Pin173:EADC0_CH9
Pin174:EADC0_CH8
Pin175:EADC0_CH7
Pin176:EADC0_CH6
GPIOpin:26
GPIOpin:27
GPIOpin:35
GPIOpin:36
GPIOpin:44
GPIOpin:45
GPIOpin:46
GPIOpin:47
GPIOpin:48
GPIOpin:49
GPIOpin:81
GPIOpin:82
GPIOpin:86
GPIOpin:87
GPIOpin:88
GPIOpin:89
GPIOpin:98
GPIOpin:99
GPIOpin:100
GPIOpin:101
GPIOpin:102
GPIOpin:103
GPIOpin:104
GPIOpin:105
GPIOpin:106
GPIOpin:107
GPIOpin:108
GPIOpin:109
GPIOpin:110
GPIOpin:111
GPIOpin:112
GPIOpin:113
GPIOpin:114
GPIOpin:115
GPIOpin:116
GPIOpin:117
GPIOpin:118
GPIOpin:142
GPIOpin:143
GPIOpin:144
GPIOpin:145
GPIOpin:146
GPIOpin:149
GPIOpin:150
SYS->GPA_MFP0 = 0x03030303
SYS->GPA_MFP1 = 0x03030303
SYS->GPA_MFP2 = 0x04040404
SYS->GPA_MFP3 = 0x0E0E0E0E
SYS->GPB_MFP0 = 0x06060101
SYS->GPB_MFP1 = 0x01010B0B
SYS->GPB_MFP2 = 0x00000101
SYS->GPB_MFP3 = 0x0E000606
SYS->GPC_MFP0 = 0x08080808
SYS->GPC_MFP1 = 0x03030000
SYS->GPC_MFP2 = 0x0C0C0C03
SYS->GPC_MFP3 = 0x000E000C
SYS->GPD_MFP0 = 0x00000606
SYS->GPD_MFP1 = 0x00000000
SYS->GPD_MFP2 = 0x01010000
SYS->GPD_MFP3 = 0x000B0300
SYS->GPE_MFP0 = 0x03030000
SYS->GPE_MFP1 = 0x03030303
SYS->GPE_MFP2 = 0x03030303
SYS->GPE_MFP3 = 0x00000003
SYS->GPF_MFP0 = 0x0A0A0E0E
SYS->GPF_MFP1 = 0x06060A0A
SYS->GPF_MFP2 = 0x06060000
SYS->GPG_MFP0 = 0x05050909
SYS->GPG_MFP1 = 0x03030300
SYS->GPG_MFP2 = 0x00080803
SYS->GPG_MFP3 = 0x00000000
SYS->GPH_MFP0 = 0x00000000
SYS->GPH_MFP1 = 0x00000000
SYS->GPH_MFP2 = 0x0B000000
SYS->GPH_MFP3 = 0x00000000
SYS->GPI_MFP1 = 0x07000000
SYS->GPI_MFP2 = 0x00070707
SYS->GPI_MFP3 = 0x03030303
SYS->GPJ_MFP0 = 0x00000303
SYS->GPJ_MFP1 = 0x00000000
SYS->GPJ_MFP2 = 0x0B0B0000
SYS->GPJ_MFP3 = 0x00000F0F
/*** (C) COPYRIGHT 2013-2022 Nuvoton Technology Corp. ***/

View File

@ -0,0 +1,94 @@
/****************************************************************************
* @file nutool_pincfg.h
* @version V1.24
* @Date 2022/09/15-10:20:52
* @brief NuMicro generated code file
*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (C) 2013-2022 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#ifndef __NUTOOL_PINCFG_H__
#define __NUTOOL_PINCFG_H__
#ifdef __cplusplus
extern "C"
{
#endif
void nutool_pincfg_init_can0(void);
void nutool_pincfg_deinit_can0(void);
void nutool_pincfg_init_eadc0(void);
void nutool_pincfg_deinit_eadc0(void);
void nutool_pincfg_init_eadc1(void);
void nutool_pincfg_deinit_eadc1(void);
void nutool_pincfg_init_emac0(void);
void nutool_pincfg_deinit_emac0(void);
void nutool_pincfg_init_epwm0(void);
void nutool_pincfg_deinit_epwm0(void);
void nutool_pincfg_init_epwm1(void);
void nutool_pincfg_deinit_epwm1(void);
void nutool_pincfg_init_hsusb(void);
void nutool_pincfg_deinit_hsusb(void);
void nutool_pincfg_init_i2c1(void);
void nutool_pincfg_deinit_i2c1(void);
void nutool_pincfg_init_i2c2(void);
void nutool_pincfg_deinit_i2c2(void);
void nutool_pincfg_init_i2c3(void);
void nutool_pincfg_deinit_i2c3(void);
void nutool_pincfg_init_i2c4(void);
void nutool_pincfg_deinit_i2c4(void);
void nutool_pincfg_init_ice(void);
void nutool_pincfg_deinit_ice(void);
void nutool_pincfg_init_pc(void);
void nutool_pincfg_deinit_pc(void);
void nutool_pincfg_init_pd(void);
void nutool_pincfg_deinit_pd(void);
void nutool_pincfg_init_pe(void);
void nutool_pincfg_deinit_pe(void);
void nutool_pincfg_init_pf(void);
void nutool_pincfg_deinit_pf(void);
void nutool_pincfg_init_pg(void);
void nutool_pincfg_deinit_pg(void);
void nutool_pincfg_init_ph(void);
void nutool_pincfg_deinit_ph(void);
void nutool_pincfg_init_pi(void);
void nutool_pincfg_deinit_pi(void);
void nutool_pincfg_init_pj(void);
void nutool_pincfg_deinit_pj(void);
void nutool_pincfg_init_qspi0(void);
void nutool_pincfg_deinit_qspi0(void);
void nutool_pincfg_init_sd0(void);
void nutool_pincfg_deinit_sd0(void);
void nutool_pincfg_init_spi1(void);
void nutool_pincfg_deinit_spi1(void);
void nutool_pincfg_init_spi2(void);
void nutool_pincfg_deinit_spi2(void);
void nutool_pincfg_init_spi3(void);
void nutool_pincfg_deinit_spi3(void);
void nutool_pincfg_init_spim(void);
void nutool_pincfg_deinit_spim(void);
void nutool_pincfg_init_uart0(void);
void nutool_pincfg_deinit_uart0(void);
void nutool_pincfg_init_uart1(void);
void nutool_pincfg_deinit_uart1(void);
void nutool_pincfg_init_uart2(void);
void nutool_pincfg_deinit_uart2(void);
void nutool_pincfg_init_uart4(void);
void nutool_pincfg_deinit_uart4(void);
void nutool_pincfg_init_uart5(void);
void nutool_pincfg_deinit_uart5(void);
void nutool_pincfg_init_usb(void);
void nutool_pincfg_deinit_usb(void);
void nutool_pincfg_init_x32(void);
void nutool_pincfg_deinit_x32(void);
void nutool_pincfg_init_xt1(void);
void nutool_pincfg_deinit_xt1(void);
void nutool_pincfg_init(void);
void nutool_pincfg_deinit(void);
#ifdef __cplusplus
}
#endif
#endif /*__NUTOOL_PINCFG_H__*/
/*** (C) COPYRIGHT 2013-2022 Nuvoton Technology Corp. ***/

View File

@ -0,0 +1,19 @@
# RT-Thread building script for component
from building import *
Import('RTT_ROOT')
from building import *
cwd = GetCurrentDir()
src = Split("""
NuPinConfig/nutool_pincfg.c
""")
src += Glob('*.c') + Glob('*.cpp')
CPPPATH = [cwd, cwd + '/NuPinConfig']
group = DefineGroup('Drivers', src, depend = [''], CPPPATH = CPPPATH)
Return('group')

View File

@ -0,0 +1,38 @@
/**************************************************************************//**
*
* @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-2-23 Wayne First version
*
******************************************************************************/
#ifndef __BOARD_H__
#define __BOARD_H__
#include "rtconfig.h"
// <o> Internal SRAM memory size[Kbytes]
#define SRAM_SIZE (512)
#define SRAM_END (0x20000000 + SRAM_SIZE * 1024)
#if defined(__ARMCC_VERSION)
extern int Image$$RW_IRAM1$$ZI$$Limit;
#define HEAP_BEGIN ((void *)&Image$$RW_IRAM1$$ZI$$Limit)
#elif __ICCARM__
#pragma section="CSTACK"
#define HEAP_BEGIN (__segment_end("CSTACK"))
#else
extern int __bss_end;
#define HEAP_BEGIN ((void *)&__bss_end)
#endif
#define HEAP_END (void *)SRAM_END
void rt_hw_board_init(void);
void rt_hw_cpu_reset(void);
#endif /* BOARD_H_ */

View File

@ -0,0 +1,303 @@
/**************************************************************************//**
*
* @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-1-16 Wayne First version
*
******************************************************************************/
#include <rtdevice.h>
#include <drv_gpio.h>
#if defined(BOARD_USING_STORAGE_SPIFLASH)
#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)
#define W25X_REG_WRITEENABLE (0x06)
#define W25X_REG_WRITESTATUS (0x01)
#define W25X_REG_QUADENABLE (0x02)
static rt_uint8_t SpiFlash_ReadStatusReg(struct rt_qspi_device *qspi_device)
{
rt_uint8_t u8Val;
rt_err_t result = RT_EOK;
rt_uint8_t w25x_txCMD1 = W25X_REG_READSTATUS;
result = rt_qspi_send_then_recv(qspi_device, &w25x_txCMD1, 1, &u8Val, 1);
RT_ASSERT(result > 0);
return u8Val;
}
static rt_uint8_t SpiFlash_ReadStatusReg2(struct rt_qspi_device *qspi_device)
{
rt_uint8_t u8Val;
rt_err_t result = RT_EOK;
rt_uint8_t w25x_txCMD1 = W25X_REG_READSTATUS2;
result = rt_qspi_send_then_recv(qspi_device, &w25x_txCMD1, 1, &u8Val, 1);
RT_ASSERT(result > 0);
return u8Val;
}
static rt_err_t SpiFlash_WriteStatusReg(struct rt_qspi_device *qspi_device, uint8_t u8Value1, uint8_t u8Value2)
{
rt_uint8_t w25x_txCMD1;
rt_uint8_t au8Val[2];
rt_err_t result;
struct rt_qspi_message qspi_message = {0};
/* Enable WE */
w25x_txCMD1 = W25X_REG_WRITEENABLE;
result = rt_qspi_send(qspi_device, &w25x_txCMD1, sizeof(w25x_txCMD1));
if (result != sizeof(w25x_txCMD1))
goto exit_SpiFlash_WriteStatusReg;
/* Prepare status-1, 2 data */
au8Val[0] = u8Value1;
au8Val[1] = u8Value2;
/* 1-bit mode: Instruction+payload */
qspi_message.instruction.content = W25X_REG_WRITESTATUS;
qspi_message.instruction.qspi_lines = 1;
qspi_message.qspi_data_lines = 1;
qspi_message.parent.cs_take = 1;
qspi_message.parent.cs_release = 1;
qspi_message.parent.send_buf = &au8Val[0];
qspi_message.parent.length = sizeof(au8Val);
qspi_message.parent.next = RT_NULL;
if (rt_qspi_transfer_message(qspi_device, &qspi_message) != sizeof(au8Val))
{
result = -RT_ERROR;
}
result = RT_EOK;
exit_SpiFlash_WriteStatusReg:
return result;
}
static void SpiFlash_WaitReady(struct rt_qspi_device *qspi_device)
{
volatile uint8_t u8ReturnValue;
do
{
u8ReturnValue = SpiFlash_ReadStatusReg(qspi_device);
u8ReturnValue = u8ReturnValue & 1;
}
while (u8ReturnValue != 0); // check the BUSY bit
}
static void SpiFlash_EnterQspiMode(struct rt_qspi_device *qspi_device)
{
rt_err_t result = RT_EOK;
uint8_t u8Status1 = SpiFlash_ReadStatusReg(qspi_device);
uint8_t u8Status2 = SpiFlash_ReadStatusReg2(qspi_device);
u8Status2 |= W25X_REG_QUADENABLE;
result = SpiFlash_WriteStatusReg(qspi_device, u8Status1, u8Status2);
RT_ASSERT(result == RT_EOK);
SpiFlash_WaitReady(qspi_device);
}
static void SpiFlash_ExitQspiMode(struct rt_qspi_device *qspi_device)
{
rt_err_t result = RT_EOK;
uint8_t u8Status1 = SpiFlash_ReadStatusReg(qspi_device);
uint8_t u8Status2 = SpiFlash_ReadStatusReg2(qspi_device);
u8Status2 &= ~W25X_REG_QUADENABLE;
result = SpiFlash_WriteStatusReg(qspi_device, u8Status1, u8Status2);
RT_ASSERT(result == RT_EOK);
SpiFlash_WaitReady(qspi_device);
}
static int rt_hw_spiflash_init(void)
{
/*
Don't forget to switch SPIM pins to QSPI0 pins on board.
CS: R12-Open, R13-Close
CLK: R14-Open, R15-Close
MOSI: R16-Open, R17-Close
MISO: R18-Open, R19-Close
IO2: R20-Open, R21-Close
IO3: R22-Open, R23-Close
*/
if (nu_qspi_bus_attach_device("qspi0", "qspi01", 4, SpiFlash_EnterQspiMode, SpiFlash_ExitQspiMode) != RT_EOK)
return -1;
#if defined(RT_USING_SFUD)
if (rt_sfud_flash_probe(FAL_USING_NOR_FLASH_DEV_NAME, "qspi01") == RT_NULL)
{
return -(RT_ERROR);
}
#endif
return 0;
}
INIT_COMPONENT_EXPORT(rt_hw_spiflash_init);
#endif /* BOARD_USING_STORAGE_SPIFLASH */
#if defined(BOARD_USING_NCT7717U)
#include "sensor_nct7717u.h"
int rt_hw_nct7717u_port(void)
{
struct rt_sensor_config cfg;
cfg.intf.dev_name = "i2c2";
cfg.irq_pin.pin = RT_PIN_NONE;
return rt_hw_nct7717u_init("nct7717u", &cfg);
}
INIT_APP_EXPORT(rt_hw_nct7717u_port);
#endif /* BOARD_USING_NCT7717U */
#if defined(BOARD_USING_MPU6500) && defined(PKG_USING_MPU6XXX)
#include "sensor_inven_mpu6xxx.h"
int rt_hw_mpu6xxx_port(void)
{
struct rt_sensor_config cfg;
rt_base_t mpu_int = NU_GET_PININDEX(NU_PD, 2);
cfg.intf.dev_name = "i2c2";
cfg.intf.user_data = (void *)MPU6XXX_ADDR_DEFAULT;
cfg.irq_pin.pin = mpu_int;
return rt_hw_mpu6xxx_init("mpu", &cfg);
}
INIT_APP_EXPORT(rt_hw_mpu6xxx_port);
#endif /* BOARD_USING_MPU6500 */
#if defined(BOARD_USING_ESP8266)
static int rt_hw_esp8266_port(void)
{
rt_base_t esp_rst_pin = NU_GET_PININDEX(NU_PC, 4);
/* ESP8266 reset pin PC.4 */
rt_pin_mode(esp_rst_pin, PIN_MODE_OUTPUT);
rt_pin_write(esp_rst_pin, 1);
return 0;
}
INIT_COMPONENT_EXPORT(rt_hw_esp8266_port);
#endif /* BOARD_USING_ESP8266 */
#if defined(BOARD_USING_LCD_ILI9341) && defined(NU_PKG_USING_ILI9341_SPI)
#if defined(NU_PKG_USING_ADC_TOUCH_SW)
#include "adc_touch.h"
#include "touch_sw.h"
#include "NuMicro.h"
#define NU_MFP_POS(PIN) ((PIN % 4) * 8)
#define NU_MFP_MSK(PIN) (0x1ful << NU_MFP_POS(PIN))
S_CALIBRATION_MATRIX g_sCalMat = { 97, 6214, -3216652, 4844, -30, -2333200, 65536 };
static void nu_pin_func(rt_base_t pin, int data)
{
uint32_t pin_index = NU_GET_PINS(pin);
uint32_t port_index = NU_GET_PORT(pin);
__IO uint32_t *GPx_MFPx = ((__IO uint32_t *) &SYS->GPA_MFP0) + port_index * 4 + (pin_index / 4);
uint32_t MFP_Msk = NU_MFP_MSK(pin_index);
*GPx_MFPx = (*GPx_MFPx & (~MFP_Msk)) | data;
}
static void tp_switch_to_analog(rt_base_t pin)
{
GPIO_T *port = (GPIO_T *)(GPIOA_BASE + (0x40) * NU_GET_PORT(pin));
if (pin == NU_GET_PININDEX(NU_PB, 6))
nu_pin_func(pin, SYS_GPB_MFP1_PB6MFP_EADC0_CH6);
else if (pin == NU_GET_PININDEX(NU_PB, 9))
nu_pin_func(pin, SYS_GPB_MFP2_PB9MFP_EADC0_CH9);
GPIO_DISABLE_DIGITAL_PATH(port, NU_GET_PIN_MASK(NU_GET_PINS(pin)));
}
static void tp_switch_to_digital(rt_base_t pin)
{
GPIO_T *port = (GPIO_T *)(GPIOA_BASE + (0x40) * NU_GET_PORT(pin));
nu_pin_func(pin, 0);
/* Enable digital path on these EADC pins */
GPIO_ENABLE_DIGITAL_PATH(port, NU_GET_PIN_MASK(NU_GET_PINS(pin)));
}
static S_TOUCH_SW sADCTP =
{
.adc_name = "eadc0",
.i32ADCChnYU = 6,
.i32ADCChnXR = 9,
.pin =
{
NU_GET_PININDEX(NU_PB, 7), // XL
NU_GET_PININDEX(NU_PB, 6), // YU
NU_GET_PININDEX(NU_PB, 9), // XR
NU_GET_PININDEX(NU_PB, 8), // YD
},
.switch_to_analog = tp_switch_to_analog,
.switch_to_digital = tp_switch_to_digital,
};
#endif
#include <lcd_ili9341.h>
#if defined(PKG_USING_GUIENGINE)
#include <rtgui/driver.h>
#endif
int rt_hw_ili9341_port(void)
{
if (rt_hw_lcd_ili9341_spi_init("spi2", RT_NULL) != RT_EOK)
return -1;
rt_hw_lcd_ili9341_init();
#if defined(PKG_USING_GUIENGINE)
rt_device_t lcd_ili9341;
lcd_ili9341 = rt_device_find("lcd");
if (lcd_ili9341)
{
rtgui_graphic_set_device(lcd_ili9341);
}
#endif
#if defined(NU_PKG_USING_ADC_TOUCH_SW)
nu_adc_touch_sw_register(&sADCTP);
#endif
return 0;
}
INIT_COMPONENT_EXPORT(rt_hw_ili9341_port);
#endif /* BOARD_USING_LCD_ILI9341 */

View File

@ -0,0 +1,65 @@
/**************************************************************************//**
*
* @copyright (C) 2020 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2022-4-1 Wayne First version
*
******************************************************************************/
#ifndef _FAL_CFG_H_
#define _FAL_CFG_H_
#include <rtconfig.h>
#include <board.h>
/* ===================== Flash device Configuration ========================= */
#if defined(FAL_PART_HAS_TABLE_CFG)
#if defined(BSP_USING_FMC)
extern const struct fal_flash_dev Onchip_aprom_flash;
extern const struct fal_flash_dev Onchip_ldrom_flash;
#endif
#if defined(FAL_USING_SFUD_PORT)
extern struct fal_flash_dev nor_flash0;
#endif
#if defined(BSP_USING_FMC) && defined(FAL_USING_SFUD_PORT)
#define FAL_FLASH_DEV_TABLE \
{ \
&Onchip_aprom_flash, \
&Onchip_ldrom_flash, \
&nor_flash0, \
}
#elif defined(BSP_USING_FMC)
#define FAL_FLASH_DEV_TABLE \
{ \
&Onchip_aprom_flash, \
&Onchip_ldrom_flash, \
&nor_flash0, \
}
#elif defined(FAL_USING_SFUD_PORT)
#define FAL_FLASH_DEV_TABLE \
{ \
&nor_flash0, \
}
#else
#define FAL_FLASH_DEV_TABLE \
{ \
}
#endif
#define FAL_PART_TABLE \
{ \
{FAL_PART_MAGIC_WORD, "filesystem", FAL_USING_NOR_FLASH_DEV_NAME, 0, 4*1024*1024, 0}, \
{FAL_PART_MAGIC_WORD, "ldrom", "OnChip_LDROM", 0, 0x1000, 0}, \
{FAL_PART_MAGIC_WORD, "aprom", "OnChip_APROM", 0x60000, 0x20000, 0}, \
}
#endif /* FAL_PART_HAS_TABLE_CFG */
#endif /* _FAL_CFG_H_ */

View File

@ -0,0 +1,26 @@
/****************************************************************************
* @file nutool_clkcfg.h
* @version V1.05
* @Date 2020/04/15-11:28:38
* @brief NuMicro generated code file
*
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2013-2020 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#ifndef __NUTOOL_CLKCFG_H__
#define __NUTOOL_CLKCFG_H__
#ifdef __cplusplus
extern "C"
{
#endif
#undef __HXT
#define __HXT (12000000UL) /*!< High Speed External Crystal Clock Frequency */
#ifdef __cplusplus
}
#endif
#endif /*__NUTOOL_CLKCFG_H__*/
/*** (C) COPYRIGHT 2013-2020 Nuvoton Technology Corp. ***/

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,139 @@
/****************************************************************************
* @file nutool_modclkcfg.h
* @version V1.05
* @Date 2020/04/15-11:28:38
* @brief NuMicro generated code file
*
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2013-2020 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#ifndef __NUTOOL_MODCLKCFG_H__
#define __NUTOOL_MODCLKCFG_H__
#ifdef __cplusplus
extern "C"
{
#endif
void nutool_modclkcfg_init_acmp01(void);
void nutool_modclkcfg_deinit_acmp01(void);
void nutool_modclkcfg_init_bpwm0(void);
void nutool_modclkcfg_deinit_bpwm0(void);
void nutool_modclkcfg_init_bpwm1(void);
void nutool_modclkcfg_deinit_bpwm1(void);
void nutool_modclkcfg_init_can0(void);
void nutool_modclkcfg_deinit_can0(void);
void nutool_modclkcfg_init_can1(void);
void nutool_modclkcfg_deinit_can1(void);
void nutool_modclkcfg_init_crc(void);
void nutool_modclkcfg_deinit_crc(void);
void nutool_modclkcfg_init_crpt(void);
void nutool_modclkcfg_deinit_crpt(void);
void nutool_modclkcfg_init_dac(void);
void nutool_modclkcfg_deinit_dac(void);
void nutool_modclkcfg_init_eadc(void);
void nutool_modclkcfg_deinit_eadc(void);
void nutool_modclkcfg_init_ebi(void);
void nutool_modclkcfg_deinit_ebi(void);
void nutool_modclkcfg_init_ecap0(void);
void nutool_modclkcfg_deinit_ecap0(void);
void nutool_modclkcfg_init_ecap1(void);
void nutool_modclkcfg_deinit_ecap1(void);
void nutool_modclkcfg_init_emac(void);
void nutool_modclkcfg_deinit_emac(void);
void nutool_modclkcfg_init_epwm0(void);
void nutool_modclkcfg_deinit_epwm0(void);
void nutool_modclkcfg_init_epwm1(void);
void nutool_modclkcfg_deinit_epwm1(void);
void nutool_modclkcfg_init_fmcidle(void);
void nutool_modclkcfg_deinit_fmcidle(void);
void nutool_modclkcfg_init_hsotg(void);
void nutool_modclkcfg_deinit_hsotg(void);
void nutool_modclkcfg_init_hsusbd(void);
void nutool_modclkcfg_deinit_hsusbd(void);
void nutool_modclkcfg_init_i2c0(void);
void nutool_modclkcfg_deinit_i2c0(void);
void nutool_modclkcfg_init_i2c1(void);
void nutool_modclkcfg_deinit_i2c1(void);
void nutool_modclkcfg_init_i2c2(void);
void nutool_modclkcfg_deinit_i2c2(void);
void nutool_modclkcfg_init_i2s0(void);
void nutool_modclkcfg_deinit_i2s0(void);
void nutool_modclkcfg_init_isp(void);
void nutool_modclkcfg_deinit_isp(void);
void nutool_modclkcfg_init_opa(void);
void nutool_modclkcfg_deinit_opa(void);
void nutool_modclkcfg_init_otg(void);
void nutool_modclkcfg_deinit_otg(void);
void nutool_modclkcfg_init_pdma(void);
void nutool_modclkcfg_deinit_pdma(void);
void nutool_modclkcfg_init_qei0(void);
void nutool_modclkcfg_deinit_qei0(void);
void nutool_modclkcfg_init_qei1(void);
void nutool_modclkcfg_deinit_qei1(void);
void nutool_modclkcfg_init_qspi0(void);
void nutool_modclkcfg_deinit_qspi0(void);
void nutool_modclkcfg_init_rtc(void);
void nutool_modclkcfg_deinit_rtc(void);
void nutool_modclkcfg_init_sc0(void);
void nutool_modclkcfg_deinit_sc0(void);
void nutool_modclkcfg_init_sc1(void);
void nutool_modclkcfg_deinit_sc1(void);
void nutool_modclkcfg_init_sc2(void);
void nutool_modclkcfg_deinit_sc2(void);
void nutool_modclkcfg_init_sdh0(void);
void nutool_modclkcfg_deinit_sdh0(void);
void nutool_modclkcfg_init_sdh1(void);
void nutool_modclkcfg_deinit_sdh1(void);
void nutool_modclkcfg_init_spi0(void);
void nutool_modclkcfg_deinit_spi0(void);
void nutool_modclkcfg_init_spi1(void);
void nutool_modclkcfg_deinit_spi1(void);
void nutool_modclkcfg_init_spi2(void);
void nutool_modclkcfg_deinit_spi2(void);
void nutool_modclkcfg_init_spi3(void);
void nutool_modclkcfg_deinit_spi3(void);
void nutool_modclkcfg_init_spim(void);
void nutool_modclkcfg_deinit_spim(void);
void nutool_modclkcfg_init_systick(void);
void nutool_modclkcfg_deinit_systick(void);
void nutool_modclkcfg_init_tmr0(void);
void nutool_modclkcfg_deinit_tmr0(void);
void nutool_modclkcfg_init_tmr1(void);
void nutool_modclkcfg_deinit_tmr1(void);
void nutool_modclkcfg_init_tmr2(void);
void nutool_modclkcfg_deinit_tmr2(void);
void nutool_modclkcfg_init_tmr3(void);
void nutool_modclkcfg_deinit_tmr3(void);
void nutool_modclkcfg_init_uart0(void);
void nutool_modclkcfg_deinit_uart0(void);
void nutool_modclkcfg_init_uart1(void);
void nutool_modclkcfg_deinit_uart1(void);
void nutool_modclkcfg_init_uart2(void);
void nutool_modclkcfg_deinit_uart2(void);
void nutool_modclkcfg_init_uart3(void);
void nutool_modclkcfg_deinit_uart3(void);
void nutool_modclkcfg_init_uart4(void);
void nutool_modclkcfg_deinit_uart4(void);
void nutool_modclkcfg_init_uart5(void);
void nutool_modclkcfg_deinit_uart5(void);
void nutool_modclkcfg_init_usbd(void);
void nutool_modclkcfg_deinit_usbd(void);
void nutool_modclkcfg_init_usbh(void);
void nutool_modclkcfg_deinit_usbh(void);
void nutool_modclkcfg_init_usci0(void);
void nutool_modclkcfg_deinit_usci0(void);
void nutool_modclkcfg_init_usci1(void);
void nutool_modclkcfg_deinit_usci1(void);
void nutool_modclkcfg_init_wdt(void);
void nutool_modclkcfg_deinit_wdt(void);
void nutool_modclkcfg_init_wwdt(void);
void nutool_modclkcfg_deinit_wwdt(void);
void nutool_modclkcfg_init_base(void);
void nutool_modclkcfg_init(void);
#ifdef __cplusplus
}
#endif
#endif /*__NUTOOL_MODCLKCFG_H__*/
/*** (C) COPYRIGHT 2013-2020 Nuvoton Technology Corp. ***/

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -0,0 +1,28 @@
/*###ICF### Section handled by ICF editor, don't touch! ****/
/*-Editor annotation file-*/
/* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
/*-Specials-*/
define symbol __ICFEDIT_intvec_start__ = 0x00000000;
/*-Memory Regions-*/
define symbol __ICFEDIT_region_ROM_start__ = 0x00000000;
define symbol __ICFEDIT_region_ROM_end__ = 0x000FFFFF;
define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
define symbol __ICFEDIT_region_RAM_end__ = 0x2007FFFF;
/*-Sizes-*/
define symbol __ICFEDIT_size_cstack__ = 0x0400;
define symbol __ICFEDIT_size_heap__ = 0x0000;
/**** End of ICF editor section. ###ICF###*/
define memory mem with size = 4G;
define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
initialize by copy { readwrite };
do not initialize { section .noinit };
place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
place in ROM_region { readonly };
place in RAM_region { readwrite, last block CSTACK};

View File

@ -0,0 +1,15 @@
; *************************************************************
; *** Scatter-Loading Description File generated by uVision ***
; *************************************************************
LR_IROM1 0x00000000 0x00100000 { ; load region size_region
ER_IROM1 0x00000000 0x00100000 { ; load address = execution address
*.o (RESET, +First)
*(InRoot$$Sections)
.ANY (+RO)
}
RW_IRAM1 0x20000000 0x00080000 { ; RW data
.ANY (+RW +ZI)
}
}

View File

@ -0,0 +1,161 @@
/**************************************************************************//**
*
* @copyright (C) 2019 Nuvoton Technology Corp. All rights reserved.
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-1-16 Wayne First version
*
******************************************************************************/
/* Program Entry, set to mark it as "used" and avoid gc */
MEMORY
{
CODE (rx) : ORIGIN = 0x00000000, LENGTH = 1024k /* 1024K flash */
DATA (rw) : ORIGIN = 0x20000000, LENGTH = 512k /* 512K sram */
}
ENTRY(Reset_Handler)
_system_stack_size = 0x1000;
SECTIONS
{
.vector :
{
. = ALIGN(4);
_stext = .;
KEEP(*(.isr_vector)) /* Startup code */
} > CODE = 0
.text :
{
. = ALIGN(4);
*(.text) /* remaining code */
*(.text.*) /* remaining code */
*(.rodata) /* read-only data (constants) */
*(.rodata*)
*(.glue_7)
*(.glue_7t)
*(.gnu.linkonce.t*)
/* section information for finsh shell */
. = ALIGN(4);
__fsymtab_start = .;
KEEP(*(FSymTab))
__fsymtab_end = .;
. = ALIGN(4);
__vsymtab_start = .;
KEEP(*(VSymTab))
__vsymtab_end = .;
. = ALIGN(4);
/* section information for initial. */
. = ALIGN(4);
__rt_init_start = .;
KEEP(*(SORT(.rti_fn*)))
__rt_init_end = .;
. = ALIGN(4);
/* section information for utest */
. = ALIGN(4);
__rt_utest_tc_tab_start = .;
KEEP(*(UtestTcTab))
__rt_utest_tc_tab_end = .;
. = ALIGN(4);
_etext = .;
} > CODE = 0
/* .ARM.exidx is sorted, so has to go in its own output section. */
__exidx_start = .;
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
/* This is used by the startup in order to initialize the .data section */
_sidata = .;
} > CODE
__exidx_end = .;
/* .data section which is used for initialized data */
.stack :
{
_sstack = .;
. = . + _system_stack_size;
. = ALIGN(4);
_estack = .;
} >DATA
.data : AT (_sidata)
{
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data section */
_sdata = . ;
*(.data)
*(.data.*)
*(.gnu.linkonce.d*)
. = ALIGN(4);
/* This is used by the startup in order to initialize the .data section */
_edata = . ;
} >DATA
__bss_start = .;
.bss :
{
. = ALIGN(4);
/* This is used by the startup in order to initialize the .bss section */
_sbss = .;
*(.bss)
*(.bss.*)
*(COMMON)
. = ALIGN(4);
/* This is used by the startup in order to initialize the .bss section */
_ebss = . ;
*(.bss.init)
} > DATA
__bss_end = .;
_end = .;
__ram_top = ORIGIN(DATA) + LENGTH(DATA);
/* Stabs debugging sections. */
.stab 0 : { *(.stab) }
.stabstr 0 : { *(.stabstr) }
.stab.excl 0 : { *(.stab.excl) }
.stab.exclstr 0 : { *(.stab.exclstr) }
.stab.index 0 : { *(.stab.index) }
.stab.indexstr 0 : { *(.stab.indexstr) }
.comment 0 : { *(.comment) }
/* DWARF debug sections.
* Symbols in the DWARF debugging sections are relative to the beginning
* of the section so we begin them at 0. */
/* DWARF 1 */
.debug 0 : { *(.debug) }
.line 0 : { *(.line) }
/* GNU DWARF 1 extensions */
.debug_srcinfo 0 : { *(.debug_srcinfo) }
.debug_sfnames 0 : { *(.debug_sfnames) }
/* DWARF 1.1 and DWARF 2 */
.debug_aranges 0 : { *(.debug_aranges) }
.debug_pubnames 0 : { *(.debug_pubnames) }
/* DWARF 2 */
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
.debug_abbrev 0 : { *(.debug_abbrev) }
.debug_line 0 : { *(.debug_line) }
.debug_frame 0 : { *(.debug_frame) }
.debug_str 0 : { *(.debug_str) }
.debug_loc 0 : { *(.debug_loc) }
.debug_macinfo 0 : { *(.debug_macinfo) }
/* SGI/MIPS DWARF 2 extensions */
.debug_weaknames 0 : { *(.debug_weaknames) }
.debug_funcnames 0 : { *(.debug_funcnames) }
.debug_typenames 0 : { *(.debug_typenames) }
.debug_varnames 0 : { *(.debug_varnames) }
}

View File

@ -0,0 +1,140 @@
import os
# toolchains options
ARCH='arm'
CPU='cortex-m4'
CROSS_TOOL='gcc'
if os.getenv('RTT_CC'):
CROSS_TOOL = os.getenv('RTT_CC')
if os.getenv('RTT_ROOT'):
RTT_ROOT = os.getenv('RTT_ROOT')
# cross_tool provides the cross compiler
# EXEC_PATH is the compiler execute path, for example, CodeSourcery, Keil MDK, IAR
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = r'C:\Program Files (x86)\GNU Tools ARM Embedded\6 2017-q1-update\bin'
elif CROSS_TOOL == 'keil':
PLATFORM = 'armcc'
EXEC_PATH = r'C:\Keil_v5'
elif CROSS_TOOL == 'iar':
PLATFORM = 'iccarm'
EXEC_PATH = r'C:\Program Files (x86)\IAR Systems\Embedded Workbench 8.2'
if os.getenv('RTT_EXEC_PATH'):
EXEC_PATH = os.getenv('RTT_EXEC_PATH')
BUILD = ''
#BUILD = 'debug'
if PLATFORM == 'gcc':
# toolchains
PREFIX = 'arm-none-eabi-'
CC = PREFIX + 'gcc'
AS = PREFIX + 'gcc'
AR = PREFIX + 'ar'
CXX = PREFIX + 'g++'
LINK = PREFIX + 'gcc'
TARGET_EXT = 'elf'
SIZE = PREFIX + 'size'
OBJDUMP = PREFIX + 'objdump'
OBJCPY = PREFIX + 'objcopy'
DEVICE = ' -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -ffunction-sections -fdata-sections'
CFLAGS = DEVICE + ' -Dgcc'
AFLAGS = ' -c' + DEVICE + ' -x assembler-with-cpp -Wa,-mimplicit-it=thumb '
LFLAGS = DEVICE + ' -Wl,--gc-sections,-Map=rtthread.map,-cref,-u,Reset_Handler -T ./linking_scripts/m460_link.ld '
CPATH = ''
LPATH = ''
if BUILD == 'debug':
CFLAGS += ' -O0 -gdwarf-2 -g'
AFLAGS += ' -gdwarf-2'
else:
CFLAGS += ' -O2'
CXXFLAGS = CFLAGS
POST_ACTION = OBJCPY + ' -O binary $TARGET rtthread.bin\n' + SIZE + ' $TARGET \n'
elif PLATFORM == 'armcc':
# toolchains
CC = 'armcc'
AS = 'armasm'
AR = 'armar'
LINK = 'armlink'
TARGET_EXT = 'axf'
DEVICE = ' --cpu=cortex-m4.fp'
CFLAGS = DEVICE + ' --apcs=interwork'
AFLAGS = DEVICE
LFLAGS = DEVICE + ' --info sizes --info totals --info unused --info veneers --list rtthread.map --scatter ./linking_scripts/m460_flash.sct'
CFLAGS += ' --c99'
CFLAGS += ' -I' + EXEC_PATH + '/ARM/RV31/INC'
LFLAGS += ' --libpath ' + EXEC_PATH + '/ARM/RV31/LIB'
EXEC_PATH += '/arm/bin40/'
if BUILD == 'debug':
CFLAGS += ' -g -O0'
AFLAGS += ' -g'
else:
CFLAGS += ' -O2'
POST_ACTION = 'fromelf --bin $TARGET --output rtthread.bin \nfromelf -z $TARGET'
elif PLATFORM == 'iccarm':
# toolchains
CC = 'iccarm'
AS = 'iasmarm'
AR = 'iarchive'
LINK = 'ilinkarm'
TARGET_EXT = 'out'
DEVICE = ' '
CFLAGS = DEVICE
CFLAGS += ' --diag_suppress Pa050'
CFLAGS += ' --no_cse'
CFLAGS += ' --no_unroll'
CFLAGS += ' --no_inline'
CFLAGS += ' --no_code_motion'
CFLAGS += ' --no_tbaa'
CFLAGS += ' --no_clustering'
CFLAGS += ' --no_scheduling'
CFLAGS += ' --debug'
CFLAGS += ' --endian=little'
CFLAGS += ' --cpu=Cortex-M4'
CFLAGS += ' -e'
CFLAGS += ' --fpu=None'
CFLAGS += ' --dlib_config "' + EXEC_PATH + '/arm/INC/c/DLib_Config_Normal.h"'
CFLAGS += ' -Ol'
CFLAGS += ' --use_c++_inline'
AFLAGS = ''
AFLAGS += ' -s+'
AFLAGS += ' -w+'
AFLAGS += ' -r'
AFLAGS += ' --cpu Cortex-M4'
AFLAGS += ' --fpu None'
LFLAGS = ' --config ./linking_scripts/m460_flash.icf'
LFLAGS += ' --redirect _Printf=_PrintfTiny'
LFLAGS += ' --redirect _Scanf=_ScanfSmall'
LFLAGS += ' --entry __iar_program_start'
EXEC_PATH = EXEC_PATH + '/arm/bin/'
POST_ACTION = ''
def dist_handle(BSP_ROOT, dist_dir):
import sys
cwd_path = os.getcwd()
sys.path.append(os.path.join(os.path.dirname(BSP_ROOT), 'tools'))
from sdk_dist import dist_do_building
dist_do_building(BSP_ROOT, dist_dir)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<workspace>
<project>
<path>$WS_DIR$\Template.ewp</path>
</project>
<batchBuild/>
</workspace>

View File

@ -0,0 +1,402 @@
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<Project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="project_projx.xsd">
<SchemaVersion>2.1</SchemaVersion>
<Header>### uVision Project, (C) Keil Software</Header>
<Targets>
<Target>
<TargetName>rtthread-m460</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060750::V5.06 update 6 (build 750)::ARMCC</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>
<Device>M467HJHAE</Device>
<Vendor>Nuvoton</Vendor>
<PackID>Nuvoton.NuMicro_DFP.1.3.13</PackID>
<PackURL>https://github.com/OpenNuvoton/cmsis-packs/raw/master/</PackURL>
<Cpu>IRAM(0x20000000,0x80000) IROM(0x00000000,0x100000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000)</Cpu>
<FlashUtilSpec></FlashUtilSpec>
<StartupFile></StartupFile>
<FlashDriverDll>UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0M460_AP_1M -FS00 -FL0100000 -FP0($$Device:M467HJHAE$Flash\M460_AP_1M.FLM))</FlashDriverDll>
<DeviceId>0</DeviceId>
<RegisterFile>$$Device:M467HJHAE$Device\M460\Include\m460.h</RegisterFile>
<MemoryEnv></MemoryEnv>
<Cmp></Cmp>
<Asm></Asm>
<Linker></Linker>
<OHString></OHString>
<InfinionOptionDll></InfinionOptionDll>
<SLE66CMisc></SLE66CMisc>
<SLE66AMisc></SLE66AMisc>
<SLE66LinkerMisc></SLE66LinkerMisc>
<SFDFile>$$Device:M467HJHAE$SVD\Nuvoton\M460.svd</SFDFile>
<bCustSvd>0</bCustSvd>
<UseEnv>0</UseEnv>
<BinPath></BinPath>
<IncludePath></IncludePath>
<LibPath></LibPath>
<RegisterFilePath></RegisterFilePath>
<DBRegisterFilePath></DBRegisterFilePath>
<TargetStatus>
<Error>0</Error>
<ExitCodeStop>0</ExitCodeStop>
<ButtonStop>0</ButtonStop>
<NotGenerated>0</NotGenerated>
<InvalidFlash>1</InvalidFlash>
</TargetStatus>
<OutputDirectory>.\build\keil5\</OutputDirectory>
<OutputName>rtthread</OutputName>
<CreateExecutable>1</CreateExecutable>
<CreateLib>0</CreateLib>
<CreateHexFile>1</CreateHexFile>
<DebugInformation>1</DebugInformation>
<BrowseInformation>1</BrowseInformation>
<ListingPath>.\build\keil5\</ListingPath>
<HexFormatSelection>1</HexFormatSelection>
<Merge32K>0</Merge32K>
<CreateBatchFile>0</CreateBatchFile>
<BeforeCompile>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopU1X>0</nStopU1X>
<nStopU2X>0</nStopU2X>
</BeforeCompile>
<BeforeMake>
<RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopB1X>0</nStopB1X>
<nStopB2X>0</nStopB2X>
</BeforeMake>
<AfterMake>
<RunUserProg1>1</RunUserProg1>
<RunUserProg2>0</RunUserProg2>
<UserProg1Name>fromelf.exe --bin --output "$L@L.bin" "$L@L.axf"</UserProg1Name>
<UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode>
<UserProg2Dos16Mode>0</UserProg2Dos16Mode>
<nStopA1X>0</nStopA1X>
<nStopA2X>0</nStopA2X>
</AfterMake>
<SelectedForBatchBuild>0</SelectedForBatchBuild>
<SVCSIdString></SVCSIdString>
</TargetCommonOption>
<CommonProperty>
<UseCPPCompiler>0</UseCPPCompiler>
<RVCTCodeConst>0</RVCTCodeConst>
<RVCTZI>0</RVCTZI>
<RVCTOtherData>0</RVCTOtherData>
<ModuleSelection>0</ModuleSelection>
<IncludeInBuild>1</IncludeInBuild>
<AlwaysBuild>0</AlwaysBuild>
<GenerateAssemblyFile>0</GenerateAssemblyFile>
<AssembleAssemblyFile>0</AssembleAssemblyFile>
<PublicsOnly>0</PublicsOnly>
<StopOnExitCode>3</StopOnExitCode>
<CustomArgument></CustomArgument>
<IncludeLibraryModules></IncludeLibraryModules>
<ComprImg>1</ComprImg>
</CommonProperty>
<DllOption>
<SimDllName>SARMCM3.DLL</SimDllName>
<SimDllArguments> </SimDllArguments>
<SimDlgDll>DCM.DLL</SimDlgDll>
<SimDlgDllArguments>-pCM4</SimDlgDllArguments>
<TargetDllName>SARMCM3.DLL</TargetDllName>
<TargetDllArguments></TargetDllArguments>
<TargetDlgDll>TCM.DLL</TargetDlgDll>
<TargetDlgDllArguments>-pCM4</TargetDlgDllArguments>
</DllOption>
<DebugOption>
<OPTHX>
<HexSelection>1</HexSelection>
<HexRangeLowAddress>0</HexRangeLowAddress>
<HexRangeHighAddress>0</HexRangeHighAddress>
<HexOffset>0</HexOffset>
<Oh166RecLen>16</Oh166RecLen>
</OPTHX>
</DebugOption>
<Utilities>
<Flash1>
<UseTargetDll>1</UseTargetDll>
<UseExternalTool>0</UseExternalTool>
<RunIndependent>0</RunIndependent>
<UpdateFlashBeforeDebugging>1</UpdateFlashBeforeDebugging>
<Capability>1</Capability>
<DriverSelection>4103</DriverSelection>
</Flash1>
<bUseTDR>1</bUseTDR>
<Flash2>BIN\UL2CM3.DLL</Flash2>
<Flash3></Flash3>
<Flash4></Flash4>
<pFcarmOut></pFcarmOut>
<pFcarmGrp></pFcarmGrp>
<pFcArmRoot></pFcArmRoot>
<FcArmLst>0</FcArmLst>
</Utilities>
<TargetArmAds>
<ArmAdsMisc>
<GenerateListings>0</GenerateListings>
<asHll>1</asHll>
<asAsm>1</asAsm>
<asMacX>1</asMacX>
<asSyms>1</asSyms>
<asFals>1</asFals>
<asDbgD>1</asDbgD>
<asForm>1</asForm>
<ldLst>0</ldLst>
<ldmm>1</ldmm>
<ldXref>1</ldXref>
<BigEnd>0</BigEnd>
<AdsALst>1</AdsALst>
<AdsACrf>1</AdsACrf>
<AdsANop>0</AdsANop>
<AdsANot>0</AdsANot>
<AdsLLst>1</AdsLLst>
<AdsLmap>1</AdsLmap>
<AdsLcgr>1</AdsLcgr>
<AdsLsym>1</AdsLsym>
<AdsLszi>1</AdsLszi>
<AdsLtoi>1</AdsLtoi>
<AdsLsun>1</AdsLsun>
<AdsLven>1</AdsLven>
<AdsLsxf>1</AdsLsxf>
<RvctClst>0</RvctClst>
<GenPPlst>0</GenPPlst>
<AdsCpuType>"Cortex-M4"</AdsCpuType>
<RvctDeviceName></RvctDeviceName>
<mOS>0</mOS>
<uocRom>0</uocRom>
<uocRam>0</uocRam>
<hadIROM>1</hadIROM>
<hadIRAM>1</hadIRAM>
<hadXRAM>0</hadXRAM>
<uocXRam>0</uocXRam>
<RvdsVP>2</RvdsVP>
<RvdsMve>0</RvdsMve>
<hadIRAM2>0</hadIRAM2>
<hadIROM2>0</hadIROM2>
<StupSel>8</StupSel>
<useUlib>0</useUlib>
<EndSel>0</EndSel>
<uLtcg>0</uLtcg>
<nSecure>0</nSecure>
<RoSelD>3</RoSelD>
<RwSelD>3</RwSelD>
<CodeSel>0</CodeSel>
<OptFeed>0</OptFeed>
<NoZi1>0</NoZi1>
<NoZi2>0</NoZi2>
<NoZi3>0</NoZi3>
<NoZi4>0</NoZi4>
<NoZi5>0</NoZi5>
<Ro1Chk>0</Ro1Chk>
<Ro2Chk>0</Ro2Chk>
<Ro3Chk>0</Ro3Chk>
<Ir1Chk>1</Ir1Chk>
<Ir2Chk>0</Ir2Chk>
<Ra1Chk>0</Ra1Chk>
<Ra2Chk>0</Ra2Chk>
<Ra3Chk>0</Ra3Chk>
<Im1Chk>1</Im1Chk>
<Im2Chk>0</Im2Chk>
<OnChipMemories>
<Ocm1>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm1>
<Ocm2>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm2>
<Ocm3>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm3>
<Ocm4>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm4>
<Ocm5>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm5>
<Ocm6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</Ocm6>
<IRAM>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x80000</Size>
</IRAM>
<IROM>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x100000</Size>
</IROM>
<XRAM>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</XRAM>
<OCR_RVCT1>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT1>
<OCR_RVCT2>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT2>
<OCR_RVCT3>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT3>
<OCR_RVCT4>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x100000</Size>
</OCR_RVCT4>
<OCR_RVCT5>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT5>
<OCR_RVCT6>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT6>
<OCR_RVCT7>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT7>
<OCR_RVCT8>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT8>
<OCR_RVCT9>
<Type>0</Type>
<StartAddress>0x20000000</StartAddress>
<Size>0x80000</Size>
</OCR_RVCT9>
<OCR_RVCT10>
<Type>0</Type>
<StartAddress>0x0</StartAddress>
<Size>0x0</Size>
</OCR_RVCT10>
</OnChipMemories>
<RvctStartVector></RvctStartVector>
</ArmAdsMisc>
<Cads>
<interw>1</interw>
<Optim>3</Optim>
<oTime>0</oTime>
<SplitLS>0</SplitLS>
<OneElfS>0</OneElfS>
<Strict>0</Strict>
<EnumInt>0</EnumInt>
<PlainCh>0</PlainCh>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<wLevel>0</wLevel>
<uThumb>0</uThumb>
<uSurpInc>0</uSurpInc>
<uC99>0</uC99>
<uGnu>0</uGnu>
<useXO>0</useXO>
<v6Lang>1</v6Lang>
<v6LangP>1</v6LangP>
<vShortEn>1</vShortEn>
<vShortWch>1</vShortWch>
<v6Lto>0</v6Lto>
<v6WtE>0</v6WtE>
<v6Rtti>0</v6Rtti>
<VariousControls>
<MiscControls>--c99 --diag_suppress=66,1296,186</MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Cads>
<Aads>
<interw>1</interw>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<thumb>0</thumb>
<SplitLS>0</SplitLS>
<SwStkChk>0</SwStkChk>
<NoWarn>0</NoWarn>
<uSurpInc>0</uSurpInc>
<useXO>0</useXO>
<uClangAs>0</uClangAs>
<VariousControls>
<MiscControls></MiscControls>
<Define></Define>
<Undefine></Undefine>
<IncludePath></IncludePath>
</VariousControls>
</Aads>
<LDads>
<umfTarg>0</umfTarg>
<Ropi>0</Ropi>
<Rwpi>0</Rwpi>
<noStLib>0</noStLib>
<RepFail>1</RepFail>
<useFile>0</useFile>
<TextAddressRange>0x00000000</TextAddressRange>
<DataAddressRange>0x20000000</DataAddressRange>
<pXoBase></pXoBase>
<ScatterFile>.\linking_scripts\m460_flash.sct</ScatterFile>
<IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath>
<Misc></Misc>
<LinkerInputFile></LinkerInputFile>
<DisabledWarnings></DisabledWarnings>
</LDads>
</TargetArmAds>
</TargetOption>
<Groups>
<Group>
<GroupName>::CMSIS</GroupName>
</Group>
</Groups>
</Target>
</Targets>
<RTE>
<apis/>
<components>
<component Cclass="CMSIS" Cgroup="CORE" Cvendor="ARM" Cversion="5.4.0" condition="ARMv6_7_8-M Device">
<package name="CMSIS" schemaVersion="1.3" url="http://www.keil.com/pack/" vendor="ARM" version="5.7.0"/>
<targetInfos>
<targetInfo name="rtthread-m460"/>
</targetInfos>
</component>
</components>
<files/>
</RTE>
</Project>

View File

@ -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=0x50000
CONFIG_ARCH_ARM=y
CONFIG_RT_USING_CPU_FFS=y
CONFIG_ARCH_ARM_CORTEX_M=y
@ -162,6 +162,7 @@ CONFIG_RT_SERIAL_USING_DMA=y
CONFIG_RT_SERIAL_RB_BUFSZ=2048
CONFIG_RT_USING_CAN=y
# CONFIG_RT_CAN_USING_HDR is not set
# CONFIG_RT_CAN_USING_CANFD is not set
CONFIG_RT_USING_HWTIMER=y
# CONFIG_RT_USING_CPUTIME is not set
CONFIG_RT_USING_I2C=y
@ -315,9 +316,11 @@ 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
CONFIG_RT_USING_NETDEV=y
CONFIG_NETDEV_USING_IFCONFIG=y
@ -335,6 +338,7 @@ CONFIG_RT_USING_AT=y
CONFIG_AT_USING_CLIENT=y
CONFIG_AT_CLIENT_NUM_MAX=1
CONFIG_AT_USING_SOCKET=y
# CONFIG_AT_USING_SOCKET_SERVER is not set
CONFIG_AT_USING_CLI=y
# CONFIG_AT_PRINT_RAW_CMD is not set
CONFIG_AT_CMD_MAX_LEN=512
@ -406,8 +410,12 @@ CONFIG_PKG_AT_DEVICE_PATH="/packages/iot/at_device"
CONFIG_AT_DEVICE_USING_ESP8266=y
CONFIG_AT_DEVICE_ESP8266_INIT_ASYN=y
CONFIG_AT_DEVICE_ESP8266_SOCKET=y
# CONFIG_AT_DEVICE_ESP8266_SAMPLE is not set
CONFIG_AT_DEVICE_ESP8266_SAMPLE=y
# CONFIG_AT_DEVICE_ESP8266_SAMPLE_BSP_TAKEOVER is not set
CONFIG_ESP8266_SAMPLE_WIFI_SSID="NT_ZY_BUFFALO"
CONFIG_ESP8266_SAMPLE_WIFI_PASSWORD="12345678"
CONFIG_ESP8266_SAMPLE_CLIENT_NAME="uart1"
CONFIG_ESP8266_SAMPLE_RECV_BUFF_LEN=2048
# CONFIG_AT_DEVICE_USING_RW007 is not set
# CONFIG_AT_DEVICE_USING_SIM800C is not set
# CONFIG_AT_DEVICE_USING_SIM76XX is not set
@ -449,6 +457,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
@ -482,12 +491,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
@ -505,6 +516,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_RAPIDJSON is not set
# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_AGILE_JSMN is not set
# CONFIG_PKG_USING_PARSON is not set
#
# XML: Extensible Markup Language
@ -516,6 +528,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# 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
@ -527,6 +540,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_LVGL is not set
# 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
@ -603,6 +617,8 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# 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
# CONFIG_PKG_USING_ARMV7M_DWT_TOOL is not set
#
# system packages
@ -615,14 +631,6 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
#
# POSIX extension functions
#
# CONFIG_PKG_USING_POSIX_GETLINE is not set
# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
# CONFIG_PKG_USING_POSIX_ITOA is not set
# CONFIG_PKG_USING_POSIX_STRINGS is not set
#
# acceleration: Assembly language or algorithmic acceleration packages
#
@ -634,6 +642,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# 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
#
@ -646,9 +655,11 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# 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_FREERTOS_WRAPPER 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_PERF_COUNTER is not set
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
@ -677,6 +688,7 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# 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
@ -685,8 +697,10 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_SHT3X is not set
# CONFIG_PKG_USING_ADT74XX is not set
# CONFIG_PKG_USING_AS7341 is not set
# CONFIG_PKG_USING_STM32_SDIO is not set
# CONFIG_PKG_USING_ESP_IDF is not set
# CONFIG_PKG_USING_ICM20608 is not set
# CONFIG_PKG_USING_BUTTON is not set
# CONFIG_PKG_USING_PCF8574 is not set
@ -698,6 +712,11 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_NRF5X_SDK is not set
# CONFIG_PKG_USING_NRFX is not set
# CONFIG_PKG_USING_WM_LIBRARIES is not set
#
# Kendryte SDK
#
# CONFIG_PKG_USING_K210_SDK 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
@ -758,6 +777,8 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_MB85RS16 is not set
# CONFIG_PKG_USING_CW2015 is not set
# CONFIG_PKG_USING_RFM300 is not set
# CONFIG_PKG_USING_IO_INPUT_FILTER is not set
# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set
#
# AI packages
@ -831,6 +852,8 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# 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
@ -961,13 +984,16 @@ CONFIG_BOARD_USING_HSUSBH_USBD=y
#
CONFIG_NU_PKG_USING_UTILS=y
CONFIG_NU_PKG_USING_DEMO=y
# CONFIG_NU_PKG_USING_LVGL is not set
CONFIG_NU_PKG_USING_BMX055=y
# CONFIG_NU_PKG_USING_MAX31875 is not set
# CONFIG_NU_PKG_USING_NCT7717U is not set
CONFIG_NU_PKG_USING_NAU88L25=y
# CONFIG_NU_PKG_USING_NAU8822 is not set
# CONFIG_NU_PKG_USING_DA9062 is not set
# CONFIG_NU_PKG_USING_ILI9341 is not set
# CONFIG_NU_PKG_USING_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 is not set
# CONFIG_NU_PKG_USING_SPINAND is not set

View File

@ -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)

View File

@ -184,64 +184,18 @@ INIT_APP_EXPORT(rt_hw_bmx055_port);
#endif /* BOARD_USING_BMX055 */
#if defined(BOARD_USING_ESP8266)
#include <at_device_esp8266.h>
#define LOG_TAG "at.sample.esp"
#undef DBG_TAG
#include <at_log.h>
static struct at_device_esp8266 esp0 =
{
"esp0", /* esp8266 device name */
"uart1", /* esp8266 serial device name, EX: uart1, uuart1 */
"NT_ZY_BUFFALO", /* Wi-Fi SSID */
"12345678", /* Wi-Fi PASSWORD */
1024 /* Receive buffer length */
};
static int rt_hw_esp8266_port(void)
{
struct at_device_esp8266 *esp8266 = &esp0;
rt_base_t esp_rst_pin = NU_GET_PININDEX(NU_PH, 3);
/* ESP8266 reset pin PH.3 */
rt_pin_mode(esp_rst_pin, PIN_MODE_OUTPUT);
rt_pin_write(esp_rst_pin, 1);
return at_device_register(&(esp8266->device),
esp8266->device_name,
esp8266->client_name,
AT_DEVICE_CLASS_ESP8266,
(void *) esp8266);
return 0;
}
INIT_APP_EXPORT(rt_hw_esp8266_port);
static void at_wifi_set(int argc, char **argv)
{
struct at_device_ssid_pwd sATDConf;
struct at_device *at_dev = RT_NULL;
/* If the number of arguments less than 2 */
if (argc != 3)
{
rt_kprintf("\n");
rt_kprintf("at_wifi_set <ssid> <password>\n");
return ;
}
sATDConf.ssid = argv[1]; //ssid
sATDConf.password = argv[2]; //password
if ((at_dev = at_device_get_first_initialized()) != RT_NULL)
at_device_control(at_dev, AT_DEVICE_CTRL_SET_WIFI_INFO, &sATDConf);
else
{
rt_kprintf("Can't find any initialized AT device.\n");
}
}
#ifdef FINSH_USING_MSH
MSH_CMD_EXPORT(at_wifi_set, AT device wifi set ssid / password function);
#endif
#endif /* BOARD_USING_ESP8266 */
#if defined(BOARD_USING_LCD_ILI9341) && defined(NU_PKG_USING_ILI9341_SPI)

View File

@ -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_KPRINTF_USING_LONGLONG is not set
# CONFIG_RT_PRINTF_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=0x40101
CONFIG_RT_VER_NUM=0x40100
CONFIG_ARCH_ARM=y
# CONFIG_RT_USING_CPU_FFS is not set
CONFIG_ARCH_ARM_CORTEX_M=y
@ -257,21 +257,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
#
# CONFIG_UTEST_SERIAL_TC is not set
#
# RTT Posix Testcase
#
# CONFIG_RTT_POSIX_TESTCASE is not set
#
# RT-Thread online packages
#
@ -330,7 +320,6 @@ 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
@ -364,14 +353,12 @@ 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
@ -389,7 +376,6 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_RAPIDJSON is not set
# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_AGILE_JSMN is not set
# CONFIG_PKG_USING_PARSON is not set
#
# XML: Extensible Markup Language
@ -401,7 +387,6 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# 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
@ -413,7 +398,6 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_LVGL is not set
# 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
@ -488,9 +472,6 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# 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
# CONFIG_PKG_USING_ARMV7M_DWT_TOOL is not set
#
# system packages
@ -503,6 +484,14 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
#
# POSIX extension functions
#
# CONFIG_PKG_USING_POSIX_GETLINE is not set
# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
# CONFIG_PKG_USING_POSIX_ITOA is not set
# CONFIG_PKG_USING_POSIX_STRINGS is not set
#
# acceleration: Assembly language or algorithmic acceleration packages
#
@ -514,7 +503,6 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# 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
#
@ -527,11 +515,9 @@ 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_FREERTOS_WRAPPER 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_PERF_COUNTER is not set
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
@ -560,7 +546,6 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# 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
@ -569,10 +554,8 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_SHT3X is not set
# CONFIG_PKG_USING_ADT74XX is not set
# CONFIG_PKG_USING_AS7341 is not set
# CONFIG_PKG_USING_STM32_SDIO is not set
# CONFIG_PKG_USING_ESP_IDF is not set
# CONFIG_PKG_USING_ICM20608 is not set
# CONFIG_PKG_USING_BUTTON is not set
# CONFIG_PKG_USING_PCF8574 is not set
@ -584,11 +567,6 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_NRF5X_SDK is not set
# CONFIG_PKG_USING_NRFX is not set
# CONFIG_PKG_USING_WM_LIBRARIES is not set
#
# Kendryte SDK
#
# CONFIG_PKG_USING_K210_SDK 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
@ -649,8 +627,6 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# CONFIG_PKG_USING_MB85RS16 is not set
# CONFIG_PKG_USING_CW2015 is not set
# CONFIG_PKG_USING_RFM300 is not set
# CONFIG_PKG_USING_IO_INPUT_FILTER is not set
# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set
#
# AI packages
@ -724,66 +700,6 @@ CONFIG_UTEST_SMALL_MEM_TC=y
# 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
# CONFIG_PKG_USING_QPARAM is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
# CONFIG_PKG_USING_MPLAYER is not set
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
# CONFIG_PKG_USING_JS_PERSIMMON is not set
# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_WICED is not set
# CONFIG_PKG_USING_CLOUDSDK is not set
# CONFIG_PKG_USING_POWER_MANAGER is not set
# CONFIG_PKG_USING_RT_OTA is not set
# CONFIG_PKG_USING_RTINSIGHT is not set
# CONFIG_PKG_USING_SMARTCONFIG is not set
# CONFIG_PKG_USING_RTX is not set
# CONFIG_RT_USING_TESTCASE is not set
# CONFIG_PKG_USING_NGHTTP2 is not set
# CONFIG_PKG_USING_AVS is not set
# CONFIG_PKG_USING_ALI_LINKKIT is not set
# CONFIG_PKG_USING_STS is not set
# CONFIG_PKG_USING_DLMS is not set
# CONFIG_PKG_USING_AUDIO_FRAMEWORK is not set
# CONFIG_PKG_USING_ZBAR is not set
# CONFIG_PKG_USING_MCF is not set
# CONFIG_PKG_USING_URPC is not set
# CONFIG_PKG_USING_DCM is not set
# CONFIG_PKG_USING_EMQ is not set
# CONFIG_PKG_USING_CFGM is not set
# CONFIG_PKG_USING_RT_CMSIS_DAP is not set
# CONFIG_PKG_USING_SMODULE is not set
# CONFIG_PKG_USING_SNFD is not set
# CONFIG_PKG_USING_UDBD is not set
# CONFIG_PKG_USING_BENCHMARK is not set
# CONFIG_PKG_USING_UBJSON is not set
# CONFIG_PKG_USING_DATATYPE is not set
# CONFIG_PKG_USING_FASTFS is not set
# CONFIG_PKG_USING_RIL is not set
# CONFIG_PKG_USING_WATCH_DCM_SVC is not set
# CONFIG_PKG_USING_WATCH_APP_FWK is not set
# CONFIG_PKG_USING_GUI_TEST is not set
# CONFIG_PKG_USING_PMEM is not set
# CONFIG_PKG_USING_LWRDP is not set
# CONFIG_PKG_USING_MASAN is not set
# CONFIG_PKG_USING_BSDIFF_LIB is not set
# CONFIG_PKG_USING_PRC_DIFF is not set
#
# RT-Thread Smart
#
# CONFIG_PKG_USING_UKERNEL is not set
# CONFIG_PKG_USING_TRACE_AGENT is not set
#
# Hardware Drivers Config
@ -870,7 +786,6 @@ CONFIG_BSP_USING_NULINKME=y
#
CONFIG_NU_PKG_USING_UTILS=y
CONFIG_NU_PKG_USING_DEMO=y
# 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
@ -878,7 +793,6 @@ CONFIG_NU_PKG_USING_DEMO=y
# CONFIG_NU_PKG_USING_DA9062 is not set
# CONFIG_NU_PKG_USING_ILI9341 is not set
# 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 is not set
# CONFIG_NU_PKG_USING_SPINAND is not set

View File

@ -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=0x40101
CONFIG_RT_VER_NUM=0x50000
# CONFIG_RT_USING_CPU_FFS is not set
# CONFIG_ARCH_CPU_STACK_GROWS_UPWARD is not set
@ -406,8 +406,12 @@ CONFIG_PKG_AT_DEVICE_PATH="/packages/iot/at_device"
CONFIG_AT_DEVICE_USING_ESP8266=y
CONFIG_AT_DEVICE_ESP8266_INIT_ASYN=y
CONFIG_AT_DEVICE_ESP8266_SOCKET=y
# CONFIG_AT_DEVICE_ESP8266_SAMPLE is not set
CONFIG_AT_DEVICE_ESP8266_SAMPLE=y
# CONFIG_AT_DEVICE_ESP8266_SAMPLE_BSP_TAKEOVER is not set
CONFIG_ESP8266_SAMPLE_WIFI_SSID="NT_ZY_BUFFALO"
CONFIG_ESP8266_SAMPLE_WIFI_PASSWORD="12345678"
CONFIG_ESP8266_SAMPLE_CLIENT_NAME="uart4"
CONFIG_ESP8266_SAMPLE_RECV_BUFF_LEN=2048
# CONFIG_AT_DEVICE_USING_RW007 is not set
# CONFIG_AT_DEVICE_USING_SIM800C is not set
# CONFIG_AT_DEVICE_USING_SIM76XX is not set
@ -845,64 +849,6 @@ CONFIG_PKG_AT_DEVICE_VER_NUM=0x99999
# CONFIG_PKG_USING_MFBD is not set
# CONFIG_PKG_USING_SLCAN2RTT is not set
# CONFIG_PKG_USING_SOEM is not set
# CONFIG_PKG_USING_QPARAM is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
# CONFIG_PKG_USING_MPLAYER is not set
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
# CONFIG_PKG_USING_JS_PERSIMMON is not set
# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_WICED is not set
# CONFIG_PKG_USING_CLOUDSDK is not set
# CONFIG_PKG_USING_POWER_MANAGER is not set
# CONFIG_PKG_USING_RT_OTA is not set
# CONFIG_PKG_USING_RTINSIGHT is not set
# CONFIG_PKG_USING_SMARTCONFIG is not set
# CONFIG_PKG_USING_RTX is not set
# CONFIG_RT_USING_TESTCASE is not set
# CONFIG_PKG_USING_NGHTTP2 is not set
# CONFIG_PKG_USING_AVS is not set
# CONFIG_PKG_USING_ALI_LINKKIT is not set
# CONFIG_PKG_USING_STS is not set
# CONFIG_PKG_USING_DLMS is not set
# CONFIG_PKG_USING_AUDIO_FRAMEWORK is not set
# CONFIG_PKG_USING_ZBAR is not set
# CONFIG_PKG_USING_MCF is not set
# CONFIG_PKG_USING_URPC is not set
# CONFIG_PKG_USING_DCM is not set
# CONFIG_PKG_USING_EMQ is not set
# CONFIG_PKG_USING_CFGM is not set
# CONFIG_PKG_USING_RT_CMSIS_DAP is not set
# CONFIG_PKG_USING_SMODULE is not set
# CONFIG_PKG_USING_SNFD is not set
# CONFIG_PKG_USING_UDBD is not set
# CONFIG_PKG_USING_BENCHMARK is not set
# CONFIG_PKG_USING_UBJSON is not set
# CONFIG_PKG_USING_DATATYPE is not set
# CONFIG_PKG_USING_FASTFS is not set
# CONFIG_PKG_USING_RIL is not set
# CONFIG_PKG_USING_WATCH_DCM_SVC is not set
# CONFIG_PKG_USING_WATCH_APP_FWK is not set
# CONFIG_PKG_USING_GUI_TEST is not set
# CONFIG_PKG_USING_PMEM is not set
# CONFIG_PKG_USING_LWRDP is not set
# CONFIG_PKG_USING_MASAN is not set
# CONFIG_PKG_USING_BSDIFF_LIB is not set
# CONFIG_PKG_USING_PRC_DIFF is not set
#
# RT-Thread Smart
#
# CONFIG_PKG_USING_UKERNEL is not set
# CONFIG_PKG_USING_TRACE_AGENT is not set
#
# Hardware Drivers Config
@ -1016,6 +962,7 @@ CONFIG_NU_PKG_USING_DEMO=y
# 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_NCT7717U is not set
# CONFIG_NU_PKG_USING_NAU88L25 is not set
# CONFIG_NU_PKG_USING_NAU8822 is not set
# CONFIG_NU_PKG_USING_DA9062 is not set
@ -1025,3 +972,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

View File

@ -16,25 +16,8 @@
#if defined(BOARD_USING_ESP8266)
#include <at_device_esp8266.h>
#define LOG_TAG "at.sample.esp"
#undef DBG_TAG
#include <at_log.h>
static struct at_device_esp8266 esp0 =
{
"esp0", /* esp8266 device name */
"uart4", /* esp8266 serial device name, EX: uart1, uuart1 */
"NT_ZY_BUFFALO", /* Wi-Fi SSID */
"12345678", /* Wi-Fi PASSWORD */
1024 /* Receive buffer length */
};
static int rt_hw_esp8266_port(void)
{
struct at_device_esp8266 *esp8266 = &esp0;
rt_base_t esp_rst_pin = NU_GET_PININDEX(NU_PC, 13);
rt_base_t esp_fwupdate_pin = NU_GET_PININDEX(NU_PD, 12);
@ -46,40 +29,9 @@ static int rt_hw_esp8266_port(void)
rt_pin_mode(esp_fwupdate_pin, PIN_MODE_OUTPUT);
rt_pin_write(esp_fwupdate_pin, 1);
return at_device_register(&(esp8266->device),
esp8266->device_name,
esp8266->client_name,
AT_DEVICE_CLASS_ESP8266,
(void *) esp8266);
return 0;
}
INIT_APP_EXPORT(rt_hw_esp8266_port);
static void at_wifi_set(int argc, char **argv)
{
struct at_device_ssid_pwd sATDConf;
struct at_device *at_dev = RT_NULL;
/* If the number of arguments less than 2 */
if (argc != 3)
{
rt_kprintf("\n");
rt_kprintf("at_wifi_set <ssid> <password>\n");
return ;
}
sATDConf.ssid = argv[1]; //ssid
sATDConf.password = argv[2]; //password
if ((at_dev = at_device_get_first_initialized()) != RT_NULL)
at_device_control(at_dev, AT_DEVICE_CTRL_SET_WIFI_INFO, &sATDConf);
else
{
rt_kprintf("Can't find any initialized AT device.\n");
}
}
#ifdef FINSH_USING_MSH
MSH_CMD_EXPORT(at_wifi_set, AT device wifi set ssid / password function);
#endif
#endif /* BOARD_USING_ESP8266 */
#if defined(BOARD_USING_LCD_ILI9341) && defined(NU_PKG_USING_ILI9341_SPI)

View File

@ -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_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
@ -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=0x40101
CONFIG_RT_VER_NUM=0x40100
CONFIG_ARCH_ARM=y
CONFIG_RT_USING_CPU_FFS=y
CONFIG_ARCH_ARM_CORTEX_M=y
@ -163,7 +163,6 @@ CONFIG_RT_SERIAL_USING_DMA=y
CONFIG_RT_SERIAL_RB_BUFSZ=128
CONFIG_RT_USING_CAN=y
# CONFIG_RT_CAN_USING_HDR is not set
# CONFIG_RT_CAN_USING_CANFD is not set
CONFIG_RT_USING_HWTIMER=y
# CONFIG_RT_USING_CPUTIME is not set
CONFIG_RT_USING_I2C=y
@ -318,11 +317,9 @@ CONFIG_RT_USING_SAL=y
CONFIG_SAL_INTERNET_CHECK=y
#
# Docking with protocol stacks
# protocol stack implement
#
CONFIG_SAL_USING_LWIP=y
# CONFIG_SAL_USING_AT is not set
# CONFIG_SAL_USING_TLS is not set
CONFIG_SAL_USING_POSIX=y
CONFIG_RT_USING_NETDEV=y
CONFIG_NETDEV_USING_IFCONFIG=y
@ -468,7 +465,6 @@ 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
@ -502,14 +498,12 @@ 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
@ -527,7 +521,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_RAPIDJSON is not set
# CONFIG_PKG_USING_JSMN is not set
# CONFIG_PKG_USING_AGILE_JSMN is not set
# CONFIG_PKG_USING_PARSON is not set
#
# XML: Extensible Markup Language
@ -539,7 +532,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# 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
@ -551,7 +543,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_LVGL is not set
# 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
@ -628,8 +619,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# 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
# CONFIG_PKG_USING_ARMV7M_DWT_TOOL is not set
#
# system packages
@ -642,6 +631,14 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_RT_KPRINTF_THREADSAFE is not set
# CONFIG_PKG_USING_RT_VSNPRINTF_FULL is not set
#
# POSIX extension functions
#
# CONFIG_PKG_USING_POSIX_GETLINE is not set
# CONFIG_PKG_USING_POSIX_WCWIDTH is not set
# CONFIG_PKG_USING_POSIX_ITOA is not set
# CONFIG_PKG_USING_POSIX_STRINGS is not set
#
# acceleration: Assembly language or algorithmic acceleration packages
#
@ -653,7 +650,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# 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
#
@ -666,11 +662,9 @@ CONFIG_UTEST_THR_PRIORITY=20
# 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_FREERTOS_WRAPPER 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_PERF_COUNTER is not set
# CONFIG_PKG_USING_FLASHDB is not set
# CONFIG_PKG_USING_SQLITE is not set
# CONFIG_PKG_USING_RTI is not set
@ -699,7 +693,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# 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
@ -708,10 +701,8 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_REALTEK_AMEBA is not set
# CONFIG_PKG_USING_SHT2X is not set
# CONFIG_PKG_USING_SHT3X is not set
# CONFIG_PKG_USING_ADT74XX is not set
# CONFIG_PKG_USING_AS7341 is not set
# CONFIG_PKG_USING_STM32_SDIO is not set
# CONFIG_PKG_USING_ESP_IDF is not set
# CONFIG_PKG_USING_ICM20608 is not set
# CONFIG_PKG_USING_BUTTON is not set
# CONFIG_PKG_USING_PCF8574 is not set
@ -723,11 +714,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_NRF5X_SDK is not set
# CONFIG_PKG_USING_NRFX is not set
# CONFIG_PKG_USING_WM_LIBRARIES is not set
#
# Kendryte SDK
#
# CONFIG_PKG_USING_K210_SDK 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
@ -788,8 +774,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# CONFIG_PKG_USING_MB85RS16 is not set
# CONFIG_PKG_USING_CW2015 is not set
# CONFIG_PKG_USING_RFM300 is not set
# CONFIG_PKG_USING_IO_INPUT_FILTER is not set
# CONFIG_PKG_USING_RASPBERRYPI_PICO_SDK is not set
#
# AI packages
@ -863,68 +847,6 @@ CONFIG_UTEST_THR_PRIORITY=20
# 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
# CONFIG_PKG_USING_QPARAM is not set
#
# Privated Packages of RealThread
#
# CONFIG_PKG_USING_CODEC is not set
# CONFIG_PKG_USING_PLAYER is not set
# CONFIG_PKG_USING_MPLAYER is not set
# CONFIG_PKG_USING_PERSIMMON_SRC is not set
# CONFIG_PKG_USING_JS_PERSIMMON is not set
# CONFIG_PKG_USING_JERRYSCRIPT_WIN32 is not set
#
# Network Utilities
#
# CONFIG_PKG_USING_MDNS is not set
# CONFIG_PKG_USING_UPNP is not set
# CONFIG_PKG_USING_WICED is not set
# CONFIG_PKG_USING_CLOUDSDK is not set
# CONFIG_PKG_USING_POWER_MANAGER is not set
# CONFIG_PKG_USING_RT_OTA is not set
# CONFIG_PKG_USING_RTINSIGHT is not set
# CONFIG_PKG_USING_SMARTCONFIG is not set
# CONFIG_PKG_USING_RTX is not set
# CONFIG_RT_USING_TESTCASE is not set
# CONFIG_PKG_USING_NGHTTP2 is not set
# CONFIG_PKG_USING_AVS is not set
# CONFIG_PKG_USING_ALI_LINKKIT is not set
# CONFIG_PKG_USING_STS is not set
# CONFIG_PKG_USING_DLMS is not set
# CONFIG_PKG_USING_AUDIO_FRAMEWORK is not set
# CONFIG_PKG_USING_ZBAR is not set
# CONFIG_PKG_USING_MCF is not set
# CONFIG_PKG_USING_URPC is not set
# CONFIG_PKG_USING_DCM is not set
# CONFIG_PKG_USING_EMQ is not set
# CONFIG_PKG_USING_CFGM is not set
# CONFIG_PKG_USING_RT_CMSIS_DAP is not set
# CONFIG_PKG_USING_SMODULE is not set
# CONFIG_PKG_USING_SNFD is not set
# CONFIG_PKG_USING_UDBD is not set
# CONFIG_PKG_USING_BENCHMARK is not set
# CONFIG_PKG_USING_UBJSON is not set
# CONFIG_PKG_USING_DATATYPE is not set
# CONFIG_PKG_USING_FASTFS is not set
# CONFIG_PKG_USING_RIL is not set
# CONFIG_PKG_USING_WATCH_DCM_SVC is not set
# CONFIG_PKG_USING_WATCH_APP_FWK is not set
# CONFIG_PKG_USING_GUI_TEST is not set
# CONFIG_PKG_USING_PMEM is not set
# CONFIG_PKG_USING_LWRDP is not set
# CONFIG_PKG_USING_MASAN is not set
# CONFIG_PKG_USING_BSDIFF_LIB is not set
# CONFIG_PKG_USING_PRC_DIFF is not set
#
# RT-Thread Smart
#
# CONFIG_PKG_USING_UKERNEL is not set
# CONFIG_PKG_USING_TRACE_AGENT is not set
#
# Hardware Drivers Config
@ -1040,7 +962,6 @@ CONFIG_BOARD_USING_HSUSBH_USBD=y
#
CONFIG_NU_PKG_USING_UTILS=y
CONFIG_NU_PKG_USING_DEMO=y
# 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=y
@ -1048,7 +969,8 @@ CONFIG_NU_PKG_USING_NAU88L25=y
# CONFIG_NU_PKG_USING_DA9062 is not set
# CONFIG_NU_PKG_USING_ILI9341 is not set
# 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 is not set
# CONFIG_NU_PKG_USING_SPINAND is not set
CONFIG_UTEST_CMD_PREFIX="bsp.nuvoton.utest."
CONFIG_BOARD_USE_UTEST=y

View File

@ -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)