Commit Graph

159 Commits (95e0bc094aeff15479b49d14f327fc95ac941153)

Author SHA1 Message Date
Hasnain Virk 01088647b9 Finalizing the public API for Cellular
* state machine corrections
* adding various standard API methods
* Addition/revision/enhancement of the nsapi_ppp glue layer
* Turning off debug by default
2017-05-31 15:02:11 +03:00
Hasnain Virk 3b44f4758d Adding support for APN lookup
Mainly reutilizing code from ublox C027 support lib.
As we are using external PDP context, i.e., an external IP stack,
we will pass username and password to underlying stack running PPP.
We only support CHAP as the authentication protocol.
2017-05-31 15:02:11 +03:00
Hasnain Virk 93f436ebe0 Using DCD line to invoke poll() HUP
POSIX poll() provides a mechanism to attach a POLL_HUP event
if the modem or device hangs up on you. POLL_HUP and POLL_OUT are
mutually exclusive. We poll in the PPP_input() routine if the modem
hung up. If it did we stop the data consumption, close PPP and go back
to the driver for reserruction of AT parser and subsequent retries or
application specific actions.
This is achieved by attaching an interrupt to the DCD line of the modem.
When DCD line goes high (off), we have lost the carrier. So we record an
POLLHUP event using _poll_change().
2017-05-31 15:02:11 +03:00
Hasnain Virk ea117e5a1a Memory Optimizations and simplifications in ATParser
ATParser had been using std <vector> which had been pulling along a lot
of standard C++ stuff. We have an alternative implementation whcih achieves
a similar effect but without using <vector>. this saves a bunch of valuable
RAM resource.

We have also simplified the overall system by introducing proper CR and LF
rather than \r\n type of delimiters. This newline simplification is borrowed
from retarget.cpp.
2017-05-31 15:02:11 +03:00
Hasnain Virk 4a04c9ce5d Extending ATParser to use FileHandle
Existing ATParser is extended to use FileHandle. This essentially detaches
ATParser from previous tight binding with various implementations of serial
interfaces with buffering.
Now the ATParser uses only abstract FileHandle and doesn't really care about
the underlying implementation. Underneath, it could be a USB device type FileHandle
or a Serial device type FileHandle etc.
Some simplification steps were taken as the code provided opportunities to simplify
and optimize.
2017-05-31 15:02:11 +03:00
Hasnain Virk 2790d44862 Introducing a BufferedSerial
BufferedSerial is a FileHandle and using SerialBase.
It keeps the SerialBase private however lets the user extend FileHandle
by keeping it public.

It is using CircularBuffer class for having circular buffers.

There are some minor amendments in CircularBuffer too.

Adding an entry for tx/rx buffer sizes in platform/mbed_lib.json.
Default size is 256 bytes.

For RTOS read(), write() calls yield for other threads to carry on with their stuff.
For non-RTOS blovking read or write would mean a loop where 100 percent resources are
consumed by this loop. Need to get a better implementation in. Currently no mechanism to
wake the mcu up after WFE.
2017-05-31 15:02:11 +03:00
Hasnain Virk 09ae609d56 Stream class should use mbed::fdopen() to attach a stream
mbed::fdopen() is provided in mbed_retarget.cpp which will attach a stream to the
given FileHandle. Removing mbed_set_unbuffered_stream() from stream class as it
is defined in mbed_retarget.cpp. Stream class should not decide whether it wants
to detach buffers from c library or not. mbed::fdopen() will do that based upon
isatty() call. So if a FileHandle is not a tty, i.e., is not a device type, c library
buffering will not be turned off. For device type FileHandles, c library buffering
is turned off.
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
Kevin Bracey 533910cb87 Correct return type of FileHandle::size()
File size should be off_t, not size_t.
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
Anna Bridge 8543279901 Merge pull request #4259 from LMESTM/fix_Stream_issue687
Add error check in Stream constructor
2017-05-04 15:56:44 +01:00
Anna Bridge aa80b55628 Merge pull request #4233 from sg-/fix-the-docs2
[platform] Update doxygen comments
2017-05-04 15:12:54 +01:00
Jimmy Brisson 7ace0cbb14 Merge pull request #3881 from geky/log-no-io
Remove debug links to printf/exit in NDEBUG builds
2017-05-02 11:37:10 -05:00
Laurent MEUNIER 4ad4b2a2ef On small targets there might be memory issues that lead to
failing on file allocation / opening during Stream creation.

The consequence was application continues running, but any printf
to the Serial object whose Stream was not properly created
would not show any error (and characters would not show either)

