Commit Graph

107 Commits (8624fdf0a75dad0b1310606df72cb95c97c00adf)

Author SHA1 Message Date
Senthil Ramakrishnan 7490b1c87f Api tests modification and uLib related fixes 2019-02-28 11:55:21 -06:00
deepikabhavnani 387e4ca9f4 New heap can be equal to heap limit for last chunk 2019-02-21 17:20:49 -06:00
deepikabhavnani 1a1c74c38b mbed_rtx.h not to include in platform 2019-02-19 15:49:49 -06:00
Deepika f13a3e32b6 Fix GCC _sbrk allocation 2019-02-19 15:49:49 -06:00
deepikabhavnani b36147fbe9 ISR_Stack_start/size defines are not needed, use linker file defines 2019-02-19 15:49:49 -06:00
deepikabhavnani 9d1ce66b14 ISR_STACK_START/ HEAP_START defines not used by GCC_ARM toolchain 2019-02-19 15:49:49 -06:00
Deepika 537b3646d3 Resolve build/type cast errors 2019-02-19 15:49:49 -06:00
Deepika 41eaefeeb4 Update memory model for stack and heap memory
Memory model for RTOS and No RTOS was initially single stack and heap,
only few targets implemented 2-region RAM model.

2-region RAM model is applied for all toolchains and targets.

GCC: __wrap__sbrk was implemented for 2-region ram model, with switch to 2-region
for all targets, we do not need target specific implementation of this API
Also _sbrk is WEAK function, hence can be over written in target folder for
special cases
2019-02-19 15:49:45 -06:00
Przemyslaw Stekiel 9c11288eb1 mbed_retarget.cpp: Fixed style 2019-02-19 15:46:32 -06:00
Przemyslaw Stekiel a3223275c2 Use 2-region memory model in ARM rtos-less builds.
The following commits: #8039, #9092 added Boot/ISR stack definition to all scatter files (ARM_LIB_STACK).

This has changed memory model for RTOS-less builds to 2-region memory model and caused failure in case of rtos less builds.
This PR defines valid heap/stack regions for rtos-less builds.
2019-02-19 15:46:21 -06:00
Michael Schwarcz 1db4e4634f mbed_retarget changes
- Avoid compiling user_setup_stackheap for TF-M secure targets
- Align sbrk for TF-M
2019-02-19 15:19:04 +02:00
deepikabhavnani 818d38b6ae Only GCC_ARM toolchain is supported, removing legacy code 2019-02-13 16:26:22 -06:00
Kevin Bracey 6e3c492cd8 mbed_retarget.cpp: Combine ARMC5 and ARMC6 tests
A couple of places in mbed_retarget.cpp were testing for either ARMC5 or
ARMC6 in a long-winded fashion. Testing for __ARMCC_VERSION being
defined is sufficient.
2019-01-29 17:49:19 +02:00
Kevin Bracey c55329157a Use atomics in __cxa_guard functions
Similar to SingletonPtr, use atomic accesses when loading the guard word
outside the lock, and when storing, to ensure no races for threads that
don't take the lock.

Lack of atomics unlikely to be a problem in current builds, but code
could conceivably be subject to reordering if link-time optimisation was
enabled.
2019-01-29 17:49:18 +02:00
Kevin Bracey ae17f6ebba Add FileHandle::truncate and ftruncate
Add support for file truncation (or extension) to the abstract API.

