Commit Graph

575 Commits (mbed-os-5.15)

Author SHA1 Message Date
cyliangtw 75dd2c22d1 Follow Mbed OS coding style of if statement 2021-08-27 01:00:51 +08:00
cyliangtw 3198bab7c6 NuMaker M480 & M451 support CAN mask 2021-08-27 00:55:53 +08:00
Martin Kojtal 769fc9da70
Merge pull request #14502 from OpenNuvoton/nuvoton_m487_wdt_reset_from_powerdown_5.15
M487: Fix crash on WDT reset from power-down (5.15)
2021-05-18 16:54:15 +02:00
Chun-Chieh Li cb3a6783aa M487: Get around h/w limit with WDT reset from PD
Use WKT to get around this h/w limit
2021-04-22 19:09:05 +08:00
Chun-Chieh Li e0aab8be9f Nuvoton: Fix hal_watchdog_kick() with WDT stopped
According to HAL spec, hal_watchdog_kick() shall do nothing when WDT is stopped.
2021-04-16 10:12:58 +08:00
Martin Kojtal e4f42d8fa5
Merge pull request #13709 from OpenNuvoton/nvt_i2c_timeout_5.15
mbed-os-5.15: Nuvoton: Fix NuMaker I2C timeout
2020-11-02 09:43:54 +00:00
cyliangtw 3d0be7d3b4 Normalize the line endings 2020-11-02 11:30:06 +08:00
Chun-Chieh Li 2acb3a45d0 M2354: Update pre-built non-PSA secure library/image
1.  Upgrade to BSP v3.00.001 for MP chip
2.  Enable fault handler dump message
2020-10-15 11:58:08 +08:00
Chun-Chieh Li 76463fe4ac M2354: Update to BSP v3.00.001
1.  Change to support MP chip. Original M2355 BSP is for test chip.
2.  UART0, used for USB VCOM, has change in clock enable bit. So chip/board version and BSP version must match.
3.  Remove TF-M legacy code.
2020-10-15 11:58:07 +08:00
Chun-Chieh Li 73614ea56e M2354: Remove flash_read override originally for test chip
In test chip, byte-read (LDRB) last byte of flash in non-secure world always gets 0xFF.
This is got around by overriding flash_read(...). Now, the override can remove in MP chip.
2020-10-15 11:58:06 +08:00
Martin Kojtal f63b4b6fec
Merge pull request #13512 from OpenNuvoton/nvt_nuc472_sd_5.15
mbed-os-5.15: Nuvoton: Fixed NUC472 SD buffer alignment
2020-10-13 11:26:48 +01:00
cyliangtw 39e2f31176 Apply the same NuMaker I2C timeout measurement to M2354 2020-10-05 12:12:24 +08:00
cyliangtw 99e767b4c7 Fix NuMaker I2C timeout,
some H/W timer count is 24 bits only, hardcode 0xffffffff causing
  wrong judgement of timeout as while H/W timer counting overflow.
2020-10-05 11:28:06 +08:00
Chun-Chieh Li a76e49c843 M2351: Support IAR
1.  Enable IAR on non-secure targets
2.  Disable IAR on secure targets because:
    (1) IAR toolchain bug: As of IAR 8.32, cmse_nonsecure_caller() is not always inlined.
    (2) TFM hasn't supported IAR yet.
2020-09-18 10:17:27 +08:00
Chun-Chieh Li 5ec9b79888 M2351: Support GCC
1.  Enable GCC support on non-secure targets
2.  Disable GCC support on secure targets becasue of GCC bug (as of 9-2019-q4-major): In non-secure entry function, callee-saved registers must be restored, but they are incorrectly cleared at optimization level "Os".
2020-09-18 10:13:18 +08:00
Chun-Chieh Li 9058a9585a M2351: Re-organize ARMC6 scatter file
Separate out secure/non-secure ARMC6 scatter files instead of merging them
2020-09-18 09:46:57 +08:00
Chun-Chieh Li 728c4b3cf0 M2351: Polish memory partition code
1.  Refine memory partition files to support different toolchains
2.  Exclude NSC region from flash IAP range
2020-09-18 09:42:20 +08:00
Chun-Chieh Li b0c767a854 M2351: Refactor startup file
1.  Re-organize to make clear all targets/toolchains support in single startup file
2.  Inline assembly syntax is limited, esp. on IAR. Try paving the way for accessing external symbols still in inline assembly instead of re-write in assembly.
3.  Update GCC C run-time sequence to fit future GCC script file.
2020-09-18 09:39:57 +08:00
Chun-Chieh Li 239ec8c941 M2351: Remove GCC/IAR linker files temporarily
Ths is to prepare for supporting GCC/IAR officially.
2020-09-18 09:35:15 +08:00
Chun-Chieh Li 21b2c4c7c5 M2351: Fix RTC clock selection 2020-09-18 09:34:08 +08:00
Chun-Chieh Li 9c86871a9f Nuvoton: Fix degrading QSPI to SPI
In most cases, we can control degraded QSPI H/W to standard through BSP SPI driver directly as if it is just SPI H/W.
However, BSP SPI driver distinguishes among SPI H/W instances in below functions:
-   SPI_Open
-   SPI_Close
-   SPI_SetBusClock
-   SPI_GetBusClock
In these cases, we must change to QSPI version instead for QSPI H/W.

