Commit Graph

695 Commits (a104dac9cb69b9a5417406813e3faa7ba2ddab8a)

Author SHA1 Message Date
Chun-Chieh Li 1f70a3caa2 M252: Change SERIAL_TX/SERIAL_RX pin names to other than USBTX/USBRX
USBTX/USBRX should be dedicated for USB VCOM and not for other uses.
2020-07-31 17:05:34 +08:00
cyliangtw dd48500cc3 Revise M263A button pin name 2020-07-21 20:50:19 +08:00
Martin Kojtal e371db441c
Merge pull request #12949 from 0xc0170/feature_CMSIS_5_b5f0603d6
CMSIS: update to CMSIS 5.7.0
2020-05-14 13:21:12 +02:00
Martin Kojtal e2fb52aab7 M2351: fix startup after cmsis update
Don't use CMSIS low level startup
2020-05-13 12:21:05 +01:00
Martin Kojtal 981fcdf52a M251: fix startup after cmsis update
Don't use CMSIS low level startup
2020-05-13 12:20:06 +01:00
Martin Kojtal 2c8be47525 Revert "Use cmsis gcc types instead of own"
This reverts commit 606ccbceff.
2020-05-13 10:43:57 +01:00
Martin Kojtal 606ccbceff Use cmsis gcc types instead of own
This caused a conflict. As CMSIS update introduced low level init, lets use the types
from CMSIS. We could potentionally use __cmsis_start but as I saw for some targets,
the init routine is slightly different. So rather keep what we have in targets, and just
use types already defined in CMSIS.
2020-05-12 16:01:21 +01:00
Martin Kojtal 8a254a9cc6
Merge pull request #12923 from OpenNuvoton/nuvoton_watchdog_lxt
Nuvoton: Refine more on watchdog HAL
2020-05-12 14:31:26 +02:00
Martin Kojtal b376ee1c7c
Merge pull request #12896 from OpenNuvoton/nuvoton_watchdog_hardfault
Nuvoton: Fix watchdog reset failure on meeting Hard Fault
2020-05-12 14:18:18 +02:00
Chun-Chieh Li 9e9e2f18de 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-05 17:50:20 +08:00
Chun-Chieh Li f6485cf92f 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-05 17:50:15 +08:00
Chun-Chieh Li d121ea89d1 Nuvoton: Fix WDT feature report with clock frequency 2020-05-05 17:50:10 +08:00
Chun-Chieh Li d823756cb7 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-05 17:50:05 +08:00
Chun-Chieh Li 73824f0c4d 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-04-30 14:22:30 +08:00
Chun-Chieh Li e7dd4057c3 M453: Support bare metal
Relevant modifications to make TOOLCHAIN_* directories clear:
1. Remove TOOLCHAIN_ARM_STD
2. Rename TOOLCHAIN_ARM_MICRO to TOOLCHAIN_ARM
2020-04-27 11:24:13 +08:00
Chun-Chieh Li 226d86b304 NANO130: Support bare metal
Relevant modifications to make TOOLCHAIN_* directories clear:
1. Remove TOOLCHAIN_ARM_STD
2. Rename TOOLCHAIN_ARM_MICRO to TOOLCHAIN_ARM
2020-04-27 11:24:13 +08:00
Chun-Chieh Li 530a5cfe7c M453: Make memory specification configurable 2020-04-27 11:24:12 +08:00
Chun-Chieh Li 188c6d9a4a NANO130: Make memory specification configurable 2020-04-27 11:24:11 +08:00
Martin Kojtal 68f1ef2df6
Merge pull request #12716 from OpenNuvoton/nuvoton_m487_bsp
M487: Update BSP
2020-04-15 09:07:10 +02:00
Martin Kojtal f03860a971
Merge pull request #12604 from OpenNuvoton/nuvoton_nano130_tickless_lpticker
NANO130: Fix test failures with tickless from lp_ticker
2020-04-01 08:40:19 +02:00
Chun-Chieh Li 2c9ec8f19d M487: Add SPDX license identifier for BSP files 2020-04-01 13:55:46 +08:00
Chun-Chieh Li d709c775b4 M487: Add SPDX license identifier 2020-04-01 13:55:45 +08:00
Chun-Chieh Li 3b9492fdbc M487: Update BSP
Relevant modifications:
1. Support degrading QSPI0/1 to SPI4/5 for normal SPI transfer
2. Fix with BSP crypto driver API change
3. Fix with BSP PDMA driver API change
4. Make necessary modifications to pass FPGA CI Test Shield tests
5. Don't distinguish pinmap among parts e.g. M480 LG. Application users must take care.
2020-04-01 13:55:12 +08:00
Martin Kojtal 0a6e586a9d
Merge pull request #12660 from OpenNuvoton/nuvoton_m2351_custom_board
M2351: Support custom board
2020-03-31 09:29:22 +02:00
Chun-Chieh Li e6823c6af5 M2351: Add SPDX license identifier for BSP files 2020-03-24 10:47:03 +08:00
Chun-Chieh Li d1655854c9 M2351: Add SPDX license identifier 2020-03-24 10:03:44 +08:00
Chun-Chieh Li dbd34ed63e NANO130: Enlarge timeout in CLK_WaitClockReady(...)
Most code doesn't check return code of CLK_WaitClockReady(...). Enlarge timeout to meet most cases.

