Commit Graph

59 Commits (698de3b5ffe6906e9ec53de0ab752859d1d5772e)

Author SHA1 Message Date
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
Jimmy Brisson 4b57c5818e
Merge pull request #5528 from c1728p9/simplify_retarget
Use retarget defines where possible
2017-11-22 10:18:36 -06:00
Jimmy Brisson b6e50f5ed9
Merge pull request #5525 from deepikabhavnani/errno_fix
Fixed: errno update failure with IAR8.x
2017-11-22 10:17:56 -06:00
Russ Butler beb0b20e32 Use retarget defines where possible
Remove the condition code around the defines in mbed_retarget.h so
all toolchains use the defined values. Exclude a small subset of
values for GCC since these are in its standard header files.
2017-11-17 19:40:47 -06:00
Deepika 83409c5af3 Fixed: errno update failure with IAR8.2
errno (part of thread local storage) setting caused hardfault with IAR8.x
versions. TLS is not supported, hence using main thread TLS area for
all threads.
2017-11-17 13:12:39 -06:00
Christopher Haster 400c25466d fs: Corrected errno when not finding a mounted filesystem 2017-10-24 11:52:06 -05:00
Russ Butler 6452821e2e Add default implementation of timer info
Add weak implementations of *_ticker_get_info which returns 1MHz and
a width of 32 bits. This allows the updated Ticker API to work with
existing devices.

Note - in the future when all targets have implemented
*_ticker_get_info these weak functions will be removed.
2017-10-05 11:57:34 -05:00
Jimmy Brisson da138f20d7 Merge pull request #5203 from geky/fix-fstat-newlib
fs: Fix fstat retarget for regular files
2017-10-05 11:13:42 -05:00
Russ Butler 114d60c8ed Remove direct use of us ticker from platform
Update platform code to use the ticker common layer rather than using
HAL us ticker directly. This both ensures that the underlying ticker
is properly initialized and that the value read is in microseconds with
full 32-bit range.
2017-09-29 09:21:00 +01:00
Jimmy Brisson 01c864e9bb Merge pull request #5099 from mprse/move_clock_function
Move clock() function from mbed_rtc_time.cpp to mbed_retarget.cpp.
2017-09-28 14:05:35 -05:00
Przemyslaw Stekiel 035c0896ed Move clock() function from mbed_rtc_time.cpp to mbed_retarget.cpp. 2017-09-27 15:32:41 +02:00
Christopher Haster 01326910c0 fs: Fixed fstat retarget for regular files
GCC's newlib library depends on fstat to get in-flight information about
a file's type an size. A working fstat for regular files is needed for
seek and related functions to work correctly.
2017-09-26 21:41:13 -05:00
Vincent Coubard 017b8f0fc7 Platform: Replace non throwing versions of new operator.
This change prevents inclusion of non throwing versions of the new operator from
the compiler standard library. On GCC, the non throwing version bring with it
some portion of the exception support code.
2017-09-21 18:37:25 +01:00
Jimmy Brisson 15a9a0382b Enable Compiling with ARMC6 across all targets
remove duplicate sys.cpp
2017-09-11 13:20:32 -05:00
Jimmy Brisson 922bf1b619 Update mbed OS to handle ARMC6 requirements 2017-09-11 13:20:32 -05:00
Deepika 7d98eebf2a __IAR_SYSTEMS_ICC__ macro had issues when 7.5 and 8.11 both workbench are installed 2017-09-06 09:51:17 -05:00
Deepika bcb8779362 Internal members of std::FILE are not available from IAR8.x 2017-09-06 09:51:15 -05:00
Deepika 38e96ac432 __aeabi_read_tp function required for TLS in Dlib 2017-09-06 09:51:15 -05:00
Jimmy Brisson dd0a0fc3e7 Merge pull request #4831 from fahhem/less_scanf
Remove excessive use of printf/scanf in mbed_fdopen/_open
2017-08-24 10:12:10 -05:00
Jimmy Brisson 99a8467b70 Merge pull request #4817 from c1728p9/move_rtx_handlers
Move RTX error handlers into RTX handler file
2017-08-14 11:44:19 -05:00
Fahrzin Hemmati 88f90788bf Remove null byte at the end of fdopen's faux filename 2017-08-10 21:14:12 -07:00
ccli8 98a79c872b [M487] Support NuMaker-PFM-M487 board 2017-08-01 10:14:24 +08:00
Fahrzin Hemmati af37520e42 Use MBED_STATIC_ASSERT instead of static_assert 2017-07-31 09:29:34 -07:00
Fahrzin Hemmati 199d108063 Update comments for code review 2017-07-31 09:29:34 -07:00
Fahrzin Hemmati e5ef69a925 Remove excessive use of printf/scanf in mbed_fdopen/_open 2017-07-31 09:29:34 -07:00
Russ Butler 46f6f52299 Move RTX error handlers into RTX handler file
Move the RTX error handlers out of mbed_retarget.cpp and into an the
dedicated RTX handler file.
2017-07-27 10:08:39 -05:00
Martin Kojtal 8a9f49653b retarget: fix microlib for mbed 2
This is as it used to be, reverting the removal. uARM does not have any hook
that we could use for mbed sdk init and copy nvic, therefore _open is used that
should be sufficient, but not ideal.

