Commit Graph

226 Commits (7501ee7fc9eb6572cb21d0003cb2fda6b87b98e9)

Author SHA1 Message Date
Jamie Smith 699437ecf9
Allow Mbed CE to be built as an Arduino core (#206)
* Various changes for Arduino core support

* Apply Arduino Mbed TLS patches

* Apply linker script patch, add missing CXX standard

* Fix SDBlockDevice compile error, fix "no rule to make mbed-target-config.h"

* Fix missing source file for RPi Pico

* Fix missing licenses
2024-01-13 10:01:45 -08:00
timIdeaTech 79c56f3155
add lfsv2 to storage/platform lib list (#201)
add lfsv2 to storage/kvstore/kv_config link libs
2023-12-20 16:42:04 -08:00
Jamie Smith 69d95b598a
Make DMA SPI driver aware of CPU cache, fix data corruption and other SPI issues on STM32H7 (#199)
* Handle cache alignment in DMA SPI driver

* Fix build on cache-less devices

* Fix a couple things I missed

* Run formatter, improve CacheAlignedBuffer docs

* Add missing license identifiers to source files

* Make CacheAlignedBuffer heap-allocatable, try and add exclusion for Nordic license in scancode_evaluate.py

* Formatting, docs, revert accidental change

* Update code blocks to pass spell checker
2023-12-19 10:21:47 -08:00
Jamie Smith 264dbe219f
SDBlockDevice: revert HW CS support, add async support (#181)
* SDBlockDevice: revert HW CS support, add async support

* Convert one last call

* Turn off debug mode, whoops

* Run formatter
2023-08-27 11:05:18 -07:00
Jamie Smith a639176603
Fix declaring OSPIFBlockDevice and QSPIFBlockDevice as globals, fix some STM32U585 issues (#167)
* Attempt to fix declaring an OSPIFBlockDevice as a global object

* Astyle format

* Add B_U585_IOT02A upload method support and default OSPIF mappings.  Guard against incorrect case on upload method

* Also fix the same error in QSPIFBlockDevice

* Fix compile error for mbed-wifi

* Provide ScopedMutexLock for unittests mode
2023-07-17 19:52:38 -07:00
Jamie Smith 3f7d67c64c
Synchronize upstream changes - May 2023 edition (#160)
* fix STM32L1 FLASH_SIZE for cat.3 devices with DEV_ID 0x436

* Fix mesh connect semaphore not releasing causing blockage

* Add support of NSAPI_ICMP sockets in Nanostack

* STM32F1: add MCU_STM32F103xD support

* STM32F1: add MCU_STM32F103xG support

* test: Disable failing tests due to echo server

Some tests are failing as echo.mbedcloudtesting.com is not serving TLS
requests anymore.

Signed-off-by: Saheer Babu <saheer.babu@arm.com>

* Check CAN DLC length value

* Fix default interface ID only being used partially

If user sets the default interface ID for a socket (e.g. using setsockopt
with SOCKET_INTERFACE_SELECT), the default interface should take over
other interface selection mechanisms as a interface is bound to the socket.
This applies for both IPv6 local and global scopes for unicast messages
but not for multicast messages as these are bound to a multicast interface
using SOCKET_IPV6_MULTICAST_IF socket option.

* Targets: NXP: IMXRT: Fixed GCC_ARM lds syntax.

Signed-off-by: Yilin Sun <imi415@imi.moe>

* CAN: read only up to 8 bytes

If HAL implementation writes more than 8 bytes of data, error immediately.
CANMessage defines only 8 bytes of data, lenght cannot be > 8.

This fixes https://github.com/ARMmbed/mbed-os/issues/15361

Signed-off-by: Martin Kojtal <martin.kojtal@arm.com>

* STM32F303xC: add RAM_CCM in GCC linker script

* fix(drivers/emac): Remove incorrect RMII RX ER initialization

* fix(drivers/emac): Add missing SPDX indetifier to ST driver files

* fixed compiler inline issue

* Update Mbed version block

* removed HSE speed limitation for STM32G431RB

* Added HSE range validation for STM32g431xB

* added support for 4, 8 and 16MHz

* M487: Remove unused variable 'u32EscapeFrame'

Remove unused variable 'u32EscapeFrame' in BSP m480_ccap.h to avoid warnings

* force FIFO IRQ for FDCan RX on H7

* Add hardware CRC support to STM32G4

* add support for Nucleo-H745ZI

* Update MAX32670 peripheral drivers with final ones that use by SDK

Signed-off-by: Sadik.Ozer <sadik.ozer@analog.com>

* MAX32670 apply mbed required changes on peripheral drivers

Signed-off-by: Sadik.Ozer <sadik.ozer@analog.com>

* M467: Support CAN bus

1.  Update BSP CANFD driver
2.  Notes for implementation
    (1) Each CANFD instance supports two IRQ lines. Use only line 0. Line 1 is not used.
    (2) For Rx disabling multiple filter handles,
        1)  Map all filter handles to filter handle 0
        2)  Use Rx FIFO 0 for filter handle 0
    (3) For Rx enabling multiple filter handles,
        1)  Use Rx FIFO 0 for filter handle 0
        2)  Use Rx FIFO 1 for filter handle through first invoking can_filter()
        3)  Use dedicated Rx Buffer for other filter handles
        NOTE: H/W supports mask on Rx FIFO 0/1 but not on dedicated Rx Buffer.
    (4) For Tx, use only dedicated Tx Buffer. BSP CANFD driver doesn't support Tx FIFO/Queue.
    (5) Support no CAN FD.

* Fix 'new[]' array freed with 'delete'

The array _scratch_buf is allocated using new[] in line 761 of
mbed-os/storage/kvstore/securestore/source/SecureStore.cpp.
But it was freed using delete.

* Define default parameters of functions of derived class the same as the base class

The member function bringup() of class ThreadInterface redefines
parameter stack's default value to IPV6_STACK from the inherited default value
DEFAULT_STACK (in Interface).
The default value will be resolved statically, not by dispatch, so this
can cause confusion.
Similar arguments apply to LoWPANNDInterface and WisunInterface.

* Avoid calling virtual functions from constructors and destructors

Virtual functions are resolved statically (not dynamically) in
constructors and destructors for the same class. The call should be made
explicitly static by qualifying it using the scope resolution operator.

* Fix potentially overrunning write of sprintf

Format string "%d" requires 12 bytes (including the null terminator).
Also, use snprintf instead of sprintf to prevent buffer overflow.

* Fix system_clock.c location

Signed-off-by: Jasper Jonker <jasper.jonker@wingtra.com>

* Fix variable name

Signed-off-by: Jasper <jasper.jonker@wingtra.com>

* Change storage-class of secret_buf to static

Storing the address of a local variable (`secret_buf`)
in non-local memory (`prf_ptr->secret`) can cause a
dangling pointer bug if the address is used after the function returns.

* fix compiling errors of FATFileSystem when exFAT was enabled

* Add OSPI support for STM32H7

* Nuvoton: Enable extending sampling time for ADC/EADC

For all Nuvoton targets, enable extending sampling time in ADC/EADC clocks on per-pin basis.

---------

Signed-off-by: Saheer Babu <saheer.babu@arm.com>
Signed-off-by: Yilin Sun <imi415@imi.moe>
Signed-off-by: Martin Kojtal <martin.kojtal@arm.com>
Signed-off-by: Sadik.Ozer <sadik.ozer@analog.com>
Signed-off-by: Jasper Jonker <jasper.jonker@wingtra.com>
Signed-off-by: Jasper <jasper.jonker@wingtra.com>
Co-authored-by: caodd <caodd1993@qq.com>
Co-authored-by: YannCharbon <yann.charbon@ik.me>
Co-authored-by: Jerome Coutant <jerome.coutant@st.com>
Co-authored-by: Saheer Babu <saheer.babu@arm.com>
Co-authored-by: Martyx00 <martin.petran@protonmail.com>
Co-authored-by: Yilin Sun <imi415@imi.moe>
Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: akiroz <akiroz.vectis@gmail.com>
Co-authored-by: Charles <hallard04@free.fr>
Co-authored-by: Leonard Chiang <leochiang2002@gmail.com>
Co-authored-by: Chun-Chieh Li <ccli8@nuvoton.com>
Co-authored-by: jmcloud <jmcloud@tesla.com>
Co-authored-by: Augusto Zanellato <augusto.zanellato@gmail.com>
Co-authored-by: Sadik.Ozer <sadik.ozer@analog.com>
Co-authored-by: Mingjie Shen <shen497@purdue.edu>
Co-authored-by: Jasper Jonker <jasper.jonker@wingtra.com>
Co-authored-by: wdx04 <wdx04@outlook.com>
2023-05-17 01:18:28 -07:00
Jookia ea044e0695
STM32F7 QSPI flash timeouts and 4-byte addressing (#152)
* STM32F7: Unconditionally enable QSPI workarounds

On the STM32769NI at least this patch is required for stable QSPI use.
Enable it uncondtionally in case other boards need it too.

Further discussions:

https://github.com/ARMmbed/mbed-os/issues/10049
https://github.com/ARMmbed/mbed-os/issues/15108

https://github.com/STMicroelectronics/STM32CubeF7/issues/52
https://github.com/STMicroelectronics/STM32CubeF7/issues/82

* QSPIF: Attempt 4-byte addressing on Macronix chips

mbed-os PR 11531 introduced 4-byte addressing in the QSPIF block device:

https://github.com/ARMmbed/mbed-os/pull/11531

During testing it was found that this code broke on the NRF52840_DK and
DISCO_F769NI.

The NRF52840_DK controller seems unable to handle 4-byte addressing at
all and has been disabled entirely in another code section.

The DISCO_F769NI breakage was attributed to the flash chip but after more
research I believe this is related to the QSPI controller, not the 4-byte
addressing itself.

Now that the QSPI controller has a workaround, enable 4-byte addressing
again and hope it works fine this time.
2023-03-21 09:19:22 -07:00
Jamie Smith 280d40c5c7
Update for Doxygen 1.9.5 (#119)
* Update for Doxygen 1.9.5

* Also update doxygen version in docs.yaml

* Also fix Doxygen version in basic_checks.yaml
2023-01-03 21:26:26 -08:00
Jamie Smith 97c267219a
Fix all Doxygen errors and make any future errors fatal (#118)
* Start working on fixing doxygen warnings

* Upgrade doxyfile to Doxygen 1.9.1

* Clean up some unmatched groups and add some exclusions

* Fix docs for rtos::ThisThread not showing up

* Fix up KV store docs

* Fix incorrect @files, some more incorrect groups

* Fix lots of broken links

* Start fixing mbedtls groups

* Fix more mbedtls docs

* Fix remaining mbedtls files with missing or incorrect grouping

* Fix a huge amount of PSA docs errors

* Fix a few more mbedtls docs errors

* Fix __cplusplus not defined for docs, clean up call in callback typedef, fix some docs errors

* Fix some broken doc links in HAL headers

* Fix more PSA doc errors

* Fix some doxygen errors in networking code

* Fix lots of network related doc errors

* Try and fix some CI failures

* Use Doxygen Action instead of doxygen in Mbed container to get the right version

* Try removing docs check

* Add first part of doxygen action

* Add next part of doxygen action

* Fix yaml syntax error

* Add in license check fix

* Try using verbose scancode

* Fix some more docs issues, workaround scancode-toolkit#3179

* Clean up the LoRaRadio get_state() function on each implementation.  Also fix some other compile and doc errors.

* Fix all remaining doxygen errors

* Fix escaping, for realsies this time

* Remove Doxygen unsupported config options, fix some more get_status() declarations

* Fix some UNITTESTS build errors

* Fix one more compile error

* Another unittest error
2022-12-30 18:41:41 -05:00
Jay Sridharan 961632a860
Clean up group/module definitions in doxygen (#97)
* Clean up group definitions in doxygen

* remove THIRD_PARTY_DOCS

* some stragglers

* fix astyle formatting
2022-11-12 23:27:50 -08:00
Jamie Smith 32a9080c7d
Enable Arduino Nano 33 BLE (#55)
* Add upload target for Arduino Nano 33 BLE, fix linker script preprocessing, add option for USB serial by default

* astyle error

* Use HINTS instead of PATHS so that the Arduino dir is searched first

* Enable OpenOCD and PyOCD for Nano 33 BLE in SWD mode

* Fix missing dependency for USB tests on Windows

* Add RAM defines for nrf52840

* Fix mbed-storage-kv-config depending on SD card library even if said library was not enabled

* Update dsrdtr value

* No longer need to modify linker script now that we aren't using whole-archive!

* Add OPENOCD_ADAPTER_SERIAL

* Add handling for cmsis dap

* Fix typo

* Fix weak symbol issue causing Bluetooth to not work.  In this case, the weak implementation can simply be removed, because there's no legitimate case where it is used.
2022-10-16 10:32:38 -07:00
Jamie Smith ffc33676d1
Lots of usability improvements for the I2C API. Better docs and new top-level functions. (#64)
* Lots of usability improvements for the I2C API.  Better docs and new top-level functions.

* Document frequencies

* Tabs to spaces

* More style fixes

* Run astyle

* Clean up docs

* Add note about addressing, change 10 bit to 11 bit

* Fix spellcheck

* Fix paste error

* Oops, fix accidental change
2022-10-02 21:27:33 -07:00
Jamie Smith 0874f74ae9 Allow SDBlockDevice to use either HW or SW chip selects 2022-09-14 00:25:30 -07:00
Jamie Smith d6556c84fc Fix some build errors 2022-09-14 00:25:30 -07:00
Jamie Smith d83dbc2ac4 Fix ABI differences between mbed-baremetal and mbed-os, remove PlatformMutex 2022-09-14 00:25:30 -07:00
Jamie Smith 69c1d4a55a Rename inconsistently named testing-related variables. Also fix STM32CUBE not working from application code. 2022-09-14 00:25:29 -07:00
Jamie Smith dd66013d9c Try and fix host tests 2022-09-14 00:25:28 -07:00
Jamie Smith bc46f5a3af Convert storage/ targets into STATIC libraries 2022-09-14 00:25:28 -07:00
Jamie Smith 63aa3360c0 Clean up top-level build file and build options, fix build issues on MinGW 2022-09-14 00:25:25 -07:00
Michał Majcherski b932850d62
Fix missing mbed:: profix issue 2022-08-23 22:47:56 +02:00
Andreas Reichle e42fa8ffe3 add missing unlock in file_truncate in FATFileSystem 2022-07-04 11:21:50 +02:00
Uruloke d95768b38c QSPIF: Add missing mbed namespace prefix to header file 2021-10-19 15:09:34 +02:00
Robert Walton fca7323f73 CMake: QSPIFBlockDevice: Guard unit test directory
In the QSPIFBlockDevice component we checked if BUILD_TESTING was
enabled before adding the QSPIFBlockDevice/UNITTESTS subdirectory. In
the parent blockdevice/CMakeLists.txt we added the QSPIFBlockDevice
subdirectory to the build under two separate conditions:

* when "QSPIF" is present in MBED_TARGET_LABELS
* when building only unit tests

This wasn't quite enough, as when we build greentea tests for some
targets QSPIF is enabled in MBED_TARGET_LABELS, causing the
QSPIFBlockDevice subdirectory and its unit tests to be added when
building greentea tests. This caused a test failure on targets which
enable QSPIF:

```
The following tests FAILED:
	 40 - qspif-unittest_NOT_BUILT (Not Run)
```

To fix this we need to specifically check that we're not building
greentea tests before adding the QSPIFBlockDevice/UNITTESTS directory to
the project.

Part of this issue is our reliance on MBED_TARGET_LABELS to pull
features in to the build. We should refactor our usage of
MBED_TARGET_LABELS and use CMake target dependencies where possible.
Then we wouldn't need to add subdirectories under various, often
conflicting, scenarios. Instead the targets would always be available
and we would just choose which ones to actually build in different cases
using CMake target linking.
2021-09-15 11:38:30 +01:00
Lingkai Dong 6bb23815c5 SFDP: Add support for multiple configurations and sector maps
A Sector Map Parameter Table contains a sequence of the following
descriptors:
* (Optional) configuration detection command descriptors, one for
each command to run to determine the current configuration. This
exists only if the flash layout is configurable.
* Sector map descriptors, one for each possible configuration. On
a flash device with a non-configurable layout, there is only one
such descriptor.

Previously we only supported the non-configurable case with a single
descriptor. This commit adds support for multiple configurations.
2021-09-10 11:40:01 +01:00
Lingkai Dong f88bf828ab QSPIFBlockDevice: Add unit test for the S25FS512S quirk
Add a test case to verify that the quirk on `CR1NV` and `CR3NV`
registers get applied by `QSPIFBlockDevice` when the flash device
is S25FS512S.

`QSPIFBlockDevice` depends on the SFDP functions and the `QSPI` class,
but we can't use gMock on them because:
* SFDP functions are global functions, whereas gMock only supports
mocking class member functions.
* A mocked class is injected into the test subject, but passing a
preexisting `QSPI` instance into `QSPIFBlockDevice` is not possible
(unless we resort to pointers). For details, see comments in
test_QSPIFBlockDevice.cpp.

So fakes of the `QSPI` class and any SFDP functions involved are
defined in test_QSPIFBlockDevice.cpp.
2021-09-10 11:33:34 +01:00
Lingkai Dong 23a79ef459 QSPIFBlockDevice: Add quirk to ignore overlaying sectors on S25FS512S
The entire flash chip S25FS512S consists of uniform 256KB sectors.
Additionally, it has three configurations:
* 0x01: Eight 4KB sectors (32KB in total) overlaying the start of
the first 256KB sector
* 0x03: Eight 4KB sectors (32KB in total) overlaying the end of the
last 256KB sector
* 0x05: No overlaying sectors

The active configuration is determined from bit fields of two
registers, CR1NV and CR3NV.

Mbed OS does not currently support partially overlaying sectors,
meaning that with eight 4KB sectors overlay a 256KB sectors, the
remaining 224KB (== 256KB - 8 * 4KB) of the big sector can't be
correctly handled. Supporting such scenario would involve a large
amount of rewriting in Mbed OS's BlockDevice, SFDP and their tests,
and may increase the code size.

So, this commit applies a quirk to always report configuration 0x05
(no overlaying sectors). Even if 0x01 or 0x03 is the real configuration,
they are compatible with the 0x05 configuration because 256KB sectors
exist in all cases.

Note: This quirk does *not* change actual configurations on hardware,
because registers CR1NV and CR3NV are one-time configurable (OTP) -
each bit field has a factory value of 0 and can be changed to 1 by the
user but not back to 0. So QSPIFBlockDevice avoids changing them.
2021-09-10 10:49:37 +01:00
Lingkai Dong 6032671b41 QSPIFBlockDevice: Add quirk for inconsistent CR3NV register value
Cypress S25FS512S's SFDP table suggests that bit-1 of the register
CR3NV on 25FS512S should equal 1. But it is a known issue that the
value is actually 0 on hardware. So if we query the value of CR3NV
during configuration detection, we can't find a configuration that
matches the SFDP data. This issue has been discussed in the Linux MTD
(Memory Technology Devices) mailing list:
https://linux-mtd.infradead.narkive.com/ylHK6CyT/spi-nor-fs512s-incorrect-cr3nv-1-value

This commit adds a quirk to report bit-1 of CR3NV as 1.

Note: In Mbed OS, vendor-specific quirks can only be handled in block
devices. The SFDP functions assume data from hardware to be correct.
So this quirk is in the block device.
2021-09-10 10:49:37 +01:00
Lingkai Dong 8dfad16f5d QSPIFBlockDevice: Use fully-qualified include path
In Mbed OS, each library has an `include/<library>/` subdirectory
containing headers. The recommended way to include a header is
`#include "<library>/<header>.h"` to avoid potential conflicts with
any external modules that have same names of headers.

This is not enforced yet, and both include/ and include/<component>/
are in a library's include paths, to avoid breaking preexisting
Mbed projects that don't follow the recommendation. But code within
Mbed OS should follow it at least.
2021-09-10 10:15:22 +01:00
Lingkai Dong 0cb62c4944 SFDP: unit tests: Fix Configuration ID in fake test data
The second byte of the sector map descriptor is the configuration ID.
On a device with non-configurable layout, the only available map
descriptor's configuration ID must be 0x00 as required by the
JESD216D standard. This value is important, because we will check
each descriptor's configuration ID when we support multiple
configurations.

Note: The test data is fake - when we modified real data of a
configurable device to become non-configurable for test purpose, we
forgot to change this field.
2021-09-10 09:46:02 +01:00
Lingkai Dong 50183d2ee4 SFDP: unit tests: Move unshared test data into case
Some test data in test_sfdp.cpp is used by one test case only, so
we turn it into a local variable.
2021-09-10 09:46:02 +01:00
Lingkai Dong b5e7dd9d32 SFDP: Add more parameters to the reader callback
The SFDP functions parse SFDP data which is fetched by a callback
called `sfdp_reader` provided by {SPIF,QSPIF,OSPIF}BlockDevice.
Currently, this callback interface only takes a read address and an RX
buffer to store output data. This has been enough, because other SPI
parameters are always the same when fetching the SFDP table only -
they are just hardcoded in each reader.

But in the future we will add support for flash devices with multiple
configurations (in a subsequent commit), and to detect which
configuration is enabled, we will need to send detection commands
which require device-dependent SPI parameters:
* address size
* instruction
* dummy cycles

This commit
* turns the above SPI parameters from predefined/hardcoded values
into parameters of the callback
* lets the SFDP functions pass the above parameters to the callback
(Note: To read the SFDP table itself, those values are constants
defined by the standard, not tied to any particular device, so they
can be known to the SFDP functions)
* updates the callbacks implemented by {SPIF,QSPIF,OSPIF}BlockDevice
* updates the mock callback for unit tests and expectations
2021-09-10 09:46:02 +01:00
Lingkai Dong 2581254492 SFDP: Fix sector map table allocation check
When passing an allocation size directly to `std::make_unique`,
`std::nothrow` is unavailable, so any failed allocation results in
an exception which we cannot catch because Mbed OS is compiled with
`-fno-exceptions`. To fix this, chain `std::make_unique` with
`new (std::nothrow)`, and the allocated `unique_ptr` retains the
`nullptr` property.
2021-09-10 09:45:11 +01:00
Lingkai Dong 0b868d5a1a General block device test: Fix thread stack allocation
The test case for multithreaded erase/program/read allocates a few
Thread objects from the heap and starts them. It has a few problems:

* To check that there will be enough heap to start a new thread, the
test case tries to allocate a dummy buffer of the thread's heap size
and then frees it, before starting the thread. Then the thread will
allocate its own stack. Such check is not reliable, because threads
that are already running also perform additional allocation (when
running `test_thread_job()`) and may take away the memory we just
checked.
* When deleting all threads in a loop, the loop boundary misses the
last thread if the last thread object was allocated but not started
(i.e. due to failed thread stack allocation check).

To fix the issues
* Start a thread without any allocation test. Following the preceding
commit "rtos: Thread: Make stack allocation failure runtime catchable",
`Thread::start()` now returns `osErrorNoMemory` if stack allocation
fails which we can handle.
* Store pointers to all threads in a zero-initialized array, and
free all elements at the end of the test.
2021-09-08 14:18:21 +01:00
Robert Walton 7842320ab7 CMake: Add option to enable greentea tests
Add an option to enable the greentea tests independently from the unit
tests.

We can't just use the typical BUILD_TESTING option to enable greentea
tests. BUILD_TESTING enables unit tests and fetches googletest, which
are compiled for the host. Greentea tests are cross compiled and require
a toolchain file. For this reason we add a new option just to enable
greentea tests, preventing build failures triggered by the unit tests
and googletest.
2021-08-10 16:35:11 +01:00
Lingkai Dong a16c2bf173 SFDP: Add unit tests for Sector Map Parameter Table parsing
Add tests for `sfdp_parse_sector_map_table()` which currently (at the
time of this commit) supports flash devices with
* no Sector Map Parameter Table (i.e. the whole flash is uniform and
non-configurable)
* a single descriptor in the Sector Map Parameter Table (i.e. the
flash layout is non-configurable and has multiple regions)

Support and unit tests for flashes with multiple configurable layouts
will be added in the future.

Note: The implementation of `sfdp_parse_sector_map_table()` assumes
the table to be valid if read succeeds, so the SFDP reader callback
needs to ensure it reads data correctly or return an error.
2021-08-06 15:27:28 +01:00
Lingkai Dong f08c3cdfb5 SFDP: TestEraseTypeAlgorithm: Move setup into test case
The test data `struct mbed::sfdp_smptbl_info smptbl` is only relevant
to `TestEraseTypeAlgorithm` and not shared with other test cases.
2021-08-06 14:30:16 +01:00
Lingkai Dong 651099225e SFDP: Set region count to 1 for no sector map
A flash device with no sector map table has uniform sectors, and we
treat the whole flash as one region. In this case the function
`sfdp_parse_sector_map_table()` sets the single region's size and high
boundary accordingly, but it lacks setting of region count to 1, so
users of the SFDP parser may not get the correct number of regions.
This commit fixes the issue.
2021-08-06 14:30:16 +01:00
Lingkai Dong 68694255b5 SFDP: Move handling of no sector map into `if`
When a flash chip's SFDP table has no sector map, we treat the whole
flash as a single region. As an optimization, this should only be
done if there is indeed no sector map.
2021-08-04 14:03:24 +01:00
Lingkai Dong dca2aa79a0 Unit tests: Remove redundant CMake target mbed-headers-base
Individual libraries' `target_h` stub headers have now all been moved
from `mbed-headers-base` to `mbed-headers-<library>`.

Note: Even though headers previously in `target_h` are technically
stubs/fakes too, they are used by not only unit tests but also regular
libraries when compiled for unit tests, because no target-specific HAL
implementation exists in this case. In order for regular library
sources to pick up `target_h` headers, those headers must

* have the same names as regular headers
* appear first in include paths

This is why those headers are part of `mbed-headers-<library>` and not
`mbed-stubs-<library>`. Before this refactoring, `mbed-headers-base`
was the first in unit tests' include paths.
2021-08-02 17:42:43 +01:00
Martin Kojtal 334be7bbf2
Merge pull request #14911 from DDC-NDRS/fatfs_0.14b
FatFs: upgrade to R0.14b
2021-07-30 11:46:42 +01:00
Robert Walton b0c0fc9f66 unittests: Reduce runtime of TDBStoreModuleTest.corrupted_set_deinit_init_get
Instead of performing 10,000 "set, deinit, get" operations, let's just
perform 100. This reduces test time from 4.8s to 0.02s.
2021-07-27 21:09:39 +01:00
Robert Walton a09d08917b CMake: unittests: Show all tests in CTest report
Previously a test executable was recognised as a single test by CTest.
However, test executables usually contain multiple test cases, the
results of the test cases should be individually reported. With our
previous setup we could miss test case failures that didn't cause the
executable to return an error code.

This commit uses gtest_discover_test to discover all test cases in a
test executable. This enables CTest to match test passes and failures
from the googletest binary output.
2021-07-27 21:09:39 +01:00
Robert Walton 1e48a61d89 CMake: unittests: Remove trailing whitespace 2021-07-27 21:09:38 +01:00
Martin Kojtal 6827b4275b
Merge pull request #14397 from macronix/macronix_spi_NAND
add SPI NAND Block device driver
2021-07-26 15:24:47 +02:00
ndrs-pst 369ae208ad FATFS: FATFileSystem.cpp migration, according to FatFs version upgrade from R0.13a to R0.14b 2021-07-21 19:39:26 +07:00
Martin Kojtal 11439bf264
Merge pull request #14909 from DDC-NDRS/ndrs-pst
SPIF: fixed _address_size to always initialize as 3_BYTES in ::init()
2021-07-20 09:55:08 +02:00
ndrs-pst 8394988354 SPIF: Moving _address_size = SPIF_ADDR_SIZE_3_BYTES from constructors into ::init() instead 2021-07-19 17:30:00 +07:00
ndrs-pst 9e5f21be16 Update FatFs from R0.13a to R0.14b by manual migration Mbed-OS modification in R0.13a to R0.14b
Since a lot of fixed from upstream (0.13b, 0.13c, 0.14, 0.14a and 0.14b)
@see http://elm-chan.org/fsw/ff/updates.txt
2021-07-10 23:39:31 +07:00
Jaeden Amero b490c67241
Merge pull request #14882 from LDong-Arm/storage_tests_cleanup
Unit tests: storage: Only use headers, sources and definitions needed by each test
2021-07-07 16:12:10 +01:00
Jaeden Amero dc6dd17bb0
Merge pull request #14884 from LDong-Arm/rm_UNITTEST_macro
Remove the `UNITTEST` macro from production code
2021-07-07 15:20:31 +01:00