Skip to content

Commit 2be0c59

Browse files
authored
Merge pull request #4460 from OpenNuvoton/nuvoton
[nuvoton] Update BSP.
2 parents 4a0855c + 6ec6285 commit 2be0c59

File tree

113 files changed

+3068
-300
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+3068
-300
lines changed

bsp/nuvoton/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
# Nuvoton BSP descriptions
1+
ï»? Nuvoton BSP descriptions
22
Current supported BSP shown in below table:
33

44
| **BSP folder** | **Board name** |
55
|:------------------------- |:-------------------------- |
66
| [numaker-iot-m487](numaker-iot-m487) | Nuvoton NuMaker-IoT-M487 |
77
| [numaker-pfm-m487](numaker-pfm-m487) | Nuvoton NuMaker-PFM-M487 |
88
| [nk-980iot](nk-980iot) | Nuvoton NK-980IOT |
9-
| [numaker-m2354](numaker-m2354) | Nuvoton NuMaker-M2354 |
9+
| [numaker-m2354](numaker-m2354) | Nuvoton NuMaker-M2354 |
10+
| [nk-rtu980](nk-rtu980) | Nuvoton NK-RTU980 |

bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/NuMicro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#ifndef __NUMICRO_H__
1010
#define __NUMICRO_H__
1111

12+
#include "nutool_clkcfg.h"
1213
#include "M2354.h"
1314

1415
#endif /* __NUMICRO_H__ */

bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/system_M2354.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,21 @@ extern "C" {
4949
/*----------------------------------------------------------------------------
5050
Define SYSCLK
5151
*----------------------------------------------------------------------------*/
52+
#ifndef __HXT
5253
#define __HXT (12000000UL) /*!< External Crystal Clock Frequency */
54+
#endif
55+
5356
#define __LIRC (32000UL) /*!< Internal 32K RC Oscillator Frequency */
5457
#define __HIRC (12000000UL) /*!< Internal 12M RC Oscillator Frequency */
58+
59+
#ifndef __LXT
5560
#define __LXT (32768UL) /*!< External Crystal Clock Frequency 32.768KHz */
61+
#endif
62+
63+
#ifndef __HSI
5664
#define __HSI (48000000UL) /*!< PLL Output Clock Frequency */
65+
#endif
66+
5767
#define __HIRC48 (48000000UL) /*!< Internal 48M RC Oscillator Frequency */
5868
#define __LIRC32 (32000UL) /*!< Internal 32K RC Oscillator Frequency */
5969
#define __MIRC (4000000UL) /*!< Internal 4M RC Oscillator Frequency */
@@ -93,7 +103,7 @@ extern uint32_t __PC(void); /*!< Return the current program counter valu
93103
*/
94104
#define ASSERT_PARAM(expr) { if (!(expr)) { AssertError((uint8_t*)__FILE__, __LINE__); } }
95105

96-
void AssertError(uint8_t* file, uint32_t line);
106+
void AssertError(uint8_t *file, uint32_t line);
97107
#else
98108
#define ASSERT_PARAM(expr)
99109
#endif

bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.ewp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@
348348
<state>$PROJ_DIR$\..\..\Device\Nuvoton\M2354\Include</state>
349349
<state>$PROJ_DIR$\..\..\CMSIS\Include</state>
350350
<state>$PROJ_DIR$\..\inc</state>
351+
<state>$PROJ_DIR$</state>
351352
</option>
352353
<option>
353354
<name>CCStdIncCheck</name>
@@ -1385,6 +1386,7 @@
13851386
<state>$PROJ_DIR$\..\..\Device\Nuvoton\M2354\Include</state>
13861387
<state>$PROJ_DIR$\..\..\CMSIS\Include</state>
13871388
<state>$PROJ_DIR$\..\inc</state>
1389+
<state>$PROJ_DIR$</state>
13881390
</option>
13891391
<option>
13901392
<name>CCStdIncCheck</name>

bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.uvprojx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@
338338
<MiscControls></MiscControls>
339339
<Define></Define>
340340
<Undefine></Undefine>
341-
<IncludePath>..\inc;..\..\CMSIS\Include;..\..\Device\Nuvoton\M2354\Include</IncludePath>
341+
<IncludePath>..\inc;..\..\CMSIS\Include;..\..\Device\Nuvoton\M2354\Include;.</IncludePath>
342342
</VariousControls>
343343
</Cads>
344344
<Aads>

bsp/nuvoton/libraries/m2354/rtt_port/drv_bpwm_capture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#if defined(BSP_USING_BPWM_CAPTURE)
1515
#if ((BSP_USING_BPWM0_CAPTURE_CHMSK+BSP_USING_BPWM1_CAPTURE_CHMSK)!=0)
1616
#include <rtdevice.h>
17-
#include <NuMicro.h>
17+
#include "NuMicro.h"
1818

1919
/* Private typedef --------------------------------------------------------------*/
2020
typedef struct _bpwm_dev

bsp/nuvoton/libraries/m2354/rtt_port/drv_can.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#include <rtdevice.h>
1818
#include <rthw.h>
19-
#include <NuMicro.h>
19+
#include "NuMicro.h"
2020

2121
/* Private Define ---------------------------------------------------------------*/
2222
#define RX_MSG_ID_INDEX 16

bsp/nuvoton/libraries/m2354/rtt_port/drv_clk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <rtdbg.h>
1919
#include <stdint.h>
2020
#include <string.h>
21-
#include <NuMicro.h>
21+
#include "NuMicro.h"
2222

2323

2424
/* Private define ---------------------------------------------------------------*/

bsp/nuvoton/numaker-m2354/board/board.c renamed to bsp/nuvoton/libraries/m2354/rtt_port/drv_common.c

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <rtconfig.h>
1414
#include <rtthread.h>
15-
#include <NuMicro.h>
15+
#include "NuMicro.h"
1616
#include <nu_bitutil.h>
1717
#include "drv_uart.h"
1818
#include "board.h"
@@ -24,7 +24,7 @@
2424
/**
2525
* This function will initial M487 board.
2626
*/
27-
void rt_hw_board_init(void)
27+
RT_WEAK void rt_hw_board_init(void)
2828
{
2929
/* Init System/modules clock */
3030
nutool_modclkcfg_init();
@@ -67,6 +67,41 @@ void rt_hw_board_init(void)
6767
#endif
6868
}
6969

70+
/**
71+
* The time delay function.
72+
*
73+
* @param microseconds.
74+
*/
75+
void rt_hw_us_delay(rt_uint32_t us)
76+
{
77+
rt_uint32_t ticks;
78+
rt_uint32_t told, tnow, tcnt = 0;
79+
rt_uint32_t reload = SysTick->LOAD;
80+
81+
ticks = us * reload / (1000000 / RT_TICK_PER_SECOND);
82+
told = SysTick->VAL;
83+
while (1)
84+
{
85+
tnow = SysTick->VAL;
86+
if (tnow != told)
87+
{
88+
if (tnow < told)
89+
{
90+
tcnt += told - tnow;
91+
}
92+
else
93+
{
94+
tcnt += reload - tnow + told;
95+
}
96+
told = tnow;
97+
if (tcnt >= ticks)
98+
{
99+
break;
100+
}
101+
}
102+
}
103+
}
104+
70105
/**
71106
* This is the timer interrupt service routine.
72107
*

bsp/nuvoton/libraries/m2354/rtt_port/drv_eadc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
#include <rtconfig.h>
1313
#include <rtdevice.h>
14-
#include <NuMicro.h>
14+
#include "NuMicro.h"
1515

1616
#ifdef BSP_USING_EADC
1717

0 commit comments

Comments
 (0)