The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Files at this revision

API Documentation at this revision

Comitter:
emilmont
Date:
Wed Jan 16 12:56:34 2013 +0000
Parent:
54:71b101360fb9
Child:
56:3753e96f3c8b
Commit message:
Include "sleep_api.h" in "mbed.h"
Add initial IAR toolchain support
LPC I2C: better handling of status
Add sleep mode support for the LPC1768
Correct GCC "__semihost" definition
Correct GCC "_isatty" retargeting

Changed in this revision

AnalogIn.h Show annotated file Show diff for this revision Revisions of this file
AnalogOut.h Show annotated file Show diff for this revision Revisions of this file
BusIn.h Show annotated file Show diff for this revision Revisions of this file
BusInOut.h Show annotated file Show diff for this revision Revisions of this file
CAN.h Show annotated file Show diff for this revision Revisions of this file
DigitalIn.h Show annotated file Show diff for this revision Revisions of this file
DigitalInOut.h Show annotated file Show diff for this revision Revisions of this file
DigitalOut.h Show annotated file Show diff for this revision Revisions of this file
DirHandle.h Show annotated file Show diff for this revision Revisions of this file
Ethernet.h Show annotated file Show diff for this revision Revisions of this file
FileBase.h Show annotated file Show diff for this revision Revisions of this file
FileHandle.h Show annotated file Show diff for this revision Revisions of this file
FileLike.h Show annotated file Show diff for this revision Revisions of this file
FilePath.h Show annotated file Show diff for this revision Revisions of this file
FileSystemLike.h Show annotated file Show diff for this revision Revisions of this file
FunctionPointer.h Show annotated file Show diff for this revision Revisions of this file
I2C.h Show annotated file Show diff for this revision Revisions of this file
I2CSlave.h Show annotated file Show diff for this revision Revisions of this file
InterruptIn.h Show annotated file Show diff for this revision Revisions of this file
LPC11U24/ARM/cmsis_nvic.o Show annotated file Show diff for this revision Revisions of this file
LPC11U24/ARM/mbed.ar Show annotated file Show diff for this revision Revisions of this file
LPC11U24/ARM/system_LPC11Uxx.o Show annotated file Show diff for this revision Revisions of this file
LPC11U24/PinNames.h Show annotated file Show diff for this revision Revisions of this file
LPC11U24/device.h Show annotated file Show diff for this revision Revisions of this file
LPC11U24/gpio_object.h Show annotated file Show diff for this revision Revisions of this file
LPC11U24/uARM/cmsis_nvic.o Show annotated file Show diff for this revision Revisions of this file
LPC11U24/uARM/mbed.ar Show annotated file Show diff for this revision Revisions of this file
LPC11U24/uARM/system_LPC11Uxx.o Show annotated file Show diff for this revision Revisions of this file
LPC1768/ARM/cmsis_nvic.o Show annotated file Show diff for this revision Revisions of this file
LPC1768/ARM/mbed.ar Show annotated file Show diff for this revision Revisions of this file
LPC1768/ARM/system_LPC17xx.o Show annotated file Show diff for this revision Revisions of this file
LPC1768/GCC_ARM/cmsis_nvic.o Show annotated file Show diff for this revision Revisions of this file
LPC1768/GCC_ARM/core_cm3.o Show annotated file Show diff for this revision Revisions of this file
LPC1768/GCC_ARM/libmbed.a Show annotated file Show diff for this revision Revisions of this file
LPC1768/GCC_ARM/system_LPC17xx.o Show annotated file Show diff for this revision Revisions of this file
LPC1768/GCC_CR/libmbed.a Show annotated file Show diff for this revision Revisions of this file
LPC1768/GCC_CS/libmbed.a Show annotated file Show diff for this revision Revisions of this file
LPC1768/PeripheralNames.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/PinNames.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/device.h Show annotated file Show diff for this revision Revisions of this file
LPC1768/gpio_object.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/ARM/mbed.ar Show annotated file Show diff for this revision Revisions of this file
LPC2368/PeripheralNames.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/PinNames.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/device.h Show annotated file Show diff for this revision Revisions of this file
LPC2368/gpio_object.h Show annotated file Show diff for this revision Revisions of this file
LocalFileSystem.h Show annotated file Show diff for this revision Revisions of this file
PortIn.h Show annotated file Show diff for this revision Revisions of this file
PortInOut.h Show annotated file Show diff for this revision Revisions of this file
PortOut.h Show annotated file Show diff for this revision Revisions of this file
PwmOut.h Show annotated file Show diff for this revision Revisions of this file
SPI.h Show annotated file Show diff for this revision Revisions of this file
SPISlave.h Show annotated file Show diff for this revision Revisions of this file
Serial.h Show annotated file Show diff for this revision Revisions of this file
Stream.h Show annotated file Show diff for this revision Revisions of this file
Ticker.h Show annotated file Show diff for this revision Revisions of this file
Timeout.h Show annotated file Show diff for this revision Revisions of this file
Timer.h Show annotated file Show diff for this revision Revisions of this file
TimerEvent.h Show annotated file Show diff for this revision Revisions of this file
can_api.h Show annotated file Show diff for this revision Revisions of this file
error.h Show annotated file Show diff for this revision Revisions of this file
i2c_api.h Show annotated file Show diff for this revision Revisions of this file
mbed.h Show annotated file Show diff for this revision Revisions of this file
mbed_debug.h Show annotated file Show diff for this revision Revisions of this file
mbed_interface.h Show annotated file Show diff for this revision Revisions of this file
pwmout_api.h Show annotated file Show diff for this revision Revisions of this file
rtc_api.h Show annotated file Show diff for this revision Revisions of this file
rtc_time.h Show annotated file Show diff for this revision Revisions of this file
semihost_api.h Show annotated file Show diff for this revision Revisions of this file
serial_api.h Show annotated file Show diff for this revision Revisions of this file
sleep_api.h Show annotated file Show diff for this revision Revisions of this file
spi_api.h Show annotated file Show diff for this revision Revisions of this file
toolchain.h Show annotated file Show diff for this revision Revisions of this file
--- a/AnalogIn.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/AnalogIn.h	Wed Jan 16 12:56:34 2013 +0000
@@ -35,11 +35,11 @@
  * Example:
  * @code
  * // Print messages when the AnalogIn is greater than 50%
- * 
+ *
  * #include "mbed.h"
- * 
+ *
  * AnalogIn temperature(p20);
