Commit Graph

173 Commits (95996fb9245727a4471a2036e714052d63e65128)

Author SHA1 Message Date
Chun-Chieh Li 359d41adef M2351: Remove LPTICKER to spare memory for non-PSA minimal secure build 2020-01-16 09:58:32 +08:00
Martin Kojtal 117201d77d "Update secure binaries for NU_PFM_M2351_S (ARMC6)" 2020-01-14 14:27:54 +00:00
Martin Kojtal af03f839e2
Merge pull request #10959 from OpenNuvoton/nuvoton_m2351_psa
M2351: Support TFM level 1
2020-01-08 16:09:35 +01:00
cyliangtw 95be7da860 Add CLKSEL0_USBSEL_HIRC48 in m2351_clk.h 2020-01-06 19:08:52 +08:00
Chun-Chieh Li 22e4f93400 [M2351] Add pre-built secure images for PSA 2020-01-06 15:55:01 +08:00
Chun-Chieh Li c9b4474d50 [M2351] Merge secure idle/powerdown sequences into one
Merge SYS_UnlockReg_S()/CLK_Idle_S() or CLK_PowerDown_S()/SYS_LockReg_S()
into nu_idle_s() or nu_powerdown_s() when they are available.
2020-01-06 15:55:01 +08:00
Chun-Chieh Li a0a1c4d52c [M2351] Override NS interface by locking kernel scheduler
Lock kernel scheduler rather than mutex to guarantee serialization of NS
secure calls
2020-01-06 15:55:01 +08:00
ccli8 dec84ede7e [M2351] Enforce locked entry into TFM for platform-specific NSC calls
On M2351, some spaces like SYS/CLK are hard-wired to secure and cannot change.
To access these spaces from non-secure world, we must provide platform-specific NSC
functions. With TFM introduced, we must synchronize NSC calls into TFM to keep TFM
in sync instead of straight NSC calls. To achieve this goal, we go with the following
approach:

1. Like PSA APIs, enforce locked entry through tfm_ns_lock_dispatch().
2. Run platform-specific secure functions in default secure partition, in which SYS/CLK
   spaces have been configured to be accessible.
2020-01-06 15:55:00 +08:00
ccli8 41d95ef2fb [M2351] Support TFM level 1 2020-01-06 15:55:00 +08:00
ccli8 76a029e88d [M2351] Support initializing multiple .data/.bss sections with GCC_ARM 2020-01-06 15:54:59 +08:00
ccli8 db11eef0bc [M2351] Remove draft uvisor code with GCC_ARM
uVisor is deprecated since mbed-os 5.10, so remove related code with it.
2020-01-06 15:54:59 +08:00
ccli8 1aca8a5b56 [M2351] Make exported NSC symbols consistent across toolchains
This idea comes from TFM.
2020-01-06 15:54:59 +08:00
Martin Kojtal a8ee2d8c7d
Merge pull request #11594 from OpenNuvoton/nuvoton_m2351_partition-memory-pelion
M2351: Pre-build secure image/lib to favor pelion application
2019-12-03 09:05:49 +01: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 26e6b15110 M2351: Re-build default secure image/gateway library to favor Pelion application
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
2019-10-28 10:23:43 +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
Chun-Chieh Li 85bb65cd56 M2351: Add pre-built secure image for non-PSA 2019-09-16 11:01:34 +08:00
Chun-Chieh Li 2471c9ea10 M2351: Remove pre-built non-PSA secure image temporarily
This will add back immediately after target renaming is done.
2019-09-16 10:20:30 +08:00
Chun-Chieh Li c99c43cacd [M2351] Fix pinmap table error with SPI clock pin 2019-08-20 13:12:44 +08:00
Chun-Chieh Li 07f39f1337 [M2351] Fix CLK_SetModuleClock_S(...) error with SPI
Fix SPI module index error in modidx_ns_tab table in CLK_SetModuleClock_S().
Need to update secure image for this bugfix.

This is also to fix FPGA CI test mbed_hal_fpga_ci_test_shield-spi/
SPI - init/free test all pins.
2019-08-20 13:12:44 +08:00
Chun-Chieh Li c3d7ef8341 [Nuvoton] Free up peripheral pins in peripheral free-up HAL API
Without free-up of peripheral pins, peripheral pins of the same peripheral may
share by multiple ports after port iteration, and this peripheral may fail with
pin interference.
2019-08-20 13:12:43 +08:00
Chun-Chieh Li ca0846b1e9 [Nuvoton] Support GPIO input pull-high/pull-low
In Nuvoton, only new-design chips support GPIO input pull-high/pull-low modes.
Targets not supporting this feature are listed below:

- NUMAKER_PFM_NANO130
- NUMAKER_PFM_NUC472
- NUMAKER_PFM_M453
2019-08-20 13:12:42 +08:00
Chun-Chieh Li 09bf844d76 [Nuvoton] Fix redundant call to UART IRQ handler
Honor RxIrq/TxIrq to avoid redundant call to UART IRQ handler.

This is also to fix FPGA CI test mbed_hal_fpga_ci_test_shield-uart.
2019-08-20 13:12:42 +08:00
Chun-Chieh Li d46c6fea47 [Nuvoton] Fix redundant SPI clock generation
Fix SPI clocks are generated redundantly at the end of transfer.