lp_ticker initialization fails with this issue. Steps for reproducing:
1.  System runs in tickless from lp_ticker mode.
2.  Arm WDT reset.
3.  In next reset cycle, lp_ticker initialization fails (active flag doesn't become active).
2020-03-20 10:26:39 +08:00
Chun-Chieh Li 427e8eb777 M2351: Support custom board
1. Introduce MCU_M2351 target to be inheritable
2. Re-organize PinNames.h to be overridable
3. Enable configurability of USB/STDIO UART pins
2020-03-20 09:39:16 +08:00
Chun-Chieh Li f5cb899413 M263: Re-organize PinNames.h
This is to support custom boards based on M261 series chips.
2020-03-20 09:16:51 +08:00
Chun-Chieh Li 15fcdb1c36 M263: Support configurability for USB/STDIO UART pins
-   STDIO_UART and STDIO_UART_TX/STDIO_UART_RX
-   USB_UART and USBTX/USBRX
2020-03-20 09:16:51 +08:00
Chun-Chieh Li edcfcf0495 M263: Enable configurability for memory specification
This is to support custom boards based on M261 series chips.
2020-03-20 09:16:50 +08:00
Chun-Chieh Li 203a9fe0ec M263: Add SERIAL_TX/SERIAL_RX pin names
Don't set SERIAL_TX/SERIAL_RX to USBTX/USBRX which should be dedicated for USB VCOM and not for other uses.
2020-03-20 09:16:49 +08:00
Chun-Chieh Li 5ec86411c4 M487: Re-organize PinNames.h
This is to support custom targets based on M480 series chips.
2020-03-12 09:34:45 +08:00
Chun-Chieh Li 2cf82821dd M487: Support configurability of USB/STDIO UART pins
-   STDIO_UART and STDIO_UART_TX/STDIO_UART_RX
-   USB_UART and USBTX/USBRX
2020-03-12 09:34:45 +08:00
Chun-Chieh Li 9d26390595 M487: Make memory specification configurable
This is to support custom targets based on M480 series chips.
2020-03-12 09:34:14 +08:00
Chun-Chieh Li 98c151a9f2 M487: Make SPIM CCM mode configurable
This is to support custom targets based on M480 series chips.
2020-03-12 09:31:51 +08:00
Chun-Chieh Li 2f770b77a9 M487: Remove BUTTON1/2 for custom targets
This is to support custom targets based on M480 series chips.
2020-03-12 09:31:51 +08:00
Chun-Chieh Li c4ffd38a90 M487: Change SERIAL_TX/SERIAL_RX pin names to other than USBTX/USBRX
USBTX/USBRX should be dedicated for USB VCOM and not for other uses.
2020-03-12 09:31:51 +08:00
Chun-Chieh Li cbf1a8a6fd M487: Get around h/w issue with reset from power-down mode
When UART interrupt enabled and WDT reset from power-down mode, in the next
cycle, UART interrupt keeps breaking in and cannot block unless via NVIC. To
get around it, we deliberately make up a signal of WDT wake-up from power-down
mode in the start of boot proces when WDT reset is detected.
2020-02-27 17:46:19 +08:00
Chun-Chieh Li 55f88a0942 M487: Re-implement Reset_Handler() in naked inline assembly
This is to guarantee SRAM bank2, not initialized yet, isn't used for stack by function preamble code at the very start.
2020-02-27 17:38:53 +08:00
Martin Kojtal 119931e56d
Merge pull request #12478 from OpenNuvoton/nuvoton_m2351_minor
M2351: Fix some minor issues
2020-02-24 12:51:52 +00:00
Martin Kojtal dc733d8883
Merge pull request #12477 from fkjagodzinski/hal-gpio-get_capabilities
HAL: Add a get_capabilities() function to GPIO API
2020-02-24 07:47:39 +00:00
Filip Jagodzinski 09ecd2fdc0 Nuvoton: Add gpio_get_capabilities()
TARGET_NANO100, TARGET_NUC472 & TARGET_M451 do not support input pull
mode configuration.
2020-02-19 18:58:47 +01:00
Chun-Chieh Li 34d3d43f0d M2351: Fix NSC_Init(...)
Actually, NSC_Init(...) is not used by secure code currently. No need to rebuild secoure image/lib.
2020-02-19 17:59:49 +08:00
Chun-Chieh Li 7328467012 M2351: Fix interrupt vector with BSP update 2020-02-19 17:57:01 +08:00
Chun-Chieh Li d5620b66a7 M2351: Fix RTC comment 2020-02-19 17:51:49 +08:00
Chun-Chieh Li 8df96ec50a Nuvoton: Make SPI inter-frame (delay match configured suspend interval
In no MISO case, skip SPI read so that no more write/read delay contribute to SPI inter-frame delay when data is written successively.

Update targets:
-   NUMAKER_PFM_NANO130
-   NUMAKER_PFM_NUC472
-   NUMAKER_PFM_M453
-   NUMAKER_PFM_M487/NUMAKER_IOT_M487
-   NU_PFM_M2351_*
-   NUMAKER_IOT_M263A
-   NUMAKER_M252KG
2020-02-17 15:00:09 +08:00
Chun-Chieh Li 769781cfb3 M2351: Update PSA secure image/lib with RTC LXT 2020-02-13 11:24:02 +08:00
Chun-Chieh Li 4c9e0f1fcd M2351: Update non-PSA secure image/lib with RTC LXT 2020-02-13 11:24:02 +08:00
Chun-Chieh Li 9f9ca0acaa M2351: Fix CRYPTO_MODBASE() when crypto module is configured to secure
This bug results from BSP update:

-   CRPT: Base address of secure or non-secure crypto module, dependent on partition
-   CRPT_S: Base address of secure crypto module
-   CRPT_NS: Base address of non-secured crypto module
2020-02-13 11:24:02 +08:00
Chun-Chieh Li 834e1aad60 M2351: Fix delay code with RTC clock source
Explicitly configure RTC clock source to LXT
2020-02-13 11:24:02 +08:00
Chun-Chieh Li 28495bb075 M2351: Refine gpio_irq_set(...) with inconsistent GPIO_EnableInt(...) implementations
No logic change
2020-02-13 11:24:02 +08:00
Chun-Chieh Li 582c08c129 M2351: Refine code layout of PeripheralPins.c
No logic change
2020-02-13 11:24:01 +08:00
Chun-Chieh Li 4a1d612e90 Nuvoton: Fix delay code with RTC clock source
Explicitly configure RTC clock source to LXT

Update targets:

-   NUMAKER_PFM_NANO130
-   NUMAKER_PFM_NUC472
-   NUMAKER_PFM_M453
-   NUMAKER_PFM_M487/NUMAKER_IOT_M487
-   NUMAKER_M252KG
-   NUMAKER_IOT_M263A
2020-02-13 11:24:01 +08:00
Chun-Chieh Li 86fcae5b03 Nuvoton: Fix GPIO rising/falling edge interrupts cannot exist simultaneously
This is to pass mbed_hal_fpga_ci_test_shield-gpio_irq test.

Update targets:

-   NUMAKER_PFM_NANO130
-   NUMAKER_PFM_NUC472
-   NUMAKER_PFM_M453
-   NUMAKER_PFM_M487/NUMAKER_IOT_M487
-   NUMAKER_M252KG
-   NUMAKER_IOT_M263A
2020-02-13 11:24:01 +08:00
Martin Kojtal 8e522056a0
Merge pull request #12404 from OpenNuvoton/nuvoton_m2351_bsp
M2351: Update BSP and bugfix
2020-02-11 15:43:10 +00:00
Chun-Chieh Li 3d9c7b2519 M2351: Update PSA secure image/lib with BSP update 2020-02-10 18:37:30 +08:00
Chun-Chieh Li ee8236b22e M2351: Update non-PSA secure image/lib with BSP update 2020-02-10 17:50:15 +08:00
Chun-Chieh Li 6f793fbb5a M2351: Fix GPIO rising/falling edge interrupts cannot exist simultaneously 2020-02-10 17:44:55 +08:00
Chun-Chieh Li a2c9ae6b7d M2351: Update BSP and bugfix
Align with mainline BSP and fix relevant bugs:

1.  Align with SPI module naming
    (1) Remove SPI5
    (2) Degrade QSPI0 to SPI4 so that it can use for standard SPI
2.  Fix some code lacking GPIO H
3.  Implement __PC(...) by following BSP instead of with MBED_CALLER_ADDR()
4.  Add SCU_IRQHandler(). Change printf(...) with interrupt-safe error(...)
5.  Other minor alignment change
2020-02-10 16:23:32 +08:00
Chun-Chieh Li 82770d7e2b M2351: Refine PeripheralNames.h
No logic change and bugfix
2020-02-10 09:07:13 +08:00
Przemyslaw Stekiel a4e1354769 Remove pinmap_restricted_peripherals() function from Nuvoton (STDIO uart is restricted by default) 2020-02-07 10:45:02 +01:00
Martin Kojtal 32675cc6ac
Merge pull request #11874 from fkjagodzinski/armc6_build-enable_lto_for_release
ARMC6: Add a build profile extension with the link-time optimizer enabled
2020-02-05 14:42:16 +00:00
Chun-Chieh Li 9faa236dfc M2351: Refactor startup file
1.  Re-organize to make clear for 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.
2020-02-05 10:14:26 +08:00
Maciej Bocianski e3b8514a91 NUMAKER_IOT_M487: keep __vector_handlers symbols in LTO builds
Add a "used" attribute to __vector_handlers to fix ARMC6 build with
the "-flto" flag.
(Error: L6236E: No section matches selector - no section to be FIRST/LAST. )

This attribute, attached to a function/variable, means that code must be emitted
for the function even if it appears that the function is not referenced.
2020-02-04 12:38:37 +01:00
Maciej Bocianski 6d896f032f NU_PFM_M2351_NPSA: keep __vector_handlers symbol in LTO builds
Add a "used" attribute to __vector_handlers to fix ARMC6 build with
the "-flto" flag.
(Error: L6236E: No section matches selector - no section to be FIRST/LAST.)

This attribute, attached to a function/variable, means that code must be emitted
for the function even if it appears that the function is not referenced.
2020-02-04 12:38:26 +01:00
Maciej Bocianski 50c3b100a8 NUMAKER_PFM_NUC472: keep __vector_handlers symbol in LTO builds
Add a "used" attribute to __vector_handlers to fix ARMC6 build with
the "-flto" flag.
(Error: L6236E: No section matches selector - no section to be FIRST/LAST.)

This attribute, attached to a function/variable, means that code must be emitted
for the function even if it appears that the function is not referenced.
2020-02-04 12:30:00 +01:00
Maciej Bocianski ad7f27bf77 NUMAKER_PFM_NANO130: keep __vector_handlers symbol in LTO builds
Add a "used" attribute to __vector_handlers to fix ARMC6 build with
the "-flto" flag.
(Error: L6236E: No section matches selector - no section to be FIRST/LAST.)

This attribute, attached to a function/variable, means that code must be emitted
for the function even if it appears that the function is not referenced.
2020-02-04 12:29:59 +01:00
Maciej Bocianski ddd2cf8920 NUMAKER_PFM_M453: keep __vector_handlers symbol in LTO builds
Add a "used" attribute to __vector_handlers to fix ARMC6 build with
the "-flto" flag.
(Error: L6236E: No section matches selector - no section to be FIRST/LAST.)

This attribute, attached to a function/variable, means that code must be emitted
for the function even if it appears that the function is not referenced.
2020-02-04 12:29:59 +01:00
Maciej Bocianski f0dc4abb3f NUMAKER_M252KG: keep __vector_handlers symbol in LTO builds
Add a "used" attribute to __vector_handlers to fix ARMC6 build with
the "-flto" flag.
(Error: L6236E: No section matches selector - no section to be FIRST/LAST. )

This attribute, attached to a function/variable, means that code must be emitted
for the function even if it appears that the function is not referenced.
2020-02-04 12:29:58 +01:00
Maciej Bocianski 9aade4a816 NUMAKER_IOT_M263A: keep __vector_handlers symbol in LTO builds
Add a "used" attribute to __vector_handlers to fix ARMC6 build with
the "-flto" flag.
(Error: L6236E: No section matches selector - no section to be FIRST/LAST. )

This attribute, attached to a function/variable, means that code must be emitted
for the function even if it appears that the function is not referenced.
2020-02-04 12:29:57 +01:00
Filip Jagodzinski 28b1169b7e NUVOTON: Fix undefined reference to Reset_Handler_Cascade
Add a "used" attribute to Reset_Handler_Cascade to fix GCC build with
the "-flto" flag.
This attribute, attached to a function, means that code must be emitted
for the function even if it appears that the function is not referenced.
2020-02-04 12:29:51 +01:00
Chun-Chieh Li 94762d02a1 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-01-30 13:12:31 +08:00
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 40b7901cfb
Merge pull request #12217 from OpenNuvoton/nuvoton_usbd
Nuvoton: Add DEVICE_USBDEVICE detection in usbd implementation
2020-01-08 17:00:23 +01: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 b924a922a8 Add DEVICE_USBDEVICE detection in usbd implementation to avoid compiler error on target without usb-device 2020-01-08 19:36:51 +08:00
Martin Kojtal b77f6b457e
Merge pull request #12055 from 0xc0170/fix_12054
cmsis: remove arm math
2020-01-08 12:00:54 +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 078f71d72a nuvoton: remove dsp math from bitutil file 2020-01-03 15:25:02 +00:00
cyliangtw 115520a7b8 Add SPDX identifiers in Nuvoton USBD files 2020-01-03 20:40:47 +08:00
cyliangtw eab8555fc8 Support NUC472 with USB 2.0 only and set M487 USB1.1 in default 2020-01-03 20:40:46 +08:00
cyliangtw 4cddc5de25 Add M453 USBD 2020-01-03 20:40:45 +08:00
cyliangtw 6612ee8460 Set NANO130 CLK as 48 MHz for USBD support 2020-01-03 20:40:44 +08:00
cyliangtw abf3eeed64 Support NuMaker M453, NUC472, M2351 & M263 USBD; also support M0 usb-isr non-recloate vector limit 2020-01-03 20:40:43 +08:00
cyliangtw a5aaabff5d NANO130 add extern C into nano100_usbd.h for C++ caller 2020-01-03 20:40:42 +08:00
cyliangtw 93fbef2cde Refine M487 USBD code and build M263A successfully 2020-01-03 20:40:41 +08:00
cyliangtw 9b721bf327 Support M487 USBD 1.1 & 2.0 2020-01-03 20:40:39 +08:00
cyliangtw 84882f773e M487: Fixed USBD serial input pending issue 2020-01-03 20:40:37 +08:00
cyliangtw b34fd309e3 M487: Support USBD 2020-01-03 20:40:36 +08:00
Chun-Chieh Li c99dc34f65 Nuvoton: Support dynamic heap configuration on IAR
On IAR, configure heap to 1KiB at a minimum and expandable, dependent on available SRAM. This requires IAR 8.x.

Support targets:
-   NUMAKER_PFM_NUC472 w/ and w/o XRAM
-   NUMAKER_PFM_M453
-   NUMAKER_PFM_M487/NUMAKER_IOT_M487
-   NUMAKER_IOT_M263A
-   NUMAKER_M252KG
2019-12-27 09:01:07 +08:00