Change target:
-   NU_M2354*
2020-09-03 11:29:04 +08:00
cyliangtw eab9417141 Fix nuc472 SD buffer alignment 2020-08-31 12:08:38 +08:00
Chun-Chieh Li de982dbf58 M2354: Get around LDRB last byte of flash in non-secure
On test chip, byte-read (LDRB) last byte of flash in non-secure world always gets 0xFF.
Get around it. Recover back on MP chips.
2020-07-10 09:45:21 +08:00
Chun-Chieh Li 3dd967426d M2354: Add pre-built secure image/lib for non-PSA 2020-07-10 09:45:21 +08:00
Chun-Chieh Li d1ea81e991 M2354: Initial support 2020-07-07 17:09:57 +08:00
Martin Kojtal 8e5976898f
Merge pull request #12969 from OpenNuvoton/nuvoton_5.15_watchdog_hardfault
Nuvoton: Fix watchdog reset failure on meeting Hard Fault (5.15)
2020-06-09 11:09:06 +02:00
Martin Kojtal 1dd5069fe7
Merge pull request #12986 from OpenNuvoton/nuvoton_5.15_m2351_npsa_secure-minimal-build
M2351: Enable non-PSA minimal secure build (5.15)
2020-06-08 13:23:16 +02:00
Chun-Chieh Li e0bd07f649 M2351: Enable non-PSA minimal secure build
In this new memory partition, secure program is most simplified and non-secure program can make most use of memory for its large application like Pelion:

-   Flash (512KiB in total): 64KiB for secure and 448KiB for nonsecure.
-   SRAM (96KiB in total): 8KiB for secure and 88KiB for nonsecure.

Besides, to make secure program fit into 8KiB:

-   Decrease boot stack size to 0x600 bytes
-   Remove serial support
-   Remove LPTICKER

Re-build default secure image/gateway library to favor Pelion client application
2020-05-18 11:12:19 +08:00
Chun-Chieh Li 3d1fd6ae0d Nuvoton: Change WDT clock source to LXT
LIRC has 40%~50% error rate, so change WDT clock source to LXT from LIRC.

NOTE: NANO100 series just supports LIRC-clocked WDT.
2020-05-14 11:45:38 +08:00
Chun-Chieh Li 572bae3ad6 Nuvoton: Fix failure to change WDT clock source
WDT clock source selection and its enablement bits are protected. Add unlock sequence before write to them.
2020-05-14 11:45:34 +08:00
Chun-Chieh Li 2162aaaea3 Nuvoton: Fix WDT feature report with clock frequency 2020-05-14 11:45:31 +08:00
Chun-Chieh Li b70b65c1b5 Nuvoton: Enlarge WDT reset delay to avoid premature WDT reset
Consider the following factors to define WDT reset delay:
1. Cannot be too small. This is to avoid premature WDT reset in pieces of timeout cascading.
2. Cannot be too large. This is to pass Greentea reset_reason/watchdog_reset tests, which have e.g. 50~100 reset delay tolerance.
2020-05-14 11:45:27 +08:00
Chun-Chieh Li 9c59bd0bb9 Nuvoton: Fix watchdog reset failure on meeting Hard Fault
Original implementation doesn't enable watchdog reset in pieces of cascaded timeout, except the last one. This is to guarantee re-configuration can be in time, but in interrupt disabled scenario e.g. Hard Fault, watchdog reset can cease to be effective.

This change enables watchdog reset all the way of cascaded timeout. With trade-off, guaranteed watchdog reset function is more significant than re-configuration in time.
2020-05-14 11:42:51 +08:00
Chun-Chieh Li 18c39983f7 NANO130: Decrease heap to 2.75KiB to spare SRAM for static allocation
This adjustment is to pass compile on IAR on which heap configuration is hard-coded and cannot be adjusted according to staic SRAM usage.
2019-12-11 10:45:56 +00:00
Chun-Chieh Li 829efa291c NANO130: Fix OOM with packing algorithm at IAR linking
At IAR linking, the default method of 'initialize by copy' is 'auto', which will estimate
different packing algorithms, including complex 'lz77', for smallest memory footprint. But
the algorithm itself can consume some SRAM and cause OOM at linking time for NANO130, which
just has 16KiB SRAM. To avoid this error, always choose 'none' packing algorithm.
2019-12-11 10:45:56 +00:00
Chun-Chieh Li aae04b2516 Nuvoton: Remove TRNG support
These targets below just support PRNG, not real TRNG. They cannot annouce TRNG.

