From 6ec6285e1be98a667f82d20054c66edb553823bc Mon Sep 17 00:00:00 2001 From: Wayne Lin Date: Mon, 15 Mar 2021 15:41:41 +0800 Subject: [PATCH] [nuvoton] Update BSP. 1. Add NUC980 Chili board supporting. 2. Correct NuMicro.h including. 3. Implement rt_hw_us_delay system call function. 4. Move board.c to drv_common.c for M480 and M2354 series. --- bsp/nuvoton/README.md | 5 +- .../Device/Nuvoton/M2354/Include/NuMicro.h | 1 + .../Nuvoton/M2354/Include/system_M2354.h | 12 +- .../m2354/StdDriver/lib/libStdDriver.ewp | 2 + .../m2354/StdDriver/lib/libStdDriver.uvprojx | 2 +- .../m2354/rtt_port/drv_bpwm_capture.c | 2 +- .../libraries/m2354/rtt_port/drv_can.c | 2 +- .../libraries/m2354/rtt_port/drv_clk.c | 2 +- .../m2354/rtt_port/drv_common.c} | 39 +- .../libraries/m2354/rtt_port/drv_eadc.c | 2 +- .../libraries/m2354/rtt_port/drv_ebi.h | 2 +- .../libraries/m2354/rtt_port/drv_ecap.c | 2 +- .../m2354/rtt_port/drv_epwm_capture.c | 2 +- .../libraries/m2354/rtt_port/drv_fmc.h | 2 +- .../libraries/m2354/rtt_port/drv_gpio.c | 2 +- .../libraries/m2354/rtt_port/drv_i2c.c | 2 +- .../libraries/m2354/rtt_port/drv_i2s.c | 3 +- .../libraries/m2354/rtt_port/drv_i2s.h | 2 +- .../libraries/m2354/rtt_port/drv_otg.c | 2 +- .../libraries/m2354/rtt_port/drv_pdma.h | 2 +- .../libraries/m2354/rtt_port/drv_rtc.c | 11 +- .../libraries/m2354/rtt_port/drv_scuart.c | 2 +- .../libraries/m2354/rtt_port/drv_sdh.c | 2 +- .../libraries/m2354/rtt_port/drv_slcd.c | 2 +- .../libraries/m2354/rtt_port/drv_slcd.h | 2 +- .../libraries/m2354/rtt_port/drv_softi2c.c | 44 +- .../libraries/m2354/rtt_port/drv_spi.h | 2 +- .../libraries/m2354/rtt_port/drv_spii2s.c | 3 +- .../libraries/m2354/rtt_port/drv_timer.c | 2 +- .../m2354/rtt_port/drv_timer_capture.c | 2 +- .../libraries/m2354/rtt_port/drv_uart.c | 2 +- .../libraries/m2354/rtt_port/drv_ui2c.c | 2 +- .../libraries/m2354/rtt_port/drv_usbhost.c | 2 +- .../libraries/m2354/rtt_port/drv_uspi.c | 2 +- .../libraries/m2354/rtt_port/drv_uuart.c | 2 +- .../libraries/m2354/rtt_port/drv_wdt.c | 2 +- .../m480/rtt_port/drv_bpwm_capture.c | 2 +- bsp/nuvoton/libraries/m480/rtt_port/drv_can.c | 2 +- bsp/nuvoton/libraries/m480/rtt_port/drv_clk.c | 2 +- .../m480/rtt_port/drv_common.c} | 43 +- .../libraries/m480/rtt_port/drv_eadc.c | 2 +- bsp/nuvoton/libraries/m480/rtt_port/drv_ebi.h | 2 +- .../libraries/m480/rtt_port/drv_ecap.c | 2 +- .../libraries/m480/rtt_port/drv_emac.c | 2 +- .../m480/rtt_port/drv_epwm_capture.c | 2 +- bsp/nuvoton/libraries/m480/rtt_port/drv_fmc.h | 2 +- .../libraries/m480/rtt_port/drv_gpio.c | 2 +- .../libraries/m480/rtt_port/drv_hsotg.c | 2 +- bsp/nuvoton/libraries/m480/rtt_port/drv_i2c.c | 2 +- bsp/nuvoton/libraries/m480/rtt_port/drv_i2s.c | 3 +- bsp/nuvoton/libraries/m480/rtt_port/drv_i2s.h | 2 +- .../libraries/m480/rtt_port/drv_pdma.h | 2 +- bsp/nuvoton/libraries/m480/rtt_port/drv_rtc.c | 2 +- .../libraries/m480/rtt_port/drv_scuart.c | 2 +- bsp/nuvoton/libraries/m480/rtt_port/drv_sdh.c | 2 +- .../libraries/m480/rtt_port/drv_softi2c.c | 44 +- bsp/nuvoton/libraries/m480/rtt_port/drv_spi.h | 2 +- .../libraries/m480/rtt_port/drv_spii2s.c | 3 +- .../libraries/m480/rtt_port/drv_timer.c | 2 +- .../m480/rtt_port/drv_timer_capture.c | 2 +- .../libraries/m480/rtt_port/drv_uart.c | 2 +- .../libraries/m480/rtt_port/drv_ui2c.c | 2 +- .../libraries/m480/rtt_port/drv_usbhost.c | 2 +- .../libraries/m480/rtt_port/drv_uspi.c | 2 +- .../libraries/m480/rtt_port/drv_uuart.c | 2 +- bsp/nuvoton/libraries/m480/rtt_port/drv_wdt.c | 2 +- .../nu_packages/AudioCodec/acodec_nau88l25.c | 6 +- .../nu_packages/AudioCodec/audio_test.c | 8 +- bsp/nuvoton/libraries/nuc980/rtt_port/Kconfig | 15 - .../libraries/nuc980/rtt_port/drv_adc.c | 2 +- .../libraries/nuc980/rtt_port/drv_can.c | 2 +- .../libraries/nuc980/rtt_port/drv_ebi.h | 2 +- .../libraries/nuc980/rtt_port/drv_emac.c | 4 +- .../libraries/nuc980/rtt_port/drv_etimer.c | 2 +- .../nuc980/rtt_port/drv_etimer_capture.c | 2 +- .../libraries/nuc980/rtt_port/drv_gpio.c | 2 +- .../libraries/nuc980/rtt_port/drv_i2c.c | 2 +- .../libraries/nuc980/rtt_port/drv_i2s.c | 2 +- .../libraries/nuc980/rtt_port/drv_i2s.h | 2 +- .../libraries/nuc980/rtt_port/drv_pdma.h | 2 +- .../libraries/nuc980/rtt_port/drv_rtc.c | 2 +- .../libraries/nuc980/rtt_port/drv_scuart.c | 5 +- .../libraries/nuc980/rtt_port/drv_sdh.c | 2 +- .../libraries/nuc980/rtt_port/drv_softi2c.c | 4 +- .../libraries/nuc980/rtt_port/drv_spi.h | 2 +- .../libraries/nuc980/rtt_port/drv_sys.c | 18 + .../libraries/nuc980/rtt_port/drv_systick.c | 7 +- .../libraries/nuc980/rtt_port/drv_uart.c | 33 +- .../libraries/nuc980/rtt_port/drv_uart.h | 1 + .../libraries/nuc980/rtt_port/drv_usbd.c | 2 +- .../libraries/nuc980/rtt_port/drv_usbhost.c | 2 +- .../libraries/nuc980/rtt_port/drv_wdt.c | 2 +- bsp/nuvoton/nk-980iot/board/board.h | 2 +- bsp/nuvoton/nk-rtu980/.config | 828 ++++++++++++++++++ bsp/nuvoton/nk-rtu980/Kconfig | 29 + bsp/nuvoton/nk-rtu980/README.md | 106 +++ bsp/nuvoton/nk-rtu980/SConscript | 14 + bsp/nuvoton/nk-rtu980/SConstruct | 55 ++ bsp/nuvoton/nk-rtu980/applications/SConscript | 11 + bsp/nuvoton/nk-rtu980/applications/main.c | 71 ++ bsp/nuvoton/nk-rtu980/applications/mnt.c | 237 +++++ bsp/nuvoton/nk-rtu980/board/Kconfig | 48 + bsp/nuvoton/nk-rtu980/board/SConscript | 14 + bsp/nuvoton/nk-rtu980/board/board.h | 43 + bsp/nuvoton/nk-rtu980/board/board_dev.c | 236 +++++ bsp/nuvoton/nk-rtu980/board/fal_cfg.h | 46 + bsp/nuvoton/nk-rtu980/board/nu_pin_init.c | 85 ++ .../nk-rtu980/linking_scripts/nuc980.ld | 114 +++ .../nk-rtu980/linking_scripts/nuc980.sct | 11 + bsp/nuvoton/nk-rtu980/rtconfig.py | 88 ++ bsp/nuvoton/nk-rtu980/template.uvproj | 394 +++++++++ bsp/nuvoton/nk-rtu980/template.uvprojx | 387 ++++++++ bsp/nuvoton/numaker-pfm-m487/board/board.c | 97 -- 113 files changed, 3068 insertions(+), 300 deletions(-) rename bsp/nuvoton/{numaker-m2354/board/board.c => libraries/m2354/rtt_port/drv_common.c} (74%) rename bsp/nuvoton/{numaker-iot-m487/board/board.c => libraries/m480/rtt_port/drv_common.c} (70%) create mode 100644 bsp/nuvoton/nk-rtu980/.config create mode 100644 bsp/nuvoton/nk-rtu980/Kconfig create mode 100644 bsp/nuvoton/nk-rtu980/README.md create mode 100644 bsp/nuvoton/nk-rtu980/SConscript create mode 100644 bsp/nuvoton/nk-rtu980/SConstruct create mode 100644 bsp/nuvoton/nk-rtu980/applications/SConscript create mode 100644 bsp/nuvoton/nk-rtu980/applications/main.c create mode 100644 bsp/nuvoton/nk-rtu980/applications/mnt.c create mode 100644 bsp/nuvoton/nk-rtu980/board/Kconfig create mode 100644 bsp/nuvoton/nk-rtu980/board/SConscript create mode 100644 bsp/nuvoton/nk-rtu980/board/board.h create mode 100644 bsp/nuvoton/nk-rtu980/board/board_dev.c create mode 100644 bsp/nuvoton/nk-rtu980/board/fal_cfg.h create mode 100644 bsp/nuvoton/nk-rtu980/board/nu_pin_init.c create mode 100644 bsp/nuvoton/nk-rtu980/linking_scripts/nuc980.ld create mode 100644 bsp/nuvoton/nk-rtu980/linking_scripts/nuc980.sct create mode 100644 bsp/nuvoton/nk-rtu980/rtconfig.py create mode 100644 bsp/nuvoton/nk-rtu980/template.uvproj create mode 100644 bsp/nuvoton/nk-rtu980/template.uvprojx delete mode 100644 bsp/nuvoton/numaker-pfm-m487/board/board.c diff --git a/bsp/nuvoton/README.md b/bsp/nuvoton/README.md index dfa048ab2f..9d0c433984 100644 --- a/bsp/nuvoton/README.md +++ b/bsp/nuvoton/README.md @@ -1,4 +1,4 @@ -# Nuvoton BSP descriptions +� Nuvoton BSP descriptions Current supported BSP shown in below table: | **BSP folder** | **Board name** | @@ -6,4 +6,5 @@ Current supported BSP shown in below table: | [numaker-iot-m487](numaker-iot-m487) | Nuvoton NuMaker-IoT-M487 | | [numaker-pfm-m487](numaker-pfm-m487) | Nuvoton NuMaker-PFM-M487 | | [nk-980iot](nk-980iot) | Nuvoton NK-980IOT | -| [numaker-m2354](numaker-m2354) | Nuvoton NuMaker-M2354 | \ No newline at end of file +| [numaker-m2354](numaker-m2354) | Nuvoton NuMaker-M2354 | +| [nk-rtu980](nk-rtu980) | Nuvoton NK-RTU980 | \ No newline at end of file diff --git a/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/NuMicro.h b/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/NuMicro.h index 548ab843cc..cccccd4e7a 100644 --- a/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/NuMicro.h +++ b/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/NuMicro.h @@ -9,6 +9,7 @@ #ifndef __NUMICRO_H__ #define __NUMICRO_H__ +#include "nutool_clkcfg.h" #include "M2354.h" #endif /* __NUMICRO_H__ */ diff --git a/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/system_M2354.h b/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/system_M2354.h index ba5bbc1f4d..edf1e3e6e5 100644 --- a/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/system_M2354.h +++ b/bsp/nuvoton/libraries/m2354/Device/Nuvoton/M2354/Include/system_M2354.h @@ -49,11 +49,21 @@ extern "C" { /*---------------------------------------------------------------------------- Define SYSCLK *----------------------------------------------------------------------------*/ +#ifndef __HXT #define __HXT (12000000UL) /*!< External Crystal Clock Frequency */ +#endif + #define __LIRC (32000UL) /*!< Internal 32K RC Oscillator Frequency */ #define __HIRC (12000000UL) /*!< Internal 12M RC Oscillator Frequency */ + +#ifndef __LXT #define __LXT (32768UL) /*!< External Crystal Clock Frequency 32.768KHz */ +#endif + +#ifndef __HSI #define __HSI (48000000UL) /*!< PLL Output Clock Frequency */ +#endif + #define __HIRC48 (48000000UL) /*!< Internal 48M RC Oscillator Frequency */ #define __LIRC32 (32000UL) /*!< Internal 32K RC Oscillator Frequency */ #define __MIRC (4000000UL) /*!< Internal 4M RC Oscillator Frequency */ @@ -93,7 +103,7 @@ extern uint32_t __PC(void); /*!< Return the current program counter valu */ #define ASSERT_PARAM(expr) { if (!(expr)) { AssertError((uint8_t*)__FILE__, __LINE__); } } -void AssertError(uint8_t* file, uint32_t line); +void AssertError(uint8_t *file, uint32_t line); #else #define ASSERT_PARAM(expr) #endif diff --git a/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.ewp b/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.ewp index 555ab69852..69c44b7d03 100644 --- a/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.ewp +++ b/bsp/nuvoton/libraries/m2354/StdDriver/lib/libStdDriver.ewp @@ -348,6 +348,7 @@ $PROJ_DIR$\..\..\Device\Nuvoton\M2354\Include $PROJ_DIR$\..\..\CMSIS\Include $PROJ_DIR$\..\inc + $PROJ_DIR$