Commit Graph

195 Commits (126d767a59799ce12ca647d87d6019917f13e4c2)

Author SHA1 Message Date
alrvid 56ca532ef1
Moved a { to the same line as if
Moved a { to the same line as if
2023-06-15 15:38:55 +02:00
alrvid 7e206a90db
Handle negative values passed to close()
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().
2023-06-14 23:29:38 +02:00
Casper Meijn 904f867bdc semihosting: Fix typo in semihost_rename
Fix typo in semihost_rename. Now it actually sends the `new_name` as well as the `old_name`.
2022-04-26 07:24:27 +02:00
Martin Kojtal d4c6b37cad
Merge pull request #14610 from jeromecoutant/DEV_SLEEP_TRACE
Power management stat : add verbosity level for MBED_SLEEP_TRACING_ENABLED
2021-11-08 15:11:18 +00:00
jeromecoutant 658e9ae972 Power management stat : add verbosity level for MBED_SLEEP_TRACING_ENABLED
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
2021-11-08 09:46:06 +01:00
sytse 43f0c14c9a Code style violation corrected 2021-10-29 13:45:32 +02:00
sytse b99584d16d Fixed floating point formatting
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
2021-10-29 13:40:29 +02:00
Lingkai Dong 8d32b668ec Workaround for a bug in malloc() from newlib-nano 4.1.0
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.
2021-09-01 17:21:32 +01:00
Martin Kojtal 38ca4bdce4 semihosting: add compat header where is required
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.
2021-07-29 14:31:38 +01:00
Martin Kojtal 8bdec2b4db retarget: move compat header for ARMClang prior any cmsis headers
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).
2021-07-29 14:31:33 +01:00
Jaeden Amero b5c2f7079e
Merge pull request #14718 from Meano/develop
Feature: Make changes for Cortex-A5 support
2021-07-01 10:23:41 +01:00
Tymoteusz Bloch f1663e794a Disable override errno erro value
Disable setting own values of flags for fcntl() function if they are defined
2021-06-25 17:12:55 +02:00
Meano ff2188150a Make changes for Cortex-A5 support 2021-06-23 13:36:55 +08:00
Meano 6feca90589 Unify the __CORTEX_A macro in the files containing cmsis.h 2021-06-23 13:36:52 +08:00
Tymoteusz Bloch bdb0a22dec Fcntl setting Non Blocking operations improvement 2021-06-09 15:36:24 +02:00
Werner Lewis 046fa78319 Update GCC except.S to support ARMC6
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.
2021-05-24 13:54:57 +01:00
Martin Kojtal 3003a171b2 fixup! error: use __INITIAL_SP from cmsis instead of RTX one 2021-05-10 16:09:18 +01:00
Martin Kojtal f6176432d2 error: use __INITIAL_SP from cmsis instead of RTX one
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
2021-05-05 13:15:10 +01:00
George Psimenos d239ef98cd Rename USBTX/RX to CONSOLE_TX/RX 2021-03-18 17:01:54 +00:00
jeromecoutant a4350f72bd [STD-PIN] BUTTON and LED define
hal/tests/TESTS/mbed_hal/gpio/main.cpp is replaced by
hal/tests/TESTS/pin_names/generic/main.cpp now
2021-03-18 17:01:50 +00:00
jeromecoutant a6c213bb10 [STD-PIN] Replace STDIO_UART_TX by USBTX 2021-03-18 17:01:50 +00:00
Lingkai Dong 4450464fc8 Add integer overflow check to the malloc wrappers
Add a check that the combined size of the buffer to allocate and
alloc_info_t does not exceed the maximum integer value representable
by size_t.
2021-03-10 09:47:15 +00:00
Martin Kojtal 85c2d7a25c CMake: remove IAR references as they are not supported 2021-02-17 09:19:03 +00:00
Martin Kojtal 09dd4d2582 CMake platform: remove IAR related CMakeLists
Not supported
2021-02-17 09:15:50 +00:00
caodd 9a7b2a8647 Fix minimal-printf floating point decimal output error 2021-01-20 20:54:34 +08:00
Martin Kojtal c06fcaf5c5
Merge pull request #13548 from evva-sfw/enhance-minimal-printf
Add width modifier and prepending zeros for hexadecimal output and decimal precision for floating point
2020-12-10 09:14:59 +00:00
Oliver Wildtgrube 03cf6214c3 Add width modifier and prepending zeros for integer, hexadecimal and floating point output as well as decimal precision for floating point 2020-12-08 21:07:54 +01:00
Martin Kojtal 124afe79bb
Merge pull request #13755 from AGlass0fMilk/fix-init-os-timer
Fix MBED_ERROR call in init_os_timer
2020-11-24 13:38:46 +00:00
Martin Kojtal 57bbb4739b
Merge pull request #13085 from pea-pod/remove-deprecated-mbed-assert
Change MBED_STATIC_ASSERTs version for built-in
2020-11-24 13:38:07 +00:00
George Beckstein 7571982606 Fix MBED_ERROR call in init_os_timer 2020-11-19 12:35:34 -05:00
Martin Kojtal 3555ada459
Merge pull request #13867 from marcemmers/fix-systimer-overflow
SysTimer: Prevent unacknowledged tick overflow when halted for a while
2020-11-11 08:55:24 +00:00
Hugues Kamba 794e32df74 CMake: Use relative paths to list source files and directories
The absolute path is still required for listing linker
files as they are referenced from a function in the top
level CMake input source file.
2020-11-09 12:32:30 +00:00
Rajkumar Kanagaraj e7c0d93ad4 CMake: add mbed-os and mbed-baremetal targets
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.
2020-11-06 17:25:22 +00:00
Hugues Kamba bf84a5b329 CMake: Rename CMake targets
* mbed-os renamed mbed-core
* mbed-os-<COMPONENT> renamed mbed-<COMPONENT>
2020-11-06 17:25:22 +00:00
Hugues Kamba fa98689639 CMake: Componentize Mbed OS into multiple CMake targets (#13732)
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>
2020-11-06 17:25:21 +00:00
Hugues Kamba 1b576c3046 CMake: Clean up platform 2020-11-06 17:25:20 +00:00
Hugues Kamba a0fbe2947a CMake: Fix build failure due to CMSIS restructure 2020-11-06 17:25:20 +00:00
Hugues Kamba 929adbe936 CMake: Add support for platform dir 2020-11-06 17:25:15 +00:00
Marc Emmers 8b7e7ee8f6 Make _unacknowledged_ticks uint32_t to prevent overflow 2020-11-05 15:26:44 +01:00
pea-pod 507181d262 Change MBED_STATIC_ASSERTs version for built-in 2020-10-27 08:30:40 -05:00
Kevin Bracey 5ab6f1cef6 Make readdir reentrant
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.
2020-09-04 16:58:23 +03:00
Martin Kojtal 4a68b8af89
Merge pull request #13486 from rajkan01/fix_malloc_overhead_calculation
Fix heap stats overhead_size calculation
2020-09-03 11:38:41 +01:00
Hugues Kamba 834e530abd CMSIS: Restructure ported CMSIS_5
See docs/adr/0001_cmsis_component_source_structure_recommendations.md
For details information.
2020-09-01 15:55:13 +01:00
Rajkumar Kanagaraj f3c9132637 Incorporated the review comments 2020-09-01 14:46:36 +01:00
Rajkumar Kanagaraj d30ba6ba62 Fix malloc internal overhead size calculation for newlib and newlib-nano 2020-08-24 15:07:36 +01:00
Martin Kojtal 2c18e93979
Update platform/source/mbed_os_timer.cpp
fix the typo

Co-authored-by: Lingkai Dong <lingkai.dong@arm.com>
2020-08-21 14:55:58 +01:00
Martin Kojtal a6ce2c53a0 platform: move internal headers to internal/
They belong to internal folder to follow our guideline, not in source as they were.
2020-08-20 08:58:00 +01:00
Martin Kojtal 8078e20cb4 platform: remove platform/ prefix for source
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).
2020-08-18 15:55:39 +01:00
Matthew Macovsky b7c0e89eb9 Fix IAR assembler errors on except.S
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.
2020-07-29 08:25:41 -07:00
Martin Kojtal 3e42991289
Merge pull request #13046 from hugueskamba/hk_use_chrono
Use std::chrono based functions
2020-06-18 22:16:00 +02:00