Let's add a check to properly inform user of the error.
2017-05-02 17:53:58 +02:00
Christopher Haster 8705305cab callback: Moved out sfinae logic into a macro
This is required to allow doxygen to properly parse the function
declarations, otherwise it gets confused around the nested templates.
2017-04-28 16:02:36 -05:00
Sam Grove 6c65a0a7f4 [platform] Fix undocumented parameters and fix parameters that didnt
match the arguments
2017-04-26 18:41:02 -05:00
Sam Grove 5b580f6e16 [platform] Fix documentation error between argument names and @param 2017-04-26 18:39:59 -05:00
Sam Grove 33e1d66d66 [platform] Remove stale doxygen parameter that doesnt exist in code 2017-04-26 18:07:47 -05:00
Sam Grove f5d598fb61 [platform] update incorrect doxygen tag for return documentation 2017-04-26 18:06:53 -05:00
Sam Grove 4e417eb3dc [platform] fix doxygen preprocessor constant expresison warnings 2017-04-26 17:51:24 -05:00
Sam Grove 75e5b6500d [platform] Fix doxygen errors in mbed_mem_trace.h 2017-04-26 17:49:45 -05:00
Sam Grove dcbb6f6ab8 [platform] fix doxygen group close 2017-04-26 09:14:36 -05:00
Sam Grove 6062ca7404 [platform] Update doxygen errors with example code comments 2017-04-26 09:13:34 -05:00
Sam Grove 93b8bb8e52 [platform] Fix doxygen error @Return to @return 2017-04-25 14:50:29 -05:00
Sam Grove 5e7ce5fa23 [platform] Update doxygen errors from @Note to @note 2017-04-25 14:37:08 -05:00
Christopher Haster cfc223cc3f Removed debug links to printf/exit in NDEBUG builds
Allows development of small applications where stdio is avoided
2017-04-24 10:40:24 -05:00
Anna Bridge 47b1a9eeec Merge pull request #4111 from sg-/fix-the-docs
[drivers] Update doxygen errors
2017-04-21 14:10:17 +01:00
Francisco J. Manno 4398b1f3c1 Fix gcc [-Wsign-compare] warning
[Warning] mbed_board.c@99,36: comparison between signed and unsigned
integer expressions [-Wsign-compare] is seen during compilation.
Fix the warning and small improvements.

1. Change type of loop variable "i" to the same type as "size".
   Size is > 0 checked by the if statement and i stops at == size
   so none can be negative. However size still needs to be signed
   to detect error codes from vsnprintf.
2. Reduced scope of stdio_out_prev and make sure it's initialized.
3. Define a name for the error buffer size and use vsnprintf instead
   of vsprintf to avoid writing outside of the array.
   NOTE: the if(size > 0) statement doesn't need to change. If
   the message to write is larger than the buffer size vsnprintf
   truncates it automatically but still returns a positive value.
2017-04-19 18:37:37 +01:00
Sam Grove af63b57f89 Merge pull request #4141 from tung7970/fix-mbedos
Fix mbed_board.c compiler warning
2017-04-19 02:17:08 -05:00
Jimmy Brisson fb8fda3cee Merge pull request #4097 from bulislaw/build_debug_macro
Debug build flag + change to sleep behavior in debug mode
2017-04-18 15:05:02 -05:00
Jimmy Brisson 61c4d50109 Fix typo in doxygen tag 2017-04-12 15:23:24 -05:00
Sam Grove b2cd20c5c5 Merge pull request #4122 from neilt6/patch-1
Fixed compiler warning in mbed_retarget.cpp
2017-04-10 16:38:08 -05:00
Bartek Szatkowski c5f0ad506e Disable sleep when uVisor is in use 2017-04-10 11:40:04 +01:00
Bartek Szatkowski 57dc2a540c Disable sleep and deepsleep when MBED_DEBUG macro is defined 2017-04-10 11:40:04 +01:00
Tony Wu 913febd3db Fix mbed_board.c compiler warning
Fix the following compiler warning.

Compile [ 63.7%]: mbed_board.c
[Warning] mbed_board.c@99,36: comparison between signed and unsigned integer expressions [-Wsign-compare]

Signed-off-by: Tony Wu <tonyw@realtek.com>
2017-04-10 11:42:14 +08: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
Jimmy Brisson f945d71319 Update class documentation tags
stop using scope for \addtogroup. It was placing class methods into the
group documentation instead of the class documentation. The new style is
to explicitly tag the class as @ingroup. This new method will allow the
class to be linked in the group page, and the class page will contain
the detailed documentation of the class methods.
2017-04-04 14:21:53 -05:00
Adam Green 408cff4f8d Modify semihost_disabledebug() to support more interface FW revs
The current implementation of semihost_disabledebug() hangs when used
with mbed interface firwmare revision 21164, the first version which
added support for this semihost call. I encountered this hang when
running a Release build on my mbed-LPC1768 board as the RTOS attempted
to disable the debugger before the idle thread put the CPU to sleep.