No hooks to actual implementations in this commit.
2018-12-14 19:29:28 +02:00
Martin Kojtal ad759b7749 platform: add spdx license 2018-11-28 10:39:52 +00:00
kegilbert a2ac895c37 This reverts commit 9b53d1256fb358407acbaf81c70b71d937b1f7cd.i
Move the memory tracing enabled macro to a config option but
revert the !defined -> #if changes to no longer cause breaking
changes.
2018-10-26 17:35:33 -05:00
Kevin Bracey d05c60ee3f Sync output devices on exit
Mbed retarget does an `fflush` on stdout and stderr on exit - this
flushes the C library buffers (if it is buffering), but doesn't
flush any device buffers (eg UARTSerial's TX buffer). Add
sync() calls to the output device to do this.
2018-10-17 12:55:20 +03:00
Deepika f79a354311 Replace fflush to fseek before writes
You are allowed in POSIX / ANSI C to read and write on the same stream, but you
have to do an fseek in between read and write call (getc->fseek->putc)

Thanks @Alex-EEE for sharing the fix: https://github.com/ARMmbed/mbed-os/pull/7749

Added test case for verification of the behavior
2018-10-05 14:29:15 -05:00
kegilbert 9b53d1256f Replace mbed_mem_tracing_enabled macro with config option 2018-08-06 13:44:12 -05:00
ccli8 313f322cf7 [Nuvoton] Replace __wrap__sbrk with overriding _sbrk
With _sbrk being weak, we can override it directly rather than #if to support heap with
two-region model.
2018-07-26 15:47:25 +08:00
Martin Kojtal ffcb6ecfb5 platform: astyle update 2018-06-29 10:38:44 +01:00
ccli8 0597998d91 Fix compile error with MBED_MEM_TRACING_ENABLED and ARMC6 2018-06-05 17:34:28 +08:00
Senthil Ramakrishnan 5ef6728c08 Splitting MBED_ERROR macros to support ones with/without error value argument 2018-05-23 12:21:28 -05:00
Senthil Ramakrishnan d4fe75731d Adding mbed prefixes to all macros and functions to avoid namespace conflicts 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan 147d9cac4e Test application/cases optimization for some low memory targets, macro changes and test fixes 2018-05-23 12:21:10 -05:00
Senthil Ramakrishnan 2e28dd95e1 Change set_error/set_error_fatal to warning/error, add itm support and other changes 2018-05-23 12:21:08 -05:00
Senthil Ramakrishnan 9041b475c6 Error handling/logging implementation and tests 2018-05-23 12:21:07 -05:00
Cruz Monrreal a301db5d43
Merge pull request #6791 from kjbracey-arm/fcntl
Add POSIX fcntl flag support
2018-05-21 17:17:02 -05:00
Cruz Monrreal 39fd120064
Merge pull request #6797 from OpenNuvoton/nuvoton_fix_noserial
Fix compile error with DirectSerial in serial-less build
2018-05-07 10:27:27 -05:00
Kevin Bracey cf91b1c6d7 Add POSIX fcntl to control blocking
Add the POSIX fcntl call, but only implementing F_SETFL and F_GETFL
for O_NONBLOCK, so users can control the blocking flag of streams
with only the integer file descriptor.

Necessary to portably control the blockingness of the console:

    int flags = fcntl(STDOUT_FILENO, F_GETFL);
    fcntl(STDOUT_FILENO, F_SETFL, flags | O_NONBLOCK);
2018-05-03 15:40:26 +03:00
Kevin Bracey a8ab233a1a retarget: distinguish FileHandle and descriptor
Avoid using `fh` for the integer descriptor numbers, reserving
that for the `FileHandle` objects - use `fildes` or `fd`,
matching POSIX.
2018-05-03 15:40:26 +03:00
ccli8 bfe9ee7777 Fix compile error with DirectSerial in serial-less build 2018-05-03 10:52:09 +08:00
ccli8 89622378d8 Fix compile error with MBED_MEM_TRACING_ENABLED and ARMC6 2018-04-27 14:19:12 +08:00
Marcus Chang 7e6538ffed Optional hardware flow control for STDOUT
Some platforms have interface chips with hardware flow control
enabled by default. This commit adds configurable flow control to
STDOUT.

Usage:

* Define pin names STDIO_UART_RTS for Rx-flow-control and
  STDIO_UART_CTS for Tx-flow-control.
* Set target.console-uart-flow-control. Valid options are:
  null, RTS, CTS, and RTSCTS.
2018-04-15 20:12:14 -07:00
adustm 0efc876bb4 Call to specific _wrap_sbrk to support 2 region model for heap and stack 2018-02-22 17:36:20 +01:00
Jimmy Brisson 7b5d48df38
Merge pull request #5571 from kjbracey-arm/retarget_fh
Complete mbed_retarget FileHandle rework
2018-02-07 17:21:09 -06:00
Kevin Bracey f79bfddcad Make stdin/stdout/stderr be FileHandles
Rework so that everything is a FileHandle, including
stdin/stdout/stderr.

Provide legacy functionality of calling serial_getc and serial_putc as
an internal "DirectSerial" FileHandle.

Add a JSON option to use UARTSerial instead.

Add hooks for target and application to provide custom FileHandles.

Allow for CRLF conversion to work on any FileHandle that isatty(),
as stdin/stdout or any other FILE. Optimise the conversion so it
doesn't force all write calls to be 1 byte. Limit the conversion
to the stdio layer, so that read() and write() work the same as
the FileHandle methods - this seems less confusing.
2018-02-06 11:07:23 +02:00
Kevin Bracey 96c709fb35 Rework retarget opening
Rationalise layers a little more to add the POSIX standard fdopen(int)
and a local open(FileHandle) to map a FileHandle to a POSIX file
descriptor.

fdopen(FileHandle) is now a composite of those two, rather than being
a primitive.
2018-02-06 11:07:21 +02:00
Brendan McDonnell a47bf4595f make _sbrk() WEAK so the user can override it, e.g. to make malloc() always use external memory 2018-02-01 11:14:07 -05:00
Kevin Bracey b5ac071b66 Add space for real stdin/out FileHandles
Index the FileHandle array from 0 - now if filehandle[0..2] is
NULL, it uses the built-in serial for stdin/stdout/stderr,
else it will use a FileHandle.

No mechanism to actually put a FileHandle in that position yet.
2018-01-29 15:29:02 +02:00
Kevin Bracey f391d8a0dc Add POSIX file functions
Fill in a gap by providing the POSIX file functions corresponding
to the FileHandle API, so FileHandles can be used from C without
going through the C library stdio layer.

This aligns with the fact we already provide POSIX directory
functions.

Fix EOF handling for ARM C Library _sys_read.
2018-01-29 15:29:02 +02:00
Martin Kojtal 280d491ff2
Merge pull request #5456 from TeroJaasko/fix_cpp_alloc_wrappers
platform: make C++ allocation wrappers log the correct caller address
2018-01-15 15:29:54 +00:00
Cruz Monrreal c0c501c70f
Merge pull request #5768 from deepikabhavnani/storage_stats
Added statvfs API to get storage statistics
2018-01-11 10:25:41 -06:00
Tero Jääskö b81be1e34c platform: Fix C++ allocation wrappers for GCC compilation
Fix the caller address logging on the GCC compilation too.
Previously the code logged the caller address as C++ wrapper,
not the actual caller of the C++ operator new or delete.
2018-01-08 16:09:39 +02:00
Tero Jääskö 1cf5c45615 platform: make C++ allocation wrappers log the correct caller address
The C++ "operator new" and "operator delete" (and their array
variants) were logging the the caller address wrong. In practice
if one used "operator new", the logged caller address pointed
to mbed_retarget.cpp, not to the client. Fix this by exposing
the alloc wrappers to the the retarget.

Note: this fixes only the ARMCC variants, as the GCC ones have
different different API and implementation.
2018-01-08 16:09:32 +02:00
Deepika 7a90be0ce1 Added statvfs API to get storage statistics
The API is as per posix standard, but does not provide stats for file/directory.
Stats buffer (block size, total block count, free block count) is filled for
entire mounted filesystem.
2017-12-29 16:42:31 -06:00
Deepika 5bc33b94f8 Access to serial device is allowed when DEVICE_SERIAL is defined 2017-12-20 09:59:06 -06:00
Russ Butler c63a627868 Protect local static object construction in ARMCC
Implement the functions __cxa_guard_acquire, __cxa_guard_release
and __cxa_guard_abort for ARMCC so local static object construction is
thread safe.
2017-12-01 11:14:58 -06:00
Kevin Bracey ff6bc08c53 Remove pointless null check in operator delete
free() checks for NULL, no need to add another check.
2017-11-24 10:40:15 +02:00