This is also to fix FPGA CI test mbed_hal_fpga_ci_test_shield-spi/
SPI - async mode.
2019-08-20 13:12:42 +08:00
Chun-Chieh Li 80c21aeff5 [Nuvoton] Fix I2C NACK error
Fix logic error on replying NACK at the end of transfer.

This is also to fix FPGA CI test mbed_hal_fpga_ci_test_shield-i2c/
i2c - test single byte read i2c API.
2019-08-20 13:12:42 +08:00
Chun-Chieh Li fef138a3cd [Nuvoton] Fix IP initialization sequence
Better IP initialization sequence:
1. Configure IP pins
2. Select IP clock source and then enable it
3. Reset the IP (SYS_ResetModule)

NOTE1: IP reset takes effect regardless of IP clock. So it doesn't matter if
       IP clock enable is before IP reset.
NOTE2: Non-configured pins may disturb IP's state, so IP pinout first and then
       IP reset.
NOTE3: IP reset at the end of IP initialization sequence can cover unexpected
       situation.
2019-08-20 13:12:41 +08:00
Chun-Chieh Li 560fe33ed8 [Nuvoton] Exclude USB UART from testing
USB UART is dedicated to USB COM and so must exclude from FPGA CI testing.
2019-08-20 13:12:41 +08:00
Chun-Chieh Li f88bd72c19 [Nuvoton] Force enum PinName to 32-bit
NU_PINNAME_BIND(...) requires enum PinName to be 32-bit to encode module
binding information in it.
2019-08-20 13:12:41 +08:00
Chun-Chieh Li a03985ea43 [M2351] Refine wait_ns(...) code
1.  Add missing header file for mbed_mpu_manager_lock_ram_execution()/
    mbed_mpu_manager_unlock_ram_execution() to avoid compile warning.
2.  Locate delay_loop_code() on 16-byte boundary (sync to common version).
3.  Optimize delay_loop macro (sync to common version).
2019-07-08 17:51:49 +08:00
Anna Bridge ac274833f0
Merge pull request #10741 from OpenNuvoton/nuvoton_m2351_wait-ns
M2351: Override wait_ns to provide more accurate implementation
2019-06-19 12:22:56 +01:00
Chun-Chieh Li 016ab2a417 [Nuvoton] Fix channel release in analogout_free() 2019-06-13 18:11:50 +08:00
Chun-Chieh Li 197b328944 [M2351] Override wait_ns to provide more accurate implementation
At high HCLK rate, M2351 cannot provide zero-wait-state flash performance. Besides,
cache is forcibly turned off for non-secure land for internal reason. We locate
'delay_loop_code' from flash to SRAM to achieve zero-wait-state performance.
2019-06-03 16:47:14 +08:00
Kevin Bracey 87396e0bf6 Assembler atomics
Reimplement atomic code in inline assembly. This can improve
optimisation, and avoids potential architectural problems with using
LDREX/STREX intrinsics.

API further extended:
* Bitwise operations (fetch_and/fetch_or/fetch_xor)
* fetch_add and fetch_sub (like incr/decr, but returning old value -
  aligning with C++11)
* compare_exchange_weak
* Explicit memory order specification
* Basic freestanding template overloads for C++

This gives our existing C implementation essentially all the functionality
needed by C++11.

An actual Atomic<T> template based upon these C functions could follow.
2019-04-26 13:12:35 +03:00
Cruz Monrreal 73f1edd6db
Merge pull request #10004 from OpenNuvoton/nuvoton_m2351_fix-memory-partition
M2351: Support memory custom partition
2019-04-09 14:03:18 -05:00
ccli8 be96ade527 [Nuvoton] Add button names BUTTON1/BUTTON2 2019-03-26 17:05:43 +08:00
ccli8 8ca16c4c85 [M2351] Add license header 2019-03-12 09:34:07 +08:00
ccli8 14775cb123 [M2351] Refactor for memory partittion support
Add partition_M2351_mem.h/partition_M2351_mem.icf to centralize memory partition
2019-03-08 09:48:49 +08:00
ccli8 894f71e855 [M2351] Fix preprocessor command line in ARMC6 .sct file 2019-03-07 16:28:38 +08:00
ccli8 c0bba7475f [M2351] Rename TOOLCHAIN_ARM_STD TOOLCHAIN_ARMC6
This is to express ARMC6 toolchain support more explicitly.
2019-03-07 16:28:36 +08:00
ccli8 26ff0677dc [M2351] Remove unnecessary toolchain directory TOOLCHAIN_ARM_MICRO 2019-03-07 16:28:33 +08:00
Cruz Monrreal e6caa122cb
Merge pull request #9812 from kjbracey-arm/wait_ns
Add wait_ns API
2019-02-28 18:21:46 -06:00
Kevin Bracey 66dea08c0f M2351: include core_cm23.h
Nuvoton M2351 was including generic core_armv8mbl.h from CMSIS - we
need it to be more specific to identify the specific core for
wait_ns. Change to core_cm23.h.
2019-02-26 17:30:51 +02:00
Deepika b2e189f453 Target_Nuvoton: Remove target specific implementation of _sbrk 2019-02-19 15:49:49 -06:00
Cruz Monrreal 1712a2b76c
Merge pull request #9656 from OpenNuvoton/nuvoton_m2351_fix-crypto-ac-mgmt
M2351: Fix crypto AC management
2019-02-11 18:46:48 -06:00