- * 
+ *
  * int main() {
  *     while(1) {
  *         if(temperature > 0.5) {
@@ -55,13 +55,13 @@
 
     /** Create an AnalogIn, connected to the specified pin
      *
-     * @param pin AnalogIn pin to connect to 
+     * @param pin AnalogIn pin to connect to
      * @param name (optional) A string to identify the object
      */
     AnalogIn(PinName pin) {
         analogin_init(&_adc, pin);
     }
-    
+
     /** Read the input voltage, represented as a float in the range [0.0, 1.0]
      *
      * @returns A floating-point value representing the current input voltage, measured as a percentage
@@ -73,7 +73,7 @@
     /** Read the input voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
      *
      * @returns
-     *   16-bit unsigned short representing the current input voltage, normalised to a 16-bit value 
+     *   16-bit unsigned short representing the current input voltage, normalised to a 16-bit value
      */
     unsigned short read_u16() {
         return analogin_read_u16(&_adc);
@@ -88,7 +88,7 @@
      * @code
      * float x = volume.read();
      * float x = volume;
-     * 
+     *
      * if(volume.read() > 0.25) { ... }
      * if(volume > 0.25) { ... }
      * @endcode
--- a/AnalogOut.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/AnalogOut.h	Wed Jan 16 12:56:34 2013 +0000
@@ -35,9 +35,9 @@
  * Example:
  * @code
  * // Make a sawtooth output
- *  
+ *
  * #include "mbed.h"
- *  
+ *
  * AnalogOut tri(p18);
  * int main() {
  *     while(1) {
@@ -55,16 +55,16 @@
 public:
 
     /** Create an AnalogOut connected to the specified pin
-     * 
+     *
      *  @param AnalogOut pin to connect to (18)
      */
     AnalogOut(PinName pin) {
         analogout_init(&_dac, pin);
     }
-    
+
     /** Set the output voltage, specified as a percentage (float)
      *
-     *  @param value A floating-point value representing the output voltage, 
+     *  @param value A floating-point value representing the output voltage,
      *    specified as a percentage. The value should lie between
      *    0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%).
      *    Values outside this range will be saturated to 0.0f or 1.0f.
@@ -72,7 +72,7 @@
     void write(float value) {
         analogout_write(&_dac, value);
     }
-    
+
     /** Set the output voltage, represented as an unsigned short in the range [0x0, 0xFFFF]
      *
      *  @param value 16-bit unsigned short representing the output voltage,
@@ -85,7 +85,7 @@
     /** Return the current output voltage setting, measured as a percentage (float)
      *
      *  @returns
-     *    A floating-point value representing the current voltage being output on the pin, 
+     *    A floating-point value representing the current voltage being output on the pin,
      *    measured as a percentage. The returned value will lie between
      *    0.0f (representing 0v / 0%) and 1.0f (representing 3.3v / 100%).
      *
@@ -103,7 +103,7 @@
         write(percent);
         return *this;
     }
-    
+
     AnalogOut& operator= (AnalogOut& rhs) {
         write(rhs.read());
         return *this;
--- a/BusIn.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/BusIn.h	Wed Jan 16 12:56:34 2013 +0000
@@ -41,16 +41,16 @@
      * @note
      *  It is only required to specify as many pin variables as is required
      *  for the bus; the rest will default to NC (not connected)
-     */ 
+     */
     BusIn(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
           PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
           PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
           PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC);
 
     BusIn(PinName pins[16]);
-    
+
     virtual ~BusIn();
-    
+
     /** Read the value of the input bus
      *
      *  @returns
--- a/BusInOut.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/BusInOut.h	Wed Jan 16 12:56:34 2013 +0000
@@ -31,7 +31,7 @@
 class BusInOut {
 
 public:
-    
+
     /** Create an BusInOut, connected to the specified pins
      *
      *  @param p<n> DigitalInOut pin to connect to bus bit p<n> (p5-p30, NC)
@@ -57,7 +57,7 @@
      */
     void write(int value);
 
-        
+
     /** Read the value currently output on the bus
      *
      *  @returns
@@ -78,7 +78,7 @@
      *  @param mode PullUp, PullDown, PullNone
      */
     void mode(PinMode pull);
- 
+
 #ifdef MBED_OPERATORS
      /** A shorthand for write()
      */
--- a/CAN.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/CAN.h	Wed Jan 16 12:56:34 2013 +0000
@@ -27,7 +27,7 @@
 #if DEVICE_CAN
 
 #include "can_api.h"
-#include "can_helper.h" 
+#include "can_helper.h"
 #include "FunctionPointer.h"
 
 namespace mbed {
@@ -46,7 +46,7 @@
         id     = 0;
         memset(data, 0, 8);
     }
-    
+
     /** Creates CAN message with specific content.
      */
     CANMessage(int _id, const char *_data, char _len = 8, CANType _type = CANData, CANFormat _format = CANStandard) {
@@ -81,23 +81,23 @@
      * Example:
      * @code
      * #include "mbed.h"
-     *  
+     *
      * Ticker ticker;
      * DigitalOut led1(LED1);
      * DigitalOut led2(LED2);
      * CAN can1(p9, p10);
      * CAN can2(p30, p29);
-     *  
+     *
      * char counter = 0;
-     *  
+     *
      * void send() {
      *     if(can1.write(CANMessage(1337, &counter, 1))) {
      *         printf("Message sent: %d\n", counter);
      *         counter++;
-     *     } 
+     *     }
      *     led1 = !led1;
      * }
-     *  
+     *
      * int main() {
      *     ticker.attach(&send, 1);
      *    CANMessage msg;
@@ -105,15 +105,15 @@
      *         if(can2.read(msg)) {
      *             printf("Message received: %d\n\n", msg.data[0]);
      *             led2 = !led2;
-     *         } 
+     *         }
      *         wait(0.2);
      *     }
-     * } 
+     * }
      * @endcode
      */
     CAN(PinName rd, PinName td);
     virtual ~CAN();
-    
+
     /** Set the frequency of the CAN interface
      *
      *  @param hz The bus frequency in hertz
@@ -123,7 +123,7 @@
      *    0 otherwise
      */
     int frequency(int hz);
-    
+
     /** Write a CANMessage to the bus.
      *
      *  @param msg The CANMessage to write.
@@ -133,9 +133,9 @@
      *    1 if write was successful
      */
     int write(CANMessage msg);
-    
+
     /** Read a CANMessage from the bus.
-     * 
+     *
      *  @param msg A CANMessage to read to.
      *
      *  @returns
@@ -143,19 +143,19 @@
      *    1 if message arrived
      */
     int read(CANMessage &msg);
-    
+
     /** Reset CAN interface.
      *
      * To use after error overflow.
      */
     void reset();
-    
+
     /** Puts or removes the CAN interface into silent monitoring mode
      *
      *  @param silent boolean indicating whether to go into silent mode or not
      */
     void monitor(bool silent);
-    
+
     /** Returns number of read errors to detect read overflow errors.
      */
     unsigned char rderror();
@@ -170,7 +170,7 @@
      *  @param fptr A pointer to a void function, or 0 to set as none
      */
     void attach(void (*fptr)(void));
-   
+
    /** Attach a member function to call whenever a CAN frame received interrupt
     *  is generated.
     *
@@ -186,11 +186,11 @@
             remove_interrupt();
         }
     }
-    
+
 private:
     can_t _can;
     FunctionPointer _rxirq;
-    
+
     void setup_interrupt(void);
     void remove_interrupt(void);
 };
--- a/DigitalIn.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/DigitalIn.h	Wed Jan 16 12:56:34 2013 +0000
@@ -33,12 +33,12 @@
  * Example:
  * @code
  * // Flash an LED while a DigitalIn is true
- * 
+ *
  * #include "mbed.h"
- * 
+ *
  * DigitalIn enable(p5);
  * DigitalOut led(LED1);
- * 
+ *
  * int main() {
  *     while(1) {
  *         if(enable) {
@@ -60,17 +60,17 @@
     DigitalIn(PinName pin) {
         gpio_init(&gpio, pin, PIN_INPUT);
     }
-    
+
     /** Read the input, represented as 0 or 1 (int)
      *
      *  @returns
-     *    An integer representing the state of the input pin, 
+     *    An integer representing the state of the input pin,
      *    0 for logical 0, 1 for logical 1
      */
     int read() {
         return gpio_read(&gpio);
     }
-    
+
     /** Set the input pin mode
      *
      *  @param mode PullUp, PullDown, PullNone, OpenDrain
@@ -78,7 +78,7 @@
     void mode(PinMode pull) {
         gpio_mode(&gpio, pull);
     }
-    
+
 #ifdef MBED_OPERATORS
     /** An operator shorthand for read()
      */
--- a/DigitalInOut.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/DigitalInOut.h	Wed Jan 16 12:56:34 2013 +0000
@@ -40,38 +40,38 @@
     DigitalInOut(PinName pin) {
         gpio_init(&gpio, pin, PIN_INPUT);
     }
-    
+
     /** Set the output, specified as 0 or 1 (int)
      *
-     *  @param value An integer specifying the pin output value, 
-     *      0 for logical 0, 1 (or any other non-zero value) for logical 1 
+     *  @param value An integer specifying the pin output value,
+     *      0 for logical 0, 1 (or any other non-zero value) for logical 1
      */
     void write(int value) {
         gpio_write(&gpio, value);
     }
-    
+
     /** Return the output setting, represented as 0 or 1 (int)
      *
      *  @returns
-     *    an integer representing the output setting of the pin if it is an output, 
+     *    an integer representing the output setting of the pin if it is an output,
      *    or read the input if set as an input
      */
     int read() {
         return gpio_read(&gpio);
     }
-    
+
     /** Set as an output
      */
     void output() {
         gpio_dir(&gpio, PIN_OUTPUT);
     }
-    
+
     /** Set as an input
      */
     void input() {
         gpio_dir(&gpio, PIN_INPUT);
     }
-    
+
     /** Set the input pin mode
      *
      *  @param mode PullUp, PullDown, PullNone, OpenDrain
@@ -79,7 +79,7 @@
     void mode(PinMode pull) {
         gpio_mode(&gpio, pull);
     }
-    
+
 #ifdef MBED_OPERATORS
     /** A shorthand for write()
      */
@@ -87,12 +87,12 @@
         write(value);
         return *this;
     }
-    
+
     DigitalInOut& operator= (DigitalInOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** A shorthand for read()
      */
     operator int() {
--- a/DigitalOut.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/DigitalOut.h	Wed Jan 16 12:56:34 2013 +0000
@@ -33,9 +33,9 @@
  * @code
  * // Toggle a LED
  * #include "mbed.h"
- * 
+ *
  * DigitalOut led(LED1);
- * 
+ *
  * int main() {
  *     while(1) {
  *         led = !led;
@@ -54,26 +54,26 @@
     DigitalOut(PinName pin) {
         gpio_init(&gpio, pin, PIN_OUTPUT);
     }
-    
+
     /** Set the output, specified as 0 or 1 (int)
      *
-     *  @param value An integer specifying the pin output value, 
-     *      0 for logical 0, 1 (or any other non-zero value) for logical 1 
+     *  @param value An integer specifying the pin output value,
+     *      0 for logical 0, 1 (or any other non-zero value) for logical 1
      */
     void write(int value) {
         gpio_write(&gpio, value);
     }
-    
+
     /** Return the output setting, represented as 0 or 1 (int)
      *
      *  @returns
-     *    an integer representing the output setting of the pin, 
+     *    an integer representing the output setting of the pin,
      *    0 for logical 0, 1 for logical 1
      */
     int read() {
         return gpio_read(&gpio);
     }
-    
+
 #ifdef MBED_OPERATORS
     /** A shorthand for write()
      */
@@ -81,12 +81,12 @@
         write(value);
         return *this;
     }
-    
+
     DigitalOut& operator= (DigitalOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** A shorthand for read()
      */
     operator int() {
@@ -100,4 +100,4 @@
 
 } // namespace mbed
 
-#endif 
+#endif
--- a/DirHandle.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/DirHandle.h	Wed Jan 16 12:56:34 2013 +0000
@@ -22,12 +22,14 @@
 #ifndef MBED_DIRHANDLE_H
 #define MBED_DIRHANDLE_H
 
-#ifdef __ARMCC_VERSION
-# define NAME_MAX 255
+#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
+#   define NAME_MAX 255
 typedef int mode_t;
+
 #else
-# include <sys/syslimits.h>
+#   include <sys/syslimits.h>
 #endif
+
 #include "FileHandle.h"
 
 struct dirent {
@@ -41,7 +43,7 @@
  *  at least closedir, readdir and rewinddir.
  *
  *  If a FileSystemLike class defines the opendir method, then the
- *  directories of an object of that type can be accessed by 
+ *  directories of an object of that type can be accessed by
  *  DIR *d = opendir("/example/directory") (or opendir("/example")
  *  to open the root of the filesystem), and then using readdir(d) etc.
  *
@@ -59,7 +61,7 @@
      *   -1 on error.
      */
     virtual int closedir()=0;
-    
+
     /** Return the directory entry at the current position, and
      *  advances the position to the next entry.
      *
@@ -87,7 +89,7 @@
      *  @param location The location to seek to. Must be a value returned by telldir.
      */
     virtual void seekdir(off_t location) { }
-    
+
     virtual ~DirHandle() {}
 };
 
--- a/Ethernet.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/Ethernet.h	Wed Jan 16 12:56:34 2013 +0000
@@ -33,14 +33,14 @@
  * Example:
  * @code
  * // Read destination and source from every ethernet packet
- * 
+ *
  * #include "mbed.h"
  *
  * Ethernet eth;
- *  
+ *
  * int main() {
  *     char buf[0x600];
- *     
+ *
  *     while(1) {
  *         int size = eth.receive();
  *         if(size > 0) {
@@ -50,7 +50,7 @@
  *             printf("Source: %02X:%02X:%02X:%02X:%02X:%02X\n",
  *                     buf[6], buf[7], buf[8], buf[9], buf[10], buf[11]);
  *         }
- *         
+ *
  *         wait(1);
  *     }
  * }
@@ -59,7 +59,7 @@
 class Ethernet {
 
 public:
-    
+
     /** Initialise the ethernet interface.
      */
     Ethernet();
@@ -79,7 +79,7 @@
     /** Writes into an outgoing ethernet packet.
      *
      *  It will append size bytes of data to the previously written bytes.
-     *  
+     *
      *  @param data An array to write.
      *  @param size The size of data.
      *
@@ -101,7 +101,7 @@
 
     /** Recevies an arrived ethernet packet.
      *
-     *  Receiving an ethernet packet will drop the last received ethernet packet 
+     *  Receiving an ethernet packet will drop the last received ethernet packet
      *  and make a new ethernet packet ready to read.
      *  If no ethernet packet is arrived it will return 0.
      *
@@ -117,14 +117,14 @@
      *  possible to read bytes from this packet.
      *  Read will write up to size bytes into data.
      *
-     *  It is possible to use read multible times. 
+     *  It is possible to use read multible times.
      *  Each time read will start reading after the last read byte before.
      *
      *  @returns
      *  The number of byte read.
      */
     int read(char *data, int size);
-    
+
     /** Gives the ethernet address of the mbed.
      *
      *  @param mac Must be a pointer to a 6 byte char array to copy the ethernet address in.
@@ -132,7 +132,7 @@
     void address(char *mac);
 
     /** Returns if an ethernet link is pressent or not. It takes a wile after Ethernet initializion to show up.
-     * 
+     *
      *  @returns
      *   0 if no ethernet link is pressent,
      *   1 if an ethernet link is pressent.
@@ -141,7 +141,7 @@
      * @code
      * // Using the Ethernet link function
      * #include "mbed.h"
-     * 
+     *
      * Ethernet eth;
      *
      * int main() {
--- a/FileBase.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/FileBase.h	Wed Jan 16 12:56:34 2013 +0000
@@ -26,7 +26,7 @@
 
 #include <stdio.h>
 
-#ifdef __ARMCC_VERSION
+#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
 #    define O_RDONLY 0
 #    define O_WRONLY 1
 #    define O_RDWR   2
@@ -58,19 +58,19 @@
 class FileBase {
 public:
     FileBase(const char *name, PathType t);
-    
+
     virtual ~FileBase();
-    
+
     const char* getName(void);
     PathType    getPathType(void);
-    
+
     static FileBase *lookup(const char *name, unsigned int len);
-    
+
     static FileBase *get(int n);
 
-protected: 
+protected:
     static FileBase *_head;
-    
+
     FileBase   *_next;
     const char *_name;
     PathType    _path_type;
--- a/FileHandle.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/FileHandle.h	Wed Jan 16 12:56:34 2013 +0000
@@ -25,14 +25,16 @@
 typedef int FILEHANDLE;
 
 #include <stdio.h>
-#ifdef __ARMCC_VERSION
+
+#if defined(__ARMCC_VERSION) || defined(__ICCARM__)
 typedef int ssize_t;
 typedef long off_t;
+
 #else
-#include <sys/types.h>
+#   include <sys/types.h>
 #endif
 
-namespace mbed { 
+namespace mbed {
 
 /** An OO equivalent of the internal FILEHANDLE variable
  *  and associated _sys_* functions.
@@ -40,7 +42,7 @@
  * FileHandle is an abstract class, needing at least sys_write and
  *  sys_read to be implmented for a simple interactive device.
  *
- * No one ever directly tals to/instanciates a FileHandle - it gets 
+ * No one ever directly tals to/instanciates a FileHandle - it gets
  *  created by FileSystem, and wrapped up by stdio.
  */
 class FileHandle {
@@ -114,7 +116,7 @@
         lseek(pos, SEEK_SET);
         return res;
     }
-    
+
     virtual ~FileHandle();
 };
 
--- a/FileLike.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/FileLike.h	Wed Jan 16 12:56:34 2013 +0000
@@ -41,7 +41,7 @@
      *  name - The name to use to open the file.
      */
     FileLike(const char *name);
-    
+
     virtual ~FileLike();
 };
 
--- a/FilePath.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/FilePath.h	Wed Jan 16 12:56:34 2013 +0000
@@ -32,12 +32,12 @@
 class FilePath {
 public:
     FilePath(const char* file_path);
-    
+
     const char* fileName(void);
-    
+
     bool          isFileSystem(void);
     FileSystemLike* fileSystem(void);
-    
+
     bool    isFile(void);
     FileLike* file(void);
 
--- a/FileSystemLike.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/FileSystemLike.h	Wed Jan 16 12:56:34 2013 +0000
@@ -44,12 +44,12 @@
      *  @param name The name to use for the filesystem.
      */
     FileSystemLike(const char *name);
-    
+
     virtual ~FileSystemLike();
-    
+
     static DirHandle *opendir();
     friend class BaseDirHandle;
-    
+
     /** Opens a file from the filesystem
      *
      *  @param filename The name of the file to open.
@@ -101,7 +101,7 @@
      *   -1 on failure.
      */
     virtual int mkdir(const char *name, mode_t mode) { return -1; }
-    
+
     // TODO other filesystem functions (mkdir, rm, rn, ls etc)
 };
 
--- a/FunctionPointer.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/FunctionPointer.h	Wed Jan 16 12:56:34 2013 +0000
@@ -24,7 +24,7 @@
 
 #include <string.h>
 
-namespace mbed { 
+namespace mbed {
 
 /** A class for storing and calling a pointer to a static or member void function
  */
@@ -32,31 +32,31 @@
 public:
 
     /** Create a FunctionPointer, attaching a static function
-     * 
+     *
      *  @param function The void static function to attach (default is none)
      */
     FunctionPointer(void (*function)(void) = 0);
 
     /** Create a FunctionPointer, attaching a member function
-     * 
+     *
      *  @param object The object pointer to invoke the member function on (i.e. the this pointer)
-     *  @param function The address of the void member function to attach 
+     *  @param function The address of the void member function to attach
      */
     template<typename T>
     FunctionPointer(T *object, void (T::*member)(void)) {
         attach(object, member);
     }
-    
+
     /** Attach a static function
-     * 
+     *
      *  @param function The void static function to attach (default is none)
      */
     void attach(void (*function)(void) = 0);
-    
+
     /** Attach a member function
-     * 
+     *
      *  @param object The object pointer to invoke the member function on (i.e. the this pointer)
-     *  @param function The address of the void member function to attach 
+     *  @param function The address of the void member function to attach
      */
     template<typename T>
     void attach(T *object, void (T::*member)(void)) {
@@ -65,7 +65,7 @@
         _membercaller = &FunctionPointer::membercaller<T>;
         _function = 0;
     }
-    
+
     /** Call the attached static or member function
      */
     void call();
@@ -78,7 +78,7 @@
         memcpy((char*)&m, member, sizeof(m));
         (o->*m)();
     }
-    
+
     void (*_function)(void);                // static function pointer - 0 if none attached
     void *_object;                            // object this pointer - 0 if none attached
     char _member[16];                        // raw member function pointer storage - converted back by registered _membercaller
--- a/I2C.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/I2C.h	Wed Jan 16 12:56:34 2013 +0000
@@ -81,14 +81,14 @@
      * the address is forced to 1 to indicate a read.
      *
      *  @param address 8-bit I2C slave address [ addr | 1 ]
-     *  @param data Pointer to the byte-array to read data in to 
+     *  @param data Pointer to the byte-array to read data in to
      *  @param length Number of bytes to read
      *  @param repeated Repeated start, true - don't send stop at end
      *
      *  @returns
      *       0 on success (ack),
      *   non-0 on failure (nack)
-     */ 
+     */
     int read(int address, char *data, int length, bool repeated = false);
 
     /** Read a single byte from the I2C bus
@@ -106,14 +106,14 @@
      * the address is forced to 0 to indicate a write.
      *
      *  @param address 8-bit I2C slave address [ addr | 0 ]
-     *  @param data Pointer to the byte-array data to send 
+     *  @param data Pointer to the byte-array data to send
      *  @param length Number of bytes to send
      *  @param repeated Repeated start, true - do not send stop at end
      *
      *  @returns
      *       0 on success (ack),
      *   non-0 on failure (nack)
-     */ 
+     */
     int write(int address, const char *data, int length, bool repeated = false);
 
     /** Write single byte out on the I2C bus
@@ -137,7 +137,7 @@
 
 protected:
     void aquire();
-    
+
     i2c_t _i2c;
     static I2C  *_owner;
     int         _hz;
--- a/I2CSlave.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/I2CSlave.h	Wed Jan 16 12:56:34 2013 +0000
@@ -47,7 +47,7 @@
  *     while (1) {
  *         int i = slave.receive();
  *         switch (i) {
- *             case I2CSlave::ReadAddressed: 
+ *             case I2CSlave::ReadAddressed:
  *                 slave.write(msg, strlen(msg) + 1); // Includes null char
  *                 break;
  *             case I2CSlave::WriteGeneral:
@@ -62,7 +62,7 @@
  *         for(int i = 0; i < 10; i++) buf[i] = 0;    // Clear buffer
  *     }
  * }
- * @endcode                  
+ * @endcode
  */
 class I2CSlave {
 
@@ -94,7 +94,7 @@
      *  - NoData            - the slave has not been addressed
      *  - ReadAddressed     - the master has requested a read from this slave
      *  - WriteAddressed    - the master is writing to this slave
-     *  - WriteGeneral      - the master is writing to all slave 
+     *  - WriteGeneral      - the master is writing to all slave
      */
     int receive(void);
 
@@ -107,7 +107,7 @@
      *       0 on success,
      *   non-0 otherwise
      */
-    int read(char *data, int length); 
+    int read(char *data, int length);
 
     /** Read a single byte from an I2C master.
      *
--- a/InterruptIn.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/InterruptIn.h	Wed Jan 16 12:56:34 2013 +0000
@@ -68,13 +68,13 @@
      */
     InterruptIn(PinName pin);
     virtual ~InterruptIn();
-    
+
      int read();
 #ifdef MBED_OPERATORS
     operator int();
 
 #endif
-     
+
     /** Attach a function to call when a rising edge occurs on the input
      *
      *  @param fptr A pointer to a void function, or 0 to set as none
@@ -82,7 +82,7 @@
     void rise(void (*fptr)(void));
 
     /** Attach a member function to call when a rising edge occurs on the input
-     *     
+     *
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      */
@@ -99,7 +99,7 @@
     void fall(void (*fptr)(void));
 
     /** Attach a member function to call when a falling edge occurs on the input
-     *     
+     *
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      */
@@ -114,13 +114,13 @@
      *  @param mode PullUp, PullDown, PullNone
      */
     void mode(PinMode pull);
-    
+
     static void _irq_handler(uint32_t id, gpio_irq_event event);
-    
+
 protected:
     gpio_t gpio;
     gpio_irq_t gpio_irq;
-    
+
     FunctionPointer _rise;
     FunctionPointer _fall;
 };
Binary file LPC11U24/ARM/cmsis_nvic.o has changed
Binary file LPC11U24/ARM/mbed.ar has changed
Binary file LPC11U24/ARM/system_LPC11Uxx.o has changed
--- a/LPC11U24/PinNames.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC11U24/PinNames.h	Wed Jan 16 12:56:34 2013 +0000
@@ -96,9 +96,9 @@
     P1_27 = 59,
     P1_28 = 60,
     P1_29 = 61,
-    
+
     P1_31 = 63,
-    
+
     // mbed DIP Pin Names
     p5  = P0_9,
     p6  = P0_8,
@@ -126,21 +126,21 @@
     p28 = P0_5,
     p29 = P1_5,
     p30 = P1_2,
-    
+
     p33 = P0_3,
     p34 = P1_15,
     p35 = P0_20,
     p36 = P0_21,
-    
+
     // Other mbed Pin Names
     LED1 = P1_8,
     LED2 = P1_9,
     LED3 = P1_10,
     LED4 = P1_11,
-    
+
     USBTX = P0_19,
     USBRX = P0_18,
-    
+
     // Not connected
     NC = (int)0xFFFFFFFF,
 } PinName;
--- a/LPC11U24/device.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC11U24/device.h	Wed Jan 16 12:56:34 2013 +0000
@@ -47,6 +47,7 @@
 
 #define DEVICE_PWMOUT           1
 
+#define DEVICE_SEMIHOST         1
 #define DEVICE_LOCALFILESYSTEM  1
 
 #define DEVICE_SLEEP            1
--- a/LPC11U24/gpio_object.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC11U24/gpio_object.h	Wed Jan 16 12:56:34 2013 +0000
@@ -29,7 +29,7 @@
 typedef struct {
     PinName  pin;
     uint32_t mask;
-    
+
     __IO uint32_t *reg_dir;
     __IO uint32_t *reg_set;
     __IO uint32_t *reg_clr;
Binary file LPC11U24/uARM/cmsis_nvic.o has changed
Binary file LPC11U24/uARM/mbed.ar has changed
Binary file LPC11U24/uARM/system_LPC11Uxx.o has changed
Binary file LPC1768/ARM/cmsis_nvic.o has changed
Binary file LPC1768/ARM/mbed.ar has changed
Binary file LPC1768/ARM/system_LPC17xx.o has changed
Binary file LPC1768/GCC_ARM/cmsis_nvic.o has changed
Binary file LPC1768/GCC_ARM/core_cm3.o has changed
Binary file LPC1768/GCC_ARM/libmbed.a has changed
Binary file LPC1768/GCC_ARM/system_LPC17xx.o has changed
Binary file LPC1768/GCC_CR/libmbed.a has changed
Binary file LPC1768/GCC_CS/libmbed.a has changed
--- a/LPC1768/PeripheralNames.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC1768/PeripheralNames.h	Wed Jan 16 12:56:34 2013 +0000
@@ -66,11 +66,11 @@
     PWM_2,
     PWM_3,
     PWM_4,
-    PWM_5, 
-    PWM_6 
+    PWM_5,
+    PWM_6
 } PWMName;
 
-typedef enum { 
+typedef enum {
      CAN_1 = (int)LPC_CAN1_BASE,
      CAN_2 = (int)LPC_CAN2_BASE
 } CANName;
--- a/LPC1768/PinNames.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC1768/PinNames.h	Wed Jan 16 12:56:34 2013 +0000
@@ -43,9 +43,9 @@
     P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, P2_14, P2_15, P2_16, P2_17, P2_18, P2_19, P2_20, P2_21, P2_22, P2_23, P2_24, P2_25, P2_26, P2_27, P2_28, P2_29, P2_30, P2_31,
     P3_0, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P3_10, P3_11, P3_12, P3_13, P3_14, P3_15, P3_16, P3_17, P3_18, P3_19, P3_20, P3_21, P3_22, P3_23, P3_24, P3_25, P3_26, P3_27, P3_28, P3_29, P3_30, P3_31,
     P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P4_10, P4_11, P4_12, P4_13, P4_14, P4_15, P4_16, P4_17, P4_18, P4_19, P4_20, P4_21, P4_22, P4_23, P4_24, P4_25, P4_26, P4_27, P4_28, P4_29, P4_30, P4_31,
-    
+
     // mbed DIP Pin Names
-    p5 = P0_9, 
+    p5 = P0_9,
     p6 = P0_8,
     p7 = P0_7,
     p8 = P0_6,
@@ -71,7 +71,7 @@
     p28 = P0_10,
     p29 = P0_5,
     p30 = P0_4,
-    
+
     // Other mbed Pin Names
 #ifdef MCB1700
     LED1 = P1_28,
@@ -86,7 +86,7 @@
 #endif
     USBTX = P0_2,
     USBRX = P0_3,
-    
+
     // Not connected
     NC = (int)0xFFFFFFFF
 } PinName;
--- a/LPC1768/device.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC1768/device.h	Wed Jan 16 12:56:34 2013 +0000
@@ -47,9 +47,17 @@
 
 #define DEVICE_PWMOUT           1
 
-#define DEVICE_LOCALFILESYSTEM  1
+#if defined (__ICCARM__)
+#define DEVICE_SEMIHOST         0
+#else
+#define DEVICE_SEMIHOST         1
+#endif
 
-#define DEVICE_SLEEP            0
+#if DEVICE_SEMIHOST
+#define DEVICE_LOCALFILESYSTEM  1
+#endif
+
+#define DEVICE_SLEEP            1
 
 #define DEVICE_DEBUG_AWARENESS  1
 
--- a/LPC1768/gpio_object.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC1768/gpio_object.h	Wed Jan 16 12:56:34 2013 +0000
@@ -29,7 +29,7 @@
 typedef struct {
     PinName  pin;
     uint32_t mask;
-    
+
     __IO uint32_t *reg_dir;
     __IO uint32_t *reg_set;
     __IO uint32_t *reg_clr;
Binary file LPC2368/ARM/mbed.ar has changed
--- a/LPC2368/PeripheralNames.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC2368/PeripheralNames.h	Wed Jan 16 12:56:34 2013 +0000
@@ -26,7 +26,7 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif 
+#endif
 
 typedef enum {
     UART_0 = (int)LPC_UART0_BASE,
@@ -66,11 +66,11 @@
     PWM_2,
     PWM_3,
     PWM_4,
-    PWM_5, 
-    PWM_6 
+    PWM_5,
+    PWM_6
 } PWMName;
 
-typedef enum { 
+typedef enum {
      CAN_1 = (int)LPC_CAN1_BASE,
      CAN_2 = (int)LPC_CAN2_BASE
 } CANName;
--- a/LPC2368/PinNames.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC2368/PinNames.h	Wed Jan 16 12:56:34 2013 +0000
@@ -27,7 +27,7 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif 
+#endif
 
 typedef enum {
     PIN_INPUT,
@@ -44,9 +44,9 @@
     P2_0, P2_1, P2_2, P2_3, P2_4, P2_5, P2_6, P2_7, P2_8, P2_9, P2_10, P2_11, P2_12, P2_13, P2_14, P2_15, P2_16, P2_17, P2_18, P2_19, P2_20, P2_21, P2_22, P2_23, P2_24, P2_25, P2_26, P2_27, P2_28, P2_29, P2_30, P2_31,
     P3_0, P3_1, P3_2, P3_3, P3_4, P3_5, P3_6, P3_7, P3_8, P3_9, P3_10, P3_11, P3_12, P3_13, P3_14, P3_15, P3_16, P3_17, P3_18, P3_19, P3_20, P3_21, P3_22, P3_23, P3_24, P3_25, P3_26, P3_27, P3_28, P3_29, P3_30, P3_31,
     P4_0, P4_1, P4_2, P4_3, P4_4, P4_5, P4_6, P4_7, P4_8, P4_9, P4_10, P4_11, P4_12, P4_13, P4_14, P4_15, P4_16, P4_17, P4_18, P4_19, P4_20, P4_21, P4_22, P4_23, P4_24, P4_25, P4_26, P4_27, P4_28, P4_29, P4_30, P4_31,
-    
+
     // mbed DIP Pin Names
-    p5 = P0_9, 
+    p5 = P0_9,
     p6 = P0_8,
     p7 = P0_7,
     p8 = P0_6,
@@ -72,16 +72,16 @@
     p28 = P0_10,
     p29 = P0_5,
     p30 = P0_4,
-    
+
     // Other mbed Pin Names
     LED1 = P1_18,
     LED2 = P1_20,
     LED3 = P1_21,
     LED4 = P1_23,
-    
+
     USBTX = P0_2,
     USBRX = P0_3,
-    
+
     // Not connected
     NC = (int)0xFFFFFFFF
 } PinName;
--- a/LPC2368/device.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC2368/device.h	Wed Jan 16 12:56:34 2013 +0000
@@ -47,6 +47,7 @@
 
 #define DEVICE_PWMOUT           1
 
+#define DEVICE_SEMIHOST         1
 #define DEVICE_LOCALFILESYSTEM  1
 
 #define DEVICE_SLEEP            0
--- a/LPC2368/gpio_object.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LPC2368/gpio_object.h	Wed Jan 16 12:56:34 2013 +0000
@@ -29,7 +29,7 @@
 typedef struct {
     PinName  pin;
     uint32_t mask;
-    
+
     __IO uint32_t *reg_dir;
     __IO uint32_t *reg_set;
     __IO uint32_t *reg_clr;
--- a/LocalFileSystem.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/LocalFileSystem.h	Wed Jan 16 12:56:34 2013 +0000
@@ -36,19 +36,19 @@
 
 public:
     LocalFileHandle(FILEHANDLE fh);
-    
+
     virtual int close();
-    
+
     virtual ssize_t write(const void *buffer, size_t length);
-    
+
     virtual ssize_t read(void *buffer, size_t length);
-    
+
     virtual int isatty();
-    
+
     virtual off_t lseek(off_t position, int whence);
-    
+
     virtual int fsync();
-    
+
     virtual off_t flen();
 
 protected:
@@ -56,10 +56,10 @@
     int pos;
 };
 
-/** A filesystem for accessing the local mbed Microcontroller USB disk drive 
+/** A filesystem for accessing the local mbed Microcontroller USB disk drive
  *
- *  This allows programs to read and write files on the same disk drive that is used to program the 
- *  mbed Microcontroller. Once created, the standard C file access functions are used to open, 
+ *  This allows programs to read and write files on the same disk drive that is used to program the
+ *  mbed Microcontroller. Once created, the standard C file access functions are used to open,
  *  read and write files.
  *
  * Example:
@@ -70,8 +70,8 @@
  *
  * int main() {
  *     FILE *fp = fopen("/local/out.txt", "w");  // Open "out.txt" on the local file system for writing
- *     fprintf(fp, "Hello World!");              
- *     fclose(fp);                               
+ *     fprintf(fp, "Hello World!");
+ *     fclose(fp);
  *     remove("/local/out.txt");                 // Removes the file "out.txt" from the local file system
  *
  *     DIR *d = opendir("/local");               // Opens the root directory of the local file system
@@ -94,7 +94,7 @@
 
 public:
     LocalFileSystem(const char* n) : FileSystemLike(n) {
-        
+
     }
 
     virtual FileHandle *open(const char* name, int flags);
--- a/PortIn.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/PortIn.h	Wed Jan 16 12:56:34 2013 +0000
@@ -60,11 +60,11 @@
      *
      *  @param port Port to connect to (Port0-Port5)
      *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
-        */ 
+        */
     PortIn(PortName port, int mask = 0xFFFFFFFF) {
         port_init(&_port, port, mask, PIN_INPUT);
     }
-    
+
     /** Read the value currently output on the port
      *
      *  @returns
@@ -73,7 +73,7 @@
     int read() {
         return port_read(&_port);
     }
-    
+
     /** Set the input pin mode
      *
      *  @param mode PullUp, PullDown, PullNone, OpenDrain
@@ -81,10 +81,10 @@
     void mode(PinMode mode) {
         port_mode(&_port, mode);
     }
-    
+
     /** A shorthand for read()
      */
-    operator int() { 
+    operator int() {
         return read();
     }
 
--- a/PortInOut.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/PortInOut.h	Wed Jan 16 12:56:34 2013 +0000
@@ -39,19 +39,19 @@
      *
      *  @param port Port to connect to (Port0-Port5)
      *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
-     */ 
+     */
     PortInOut(PortName port, int mask = 0xFFFFFFFF) {
         port_init(&_port, port, mask, PIN_INPUT);
     }
-    
+
     /** Write the value to the output port
      *
      *  @param value An integer specifying a bit to write for every corresponding port pin
-     */    
+     */
     void write(int value) {
         port_write(&_port, value);
     }
-    
+
     /** Read the value currently output on the port
      *
      *  @returns
@@ -60,19 +60,19 @@
     int read() {
         return port_read(&_port);
     }
-    
+
     /** Set as an output
      */
     void output() {
         port_dir(&_port, PIN_OUTPUT);
     }
-    
+
     /** Set as an input
      */
     void input() {
         port_dir(&_port, PIN_INPUT);
     }
-    
+
     /** Set the input pin mode
      *
      *  @param mode PullUp, PullDown, PullNone, OpenDrain
@@ -80,22 +80,22 @@
     void mode(PinMode mode) {
         port_mode(&_port, mode);
     }
-    
+
     /** A shorthand for write()
-     */    
+     */
     PortInOut& operator= (int value) {
         write(value);
         return *this;
     }
-    
+
     PortInOut& operator= (PortInOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** A shorthand for read()
      */
-    operator int() { 
+    operator int() {
         return read();
     }
 
--- a/PortOut.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/PortOut.h	Wed Jan 16 12:56:34 2013 +0000
@@ -34,7 +34,7 @@
  * Example:
  * @code
  * // Toggle all four LEDs
- * 
+ *
  * #include "mbed.h"
  *
  * // LED1 = P1.18  LED2 = P1.20  LED3 = P1.21  LED4 = P1.23
@@ -51,7 +51,7 @@
  *     }
  * }
  * @endcode
- */  
+ */
 class PortOut {
 public:
 
@@ -59,19 +59,19 @@
      *
      *  @param port Port to connect to (Port0-Port5)
      *  @param mask A bitmask to identify which bits in the port should be included (0 - ignore)
-     */ 
+     */
     PortOut(PortName port, int mask = 0xFFFFFFFF) {
         port_init(&_port, port, mask, PIN_OUTPUT);
     }
-    
+
     /** Write the value to the output port
      *
      *  @param value An integer specifying a bit to write for every corresponding PortOut pin
-     */    
+     */
     void write(int value) {
         port_write(&_port, value);
     }
-    
+
     /** Read the value currently output on the port
      *
      *  @returns
@@ -82,20 +82,20 @@
     }
 
     /** A shorthand for write()
-     */    
-    PortOut& operator= (int value) { 
+     */
+    PortOut& operator= (int value) {
         write(value);
         return *this;
     }
-    
-    PortOut& operator= (PortOut& rhs) { 
+
+    PortOut& operator= (PortOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** A shorthand for read()
      */
-    operator int() { 
+    operator int() {
         return read();
     }
 
--- a/PwmOut.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/PwmOut.h	Wed Jan 16 12:56:34 2013 +0000
@@ -37,7 +37,7 @@
  * #include "mbed.h"
  *
  * PwmOut led(LED1);
- * 
+ *
  * int main() {
  *     while(1) {
  *         led = led + 0.01;
@@ -70,7 +70,7 @@
 
     /** Set the ouput duty-cycle, specified as a percentage (float)
      *
-     *  @param value A floating-point value representing the output duty-cycle, 
+     *  @param value A floating-point value representing the output duty-cycle,
      *    specified as a percentage. The value should lie between
      *    0.0f (representing on 0%) and 1.0f (representing on 100%).
      *    Values outside this range will be saturated to 0.0f or 1.0f.
@@ -82,7 +82,7 @@
     /** Return the current output duty-cycle setting, measured as a percentage (float)
      *
      *  @returns
-     *    A floating-point value representing the current duty-cycle being output on the pin, 
+     *    A floating-point value representing the current duty-cycle being output on the pin,
      *    measured as a percentage. The returned value will lie between
      *    0.0f (representing on 0%) and 1.0f (representing on 100%).
      *
@@ -92,7 +92,7 @@
     float read() {
         return pwmout_read(&_pwm);
     }
-    
+
     /** Set the PWM period, specified in seconds (float), keeping the duty cycle the same.
      *
      *  @note
@@ -140,12 +140,12 @@
         write(value);
         return *this;
     }
-    
+
     PwmOut& operator= (PwmOut& rhs) {
         write(rhs.read());
         return *this;
     }
-    
+
     /** An operator shorthand for read()
      */
     operator float() {
--- a/SPI.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/SPI.h	Wed Jan 16 12:56:34 2013 +0000
@@ -73,11 +73,11 @@
      *  @param mode Clock polarity and phase mode (0 - 3)
      *
      * @code
-     * mode | POL PHA 
-     * -----+--------     
-     *   0  |  0   0 
+     * mode | POL PHA
+     * -----+--------
+     *   0  |  0   0
      *   1  |  0   1
-     *   2  |  1   0 
+     *   2  |  1   0
      *   3  |  1   1
      * @endcode
      */
@@ -100,7 +100,7 @@
 
 protected:
     spi_t _spi;
-    
+
     void aquire(void);
     static SPI *_owner;
     int _bits;
--- a/SPISlave.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/SPISlave.h	Wed Jan 16 12:56:34 2013 +0000
@@ -79,11 +79,11 @@
      *  @param mode Clock polarity and phase mode (0 - 3)
      *
      * @code
-     * mode | POL PHA 
-     * -----+--------     
-     *   0  |  0   0 
+     * mode | POL PHA
+     * -----+--------
+     *   0  |  0   0
      *   1  |  0   1
-     *   2  |  1   0 
+     *   2  |  1   0
      *   3  |  1   1
      * @endcode
      */
@@ -119,7 +119,7 @@
 
 protected:
     spi_t _spi;
-    
+
     int _bits;
     int _mode;
     int _hz;
--- a/Serial.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/Serial.h	Wed Jan 16 12:56:34 2013 +0000
@@ -34,7 +34,7 @@
 
 /** A serial port (UART) for communication with other serial devices
  *
- * Can be used for Full Duplex communication, or Simplex by specifying 
+ * Can be used for Full Duplex communication, or Simplex by specifying
  * one pin as NC (Not Connected)
  *
  * Example:
@@ -55,20 +55,20 @@
 public:
     /** Create a Serial port, connected to the specified transmit and receive pins
      *
-     *  @param tx Transmit pin 
+     *  @param tx Transmit pin
      *  @param rx Receive pin
      *
      *  @note
      *    Either tx or rx may be specified as NC if unused
      */
     Serial(PinName tx, PinName rx, const char *name=NULL);
-    
+
     /** Set the baud rate of the serial port
-     *  
+     *
      *  @param baudrate The baudrate of the serial port (default = 9600).
      */
     void baud(int baudrate);
-    
+
     enum Parity {
         None = 0,
         Odd,
@@ -76,7 +76,7 @@
         Forced1,
         Forced0
     };
-    
+
     enum IrqType {
         RxIrq = 0,
         TxIrq
@@ -89,7 +89,7 @@
      *  @param stop The number of stop bits (1 or 2; default = 1)
      */
     void format(int bits = 8, Parity parity=Serial::None, int stop_bits=1);
-    
+
     /** Determine if there is a character available to read
      *
      *  @returns
@@ -97,24 +97,24 @@
      *    0 otherwise
      */
     int readable();
-    
+
     /** Determine if there is space available to write a character
-     * 
+     *
      *  @returns
      *    1 if there is space to write a character,
      *    0 otherwise
      */
     int writeable();
-    
+
     /** Attach a function to call whenever a serial interrupt is generated
      *
      *  @param fptr A pointer to a void function, or 0 to set as none
      *  @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
      */
     void attach(void (*fptr)(void), IrqType type=RxIrq);
-    
+
     /** Attach a member function to call whenever a serial interrupt is generated
-     *     
+     *
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      *  @param type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
@@ -126,13 +126,13 @@
             serial_irq_set(&_serial, (SerialIrq)type, 1);
         }
     }
-    
+
     static void _irq_handler(uint32_t id, SerialIrq irq_type);
 
 protected:
     virtual int _getc();
     virtual int _putc(int c);
-    
+
     serial_t        _serial;
     FunctionPointer _irq[2];
 };
--- a/Stream.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/Stream.h	Wed Jan 16 12:56:34 2013 +0000
@@ -39,7 +39,7 @@
     char *gets(char *s, int size);
     int printf(const char* format, ...);
     int scanf(const char* format, ...);
-    
+
     operator std::FILE*() {return _file;}
 
 protected:
@@ -53,7 +53,7 @@
 
     virtual int _putc(int c) = 0;
     virtual int _getc() = 0;
-    
+
     std::FILE *_file;
 };
 
--- a/Ticker.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/Ticker.h	Wed Jan 16 12:56:34 2013 +0000
@@ -29,7 +29,7 @@
 
 /** A Ticker is used to call a function at a recurring interval
  *
- *  You can use as many seperate Ticker objects as you require. 
+ *  You can use as many seperate Ticker objects as you require.
  *
  * Example:
  * @code
@@ -40,9 +40,9 @@
  * Ticker timer;
  * DigitalOut led1(LED1);
  * DigitalOut led2(LED2);
- * 
+ *
  * int flip = 0;
- * 
+ *
  * void attime() {
  *     flip = !flip;
  * }
@@ -72,7 +72,7 @@
     void attach(void (*fptr)(void), float t) {
         attach_us(fptr, t * 1000000.0f);
     }
-    
+
     /** Attach a member function to be called by the Ticker, specifiying the interval in seconds
      *
      *  @param tptr pointer to the object to call the member function on
@@ -83,7 +83,7 @@
     void attach(T* tptr, void (T::*mptr)(void), float t) {
         attach_us(tptr, mptr, t * 1000000.0f);
     }
-    
+
     /** Attach a function to be called by the Ticker, specifiying the interval in micro-seconds
      *
      *  @param fptr pointer to the function to be called
@@ -99,13 +99,13 @@
      *  @param tptr pointer to the object to call the member function on
      *  @param mptr pointer to the member function to be called
      *  @param t the time between calls in micro-seconds
-     */    
+     */
     template<typename T>
     void attach_us(T* tptr, void (T::*mptr)(void), unsigned int t) {
         _function.attach(tptr, mptr);
         setup(t);
     }
-    
+
     /** Detach the function
      */
     void detach();
@@ -113,7 +113,7 @@
 protected:
     void setup(unsigned int t);
     virtual void handler();
-    
+
     unsigned int _delay;
     FunctionPointer _function;
 };
--- a/Timeout.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/Timeout.h	Wed Jan 16 12:56:34 2013 +0000
@@ -28,23 +28,23 @@
 
 /** A Timeout is used to call a function at a point in the future
  *
- * You can use as many seperate Timeout objects as you require. 
+ * You can use as many seperate Timeout objects as you require.
  *
  * Example:
  * @code
  * // Blink until timeout.
  *
  * #include "mbed.h"
- * 
+ *
  * Timeout timeout;
  * DigitalOut led(LED1);
- * 
+ *
  * int on = 1;
- * 
+ *
  * void attimeout() {
  *     on = 0;
  * }
- * 
+ *
  * int main() {
  *     timeout.attach(&attimeout, 5);
  *     while(on) {
--- a/Timer.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/Timer.h	Wed Jan 16 12:56:34 2013 +0000
@@ -26,18 +26,18 @@
 
 namespace mbed {
 
-/** A general purpose timer 
+/** A general purpose timer
  *
  * Example:
  * @code
  * // Count the time to toggle a LED
  *
  * #include "mbed.h"
- * 
+ *
  * Timer timer;
  * DigitalOut led(LED1);
  * int begin, end;
- * 
+ *
  * int main() {
  *     timer.start();
  *     begin = timer.read_us();
@@ -51,16 +51,16 @@
 
 public:
     Timer();
-    
+
     /** Start the timer
      */
-    void start(); 
+    void start();
 
     /** Stop the timer
      */
-    void stop(); 
+    void stop();
 
-    /** Reset the timer to 0. 
+    /** Reset the timer to 0.
      *
      * If it was already counting, it will continue
      */
@@ -78,7 +78,7 @@
      */
     int read_us();
 
-#ifdef MBED_OPERATORS 
+#ifdef MBED_OPERATORS
     operator float();
 #endif
 
--- a/TimerEvent.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/TimerEvent.h	Wed Jan 16 12:56:34 2013 +0000
@@ -31,11 +31,11 @@
 class TimerEvent {
 public:
     TimerEvent();
-    
+
     /** The handler registered with the underlying timer interrupt
      */
     static void irq(uint32_t id);
-    
+
     /** Destruction removes it...
      */
     virtual ~TimerEvent();
@@ -43,13 +43,13 @@
 protected:
     // The handler called to service the timer event of the derived class
     virtual void handler() = 0;
-    
+
     // insert in to linked list
     void insert(unsigned int timestamp);
-    
+
     // remove from linked list, if in it
     void remove();
-    
+
     ticker_event_t event;
 };
 
--- a/can_api.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/can_api.h	Wed Jan 16 12:56:34 2013 +0000
@@ -26,7 +26,7 @@
 
 #if DEVICE_CAN
 
-#include "PinNames.h" 
+#include "PinNames.h"
 #include "PeripheralNames.h"
 #include "can_helper.h"
 
--- a/error.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/error.h	Wed Jan 16 12:56:34 2013 +0000
@@ -46,12 +46,12 @@
  * error("That shouldn't have happened!");
  * @endcode
  *
- * If the mbed running the program executes this function, it will print the 
+ * If the mbed running the program executes this function, it will print the
  * message via the USB serial port, and then die with the blue lights of death!
  *
- * The message can use printf-style formatting, so you can report variables in the 
+ * The message can use printf-style formatting, so you can report variables in the
  * message too. For example, you could use this to check a run-time condition:
- * 
+ *
  * @code
  * if(x >= 5) {
  *     error("expected x to be less than 5, but got %d", x);
--- a/i2c_api.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/i2c_api.h	Wed Jan 16 12:56:34 2013 +0000
@@ -36,7 +36,7 @@
 void i2c_frequency    (i2c_t *obj, int hz);
 int  i2c_start        (i2c_t *obj);
 void i2c_stop         (i2c_t *obj);
-int  i2c_read         (i2c_t *obj, int address, char *data, int length, int stop); 
+int  i2c_read         (i2c_t *obj, int address, char *data, int length, int stop);
 int  i2c_write        (i2c_t *obj, int address, const char *data, int length, int stop);
 void i2c_reset        (i2c_t *obj);
 int  i2c_byte_read    (i2c_t *obj, int last);
--- a/mbed.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/mbed.h	Wed Jan 16 12:56:34 2013 +0000
@@ -62,6 +62,7 @@
 #include "LocalFileSystem.h"
 #include "InterruptIn.h"
 #include "wait_api.h"
+#include "sleep_api.h"
 #include "rtc_time.h"
 
 using namespace mbed;
--- a/mbed_debug.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/mbed_debug.h	Wed Jan 16 12:56:34 2013 +0000
@@ -32,7 +32,7 @@
 #include <stdarg.h>
 
 /** Output a debug message
- * 
+ *
  * @param format printf-style format string, followed by variables
  */
 static inline void debug(const char *format, ...) {
@@ -41,12 +41,12 @@
     vfprintf(stderr, format, args);
     va_end(args);
 }
- 
+
 /** Conditionally output a debug message
- * 
+ *
  * NOTE: If the condition is constant false (!= 1) and the compiler optimization
  * level is greater than 0, then the whole function will be compiled away.
- * 
+ *
  * @param condition output only if condition is true (== 1)
  * @param format printf-style format string, followed by variables
  */
--- a/mbed_interface.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/mbed_interface.h	Wed Jan 16 12:56:34 2013 +0000
@@ -22,20 +22,24 @@
 #ifndef MBED_INTERFACE_H
 #define MBED_INTERFACE_H
 
+#include "device.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+#if DEVICE_SEMIHOST
+
 /** Functions to control the mbed interface
  *
- * mbed Microcontrollers have a built-in interface to provide functionality such as 
- * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file 
+ * mbed Microcontrollers have a built-in interface to provide functionality such as
+ * drag-n-drop download, reset, serial-over-usb, and access to the mbed local file
  * system. These functions provide means to control the interface suing semihost
  * calls it supports.
  */
 
 /** Determine whether the mbed interface is connected, based on whether debug is enabled
- * 
+ *
  *  @returns
  *    1 if interface is connected,
  *    0 otherwise
@@ -59,9 +63,9 @@
  */
 int mbed_interface_disconnect(void);
 
-/** This will disconnect the debug aspect of the interface, and if the USB cable is not 
+/** This will disconnect the debug aspect of the interface, and if the USB cable is not
  * connected, also power down the interface. If the USB cable is connected, the interface
- * will remain powered up and visible to the host 
+ * will remain powered up and visible to the host
  *
  *  @returns
  *    0 if successful,
@@ -80,6 +84,8 @@
  */
 int mbed_interface_uid(char *uid);
 
+#endif
+
 /** This returns a unique 6-byte MAC address, based on the interface UID
  * If the interface is not present, it returns a default fixed MAC address (00:02:F7:F0:00:00)
  *
@@ -90,7 +96,7 @@
  */
 void mbed_mac_address(char *mac);
 
-/** Cause the mbed to flash the BLOD LED sequence
+/** Cause the mbed to flash the BLOD (Blue LEDs Of Death) sequence
  */
 void mbed_die(void);
 
--- a/pwmout_api.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/pwmout_api.h	Wed Jan 16 12:56:34 2013 +0000
@@ -28,7 +28,7 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif 
+#endif
 
 typedef struct pwmout_s pwmout_t;
 
--- a/rtc_api.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/rtc_api.h	Wed Jan 16 12:56:34 2013 +0000
@@ -30,7 +30,7 @@
 
 #ifdef __cplusplus
 extern "C" {
-#endif 
+#endif
 
 void rtc_init(void);
 void rtc_free(void);
--- a/rtc_time.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/rtc_time.h	Wed Jan 16 12:56:34 2013 +0000
@@ -29,8 +29,8 @@
 /** Implementation of the C time.h functions
  *
  * Provides mechanisms to set and read the current time, based
- * on the microcontroller Real-Time Clock (RTC), plus some 
- * standard C manipulation and formating functions. 
+ * on the microcontroller Real-Time Clock (RTC), plus some
+ * standard C manipulation and formating functions.
  *
  * Example:
  * @code
@@ -38,18 +38,18 @@
  *
  * int main() {
  *     set_time(1256729737);  // Set RTC time to Wed, 28 Oct 2009 11:35:37
- *      
- *     while(1) {    
+ *
+ *     while(1) {
  *         time_t seconds = time(NULL);
- *         
+ *
  *         printf("Time as seconds since January 1, 1970 = %d\n", seconds);
- *  
+ *
  *         printf("Time as a basic string = %s", ctime(&seconds));
  *
  *         char buffer[32];
  *         strftime(buffer, 32, "%I:%M %p\n", localtime(&seconds));
  *         printf("Time as a custom formatted string = %s", buffer);
- *    
+ *
  *         wait(1);
  *     }
  * }
@@ -59,10 +59,10 @@
 /** Set the current time
  *
  * Initialises and sets the time of the microcontroller Real-Time Clock (RTC)
- * to the time represented by the number of seconds since January 1, 1970 
- * (the UNIX timestamp). 
- * 
- * @param t Number of seconds since January 1, 1970 (the UNIX timestamp) 
+ * to the time represented by the number of seconds since January 1, 1970
+ * (the UNIX timestamp).
+ *
+ * @param t Number of seconds since January 1, 1970 (the UNIX timestamp)
  *
  * Example:
  * @code
@@ -72,7 +72,7 @@
  *     set_time(1256729737); // Set time to Wed, 28 Oct 2009 11:35:37
  * }
  * @endcode
- */ 
+ */
 void set_time(time_t t);
 
 #ifdef __cplusplus
--- a/semihost_api.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/semihost_api.h	Wed Jan 16 12:56:34 2013 +0000
@@ -29,6 +29,7 @@
 extern "C" {
 #endif
 
+#if DEVICE_SEMIHOST
 /* __semihost intrinsic
  This intrinsic inserts an SVC or BKPT instruction into the instruction stream
  generated by the compiler. It enables you to make semihosting calls from C or
@@ -41,17 +42,13 @@
 
 /* SWI numbers for RDI (Angel) monitors */
 #ifdef __thumb__
-#define AngelSWI            0xAB
+#   define AngelSWI            0xAB
+#   define AngelSWIInsn        "bkpt"
+#   define AngelSWIAsm          bkpt
 #else
-#define AngelSWI            0x123456
-#endif
-/* For Thumb-2 code use the BKPT instruction instead of SWI */
-#ifdef __thumb2__
-#define AngelSWIInsn        "bkpt"
-#define AngelSWIAsm          bkpt
-#else
-#define AngelSWIInsn        "swi"
-#define AngelSWIAsm          swi
+#   define AngelSWI            0x123456
+#   define AngelSWIInsn        "swi"
+#   define AngelSWIAsm          swi
 #endif
 
 inline int __semihost(int reason, const void *arg) {
@@ -66,7 +63,7 @@
                    changed by a system call, so they should not be kept in
                    registers. Note: we are assuming the manual is right and
                    Angel is respecting the APCS.  */
-    
+
     return value;
 }
 
@@ -95,6 +92,8 @@
 int semihost_connected(void);
 int semihost_disabledebug(void);
 
+#endif
+
 #ifdef __cplusplus
 }
 #endif
--- a/serial_api.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/serial_api.h	Wed Jan 16 12:56:34 2013 +0000
@@ -65,7 +65,7 @@
 
 #ifdef __cplusplus
 }
-#endif 
+#endif
 
 #endif
 
--- a/sleep_api.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/sleep_api.h	Wed Jan 16 12:56:34 2013 +0000
@@ -31,31 +31,31 @@
 #endif
 
 /** Send the microcontroller to sleep
- * 
+ *
  * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
- * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates 
- * dynamic power used by the processor, memory systems and buses. The processor, peripheral and 
+ * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
+ * dynamic power used by the processor, memory systems and buses. The processor, peripheral and
  * memory state are maintained, and the peripherals continue to work and can generate interrupts.
- * 
+ *
  * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
- * 
+ *
  * @note
- *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. 
+ *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
  * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
  * able to access the LocalFileSystem
  */
 void sleep(void);
 
 /** Send the microcontroller to deep sleep
- * 
+ *
  * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
  * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
- * is still maintained. 
- * 
+ * is still maintained.
+ *
  * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
- * 
+ *
  * @note
- *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. 
+ *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
  * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
  * able to access the LocalFileSystem
  */
--- a/spi_api.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/spi_api.h	Wed Jan 16 12:56:34 2013 +0000
@@ -44,7 +44,7 @@
 
 #ifdef __cplusplus
 }
-#endif 
+#endif
 
 #endif
 
--- a/toolchain.h	Tue Jan 08 12:46:36 2013 +0000
+++ b/toolchain.h	Wed Jan 16 12:56:34 2013 +0000
@@ -30,4 +30,12 @@
 typedef int FILEHANDLE;
 #endif
 
+#if defined (__ICCARM__)
+#   define WEAK     __weak
+#   define PACKED   __packed
+#else
+#   define WEAK     __attribute__((weak))
+#   define PACKED   __attribute__((packed))
 #endif
+
+#endif