For more information, visit https://github.com/ARMmbed/mbed-os/pull/2160/files#r76563844.
2017-06-29 14:35:00 +01:00
Christopher Haster 6b02ceab5d rtos: Unbreak semaphore, trade assert for saturation with original limit
Before rtx 5, the max count on semaphores was UINT16_MAX, aftewards it
was decreased to 1024 with an assert on overflow.

This is especially problematic for semaphores used for signaling, since
there is no replacement currently available in C++.
2017-06-16 17:18:40 -05:00
Jimmy Brisson 761151359e Merge pull request #4506 from c1728p9/disable_2_error_trapping
Disable error trapping for mbed 2 builds
2017-06-09 14:22:30 -05:00
Russ Butler 018955c7b2 Disable error trapping for mbed 2 builds
To maintain backwards compatibility keep error trapping turned off
for mbed 2 builds.
2017-06-08 16:54:23 -05:00
Christopher Haster 5bd070af86 Cleaned up extra code left over after several different rebases 2017-06-06 15:21:25 -05:00
Christopher Haster 5d6fc713fb FileSystem: Reintegrated FileSystemLike interface
Required for other representations of FileSystems, ie LocalFileSystem

Introduces FileSystemHandle for the same behaviour as FileHandle and
DirHandle.

Requires the following to hook into file/dir lookup:
```
int open(FileHandle **file, const char *filename, int flags)
int open(DirHandle **dir, const char *path)
```

This hook is provided by the FileSystem class, so requires no changes
from implementations.
2017-06-03 13:17:37 -05:00
Russ Butler 770ad616dd Trap on RTX errors if enabled
If MBED_TRAP_ERRORS_ENABLED is defined to 1 then trap on RTX errors.
This includes using mutexes in ISR context.
2017-06-02 23:50:33 -05:00
Russ Butler b44e6f8a16 Assert that file IO is not used in ISRs
Trigger an assert if a file is read from or written to from an
interrupt handler or critical section. This includes using printf
from an interrupt handler or critical section. This makes failures
due to use in incorrect context deterministic and easier to locate.

This feature is enabled by defining MBED_TRAP_ERRORS_ENABLED to 1 or
by using the debug profile.
2017-06-02 23:50:31 -05:00
Sam Grove 5f138810a9 Merge pull request #4294 from ARMmbed/feature_cmsis5
Update CMSIS-Core and RTX to version 5
2017-06-02 23:44:32 -05:00
Hasnain Virk 24de27c989 Major Refactoring & extensions
For keep supporting external APIs with the same name (supposedly there are a larger
number of users of those APIs), BufferedSerial and ATParser are being renamed.
BufferedSerial becomes UARTSerial, will complement a  future USBSerial etc.
ATParser becomes ATCmdParser.

* UARTSerial moves to /drivers

* APN_db.h is moved from platform to cellular/util/.

* Original CellularInterface is restored for backward compatability (again, supposedly there
  are users of that).

* A new file, CellularBase is added which will now servce as the base class for all
  upcoming drivers.

* Special restructuring for the driver has been undertaken. This makes a clear cut distinction
  between an on-board or an off-board implementation.
  	- PPPCellularInterface is a generic network interface that works with a generic FileHandle
          and PPP. A derived class is needed to pass that FileHandle.
        - PPPCellularInterface provides some base functionality like network registration, AT setup,
          PPP connection etc. Lower level job is delegated to the derived classes and various modem
          specific APIs are provided which are supposed to be overridden.
        - UARTCellularInterface is derived from PPPCellularInterface. It constructs a FileHandle and
          passes it back to PPPCellularInterface as well as provides modem hangupf functionality.
          In future we could proive a USBInterface that would derive from PPPCellularInterface and could
          pass the FileHandle back.
	- OnboardCellularInterface is derived from UARTCellularInterfae and provides hooks to
          the target provided implementation of onbard_modem_api.h. An off-board modem, i.e, a modem on
          a shield has to override the modem_init(), modem_power_up() etc as it cannot use
          onboard_modem_api.h.