The 21164 interface firmware expects that R1 points to a valid argument
block but the current implementation passes in NULL. The fix was to
pass in a dummy block which is ignored by the newer 141212 revision of
the firmware and allows the 21164 version to proceeed without halting
the CPU until a manual reset.

Before this fix semihost_disabledebug() did work with the latest
mbed interface firmware revision 141212 but I rarely use this revision
of the interface firmware due to the instability issues I have
encountered in the past with its CDC and LocalFileSystem functionality.

With this proposed fix, the code now works with both the 21164 and
141212 revisions of the mbed interface firmware on the mbed-LPC1768.
2017-03-31 13:33:55 -07:00
Anna Bridge 039ef42822 Merge pull request #3867 from geky/fs-revert-filehandle
Filesystem: Revert deprecation of FileHandle
2017-03-23 15:45:01 +00:00
Andres AG 2d0135632d Fix C declaration of dir functions and types
This patch fixes the declaration of the DIR type and related functions
so that they can be called from C code. This is necessary when enabling
functionality that uses the filesystem in mbed TLS.
2017-03-16 16:13:44 +00:00
Christopher Haster 18bab4e024 Filesystem: Fixed typo in param naming 2017-03-14 11:04:22 -05:00
Christopher Haster 90fc0b9c47 FileSystem: Reverted deprecation of DirHandle
Should follow same path as FileHandle, although this is less used
and there is currently no route to introduce a hook for a customized
DirHandle in retarget.
2017-03-14 11:02:34 -05: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 000894d477 Fixed size_t issue for mbed 2 builds 2017-03-10 11:04:05 -06: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
Christopher Haster ee3e920ed1 Filesystem: Moved toolchain-specific types into retarget.h 2017-02-24 11:42:32 -06:00
Simon Hughes 840c77793b STORAGE: Pull request 3762 review feedback changes.
- Fixing code formatting errors with astyle tool.
- Replaced use of TOOLCHAIN_xxx macros with compiler emitted macros.
- Added const to BlockDevice::get_xxx_size() member functions.
- Added documentation for FAT filesystem thread support.
- Added documentation for fat_filesystem_set_errno().
- Added documentation clarifying the reasons for errno/stat symbol definitions in retarget.h.
- Removed FAT filesystem from mbed 2 testing.
- Fixed FATMisc.h Copyright (c) 2016 year to 2017 as its a new file.
- Removed #ifndef NDEBUG from HeapBlockDevice.cpp.
- Removed unnecessary todo comment in retarget.cpp.
2017-02-23 16:39:42 +00:00
Simon Hughes 2b96c74f84 STORAGE: Pull Request 3704 requested minor changes including:
- renaming FATFileSystemSetErrno() fat_file_system_set_errno.
- changing FATFileSystem::format() to be mount fs internally in function, rather than expecting fs to be mounted.
- requested const char *filename change.
2017-02-23 16:39:21 +00:00
Simon Hughes fdadb8cc66 STORAGE: moved toolchain_support.h into platform/retarget.h 2017-02-23 16:39:18 +00:00
Simon Hughes 4f5e94c746 STORAGE: test case fixes to support ARMCC and IAR toolchains.
Conflicts:
	features/TESTS/filesystem/fopen/fopen.cpp
