Commit Graph

24 Commits (61fb65b7fdada22cc60257e3533c5bee803b56dc)

Author SHA1 Message Date
Sam Grove 23d77e4423 Merge pull request #97 from geky/compiler-polyfill
Add useful attributes supported by supported compilers
2016-05-20 16:16:23 -05:00
Kevin Bracey 640116123c Use critical section helper in HAL
Routines using __disable_irq and __enable_irq had the effect of
enabling interrupts if called with interrupts disabled.

Some versions of __disable_irq do not return old status to restore it.

Change to use the critical section helper functions instead.
2016-05-18 14:50:31 +03:00
Christopher Haster 018e2571e6 Added other attributes on supported compilers
tested on GCC, Clang, online compiler, and IAR

attributes
- PACK
- ALIGN
- UNUSED
- WEAK
- PURE
- FORCEINLINE
- NORETURN
- UNREACHABLE
- DEPRECATED
2016-05-16 18:59:23 -05:00
Christopher Haster f05240b666 Added attribute tests from compiler-polyfill
from https://github.com/ARMmbed/compiler-polyfill/tree/master/test/attributes
2016-05-16 14:27:54 -05:00
Christopher Haster 8381fda624 Merged compiler-polyfill into toolchain.h
from https://github.com/armmbed/compiler-polyfill

notes
- Adopted existing mbed naming convention of all caps.
  This avoids conflicts with compiler declarations
  https://github.com/ARMmbed/compiler-polyfill/issues/7

- Dropped align attribute due to lack of support on IAR.

- Currently toolchain.h lives in /hal/api, although with
  the addition of /util there may be a better home.
2016-05-16 14:02:46 -05:00
Christopher Haster 4984077d07 Adopt Callback class in hal 2016-05-13 19:07:45 -05:00
Christopher Haster bf498de127 Add backward compatiblity for FunctionPointer class using Callback
effectively:
typedef Callback<R(A)> FunctionPointerArg1<R,A>
typedef Callback<R()> FunctionPointerArg1<R,void>
typedef Callback<R()> FunctionPointer
typedef Callback<R()> event_callback_t
2016-05-13 19:07:45 -05:00
Christopher Haster 8b330ae8a6 Add callback tests 2016-05-13 19:07:45 -05:00
Christopher Haster 8e42a32d00 Add Callback, an improved FunctionPointer class
- Adopt C++11 style template arguments, requires rename to Callback
- Add constructor for C style callback functions
- Add constructor for Callbacks
- Add static function for passing to C style callbacks
2016-05-13 19:07:45 -05:00
Russ Butler e161aad0c1 Create mbed-drivers/mbed.h for compatibility
Create a second mbed.h in the mbed-drivers directory to support
projects using 3.0 style includes.
2016-04-10 23:43:34 -05:00
Russ Butler 6b4dfeb1ab Fix heap allocation when used with RTOS
Remove the code which checks the heap against the stack to determine
if there is space left.  Using the stack pointer as a limit causes
problems when used with an RTOS since the stack pointer depends
on the current thread which can use a user-allocated stack residing
anywhere in memory.
2016-04-10 23:37:42 -05:00
sg- 034d3e9c27 track mbed_error.c 2016-04-07 10:25:29 -05:00
sg- 47ee2ed90f rename error.c to mbed_error.c. add toolchain.h to mbed.h exposing to all. add extern filler to toolchain.h 2016-04-07 10:22:59 -05:00
Christopher Haster 8a5121aaff Reverted merge of FuncPtr (#10)
Replaced FuncPtr with FunctionPointer in NSAPI
2016-04-06 11:23:42 -05:00
Marcus Shawcroft 0fbdad69ef Merge pull request #10 from geky/master
Added improved FuncPtr type
2016-04-07 09:23:21 +01:00
Alessandro Angelino 2fe077d50a Mirror huge PR from mbed OS
The following PRs have been mirrored:
https://github.com/ARMmbed/mbed-hal-k64f/pull/6  "All Freescale macros for memory access replaced"
https://github.com/ARMmbed/mbed-hal-k64f/pull/7  "Fix bug in union access macros"
https://github.com/ARMmbed/mbed-hal-k64f/pull/8  "Simpler and more universal macros for memory access"
https://github.com/ARMmbed/mbed-hal-k64f/pull/9  "Fixed bug in fallback macros for memory access"
https://github.com/ARMmbed/mbed-hal-k64f/pull/10 "Added volatile keyword to address for union read"
https://github.com/ARMmbed/mbed-hal-k64f/pull/14 "Removing copyright and revision from unmodified file"
2016-04-06 23:25:27 +01:00
Alessandro Angelino 3fcaed1eb0 Add uVisor to startup code 2016-04-06 23:25:27 +01:00
Alessandro Angelino e32f969459 Add uninitialized section to linker script 2016-04-06 23:25:27 +01:00
Alessandro Angelino ec980179bc Add uVisor-specific sections to linker script 2016-04-06 23:25:27 +01:00
Alessandro Angelino 7818102156 Round the SRAM offset in linker script 2016-04-06 23:25:27 +01:00
Alessandro Angelino 057bc9a98a Replace NVIC APIs with vIRQ ones 2016-04-06 23:25:27 +01:00
Alessandro Angelino 3ad0f0a430 Fix function to get sp when in unprivileged mode 2016-04-06 23:11:46 +01:00
Christopher Haster f396e3165f Added improved FuncPtr type
FuncPtr provides a more flexible templated function class as a
replacement for FunctionPointer.

FuncPtr provides an intuitive template interface:

void doit(int, char *);
FuncPtr<void(int, char *)> doit_ptr(doit);
doit_ptr(10, "hi!");

FuncPtr places memory management on the user, only supporting
storing an extra pointer for pointers to externally stored objects
that can be passed to the function. Additional binding can be
supplied by an external class.

FuncPtr<void(int)> hello(&object, &Object::method);

Additionally FuncPtr provides a copy constructor, allowing FuncPtrs
themselves to be passed to existing interfaces.

FuncPtr<void()> hello(doit); ticker.attach(hello, 1000);
2016-04-06 08:01:28 -05:00
Bogdan Marinescu 3feff63592 Preparing new layout - moved hal+mbed-drivers to ./hal 2016-04-05 16:26:29 +01:00