2017-05-31 15:02:11 +03:00
Hasnain Virk b2408d8a16 Extending FileHandle & introducing mbed_poll
This has been an attempt to extend existing FileHandle to behave like POSIX
file descriptor for input/output resources/devices too.
This will now provide an abstract indicator/handle any arbitrary file or device
type resource. May be in future, sockets too.

In order to correctly detect availability of read/write a FileHandle, we needed
a select or poll mechanisms. We opted for poll as POSIX defines in
http://pubs.opengroup.org/onlinepubs/009695399/functions/poll.html Currently,
mbed::poll() just spins and scans filehandles looking for any events we are
interested in. In future, his spinning behaviour will be replaced with
condition variables.

In retarget.cpp we have introduced an mbed::fdopen() function which is
equivalent to C fdopen(). It attaches a std stream to our FileHandle stream.
newlib-nano somehow does not seem to call isatty() so retarget doesn't work for
device type file handles. We handle this by checking ourselves in
mbed::fdopen() if we wish to attach our stream to std stream.  We also turn off
buffering by C library as our stuff will be buffered already.

sigio() is also provided, matching the API of the Socket class, with a view to
future unification. As well as unblocking poll(), _poll_change calls the user
sigio callback if an event happens, i.e., when FileHandle becomes
readable/writable.
2017-05-31 15:02:11 +03:00
Kevin Bracey fb7cbdf356 Tighten mbed_retarget.cpp error handling
* Don't set errno when calls are successful (will slightly alleviate the problem
  of errno not being thread-safe yet).
* Transfer errors returned from size() and seek() into errno.
* Fix isatty() - could never return 1 from a FileHandle.
* Use more appropriate errors than EBADF in some places (eg ENOENT for non-existant path).
2017-05-31 15:02:11 +03:00
Bartek Szatkowski b793a3fb89 Update codebase for CMSIS5/RTX5
Update all of mbed-os to use RTX5.
2017-05-30 18:55:52 +01:00
Bartek Szatkowski 2ddf4b33cb CMSIS5: Remove ARM7 support and targets 2017-05-12 13:48:43 -05:00
Neil Thiessen 6b671e5903 Fixed compiler warning in mbed_retarget.cpp
Fixed compiler warning about openmode_to_posix() being declared but never referenced.
2017-04-05 20:58:23 -06:00
Christopher Haster 61c9683644 Filesystem: Moved retarget related file interfaces into platform 2017-03-14 11:02:34 -05:00
Christopher Haster 77243ef46b Filesystem: Revert deprecation of FileHandle
As identified by @hasnainvirk, @kjbracey-arm, the FileHandle and
FileBase serve two separate functions and their integration is
limiting for certain use cases.

FileLike is actually the redundant class here, but the multiple
inheritance it provides is used as a hack by the retargeting code
to get at the FileHandle implementation bound to the FileBase name.

It may make more sense for the FileBase to inherit from FileHandle,
(with perhaps a different name), but rather than explore the
possibility, this will just restore the previous hierarchy.
2017-03-14 11:02:34 -05:00
Christopher Haster 87c0b82230 Updated includes of renamed platform header files 2017-03-01 16:45:55 -06:00
Christopher Haster 274460bef5 Filesystem: Adopted dynamic allocation of files over static allocation 2017-02-24 12:03:14 -06:00
Christopher Haster c4649afba5 Filesystem: Last minute changes due to feedback on directory iteration
- Changed to use dirent structure type
- Fixed memory leak in closedir
2017-02-24 12:03:14 -06:00
Christopher Haster 7ca4eabf77 Filesystem: Fixed integration with mbed 2 builds 2017-02-24 12:03:14 -06:00
Christopher Haster b9122c73f9 Filesystem: Integrate error handling between c++/posix layers 2017-02-24 12:03:09 -06:00
Christopher Haster eea5c9f08a Filesystem: Integration with retarget code 2017-02-24 11:55:37 -06:00