2017-02-23 16:38:15 +00:00
Simon D Hughes aefb03ccd6 ARMCC temporary fixes for undefined errno symbols. 2017-02-23 16:36:16 +00:00
Simon Hughes 0c87537f10 Added errno codes to retarget, mkdir() and ftell() tests. 2017-02-23 16:36:03 +00:00
Simon Hughes c8fecb6c88 STORAGE: tests added for errno, ferror() and clearerr(). 2017-02-23 16:30:55 +00:00
Christopher Haster b1a685125b Filesystem: Removed dependency on unistd.h
Previously used to determine stdin/stdout/stderr filenos, however
these are set by us
2017-02-23 16:30:47 +00:00
Christopher Haster 9299a88e8f Filesystem: Add support for stat
Provided through FileSystemLike::stat
2017-02-23 16:30:42 +00:00
Christopher Haster aff49d8d1e Renamed files in platform to match source names
critical.h     -> mbed_critical.h
sleep.h        -> mbed_sleep.h
toolchain.h    -> mbed_toolchain.h
rtc_time.h     -> mbed_rtc_time.h
semihost_api.h -> mbed_semihost_api.h
wait_api.h     -> mbed_wait_api.h
2017-02-22 18:17:54 -06:00
Martin Kojtal 4470d048a6 Merge pull request #3748 from c1728p9/application_transfer_support
Add a function to transfer control to another app
2017-02-21 17:11:42 +00:00
Sam Grove cfd517a3a0 Merge pull request #3783 from geky/cb-deprecate-attach
Callback: Deprecate attach member function in favor of simple assignment
2017-02-21 10:55:44 -06:00
Russ Butler 36cbae6420 Add a function to transfer control to another app
Add the function mbed_start_application() which allows a bootloader to
transfer control to an application.
2017-02-18 19:48:14 -06:00
Christopher Haster ed6fec2811 Callback: Deprecated attach member function in favor of simple assignment
The attach function is used several other places to indicate
registration for interrupts. This differs significantly to its use in
the Callback class. Additionally, the attach function is unnecessary
given that simple assignment works just as well.
2017-02-15 15:07:58 -06:00
YarivCol 2c6eba35c2 fix in mbed_error_vfprintf
MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES was not used in mbed_error_vfprintf causing wrong behavior when the option was selected (no new line is some terminals like putty).
2017-02-13 00:54:51 +02:00
Russ Butler 605614a600 Add MBED_SECTION attribute
Allow the section that code is placed in to be explicitly specified
with the attribute MBED_SECTION.
2017-02-01 09:20:29 -06:00
Bartek Szatkowski 8a4a3caf65 sleep: make sleep/deepsleep static 2017-01-19 11:53:53 +00:00
Bartek Szatkowski 1e73a66c33 sleep: remove warnings for default build 2017-01-19 11:53:24 +00:00
Bartek Szatkowski 6a045a49a9 Platform: Add sleep/deepsleep user facing functions
Add sleep/deepsleep functions to platform layer which are replacing HAL
functions with the same name, rename existing symbols in HAL layer
to hal_sleep/hal_deepsleep. This way sleep functions
are always available, even if target doesn't implement them, which makes
the code using sleep clearer. It also enables us to make decision on in
which builds (debug/release) the sleep will be enabled.
2017-01-19 09:39:29 +00:00
Martin Kojtal ab2e869a24 Merge pull request #3157 from SiliconLabs/SiliconLabs-EFR32
[Silicon Labs] Adding support for EFR32MG1 wireless SoC
2016-12-02 15:46:35 +01:00
micromint 22c0e3560b Support building mbed_critical.c with C++ compiler 2016-11-21 12:59:45 -04:00
Martin Kojtal 8eaeb86780 Merge pull request #3244 from geky/callback-type-relaxation
callback - Relax type-deduction in callback class
2016-11-16 17:42:58 +00:00
Martin Kojtal b36944fafc Merge pull request #3141 from geky/stats-stack
stats - Add cleaner stats API for stack usage
2016-11-16 17:41:37 +00:00
micromint 809b20738e Change MBED_DEPRECATED def order to support Keil 4 2016-11-10 09:59:28 -06:00
Christopher Haster 3544228b47 callback - Adopted relaxed type-deduction for bound functions
Adopting relaxed type-deduction in bound functions better aligns with
the same overloads for member functions, and provides an alternative
solution for the void pointer cast issue, which removes a large amount
of cruft.
2016-11-09 13:45:25 -06:00
Christopher Haster 3ba3bb50f9 callback - Fixed type-deduction when inheritance is involved
The type deduction for the callback constructors was to strict and
prevented implicit casts for the context pointer stored internally.

As noted by @pan-, relaxing the contraints on the templated
parameters allows C++ to correctly infer implicit casts such as
conversions between child and parent classes when inheritance is
involved.