-   NUMAKER_PFM_NUC472
-   NUMAKER_PFM_M487
-   NUMAKER_IOT_M487

On targets without TRNG, to run mbedtls applications which require entropy source,
there are two alternatives to TRNG:

-   Custom entropy source:
    Define MBEDTLS_ENTROPY_HARDWARE_ALT and provide custom mbedtls_hardware_poll(...)
-   NV seed:
    1.  Define MBEDTLS_ENTROPY_NV_SEED
    2.  Define MBEDTLS_PLATFORM_NV_SEED_READ_MACRO/MBEDTLS_PLATFORM_NV_SEED_WRITE_MACRO and provide custom mbedtls_nv_seed_read(...)/mbedtls_nv_seed_write(...).
    3.  Don't define MBEDTLS_PSA_INJECT_ENTROPY. Meet mbedtls_psa_inject_entropy(...) undefined and then provide custom one, which must be compatible with mbedtls_nv_seed_read(...)/mbedtls_nv_seed_write(...) above.
    4.  For development, simulating partial provision process, inject entropy seed via mbedtls_psa_inject_entropy(...) pre-main.
2019-11-13 18:01:24 +08:00
Martin Kojtal 5a1ccc0f2f
Merge pull request #11780 from OpenNuvoton/nuvoton_fpga_perif_free
Nuvoton: Add implementations of HAL API i2c_free and analogin_free
2019-11-04 09:49:36 +01:00
Martin Kojtal eea83007be
Merge pull request #11203 from Tharazi97/Watchdog_lower_limit_timeout_test
Add watchdog lower limit timeout test
2019-10-31 14:25:52 +01:00
Chun-Chieh Li 0260f1b3df NANO130: Remove unnecessary synchronization in analog-in HAL
Driver AnalogIn has done with it, so remove synchronization in analog-in HAL.
2019-10-31 15:23:57 +08:00
Chun-Chieh Li 72ea613a12 Nuvoton: Add i2c_free
1.  Disable interrupt
2.  Disable IP clock
3.  Free up pins

Support targets:

-   NUMAKER_PFM_NANO130
-   NUMAKER_PFM_NUC472
-   NUMAKER_PFM_M453
-   NUMAKER_PFM_M487/NUMAKER_IOT_M487
-   NU_PFM_M2351*
-   NUMAKER_IOT_M263A
-   NUMAKER_M252KG
2019-10-31 15:22:57 +08:00
Chun-Chieh Li 3abd02614a Nuvoton: Add analogin_free
1.  Deal with channel-wise and module-wise
2.  Disable IP clock
3.  Free up pin

Support targets:

-   NUMAKER_PFM_NANO130
-   NUMAKER_PFM_NUC472
-   NUMAKER_PFM_M453
-   NUMAKER_PFM_M487/NUMAKER_IOT_M487
-   NU_PFM_M2351*
-   NUMAKER_IOT_M263A
-   NUMAKER_M252KG
2019-10-31 15:19:15 +08:00
Chun-Chieh Li 8161386268 M2351: Update default secure image/gateway library
Update for change of TRNG security attribute
2019-10-24 10:55:24 +08:00
Chun-Chieh Li 4cd0332ada NUVOTON: Re-implement TRNG HAL with TRNG H/W
Targets supporting TRNG H/W:

-   NU_PFM_M2351_*
-   NUMAKER_IOT_M263A
2019-10-24 10:55:03 +08:00
Chun-Chieh Li 3f9ba9e61f NUVOTON: Fix BSP/MKROM header
Related targets:
-   NU_PFM_M2351_*
-   NUMAKER_IOT_M263A
2019-10-24 09:36:25 +08:00
Chun-Chieh Li d993c5a108 NUVOTON: Re-implement __PC() with toolchain built-in
Re-implement __PC() by replacing BSP assembly with toolchain built-in.
2019-10-24 09:36:25 +08:00
Chun-Chieh Li 3548d38a98 M2351: Change TRNG security attribute to secure 2019-10-24 09:36:24 +08:00
Chun-Chieh Li c326e07eb1 M2351: Update BSP/crypto driver 2019-10-24 09:36:24 +08:00
int_szyk d68a802f07 Add watchdog clock accuracy to Nuvoton targets. 2019-09-30 08:10:25 +02:00
Chun-Chieh Li f45ca72f11 [M252KG] Remove TRNG support
Reasons to remove TRNG support:
1.  M252 just has 32KiB SRAM and cannot afford mbedtls application.
2.  Implementing TRNG HAL with PRNG H/W has security concern.
2019-09-27 17:50:48 +08:00
Chun-Chieh Li 0168304e5b [M252KG] Add BSD-3-Clause license for BSP files 2019-09-27 17:45:57 +08:00