- move a code that waits readable SPI state from `spi_master_write`
function to inline functions `msp_writable` and `msp_wait_writable`
- move a code that waits writeable SPI state from `spi_master_write`
function to inline functions `msp_readable` and `msp_wait_readable`
- move a code that writes data to SPI from `spi_master_write`
function to inline function `msp_write_data`
- move a code that reads data from SPI from `spi_master_write`
function to inline function `msp_read_data`
This reverts commit 6649e95106.
In the malloc test, `ALLOC_ARRAY_SIZE` defines the *capacity* of array
that stores pointers to `malloc`'d buffers. It is *not* the number
of allocations.
In an ideal scenario, the test makes as many allocations as possible
until the heap runs out and malloc() returns NULL. So revert the
capacity of the array of pointers from 50 back to 100 so this array
is less likely to run out before the heap does.
The commit 84d0689 "Nano-malloc: Fix for unwanted external heap
fragmentation" from newlib 4.1.0 introduced several optimizations,
one of which is as follows:
When the last chunk in the free list is smaller than requested,
nano_malloc() calls sbrk(0) to see if the heap's current head is
adjacent to this chunk, and if so it asks sbrk() to allocate the
difference in bytes only and expands the current chunk.
This doesn't work if the heap consists of non-contiguous regions.
sbrk(0) returns the the current region's head if the region has any
remaining capacity. But if this capacity is not enough for the second
(non-trivial) call to sbrk() described above, allocation will happen
from the next region if available. Expanding the current chunk won't
work and will result in a segmentation fault.
So this optimization needs to be reverted in order to bring back
compatibility with non-contiguous heaps. Before the next version
of newlib becomes available and gets updated in the GCC Arm Embedded
Toolchain, we work around this issue by including the fix in Mbed OS.
The linker prioritizes malloc() from the project to the one from the
toolchain.
We put macros in a response file compile_time_defs.txt and pass it
to the compiler. Adding a pair of single quotes around each -D flag
ensures macro values are quoted correctly.
For example,
* String
* target_compile_definitions(): either FOO="BAR" or FOO=\"BAR\"
* response file: '-DFOO="BAR"'
* actual definition: #define FOO "BAR"
* Array of integers
* target_compile_definitions(): FOO={1, 2, 3}
* response file: '-DFOO={1, 2, 3}'
* actual definition: #define FOO {1, 2, 3}
The C/C++ macro `TARGET_NAME` allows code to print the current
target's name, e.g. in error reporting when a fault happens. This
macro is exported by Mbed CLI 1 and used by mbed_error.c, so for
compatibility we let CMake set the same name of macro.
FixesARMmbed/mbed-tools#313
This commit enables the Overriding of HAL callbacks and IRQHandler
in stm32xx_emac.cpp. Hence the user can have their own
implementations of callbacks and IRQHandler functions.
Signed-off-by: Kather Rafi Ibrahim <katherrafi.i@hcl.com>
Initially, every library greentea test has its project() creation in
their CMake. As running greentea using CTest move all greentea test
suite under one global project mbed-os and MBED_CONFIG_PATH set at
the root mbed os CMake under the condition BUILD_GREENTEA_TESTS
check so refactored rtos greentea CMake accordingly.
Initially, every library greentea test has its project() creation in
their CMake. As running greentea using CTest move all greentea test
suite under one global project mbed-os and MBED_CONFIG_PATH set at
the root mbed os CMake under the condition BUILD_GREENTEA_TESTS
check so refactored platform greentea CMake accordingly.
mbed-cli1 does not pass -I to IAR for iarasm (comparing to other toolchains). Because old tools are frozen,
we implement this workaround for fixing the build.
We use preprocessor macros that are passed to .S files anyway, so we do not loose anything but we do diverge again from CMSIS, for now..
Upgrade to the current latest version of GNU Arm Embedded,
gcc-arm-none-eabi-10.3-2021.07. This brings along fixes to v8-M targets
and better Cortex-M55 support.
In pursuit of increasing unit test coverage of Mbed OS, we add the
boilerplate code for unit testing of AnalogIn.cpp and an empty test
source file. This serves two purposes - it allows us to report on
currently untested sources in code coverage data, and it makes it a
little easier for developers to write unit tests for these sources.
The 'empty' test file contains a main function that simply returns. This
is required to allow CMake's add_executable() to be used to pull in the
source file for the SUT, which ensures that this source file is built
and therefore instrumented to generate coverage data. The alternative
that was explored was to instead use Google Test's TEST() macro and
prefix the test name with 'DISABLED_' to skip it, but that resulted in
the test being reported as skipped, which was deemed undesireable for
these 'empty' tests.
Currently there are no stub implementations of the analogin_api.c
functions. As the AnalogIn class makes use of these functions, these
stub definitions are required in order to build AnalogIn.cpp and
generate .gcno files to be used to generate code coverage metrics.