As an additional benefit, this may help the user experience by
defering invalid type errors to when the types are expanded,
limiting the number of error messages presented to users.
2016-11-09 12:42:42 -06:00
Christopher Haster e90fff3a60 stats - Added doxygen documentation to stats functions 2016-11-07 19:15:44 -06:00
Christopher Haster 9b630b3e0d stats - Added stack stats api for individual threads
Added the following
- size_t mbed_stats_stack_get_each(mbed_stats_stack_t *, size_t)
2016-11-07 19:15:44 -06:00
Christopher Haster 14aa57f81c stats - Added stats for reserved heap space for consistency 2016-11-07 19:15:44 -06:00
Christopher Haster b6e8f44c0d stats - Added stack stats api
Matched heap stats api
- void mbed_stats_heap_get(mbed_stats_heap_t *)
- void mbed_stats_stack_get(mbed_stats_stack_t *)
2016-11-07 19:15:38 -06:00
Sam Grove 30e63a27b7 Merge pull request #3202 from geky/fix-rtos-wait-math
Fix arithmetic error in rtos-based wait
2016-11-07 10:30:33 -06:00
Steven Cooreman f344c0d204 [EFR32] Set default USB serial baudrate
Silicon Labs targets use a default, unchangeable baud rate of 115200 on the stdio serial-USB bridge.
2016-11-07 11:54:45 +01:00
Christopher Haster 4d6afcddfa Fixed arithmetic error in rtos-based wait
The value of `start` is taken from before that wait call, so the value
of `us` shouldn't be changed
2016-11-04 11:42:53 -05:00
Christopher Haster c11ce2153a Added mbed_preprocessor.h to collect common cpp definitions 2016-11-03 10:26:31 -05:00
Christopher Haster 98db3ab1cb Adopted MBED_STATIC_ASSERT where possible 2016-11-01 21:39:48 -05:00
Christopher Haster 182c6a29f2 Added static assert macro
Added MBED_STATIC_ASSERT for compile-time assertions, results in
compile-time error if condition is false

The assertion acts as a declaration that can be placed at file scope, in
a code block (except after a label), or as a member of
a C++ class/struct/union.

Unfortunately, there does not exist a backup construct for use in
C class/struct/union contexts. An alternative macro,
MBED_STRUCT_STATIC_ASSERT provides this ability to avoid disabling
static assertions for the majority of mbed-supported C compilers.
2016-11-01 21:39:41 -05:00
ccli8 dfc32409a9 [NUC472/M453] Refine comment for two-region model 2016-10-11 10:55:08 +08:00
ccli8 b95478015b Support NUMAKER_PFM_M453 2016-10-11 10:55:08 +08:00
Sam Grove 3a16ca9855 Merge pull request #2911 from theotherjimmy/docs-generation
[Tools] Add documentation generation script
2016-10-06 15:57:08 -05:00
Sam Grove 670b0984eb Merge pull request #2917 from c1728p9/fix_InitTCs
Initialization steps in toolchains
2016-10-05 00:54:45 -05:00
Sam Grove 970c6551a1 Merge pull request #2873 from tung7970/fix-mbedos
callchain - fix add_front assignment
2016-10-04 22:45:30 -05:00
Jimmy Brisson f1a78027d3 Add tags to our code 2016-10-04 15:02:44 -05:00
Laurent MEUNIER bcbe0b17de INIT:GCC with rtos: Align pre-main initialization steps between TCs
In this commit we're moving the mbed_sdk_init call before the RTOS
initialisation so that the sequence is similar to other toolchains.
2016-10-04 14:55:31 -05:00
Laurent MEUNIER e8d67ac530 INIT: uARM no rtos: Align pre-main initialization steps between TCs
In uARM, the library's hook _platform_post_stackheap_init does not seem to
exist and I couldnot find a documentation describing the initialisation
flow. All we know is that _open is called after RAM init and before the
C++ init, so this is a working placeholder.

This is maybe not acceptable so a uARM lib expert may propose a better
hook to fullfil the requirement.

At least this is a workign setup.

This series should solve issue reported here:
STM32 (At least F401) breaks if Tickers are activated in a global object #2115
2016-10-04 14:55:27 -05:00
Laurent MEUNIER f50e23aea6 INIT:ARM no rtos: Align pre-main initialization steps between TCs
Various toolchains supported in MBED don't followthe same initialization
steps. This can have impacts on platform behavior.

For STM32, it is needed to call the HAL_Init() _after_ the  RAM has been
initialized (sdata from flash / zero initialized data) and _before_ the C++
objects are being created, especially if those objects require support
of tickers for instance.

In GCC and IAR, this was done in previous commit to avoid HAL_Init()
to be called twice.

In ARM this there is no hook defined in MBED yet to place the call.
The proposal is to take benefit of the library's
_platform_post_stackheap_init function that is going to be called before
__rt_lib_init where the C++ object init is done (__cpp_initialize__aeabi_)

This series should solve issue reported here:
STM32 (At least F401) breaks if Tickers are activated in a global object #2115
2016-10-04 14:55:23 -05:00
Sam Grove 15f21b0587 Merge pull request #2898 from geky/callback-fix-iar-typeinfo
callback - Add workaround for IAR issue with type information
2016-10-04 14:06:45 -05:00