Calling close() with negative numbers causes out-of-bounds indexing of the filehandles array. For example, this can happen if open() returns an error and the value is later passed to close().
Full verbosity is adding a console line for each lock/unlock API call
- stats can be enabled with json config
- default configuration is full verbosity and add a console line for each lock/unlock command
- for STM32 targets, verbosity is reduced by default
When decimal_prec is 0 and the value is negative and needs rounding subtract 1, instead of adding 1
When decimal_prec > 0 round before printing the integer part, instead of after
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.
ARMCC provides __semihost via compat header. As CMSIS 5.8.0 removed this compat header,
we need to explicitly include it to fix definition missing error.
Reference: CMSIS 5.8.0 known issues and https://github.com/ARM-software/CMSIS_5/issues/1211
This fixes the error about redefinition of enable/disable irq. we need compat header because of
semihosting (not yet provided in CMSIS).
ARM Compiler 6 supports GNU-style assembly with armclang. Instead of
relying on armasm with the legacy syntax, GCC except.S is updated so
that it can be used with ARM as well as GCC_ARM toolchains. CMake is
updated to use this version.
We used to require INITIAL_SP as rtx target headers define it. This should not be required, as
cmsis already defines symbol __INITIAL_SP for all toolchains.
Fixes#14432
mbed-os consists of mbed-core and mbed-rtos
mbed-baremetal consists of mbed-core
The main change is for mbed-core. Changing from object library to be interface. This way it allows us to do the above to have 2 main targets for users to use.
This should be backward compatible change as mbed-os target we used contains the same files/options as previously set.
Aside from the core mbed-os CMake target, a number of targets have been created so they can optionally be included by application executables that require them using `target_link_libraries()`.
Co-authored-by: Martin Kojtal <martin.kojtal@arm.com>
Co-authored-by: Rajkumar Kanagaraj <rajkumar.kanagaraj@arm.com>
Remove the static allocation for the dirent, and allocate it from the
heap during opendir().
Removing the static data can reduce RAM usage on some toolchains when
directories are not being used. The static allocation sometimes is
combined with the file handle array and can't be dropped by the linker.
Original readdir() was not thread-safe at all.
This was in violation of POSIX which states the result of readdir "is
not overwritten by another call to readdir() on a different directory
stream."
POSIX also defines readdir_r() as separate totally reentrant form where
the caller allocates the dirent, but this is generally deprecated as it
opens the door for an inadequate allocation causing a stack smash. Full
reentrancy is not typically necessary - having readdir()'s buffer data
be per-DIR is generally sufficient.
If we take platform as a component, platform/source would be outside of this component.
I removed the prefix as these are implementation specific (they are located in source folder,
not in include as the others).
Fixes two errors produced on except.S by the IAR assembler (as seen in
issue #13200).
The first: "'ALIGN' is illegal. Use directive ALIGNROM or ALIGNRAM (the
first parameter is raised to the power of 2, the second is a 32-bit fill
value)."
Fixed by changing ALIGN to ALIGNROM 2 to align to a 4-byte boundary
(mirroring what ALIGN does in the ARM except.S).
The second (on THUMB): "Must be placed inside a section"
Fixed by moving THUMB after the SECTION directive so that it affects
that section.