Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from ARMmbed:master #173

Open
wants to merge 340 commits into
base: master
Choose a base branch
from
Open

Conversation

pull[bot]
Copy link

@pull pull bot commented Apr 20, 2022

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull bot added the ⤵️ pull label Apr 20, 2022
ccli8 and others added 29 commits September 1, 2022 10:02
1.  Based on alpha version BSP (85564a2716548e7b6d6a79a490c6d94a24cf9bcf)
2.  Continuing above, tweak BSP:
    (1) Add EPWM_ConfigOutputChannel2() to enable below 1Hz and below 1% duty cycle for PWM output (m460_epwm.h/c).
    (2) Add dummy RTC_WaitAccessEnable() for consistency with previous ports (m460_rtc.h).
3.  Target NuMaker-M467HJ V0.1 board temporarily
4.  Support Arduino UNO form factor for NUMAKER_IOT_M467 target
5.  Enable export to Keil/IAR project
    -   tools/arm_pack_manager/index.json
    -   tools/export/iar/iar_definitions.json
HRESETRF is combined reset flag. Filter it out to avoid interference with reset reason check.
1.  For GCC, support multi-block .data/.bss initialization
2.  HyperRAM is mapped to two regions: 0x0A000000 and 0x80000000
    According to default system address map, 0x0A000000 is located at 'Code' region and 0x80000000 at 'RAM' region.
    With MPU enabled on Mbed OS, 'Code' region is write-never and 'RAM' region execute-never.
    0x80000000 is chosen because 'RAM' regioin is naturally for HyperRAM.
3.  Configurable multi-function pins for HBI
4.  To locate code/data at external HyperRAM:
    -   Specify __attribute__((section(".text.nu.exthyperram"))) for RO/.text/readonly section type
        Invoke mbed_mpu_manager_lock_ram_execution()/mbed_mpu_manager_unlock_ram_execution() to run HyperRAM code
    -   Specify __attribute__((section(".data.nu.exthyperram"))) for RW/.data/readwrite section type
    -   Specify __attribute__((section(".bss.nu.exthyperram"))) for ZI/.bss/zeroinit section type
5.  Add readme
1.  Prepare crypto common code
2.  Support list
    -   SHA
    -   ECC
    NOTE: AES/RSA are to support in other works
    NOTE: Compared to M487, M467's SHA supports context save & restore (DMA Cascade mode) and so no software fallback is needed.
    NOTE: M467's ECC, following M487, goes partial-module replacement and it can just improve primitives e.g. point addition/doubling by 2X,
          and cannot improve high level point multiplication because MbedTLS doesn’t open it.
          To improve performance best, full-module replacement is needed.
    NOTE: Continuing above, add support for Montgomery curve
Add crypto_xxx_wait2 helper routine to replace crypto_xxx_wait for Crypto H/W control
According to TRM, it is suggested PRNG be seeded by TRNG on every Crypto H/W reset.
1.  Crypto RSA H/W supports 1024/2048/3072/4096 key bits. Fall back to software implementation for other key bits.
2.  For decrypt, if MBEDTLS_RSA_NO_CRT isn't defined, go CRT, or normal.
3.  For decrypt, when blinding (f_rng != NULL), enable SCAP mode.
4.  Recover from Crypto RSA H/W failure:
    (1) Enable timed-out wait to escape from RSA H/W trap
    (2) On RSA H/W timeout, stop this RSA H/W operation
    (3) Fall back to S/W implementation on failure

NOTE: RSA 4096 key bits can fail with default mbedtls configuration MBEDTLS_MPI_MAX_SIZE.
      Enlarge MBEDTLS_MPI_MAX_SIZE to 1024 or larger if this feature is required.
NOTE: Fixed in BSP RSA driver, for non-CRT+SCAP mode, temporary buffer for MADDR6 requires to be key length plus 128 bits.
NOTE: Fixed in BSP RSA driver, DMA buffer must be 4-word aligned, or RSA H/W will trap.
1.  Replace ecp.c full-module, and other ec modules dependent on ecp.c (ecdh.c/ecdsa.c/ecjpake.c) will improve followingly.
2.  Recover from Crypto ECC H/W failure:
    (1) Enable timed-out wait to escape from ECC H/W trap
    (2) On ECC H/W timeout, stop this ECC H/W operation
    (3) Fall back to S/W implementation on failure
3.  Support Short Weierstrass curve
4.  Support Montgomery curve
    Montgomery curve has the form: B y^2 = x^3 + A x^2 + x
    (1) In S/W impl, A is used as (A + 2) / 4. Figure out its original value for engine.
        https://github.com/ARMmbed/mbed-os/blob/2eb06e76208588afc6cb7580a8dd64c5429a10ce/connectivity/mbedtls/include/mbedtls/ecp.h#L219-L220
    (2) In S/W impl, B is unused. Actually, B is 1 for Curve25519/Curve448 and needs to configure to engine.
        https://github.com/ARMmbed/mbed-os/blob/2eb06e76208588afc6cb7580a8dd64c5429a10ce/connectivity/mbedtls/include/mbedtls/ecp.h#L221-L222
    (3) In S/W impl, y-coord is absent, but engine needs it. Deduce it from x-coord following:
        https://tools.ietf.org/id/draft-jivsov-ecc-compact-05.html
        https://www.rieselprime.de/ziki/Modular_square_root
    NOTE: Fix Curve448 has wrong order value
          Mbed-TLS/mbedtls#5811
This is to follow designer's resolution.
Guard from null argument passed to mbedtls_ecp_point_cmp() in ECC H/W port
Some M460 chips don't support AES/SHA/ECC/RSA H/W.
Make them removable from mbedtls H/W port through '"target.macros_remove": ["MBEDTLS_CONFIG_HW_SUPPORT"]'.
New Platform for Toshiba Added
Fix in i2c_do_trsn(), interrupt doesn't change back to enabled due to premature return.
UNO D8/D9/D10/D11/D12/D13 can wire to on-board SPI flash.
Exclude these pins from FPGA CI Test Shield test.
Pinout comparison between NuMaker-M467HJ and NuMaker-IoT-M467 boards:
1.  UNO are unchanged
2.  LEDs are unchanged
3.  Buttons are unchanged, except button names
4.  NuMaker-M467HJ has HBI but NuMaker-IoT-M467 does
5.  NuMaker-M467HJ doesn't have ESP8266 but NuMaker-IoT-M467 does
6.  SDHC are unchanged
Fix in i2c_do_trsn(), interrupt doesn't change back to enabled due to premature return.

Fix targets:
-   NUMAKER_PFM_NANO130
-   NUMAKER_PFM_NUC472
-   NUMAKER_PFM_M453
-   NUMAKER_PFM_M487/NUMAKER_IOT_M487
-   NUMAKER_IOT_M252
-   NUMAKER_IOT_M263A
-   NU_M2354
ccli8 and others added 30 commits April 18, 2024 11:04
NOTE: This fix only targets CAN (M453/M487), not CAN-FD (M467).
NOTE: NUC472 CAN doesn't support filter.
Major modifications:
1. Handle Rx interrupt based on Message Object interrupt (CAN_IIDR=0x0001~0x0020) instead of CAN_STATUS.RxOK
2. Also handle Tx interrupt following above for consistency

Other related modifications:
1. Fix signature type error in CAN_CLR_INT_PENDING_BIT()
2. Add CAN_CLR_INT_PENDING_ONLY_BIT() which doesn't clear NewDat flag so that user can fetch received message in thread context

NOTE: This fix only targets CAN (NUC472/M453/M487), not CAN-FD (M467).
…interrupt

1.  The same Message Object number cannot use for both Tx and Rx simultaneously.
    For Tx, Message Object number 31 is reserved instead of 0.
    For Rx, Message Object numbers 0~30 are used and for filters.
2.  NewDat bit (CAN_IsNewDataReceived()) isn't exclusive to Rx.
    Recognize Rx interrupt by Message Object number other than 31.

NOTE: This fix only targets CAN (NUC472/M453/M487), not CAN-FD (M467).
On mask being zero, it means any match, not exact match.

NOTE: This fix only targets CAN (M453/M487), not CAN-FD (M467).
NOTE: NUC472 CAN doesn't support filter.
NUVOTON: CAN: Fix Rx interrupt and filter mask
RAK4630 LoRaWAN Allow change TCXO control adding it as a parameter
…lare

NUVOTON: Fix undeclared function as error
STM: Add separate flags for I2C slave transfer in progress
ESP8266: Fix accessing uninitialized variable
…contained in SMS payload text

When parsing SMS, it can happen that we receive CRLF in the SMS payload (happened to me when receiving provider texts).
As an example, we can receive:

"""
Hello <CR><LF>
World!
"""

With previous implementation, second consume_to_stop_tag was stopping in <CR><LF> and rest of the code was failing for obvious reasons.
With this commit we consume the full payload as bytes.
…ew variable

Problem: If a key with write-once flag is being set in a SecureStore without rollback-protection store (i.e. _rbp_kv == NULL), additional memory will be allocated for the variable _ih->key. The memory will not be deleted, though, as the delete in line 434 only happens if a rollback-protection store exists (i.e. _rbp_kv != NULL)

Solution: Only allocate the memory if _rbp_kv != NULL

Contribution is provided on behalf of BIOTRONIK.
TDBStore: Add missing delete for _inc_set_handle
Problem: The build_ram_table() function of TDBStore loops over every entry, calculates the checksum and compares them to the stored checksum in the entry header to ensure integrity. For larger TDBStores (e.g. 8 MiB or more) in external single-SPI flash devices this check can take very long, thus rendering it unusable in some cases.

Solution: The suggested solution skips the time consuming CRC of the data. After reading the key and calculating its CRC, it sets next_offset to the beginning of the next entry, thereby skipping the data. While this skips the integrity check, it significantly reduces the initial building of the RAM table.

The data CRC can be enabled or disabled with a compiler flag.

Contribution is provided on behalf of BIOTRONIK.
Add configurable status register number in mbed_lib.json for QSPIBlockDevice driver to support different Flash EPN
Correct scan parameters types
TDBSTore: skip data CRC when building RAM table
SecureStore: Add missing check for rollback-protection pointer before allocating memory
…ixes

Rework STM32H7x clocking configuration
SMS: Increase timeout for send and get. Fix text SMS parsing when CRLF is contained in the text.
* The Mbed platform and OS will reach end of life in July 2026,
  when the Mbed website will be archived and it will no longer
  be possible to build projects in our online tools.
* The device software - Mbed OS - is open source and will remain
  publicly available, but is no longer actively maintained by Arm
* The Mbed TLS project is unaffected by this announcement and
  continues to be supported as part of the TrustedFirmware
  community project.

Signed-off-by: Hugues KAMBA MPIANA <[email protected]>
Fix missing gpio_base on invoking GPIO_SET_DEBOUNCE_TIME()
reduce spam on info log of cellular sockets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.