diff --git a/docs/APIs/communication/ble.md b/docs/APIs/communication/ble.md new file mode 100644 index 0000000000..07c47dbd8d --- /dev/null +++ b/docs/APIs/communication/ble.md @@ -0,0 +1 @@ +# Communication options \ No newline at end of file diff --git a/docs/APIs/communication/communication.md b/docs/APIs/communication/communication.md new file mode 100644 index 0000000000..07c47dbd8d --- /dev/null +++ b/docs/APIs/communication/communication.md @@ -0,0 +1 @@ +# Communication options \ No newline at end of file diff --git a/docs/APIs/communication/ethernet.md b/docs/APIs/communication/ethernet.md new file mode 100644 index 0000000000..07c47dbd8d --- /dev/null +++ b/docs/APIs/communication/ethernet.md @@ -0,0 +1 @@ +# Communication options \ No newline at end of file diff --git a/docs/APIs/communication/network_stack.md b/docs/APIs/communication/network_stack.md new file mode 100644 index 0000000000..07c47dbd8d --- /dev/null +++ b/docs/APIs/communication/network_stack.md @@ -0,0 +1 @@ +# Communication options \ No newline at end of file diff --git a/docs/APIs/communication/radio.md b/docs/APIs/communication/radio.md new file mode 100644 index 0000000000..07c47dbd8d --- /dev/null +++ b/docs/APIs/communication/radio.md @@ -0,0 +1 @@ +# Communication options \ No newline at end of file diff --git a/docs/APIs/communication/wifi.md b/docs/APIs/communication/wifi.md new file mode 100644 index 0000000000..07c47dbd8d --- /dev/null +++ b/docs/APIs/communication/wifi.md @@ -0,0 +1 @@ +# Communication options \ No newline at end of file diff --git a/docs/APIs/interfaces/USBDevice/USBAudio.md b/docs/APIs/interfaces/USBDevice/USBAudio.md new file mode 100644 index 0000000000..e591b73f21 --- /dev/null +++ b/docs/APIs/interfaces/USBDevice/USBAudio.md @@ -0,0 +1,53 @@ +# USBAudio + +The USBAudio class enables the mbed to be recognized as an audio device. With this interface, you can receive and send audio packets from and to a computer (play music) over USB. For instance you can connect a speaker or an I2S/I2C chip to the mbed and play the stream received from the computer. + +The USB connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768 and the LPC11U24** +* The on-board USB connector of the **FRDM-KL25Z** + +**Warning:** Change the default sound board
To send audio packets to the mbed, you have to change the default sound board used by the Operating system.
+On Windows, you can do this by clicking on: **Control panel** > **Hardware and Sound** > **Manage audio device** in the Sound section > Select the mbed Audio device and press **Set default**
+ +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBAudio_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBAudio_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=) + +## More examples + +The following program is sending to a speaker all audio packets received. This means that you can play a music on your computer and listen it on your Mbed. + +[![View code](https://www.mbed.com/embed/?url=) + +The USBAudio playback example sends back to the computer all audio packets received. You can then listen for incoming audio packets with [audacity](http://audacity.sourceforge.net/) for instance. + +[![View code](https://www.mbed.com/embed/?url=) + +## In details + +### Audio packet length + +In this section, I will explain what kind of packets are received according to the frequency and the number of channels. + +An audio packet is received each millisecond. So let's say that a frequency of 48 kHz has been chosen with 2 channels (stereo). Knowing that each sample of a packet are 16 bits long, 48 * 2 bytes will be received each millisecond for one channel. In total, for 2 channels, 48 * 2 * 2 bytes will be received. + +**Tip:** Compute the length packet
``AUDIO_LENGTH_PACKET = (FREQ / 500) * nb_channel``
+ +### How to interpret an audio packet + +The read() function fills an uint8_t array. But these data has to be interpreted as 16 bits signed data (PCM). Then PCM values can be handled according to the number of channels. + +### MONO: single channel + +![](../../Images/mono.png) + +### STEREO: 2 channels + +When there are 2 channels, values for channel 1 and values for channel 2 will alternate as explained in the following diagram: + +![](../../Images/stereo.png) diff --git a/docs/APIs/interfaces/USBDevice/USBDevice.md b/docs/APIs/interfaces/USBDevice/USBDevice.md new file mode 100644 index 0000000000..5951b8d4b4 --- /dev/null +++ b/docs/APIs/interfaces/USBDevice/USBDevice.md @@ -0,0 +1,79 @@ +## USB Device + +The Universal Serial Bus (USB) is the most widely used bus in today's computer. USB has particularly been designed to standardize connections between the computer and peripherals. For instance, keyboards, mice, USB audio devices, printers, scanners, disk drives or cameras can use the same bus to exchange data with a computer. + +A USB device stack has been developed in order to provide all the great capabilities of USB to mbed. + +# Boards supporting USB Device + +LPC1768 | LPC11U24 | FRDM-KL25Z +---|---|--- +![](../../Images/lpc1768_usb.png) | ![](../../Images/LPC11U24_usb.png) | ![](../../Images/FRDM_KL25Z.png) | + +![](../../Images/mbed_usb_drawing.png) + +# mbed as a USB device + +![](../../Images/capa2.png) + +## Mouse + +The USBMouse class allows to emulate a mouse with your mbed. You can either chose a relative or absolute mouse. This class allows you to: + +* Move the cursor on the screen +* Click +* Scroll + +For more information, please visit [USBMouse](USBMouse.md). + +## Keyboard + +The USBKeyboard class allows to use mbed as a keyboard. You can: + +* Send basic keys +* Send "modified keys" such as: CTRL + 'c' +* Send media keys (Mute, Volume Up, Volume Down, next track, ...) + +For more information, please visit [USBKeyboard](USBKeyboard.md). + +## Mouse and Keyboard + +If you want to have all capabilities from a mouse and a keyboard at the same time, you can use the USBMouseKeyboard class. + +For more information, please visit [USBMouseKeyboard](USBMouseKeyboard.md). + +## Human Interface Device (HID) + +The USBHID class is a great opportunity to send and receive raw data to a custom program. This allows you to design your own USB device without any specific drivers on the host side as all operating systems have a built-in HID driver. + +For more information, please visit [USBHID](USBHID.md). + +## USBSerial + +The USBSerial class uses the USB interface to emulate a serial port. The mbed is recognized by the computer as a serial port. This is a great solution to communicate easily between the microcontroller and a computer. + +For more information, please visit [USBSerial](USBSerial.md). + +## USBMIDI + +Using this library, you can do things like send MIDI messages to a computer (such as to record in a sequencer, or trigger a software synthesiser) and receive messages from a computer (such as actuate things based on MIDI events). + +For more information, please visit [USBMIDI](USBMIDI.md). + +## USBAudio + +The USBAudio class enables the mbed to be recognized as an audio device. With this interface, you can receive audio packet from the computer (play music) and receive them over USB. For instance you connect a speaker or an I2S/I2C chip to the mbed and play the stream received from the computer. + +## USBMSD + +The USBMSD interface is used to emulate a mass storage device over USB. You can use this class to store or load data to and from a storage chip (SDcard, flash,...). This class implements the MSD protocol and calls pure virtual functions such as **disk_initialize**, **disk_write** or **disk_read** to interact with a storage chip. + +For more information, please visit [USBMSD](USBMSD.md). + +## USB HID Bindings + +[USBHID bindings](http://mbed.org/cookbook/USBHID-bindings-) - Design your own USB device on top of USBHID class by developing programs in different languages and running on different platforms. + +# More information + +If you want information concerning the stack architecture, visit the [USBDevice stack architecture](http://mbed.org/users/samux/notebook/usbdevice-stack-architecture/). diff --git a/docs/APIs/interfaces/USBDevice/USBHID.md b/docs/APIs/interfaces/USBDevice/USBHID.md new file mode 100644 index 0000000000..c1bf05cddc --- /dev/null +++ b/docs/APIs/interfaces/USBDevice/USBHID.md @@ -0,0 +1,63 @@ +# USBHID + +The USBHID class can be used to send and receive messages over USB. For instance, you can define your own protocol and communicate between your computer and the Mbed with all capabilities of a USB communication. To use USBHID, you need a script running on the host side (computer). For instance on a 32 bits Windows 7 machine, you can use [pywinusb](http://code.google.com/p/pywinusb/). + +The USB connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768 and the LPC11U24** +* The on-board USB connector of the **FRDM-KL25Z** + +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBHID_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBHID_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=) + +## Details + +You can choose the length of exchanged packets. In this example, mbed leds are controlled by four switches. When you press a button, there is a message sent containing buttons state. According to this message, the mbed will receive back a new message to light on leds. +We need one byte to control leds and one byte to send buttons state. + +``` +#include "mbed.h" +#include "USBHID.h" + +//We declare a USBHID device: it can send 1 byte and receive 1 byte +USBHID hid(1, 1); + +//Two reports where will be stored values to send and received +HID_REPORT recv_report; +HID_REPORT send_report; + +//Bus of leds +BusOut leds(LED1,LED2,LED3,LED4); + +//Bus of buttons +BusInOut buttons(p21, p22, p23, p24); + +int main(void) { + uint8_t p_bus = 0; + send_report.length = 1; + + while (1) { + //If a data is received, update led bus + if (hid.readNB(&recv;_report)) { + leds = recv_report.data[0]; + } + + //if the bus of buttons has changed, send a report + if (buttons.read() != p_bus) { + p_bus = buttons.read(); + send_report.data[0] = p_bus; + hid.send(&send;_report); + } + wait(0.01); + } +} +``` + +## Contribute to the USBHID bindings webpage! + +A great thing would be to develop in several languages running on different platforms, programs able to communicate with the mbed over USB. Visit the [USBHID bindings webpage](http://mbed.org/cookbook/USBHID-bindings-) and develop your own USBHID device! diff --git a/docs/APIs/interfaces/USBDevice/USBKeyboard.md b/docs/APIs/interfaces/USBDevice/USBKeyboard.md new file mode 100644 index 0000000000..fb061c4519 --- /dev/null +++ b/docs/APIs/interfaces/USBDevice/USBKeyboard.md @@ -0,0 +1,59 @@ +# USBKeyboard + + +[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/NKSlkUcoOjY/0.jpg)](http://www.youtube.com/watch?v=NKSlkUcoOjY) + +The USBKeyboard interface is used to emulate a keyboard over the USB port. You can type strings and send keycodes, send keys with modifiers (e.g. CTRL + 's'), function keys and also the media control keys + +The USB connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768 and the LPC11U24** +* The on-board USB connector of the **FRDM-KL25Z** + +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBKeyboard_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBKeyboard_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=) + +## More examples + +Program which controls sound and tracks of your playlist with switches: + +``` +#include "mbed.h" +#include "USBKeyboard.h" + +USBKeyboard keyboard; + +//Bus of buttons +BusInOut buttons(p21, p22, p23, p24, p25, p26, p29); + +int main(void) { + uint8_t p_bus = 0; + + while (1) { + //if the bus of buttons has changed, send a report + if (buttons.read() != p_bus) { + p_bus = buttons.read(); + if(p_bus & 0x01) + keyboard.mediaControl(KEY_MUTE); + if(p_bus & 0x02) + keyboard.mediaControl(KEY_VOLUME_DOWN); + if(p_bus & 0x04) + keyboard.mediaControl(KEY_VOLUME_UP); + if(p_bus & 0x08) + keyboard.mediaControl(KEY_NEXT_TRACK); + if(p_bus & 0x10) + keyboard.mediaControl(KEY_PLAY_PAUSE); + if(p_bus & 0x20) + keyboard.mediaControl(KEY_PREVIOUS_TRACK); + if(p_bus & 0x40) + keyboard.printf("Hello World\r\n"); + } + wait(0.01); + } +} +``` diff --git a/docs/APIs/interfaces/USBDevice/USBMIDI.md b/docs/APIs/interfaces/USBDevice/USBMIDI.md new file mode 100644 index 0000000000..25a091aa12 --- /dev/null +++ b/docs/APIs/interfaces/USBDevice/USBMIDI.md @@ -0,0 +1,26 @@ +# USBMIDI + +[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/pRiYQ6Dv-uY/0.jpg)](http://www.youtube.com/watch?v=pRiYQ6Dv-uY) + +The USBMIDI interface can be used to send and receive MIDI messages over USB using the standard USB-MIDI protocol. + +Using this library, you can do things like send MIDI messages to a computer (such as to record in a sequencer, or trigger a software synthesiser) and receive messages from a computer (such as actuate things based on MIDI events) + +The USB connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768 and the LPC11U24** +* The on-board USB connector of the **FRDM-KL25Z** + +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBMIDI_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBMIDI_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=) + +## More example + +In this example, you can control the MIDI message sent with buttons + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBMIDI_Receive/)](https://developer.mbed.org/users/samux/code/USBMIDI_Receive/file/tip/main.cpp) diff --git a/docs/APIs/interfaces/USBDevice/USBMSD.md b/docs/APIs/interfaces/USBDevice/USBMSD.md new file mode 100644 index 0000000000..8fa7f99989 --- /dev/null +++ b/docs/APIs/interfaces/USBDevice/USBMSD.md @@ -0,0 +1,48 @@ +# USBMSD + +The USBMSD interface is used to emulate a mass storage device over USB. You can use this class to store or load data to and from a storage chip (SDcard, flash,...). This class implements the MSD protocol and calls pure virtual functions such as ``disk_initialize``, ``disk_write`` or ``disk_read`` to interact with a storage chip. More information on how to use this class with your own chip can be found at the end of this document. + +## Hardware + +The USB connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768 and the LPC11U24** +* The on-board USB connector of the **FRDM-KL25Z** + +LPC1768 | LPC11U24| FRDM-KL25Z +---|---|--- +![](../../Images/lpc1768_usbmsd.png) | ![](../../Images/lpc11us4_usbmsd.png) | ![](../../Images/kl25z_usbmsd.png) + +## Hello World! with an SD card + +The following program has been tested with a micro SD card(Transcend micro SD 1GB). + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBMSD_SD_HelloWorld_Mbed/)](https://developer.mbed.org/users/samux/code/USBMSD_SD_HelloWorld_Mbed/file/tip/main.cpp) + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBMSD_SD_HelloWorld_FRDM-KL25Z/)](https://developer.mbed.org/users/samux/code/USBMSD_SD_HelloWorld_FRDM-KL25Z/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=) + +## How to use USBMSD with your own chip ? + +The USBMSD class implements the MSD protocol. It permits to access a memory chip (flash, sdcard,...) from a computer over USB. But this class doesn't work standalone, you need to subclass this class and define pure virtual functions which are called in USBMSD. + +You have to inherit from USBMSD and define **ALL** the following pure virtual functions: + +* virtual ``int disk_read(uint8_t * data, uint64_t block)``: function to read a block +* virtual ``int disk_write(const uint8_t * data, uint64_t block)``: function to write a block +* virtual ``int disk_initialize()``: function to initialize the memory +* virtual ``uint64_t disk_sectors()``: return the number of blocks +* virtual ``uint64_t disk_size()``: return the memory size +* virtual ``int disk_status()``: return the status of the storage chip (0: OK, 1: not initialized, 2: no medium in the drive, 4: write protection) + +All functions names are compatible with the fat filesystem library. So you can imagine using your own class with USBMSD and the fat filesystem library in the same program. Just be careful because there are two different parts which will access the sd card. You can do a master/slave system using ``disk_status()``. + +Once these functions defined, you can call ``connect()`` (at the end of the constructor of your class for instance) of USBMSD to connect your mass storage device. ``connect()`` will first call ``disk_status()`` to test the status of the disk. If ``disk_status()`` returns 1 (disk not initialized), then ``disk_initialize()`` is called. After this step, ``connect()`` will collect information such as the number of blocks and the memory size. + +A class example which inherits from USBMSD has been developed in order to access an SD card. You can follow this example and write your own class to access your storage chip. + +[![View code](https://www.mbed.com/embed/?url=) + diff --git a/docs/APIs/interfaces/USBDevice/USBMouse.md b/docs/APIs/interfaces/USBDevice/USBMouse.md new file mode 100644 index 0000000000..e12eb44bdb --- /dev/null +++ b/docs/APIs/interfaces/USBDevice/USBMouse.md @@ -0,0 +1,54 @@ +# USBMouse + +[![IMAGE ALT TEXT HERE](http://img.youtube.com/vi/1lSjP6E7RV4/0.jpg)](http://www.youtube.com/watch?v=1lSjP6E7RV4) + +The USBMouse interface is used to emulate a mouse over the USB port. You can choose relative or absolute co-ordinates, and send clicks, button state and scroll wheel movements. + +The USB connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768 and the LPC11U24** +* The on-board USB connector of the **FRDM-KL25Z** + +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBMouse_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBMouse_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=) + +## Details + +You can choose either a relative mouse or an absolute mouse. By default, a USBMouse is a relative mouse. For instance, you can use an absolute mouse to draw a circle: + +``` + #include "mbed.h" + #include "USBMouse.h" + + USBMouse mouse(ABS_MOUSE); + + #include + + int main(void) + { + uint16_t x_center = (X_MAX_ABS - X_MIN_ABS)/2; + uint16_t y_center = (Y_MAX_ABS - Y_MIN_ABS)/2; + uint16_t x_screen = 0; + uint16_t y_screen = 0; + + uint32_t x_origin = x_center; + uint32_t y_origin = y_center; + uint32_t radius = 5000; + uint32_t angle = 0; + + while (1) + { + x_screen = x_origin + cos((double)angle*3.14/180.0)*radius; + y_screen = y_origin + sin((double)angle*3.14/180.0)*radius; + + mouse.move(x_screen, y_screen); + angle += 3; + wait(0.01); + } + } +``` diff --git a/docs/APIs/interfaces/USBDevice/USBMouseKeyboard.md b/docs/APIs/interfaces/USBDevice/USBMouseKeyboard.md new file mode 100644 index 0000000000..af05c31e5b --- /dev/null +++ b/docs/APIs/interfaces/USBDevice/USBMouseKeyboard.md @@ -0,0 +1,21 @@ +# USBMouseKeyboard + +The USBMouseKeyboard interface is used to emulate a mouse and a keyboard at the same time over the USB port. + +The USB connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768 and the LPC11U24** +* The on-board USB connector of the **FRDM-KL25Z** + +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBMouseKeyboard_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBMouseKeyboard_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=) + +## Details + +You can choose either a relative mouse or an absolute mouse with the keyboard. By default, a USBMouseKeyboard is a relative mouse and a keyboard + diff --git a/docs/APIs/interfaces/USBDevice/USBSerial.md b/docs/APIs/interfaces/USBDevice/USBSerial.md new file mode 100644 index 0000000000..02fad2cbc3 --- /dev/null +++ b/docs/APIs/interfaces/USBDevice/USBSerial.md @@ -0,0 +1,49 @@ +# USBSerial + +The USBSerial interface is used to emulate a serial port over USB. You can use this serial port as an extra serial port or as a debug solution. It's also a great solution to easily communicate between your mbed and a computer. + +The USB connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768 and the LPC11U24** +* The on-board USB connector of the **FRDM-KL25Z** + +**Note:** On Windows, you need a configuration file. You can download this [archive](https://developer.mbed.org/media/uploads/samux/serial.zip) containing a .inf file. Extract it. +When you plug your USBSerial serial device, Windows will try to find an existing driver for it without success. After this step, go into the device manager to find the unknown device:
+- Right click on the device +- Update driver software +- Click on "Browse my computer for driver software" +- Indicate the path of serial.inf extracted previously and click next. +- Accept the warning and you should have a virtual port (called Mbed Virtual Serial Port in device manager) over USB!
+As _product_id_ and _vendor_id_ are hardcoded in the .inf file, if you don't want to use default values, you will have to change them in your program _AND_ in the .inf file. +
+ +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBSerial_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBSerial_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=**Warning:** Library in Beta!
This library is in Beta. If you have any problems using the USBHost library, please send a bug report at [support@mbed.org](support@mbed.org) + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/USBHost/) + +# Boards supporting USB Host + +**LPC1768** + +![](../../Images/LPC1768_pic.png) + +![](../../Images/LPC1768_drawing.png) + +# Mbed as USB Host + +## USBHostMouse + +The USBHostMouse class allows to communicate with a USB mouse: + +* read mouse position +* read buttons state +* read scroll state + +For more information, please visit [USBHostMouse](USBHostMouse.md). + +## USBHostKeyboard + +The USBHostKeyboard class allows to communicate with a USB keyboard: + +* read keycode pressed +* read modifier pressed + +For more information, please visit [USBHostKeyboard](USBHostKeyboard.md). + +## USBHostMSD + +The USBHostMSD interface is used to read/write a USB flash drive. + +For more information, please visit [USBHostMSD](USBHostMSD.md). + +## USBHostSerial + +The USBHostSerial class uses the USB interface to communicate with a virtual serial port usb device. + +For more information, please visit [USBHostSerial](USBHostSerial.md). + +## USBHostHub + +You can connect several devices to your mbed using a USB hub. Hubs are automatically detected by the USBHost stack so no need to change your programs if you are using a hub! + +For more information, please visit [USBHostHub](USBHostHub.md). + +# Library in development + +This library is currently in development. + +* Currently the stack supports: + * Mouse class + * Keyboard class + * MSD class + * Serial class + * Hub auto detection +* What can be developed: + * Support of isochronous endpoints + * Bluetooth class + * Webcam class + * And so on + +# Contribution + +It would be great if the USBHost stack development involves several developers. There is plenty of work to be done such as: + +* Core modification by adding isochronous endpoint support +* Develop drivers on top of the USBHost stack + +Any contribution from the mbed community would be greatly appreciated! diff --git a/docs/APIs/interfaces/USBHost/USBHostHub.md b/docs/APIs/interfaces/USBHost/USBHostHub.md new file mode 100644 index 0000000000..678be30889 --- /dev/null +++ b/docs/APIs/interfaces/USBHost/USBHostHub.md @@ -0,0 +1,18 @@ +# USBHostHub + +**Warning:** Library in Beta!
This library is in Beta. If you have any problems using the USBHost library, please send a bug report at [support@mbed.org](support@mbed.org)
+ +The USB Host connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768** +* Add **two 15k resistors tied to GND on D+ and D-** + +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBHostHub_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBHostHub_HelloWorld/file/tip/main.cpp) + +**Warnings:** Troobleshooting
If your mbed board is automatically resetted when you plug a USB device, you should consider to use an external power supply
+ +## Details + +As you can see there is no instance of USBHostHub in the previous code. All the Hubs are automatically enumerated by the usb thread. diff --git a/docs/APIs/interfaces/USBHost/USBHostKeyboard.md b/docs/APIs/interfaces/USBHost/USBHostKeyboard.md new file mode 100644 index 0000000000..de078fec4e --- /dev/null +++ b/docs/APIs/interfaces/USBHost/USBHostKeyboard.md @@ -0,0 +1,20 @@ +# USBHostKeyboard + +The USBHostKeyboard interface is used to communicate with a USB keyboard. + +**Warning:** Library in Beta!
This library is in Beta. If you have any problems using the USBHost library, please send a bug report at [support@mbed.org](support@mbed.org)
+ +The USB Host connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768** +* Add **two 15k resistors tied to GND on D+ and D-** + +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBHostkeyboard_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBHostkeyboard_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/USBHost/)](https://developer.mbed.org/users/mbed_official/code/USBHost/file/tip/main.cpp) + +**Warning:** Troobleshooting
If your mbed board is automatically resetted when you plug a USB device, you should consider to use an external power supply
diff --git a/docs/APIs/interfaces/USBHost/USBHostMSD.md b/docs/APIs/interfaces/USBHost/USBHostMSD.md new file mode 100644 index 0000000000..c8560ead44 --- /dev/null +++ b/docs/APIs/interfaces/USBHost/USBHostMSD.md @@ -0,0 +1,21 @@ +# USBHostMSD + +The USBHostMSD interface is used to access a USB mass storage device. + +**Warnings:** Library in Beta!
This library is in Beta. If you have any problems using the USBHost library, please send a bug report at [support@mbed.org](support@mbed.org)
+ +The USB Host connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768** +* Add **two 15k resistors tied to GND on D+ and D-** + +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBHostMSD_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBHostMSD_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/USBHost/)](https://developer.mbed.org/users/mbed_official/code/USBHost/file/tip/main.cpp) + +**Warning:** Troobleshooting
If your mbed board is automatically resetted when you plug a USB device, you should consider to use an external power supply
+ diff --git a/docs/APIs/interfaces/USBHost/USBHostMouse.md b/docs/APIs/interfaces/USBHost/USBHostMouse.md new file mode 100644 index 0000000000..6c96d5c102 --- /dev/null +++ b/docs/APIs/interfaces/USBHost/USBHostMouse.md @@ -0,0 +1,21 @@ +# USBHostMouse + +The USBHostMouse interface is used to communicate with a USB mouse. + +**Warning:** Library in Beta!
This library is in Beta. If you have any problems using the USBHost library, please send a bug report at [support@mbed.org](support@mbed.org)
+ +The USB Host connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768** +* Add **two 15k resistors tied to GND on D+ and D-** + +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBHostMouse_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBHostMouse_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/USBHost/)](https://developer.mbed.org/users/mbed_official/code/USBHost/file/tip/main.cpp) + +**Warning:** Troobleshooting
If your mbed board is automatically resetted when you plug a USB device, you should consider to use an external power supply
+ diff --git a/docs/APIs/interfaces/USBHost/USBHostSerial.md b/docs/APIs/interfaces/USBHost/USBHostSerial.md new file mode 100644 index 0000000000..229f697ec7 --- /dev/null +++ b/docs/APIs/interfaces/USBHost/USBHostSerial.md @@ -0,0 +1,20 @@ +# USBHostSerial + +The USBHostSerial interface is used to communicate with a virtual serial port usb device. + +**Warning:** Library in Beta!
This library is in Beta. If you have any problems using the USBHost library, please send a bug report at [support@mbed.org](support@mbed.org)
+ +The USB Host connector should be attached to + +* **p31 (D+), p32 (D-) and GND** for the **LPC1768** +* Add **two 15k resistors tied to GND on D+ and D-** + +## Hello World + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/samux/code/USBHostSerial_HelloWorld/)](https://developer.mbed.org/users/samux/code/USBHostSerial_HelloWorld/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/USBHost/)](https://developer.mbed.org/users/mbed_official/code/USBHost/file/tip/main.cpp) + +**Warning:** Troobleshooting
If your mbed board is automatically resetted when you plug a USB device, you should consider to use an external power supply
diff --git a/docs/APIs/interfaces/digital/CAN.md b/docs/APIs/interfaces/digital/CAN.md new file mode 100644 index 0000000000..0a8478c91a --- /dev/null +++ b/docs/APIs/interfaces/digital/CAN.md @@ -0,0 +1,68 @@ +# CAN + +CAN or Controller-Area Network is a bus standard designed to allow microcontrollers and devices to communicate with each other without a host computer. + +## Hello World! + +This example sends from one CAN bus (can1) an counter while it is listen on the other CAN bus (can2) to receive a packet. Each bus controller should be connected to a CAN bus transceiver. These should be connected together at a CAN bus. + +In order to use CAN, you need transceivers, which change the digital signal (RD/TD), outputted by the LPC1768 into a differential signal, which is transmitted along the CAN bus to the other nodes. As well as this, you need two 120 Ohm terminating resistors at either end of the bus. Without both the transceivers and the terminating resistors, the bus will not work properly. Below is an example circuit, which demonstrates how to set up a CAN bus, which simply loops the data between the mbed LPC1768's two CAN buses. + +![](../Images/can.png) + +**Note:** If using the LPC1768, or the LPC11C1X series, the transceivers are not included on the chip, so the two transceivers are required. However, if you are using the LPC11C2X series, you do not need transceivers, as they are already present on the chip. In both cases, you need terminating resistors. + +**Warning:** The mbed's pins are 5V tolerant, so this example will work. However, do not assume that the chip you are using has 5V tolerant pins, so consult with the user manual/datasheet of your device to check this. If it is not 5V tolerant, a logic level converter can be used, to lower the logic levels to 3.3V logic. + +``` +#include "mbed.h" + +Ticker ticker; +DigitalOut led1(LED1); +DigitalOut led2(LED2); +CAN can1(p9, p10); +CAN can2(p30, p29); +char counter = 0; + +void send() { + printf("send()\n"); + if(can1.write(CANMessage(1337, &counter;, 1))) { + printf("wloop()\n"); + counter++; + printf("Message sent: %d\n", counter); + } + led1 = !led1; +} + +int main() { + printf("main()\n"); + ticker.attach(&send;, 1); + CANMessage msg; + while(1) { + printf("loop()\n"); + if(can2.read(msg)) { + printf("Message received: %d\n", msg.data[0]); + led2 = !led2; + } + wait(0.2); + } +} +``` + +## API + +API summary + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1CAN.html) + +## Details + +The CAN Interface can be used on mbed pins p9/p10 and p30/p29 + +![](../Images/small_pin_out.png) + +The CAN Interface can be used to write data words out of a CAN port and will return the data received from another CAN device. The CAN clock frequency can be configured. + +## Resources + + * [Wikipedia](http://en.wikipedia.org/wiki/Controllerarea_network) diff --git a/docs/APIs/interfaces/digital/I2C.md b/docs/APIs/interfaces/digital/I2C.md new file mode 100644 index 0000000000..731a4bedc4 --- /dev/null +++ b/docs/APIs/interfaces/digital/I2C.md @@ -0,0 +1,30 @@ +# I2C + +The I2C interface provides I2C Master functionality. + +This interface can be used for communication with a I2C devices, such as serial memories, sensors and other modules or integrated circuits. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/I2C_HelloWorld_Mbed/)](https://developer.mbed.org/users/mbed_official/code/I2C_HelloWorld_Mbed/file/tip/main.cpp) + +**Warning:** Remember that you will need a pull-up resistor on sda and scl.
+All drivers on the I2C bus are required to be open collector, and so it is necessary for pull up resistors to be used on the two signals. A typical value for the pullup resistors is around 2.2k ohms, connected between the pin and 3v3.
+ +## API + +**Note:** The mbed API uses 8 bit addresses, so make sure to take that 7 bit address and left shift it by 1 before passing it. + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1I2C.html) + +## Interface + +![](../Images/pin_out.png) + +The default frequency of the I2C interface is 100KHz. + +I2C is a two wire serial protocol that allows an I2C Master exchange data with an I2C Slave. The I2C protocol support upto 127 devices per bus. The I2C interface can be used for writing data words out of the I2C port, returning the data recieved back from I2C slave. The I2C clock frequency can be configured. + +## References + + * [Wikipedia](http://en.wikipedia.org/wiki/I%C2%B2C) diff --git a/docs/APIs/interfaces/digital/I2CSlave.md b/docs/APIs/interfaces/digital/I2CSlave.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/APIs/interfaces/digital/SPI.md b/docs/APIs/interfaces/digital/SPI.md new file mode 100644 index 0000000000..d2a9672bc5 --- /dev/null +++ b/docs/APIs/interfaces/digital/SPI.md @@ -0,0 +1,34 @@ +# SPI + +The SPI Interface provides a Serial Peripheral Interface Master. + +This interface can be used for communication with SPI slave devices, such as FLASH memory, LCD screens and other modules or integrated circuits. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/SPI_HelloWorld_Mbed/)](https://developer.mbed.org/users/mbed_official/code/SPI_HelloWorld_Mbed/file/tip/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1SPI.html) + +## Interface + +![](../Images/pin_out.png) + +The default settings of the SPI interface are 1MHz, 8-bit, Mode 0 + +The SPI Interface can be used to write data words out of the SPI port, returning the data received back from the SPI slave. The SPI clock frequency and format can also be configured. The format is set to data word length 8 to 16 bits, and the mode as per the table below: + +Mode | Polarity | Phase +---|---|--- +0 | 0 | 0 +1 | 0 | 1 +2 | 1 | 0 +3 | 1 | 1 + +The SPI master generates a clock to synchronously drive a serial bit stream slave. The slave returns a bit stream, also synchronous to the clock. + +## Reference + + * [SPI on Wikipedia](http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus) diff --git a/docs/APIs/interfaces/digital/SPISlave.md b/docs/APIs/interfaces/digital/SPISlave.md new file mode 100644 index 0000000000..e69de29bb2 diff --git a/docs/APIs/interfaces/digital/Serial.md b/docs/APIs/interfaces/digital/Serial.md new file mode 100644 index 0000000000..0bc64cf441 --- /dev/null +++ b/docs/APIs/interfaces/digital/Serial.md @@ -0,0 +1,106 @@ +# Serial + +Serial is a generic protocol used by computers and electronic modules to send and receive control information and data. The Serial link has two unidirection channels, one for sending and one for receiving. The link is asynchronous, and so both ends of the serial link must be configured to use the same settings. + +One of the Serial connections goes via the mbed USB port, allowing you to easily communicate with your host PC. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/Serial_HelloWorld_Mbed/)](https://developer.mbed.org/users/mbed_official/code/Serial_HelloWorld_Mbed/file/879aa9d0247b/main.cpp) + +## API + +API summary + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1Serial.html) + +## Interface + +The Serial Interface can be used on supported pins and USBTX/USBRX + +![](../Images/pin_out.png) + +Note that USBTX/USBRX are not DIP pins; they represent the pins that route to the interface USB Serial port so you can communicate with a host PC. + +**Tip:** If you want to send data to a host PC, take a look at [SerialPC](Serial.md) + +**Note**: on a windows machine, you will need to install a USB Serial driver. See [Windows serial configuration](Windows serial configuration) **MISSING LINK** + +Serial channels have a number of configurable parameters: + + * _Baud Rate_ - There are a number of standard baud rates ranging from a few hundred bits per seconds, to megabits per second. The default setting for a Serial connection on the mbed Microcontroller is 9600 baud. + * _Data length_ - Data transferred can be either 7 or 8 bits long. The default setting for a Serial connection on the mbed Microcontroller is 8 bits. + * _Parity_ - An optional parity bit can be added. The parity bit will be automatically set to make the number of 1's in the data either odd or even. Parity settings are Odd, Even or None. The default setting for a Serial connection on the mbed microcontroller is for the parity to be set to None. + * _Stop Bits_ - After data and parity bits have been transmitted, 1 or 2 stop bit is inserted to "frame" the data. The default setting for a Serial connection on the mbed microcontroller is for one stop bit to be added. + +The default settings for the mbed microcontroller are described as _9600 8N1_, and this is common notation for Serial port settings. + +## See Also + + * [Communication with a PC](Serial.md) + +## Reference + + * [Serial Port on Wikipedia](http://en.wikipedia.org/wiki/Serial_port) + +## Examples + +### Example one + +``` +#include "mbed.h" + +Serial device(p9, p10); // tx, rx + +int main() { + device.baud(19200); + device.printf("Hello World\n"); +} +``` +### Example two + +``` +#include "mbed.h" + +Serial pc(USBTX, USBRX); // tx, rx +Serial device(p9, p10); // tx, rx + +int main() { + while(1) { + if(pc.readable()) { + device.putc(pc.getc()); + } + if(device.readable()) { + pc.putc(device.getc()); + } + } +} +``` + +### Example three + +``` +#include "mbed.h" + +DigitalOut led1(LED1); +DigitalOut led2(LED2); + +Serial pc(USBTX, USBRX); + +void callback() { + // Note: you need to actually read from the serial to clear the RX interrupt + printf("%c\n", pc.getc()); + led2 = !led2; +} + +int main() { + pc.attach(&callback;); + + while (1) { + led1 = !led1; + wait(0.5); + } +} +``` + +See [the full attach API](http://mbed.org/projects/libraries/api/mbed/trunk/Serial#Serial.attach) diff --git a/docs/APIs/interfaces/interfaces.md b/docs/APIs/interfaces/interfaces.md new file mode 100644 index 0000000000..733792ea9e --- /dev/null +++ b/docs/APIs/interfaces/interfaces.md @@ -0,0 +1,5 @@ +# Interface options + +## Digital interfaces + +## USB \ No newline at end of file diff --git a/docs/APIs/intro.md b/docs/APIs/intro.md new file mode 100644 index 0000000000..ca4096b35d --- /dev/null +++ b/docs/APIs/intro.md @@ -0,0 +1,8 @@ +# Writing applications with the mbed OS APIs + +You can think of mbed OS as a collection of application programming interfaces (APIs). You use these APIs to control the hardware, and mbed OS provides the "glue" that makes the APIs work together. + +## Hardware agnosticism + +mbed OS exposes the same APIs to you, irrespective of the hardware on which you're working. The job of making the standard APIs work with different hardware is conducted behind the scenes; this means that your application code can run on any hardware without any deliberate changes on your part. + diff --git a/docs/APIs/io/AnalogIn.md b/docs/APIs/io/AnalogIn.md new file mode 100644 index 0000000000..2b843013ef --- /dev/null +++ b/docs/APIs/io/AnalogIn.md @@ -0,0 +1,71 @@ +# AnalogIn + +The AnalogIn API is used to read an external voltage applied to an analog input pin. Only certain pins are capable of making these measurement so check the documentation for compatible pins. For more information on what it takes to convert an analog signal to its digital representation see [http://en.wikipedia.org/wiki/Analog-to-digital_converter](http://en.wikipedia.org/wiki/Analog-to-digital_converter). + +## API + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1AnalogIn.html) + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/teams/mbed/code/AnalogIn-HelloWorld/)](https://developer.mbed.org/teams/mbed/code/AnalogIn-HelloWorld/file/tip/main.cpp) + + +## Examples + +``` +#include "mbed.h" + +AnalogIn position(A0); +PwmOut servo(D3); + +int main() { + // servo requires a 20ms period + servo.period(0.020f); + while (1) { + // servo position determined by a pulse width between 1-2ms + servo.pulsewidth(0.001f + 0.001f * position); + } +} +``` + + +``` +#include "mbed.h" + +AnalogIn input(A0); + +int main() { + uint16_t samples[1024]; + + for(int i=0; i<1024; i++) { + samples[i] = input.read_u16(); + wait(0.001f); + } + + printf("Results:\n"); + for(int i=0; i<1024; i++) { + printf("%d, 0x%04X\n", i, samples[i]); + } +} +``` + + +``` +#include "mbed.h" + +AnalogIn ain(A0); +DigitalOut led1(LED1); +DigitalOut led2(LED2); +DigitalOut led3(LED3); +DigitalOut led4(LED4); + +int main() { + while (1){ + led1 = (ain > 0.2f) ? 1 : 0; + led2 = (ain > 0.4f) ? 1 : 0; + led3 = (ain > 0.6f) ? 1 : 0; + led4 = (ain > 0.8f) ? 1 : 0; + } +} +``` diff --git a/docs/APIs/io/AnalogOut.md b/docs/APIs/io/AnalogOut.md new file mode 100644 index 0000000000..73f81b64ef --- /dev/null +++ b/docs/APIs/io/AnalogOut.md @@ -0,0 +1,40 @@ +# AnalogOut + +The AnalogOut Interface is used to set the voltage of an analog output pin. The AnalogOut Interface can be used to set a voltage on pin somewhere in the range of VSS to VCC. Not all pins are capable of being AnalogOut so check the documentation. For more information on what it takes to convert an digital value to its analog representation see [http://en.wikipedia.org/wiki/Digital-to-analog_converter](http://en.wikipedia.org/wiki/Digital-to-analog_converter). + +## API + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1AnalogOut.html) + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/teams/mbed/code/AnalogOut-HelloWorld/)](https://developer.mbed.org/teams/mbed/code/AnalogOut-HelloWorld/file/tip/main.cpp) + + +## Example + +``` +#include "mbed.h" + +// The sinewave is created on this pin +AnalogOut aout(p18); + +int main() +{ + const double pi = 3.141592653589793238462; + const double amplitude = 0.5f; + const double offset = 65535/2; + double rads = 0.0; + uint16_t sample = 0; + + while(1) { + // sinewave output + for (int i = 0; i < 360; i++) { + rads = (pi * i) / 180.0f; + sample = (uint16_t)(amplitude * (offset * (cos(rads + pi))) + offset); + aout.write_u16(sample); + } + } +} + +``` diff --git a/docs/APIs/io/BusIn.md b/docs/APIs/io/BusIn.md new file mode 100644 index 0000000000..8f8d50e7a1 --- /dev/null +++ b/docs/APIs/io/BusIn.md @@ -0,0 +1,23 @@ +#BusIn + +The BusIn interface is used to create a number of DigitalIn pins that can be read as one value. + +Any of the numbered mbed pins can be used as a DigitalIn in the BusIn. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/BusIn_HelloWorld/)](https://developer.mbed.org/users/mbed_official/code/BusIn_HelloWorld/file/5e474ece410b/main.cpp) + +## API + +API summary + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1BusIn.html) + +## Interface + +The BusIn Interface can use any pin with a blue label. + +![](../Images/pin_out.png) + + diff --git a/docs/APIs/io/BusInOut.md b/docs/APIs/io/BusInOut.md new file mode 100644 index 0000000000..6a912467a1 --- /dev/null +++ b/docs/APIs/io/BusInOut.md @@ -0,0 +1,15 @@ +#BusInOut + +The BusInOut interface is used as a bi-directional bus that collects together a number of [DigitalInOut](DigitalInOut.md) pins that can be read and written as one value. + +Any of the numbered mbed pins can be used as a [DigitalInOut](DigitalInOut.md). + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/BusInOut_HelloWorld/)](https://developer.mbed.org/users/mbed_official/code/BusInOut_HelloWorld/file/075e57eccf3a/main.cpp) + +## API + +API summary + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1BusInOut.html) diff --git a/docs/APIs/io/BusOut.md b/docs/APIs/io/BusOut.md new file mode 100644 index 0000000000..5a7af0a8ea --- /dev/null +++ b/docs/APIs/io/BusOut.md @@ -0,0 +1,21 @@ +# BusOut + +The BusOut interface is used to create a number of [DigitalOut](DigitalOut.md) pins that can be written as one value. + +## Hello World! + +** MISSING ** + +## API + +API summary + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1BusOut.html) + +## Interface + +The BusOut Interface can be used on any pin with a blue label, and also with the on-board LEDs (LED1-LED4) + +The BusOut Interface can be used to set the state of the output pin, and also read back the current output state. Set the BusOut to zero to turn it off, or 1 to turn it on. + +![](../Images/pin_out.png) diff --git a/docs/APIs/io/DigitalIn.md b/docs/APIs/io/DigitalIn.md new file mode 100644 index 0000000000..2ac5fbd8c2 --- /dev/null +++ b/docs/APIs/io/DigitalIn.md @@ -0,0 +1,51 @@ +#DigitalIn + +The DigitalIn interface is used to read the value of a digital input pin. + +Any of the numbered mbed pins can be used as a DigitalIn. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/DigitalIn_HelloWorld_Mbed/)](https://developer.mbed.org/users/mbed_official/code/DigitalIn_HelloWorld_Mbed/file/tip/main.cpp) + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/DigitalIn_HelloWorld_FRDM-KL25Z/)](https://developer.mbed.org/users/mbed_official/code/DigitalIn_HelloWorld_FRDM-KL25Z/file/tip/main.cpp) + +## API + +API summary + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1DigitalIn.html) + +## Interface + +The DigitalIn Interface can be used on any pin with a blue label. + +The pin input is logic '0' for any voltage on the pin below 0.8v, and '1' for any voltage above 2.0v. By default, the DigitalIn is setup with an internal pull-down resistor. + +![](../Images/pin_out.png) + +## Related + +To handle an interrupt, see [InterruptIn](InterruptIn.md). + +Examples of logical functions: + +``` +#include "mbed.h" + +DigitalIn a(p5); +DigitalIn b(p6); +DigitalOut z_not(LED1); +DigitalOut z_and(LED2); +DigitalOut z_or(LED3); +DigitalOut z_xor(LED4); + +int main() { + while(1) { + z_not = !a; + z_and = a && b; + z_or = a || b; + z_xor = a ^ b; + } +} +``` diff --git a/docs/APIs/io/DigitalInOut.md b/docs/APIs/io/DigitalInOut.md new file mode 100644 index 0000000000..ade7e506c5 --- /dev/null +++ b/docs/APIs/io/DigitalInOut.md @@ -0,0 +1,23 @@ +# DigitialInOut + +The DigitalInOut interface is used as a bi-directional digital pin, used to read the value of a digital pin when set as an input, or write the value when set as an output. + +Any of the numbered mbed pins can be used as a DigitalInOut. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/DigitalInOut_HelloWorld_Mbed/)](https://developer.mbed.org/users/mbed_official/code/DigitalInOut_HelloWorld_Mbed/file/tip/main.cpp) + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/DigitalInOut_HelloWorld_FRDM-KL25Z/)](https://developer.mbed.org/users/mbed_official/code/DigitalInOut_HelloWorld_FRDM-KL25Z/file/tip/main.cpp) + +## API + +API summary + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1DigitalInOut.html) + +## Interface + +The DigitalInOut Interface can be used on any pin with a blue label. + +![](../Images/pin_out.png) diff --git a/docs/APIs/io/DigitalOut.md b/docs/APIs/io/DigitalOut.md new file mode 100644 index 0000000000..392a52032b --- /dev/null +++ b/docs/APIs/io/DigitalOut.md @@ -0,0 +1,21 @@ +# DigitalOut + +The DigitalOut interface is used to configure and control a digital output pin. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/DigitalOut_HelloWorld/)](https://developer.mbed.org/users/mbed_official/code/DigitalOut_HelloWorld/file/tip/main.cpp) + +## API + +API summary + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1DigitalOut.html) + +## Interface + +The DigitalOut Interface can be used on any pin with a blue label, and also with the on-board LEDs (LED1-LED4) + +The DigitalOut Interface can be used to set the state of the output pin, and also read back the current output state. Set the DigitalOut to zero to turn it off, or 1 to turn it on. + +![](../Images/pin_out.png) diff --git a/docs/APIs/io/InterruptIn.md b/docs/APIs/io/InterruptIn.md new file mode 100644 index 0000000000..a7244eef0c --- /dev/null +++ b/docs/APIs/io/InterruptIn.md @@ -0,0 +1,69 @@ +# InterruptIn + +The InterruptIn interface is used to trigger an event when a [digital input pin](DigitalIn) changes. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/InterruptIn_HelloWorld/)](https://developer.mbed.org/users/mbed_official/code/InterruptIn_HelloWorld/file/7a20a6aa1f5e/main.cpp) + +## API + +API summary + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1InterruptIn.html) + +## Interface + +**Warning:** Certain pins cannot be used for InterruptIn
+* mbed NXP LPC1768: Any of the numbered mbed pins can be used as an InterruptIn, except p19 and p20. +* mbed FRDM KL25Z: Only the pins of port A and D can be used. (PTA[0-31] and PTD[0-31]). +
+ +![](../Images/pin_out.png) + +The pin input will be logic '0' for any voltage on the pin below 0.8v, and '1' for any voltage above 2.0v. By default, the InterruptIn is setup with an internal pull-down resistor. + +**Warnings:** No blocking code in ISR
In ISR you should avoid any call to wait, infinitive while loop, or blocking calls in general.
+ +**Warning:** No printf, malloc, or new in ISR
In ISR you should avoid any call to bulky library functions. In particular, certain library functions (like printf, malloc and new) are non re-entrant and their behaviour could be corrupted when called from an ISR.
+ +## Examples + +``` + +#include "mbed.h" + +class Counter { +public: + Counter(PinName pin) : _interrupt(pin) { // create the InterruptIn on the pin specified to Counter + _interrupt.rise(this, &Counter;::increment); // attach increment function of this counter instance + } + + void increment() { + _count++; + } + + int read() { + return _count; + } + +private: + InterruptIn _interrupt; + volatile int _count; +}; + +Counter counter(p5); + +int main() { + while(1) { + printf("Count so far: %d\n", counter.read()); + wait(2); + } +} +``` + +## Related + +To read an input, see [DigitalIn](DigitalIn.md). + +For timer-based interrupts, see [Ticker](Ticker.md) (repeating interrupt) and [Timeout](Timeout.md) (one-time interrupt). diff --git a/docs/APIs/io/PortIn.md b/docs/APIs/io/PortIn.md new file mode 100644 index 0000000000..5bdf033ed3 --- /dev/null +++ b/docs/APIs/io/PortIn.md @@ -0,0 +1,19 @@ +# PortIn + +The PortIn interface is used to read an underlying GPIO port as one value. This is much faster than [BusIn](BusIn) as you can read a port in one go, but much less flexible as you are constrained by the port and bit layout of the underlying GPIO ports. + +A mask can be supplied so only certain bits of a port are used, allowing other bits to be used for other interfaces. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/PortIn_HelloWorld/)](https://developer.mbed.org/users/mbed_official/code/PortIn_HelloWorld/file/92064442fd12/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1PortIn.html) + +## Interface + +The PortIn Interface can use any pin with a blue label, as long as all the pins used are in the same GPIO port + +![](../Images/pin_out.png) diff --git a/docs/APIs/io/PortInOut.md b/docs/APIs/io/PortInOut.md new file mode 100644 index 0000000000..925507bd8f --- /dev/null +++ b/docs/APIs/io/PortInOut.md @@ -0,0 +1,19 @@ +# PortOut + +The PortInOut interface is used to read and write an underlying GPIO port as one value. This is much faster than [BusInOut](BusInOut) as you can write a port in one go, but much less flexible as you are constrained by the port and bit layout of the underlying GPIO ports. + +A mask can be supplied so only certain bits of a port are used, allowing other bits to be used for other interfaces. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/PortInOut_HelloWorld/)](https://developer.mbed.org/users/mbed_official/code/PortInOut_HelloWorld/file/018ca8a43b33/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/0954ebd79f59/classmbed_1_1PortInOut.html) + +## Interface + +The PortInOut Interface can use any pins with a blue label, as long as they are in the same port. + +![](../Images/pin_out.png) diff --git a/docs/APIs/io/PortOut.md b/docs/APIs/io/PortOut.md new file mode 100644 index 0000000000..820e081739 --- /dev/null +++ b/docs/APIs/io/PortOut.md @@ -0,0 +1,19 @@ +# PortOut + +The PortOut interface is used to write to an underlying GPIO port as one value. This is much faster than [BusOut](BusOut.md) as you can write a port in one go, but much less flexible as you are constrained by the port and bit layout of the underlying GPIO ports. + +A mask can be supplied so only certain bits of a port are used, allowing other bits to be used for other interfaces. + +## Hello World! + +[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/PortOut_HelloWorld/)](https://developer.mbed.org/users/mbed_official/code/PortOut_HelloWorld/file/9bbfdb1487ff/main.cpp) + +## API + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1PortOut.html) + +## Interface + +The PortOut Interface can use any pins with a blue label, as long as they are in the same GPIO port. + +![](../Images/pin_out.png) diff --git a/docs/APIs/io/PwmOut.md b/docs/APIs/io/PwmOut.md new file mode 100644 index 0000000000..97969dbeb4 --- /dev/null +++ b/docs/APIs/io/PwmOut.md @@ -0,0 +1,104 @@ +# PwmOut + +The PwmOut interface is used to control the frequency and mark-space ratio of a digital pulse train. + +## Hello World! + +This code example uses the default period of 0.020s and ramps the duty cycle from 0% to 100% in incriments of 10%. + +** MISSING ** + +## API + +API summary + +[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed/docs/tip/classmbed_1_1PwmOut.html) + +## Details + +The default period is 0.020s, and the default pulsewidth is 0. + +The PwmOut interface can express the pulse train in many ways depening on how it is to be used. The period and pulse width can be expressed directly in units of seconds, millisecond or microseconds. The pulsewidth can also be expressed as a percentage of the the period. + +## Implementation details + +### LPC1768 + +You can also specify the LED1-LED4 as PwmOut. Note that these are just different pinout options for the same underlying PWM hardware, so they are just alternative routing rather than extra PWM channels. So you can pin them out can't be used at the same time: + +PWM H/W Channel | Pinout Options +---|--- +PWM_1 | P2_0/p26 or P1_18/LED1 +PWM_2 | P2_1/p25 or P1_20/LED2 +PWM_3 | P2_2/p24 or P1_21/LED3 +PWM_4 | P2_3/p23 or P1_23/LED4 +PWM_5 | P2_4/p22 +PWM_6 | P2_5/p21 + +On the mbed LPC1768, the PwmOut hardware is limited to share the period value between all outputs. Therefore, if you change the period of one output, you change them all. The pulsewidth can be set independently for each output. + +### LPC11U24 + +Pin under the same "Timer" share the same period: + +Timer/Match Register | Pinout Options +---|--- +CT16B0/MR0 | p5 (P0_9) +CT16B0/MR1 | p6 (P0_8) +CT16B0/MR2 | p34 (P1_15) +CT16B1/MR0 | p36 (P0_21) +CT16B1/MR1 | p20 (P0_22) and p14 (P1_23) +CT32B0/MR0 | p25 (P1_24) +CT32B0/MR1 | p26 (P1_25) and USBTX (P0_19) +CT32B0/MR2 | p10 (P1_26) + +## Code Examples + +This code example sets the period in seconds and the duty cycle as a percentage of the period in floating point (0 to 1 range). The effect of this code snippet will be to blink LED2 over a 4 second cycle, 50% on, for a pattern of 2 seconds on, 2 seconds off. + +``` +#include "mbed.h" + +PwmOut led(LED2); + +int main() { + // specify period first, then everything else + led.period(4.0f); // 4 second period + led.write(0.50f); // 50% duty cycle + while(1); // led flashing +} +``` +The following example does the same thing. Instead of specifying the duty cycle as a relative percentage of the period it specifies it as an absolute value in seconds. In this case we have a 4 second period and a 2 second duty cycle, meaning the led will be on for 2 seconds and off for 2 seconds. + +``` +#include "mbed.h" + +PwmOut led(LED2); + +int main() { + // specify period first, then everything else + led.period(4.0f); // 4 second period + led.pulsewidth(2); // 2 second pulse (on) + while(1); // led flashing +} + +``` + +This code example is for an RC Servo. In RC Servo's you set the position based on duty cycle or pulse width of the pwm signal. This example code uses a period of 0.020s and increases the pulse width by 0.0001s on each pass. This will cause an increase of .5% of the servo's range every .25s. In effect the servo will move 2% of its range per second, meaning after 50 seconds the servo will have gone from 0% to 100% of its range. + +``` + +#include "mbed.h" + +PwmOut servo(p21); + +int main() { + servo.period(0.020); // servo requires a 20ms period + while (1) { + for(float offset=0.0; offset<0.001; offset+=0.0001) { + servo.pulsewidth(0.001 + offset); // servo position determined by a pulsewidth between 1-2ms + wait(0.25); + } + } +} +``` diff --git a/docs/APIs/io/inputs_outputs.md b/docs/APIs/io/inputs_outputs.md new file mode 100644 index 0000000000..7e2f3840f2 --- /dev/null +++ b/docs/APIs/io/inputs_outputs.md @@ -0,0 +1 @@ +# Handling inputs and outputs \ No newline at end of file diff --git a/docs/APIs/memory_files/file_system.md b/docs/APIs/memory_files/file_system.md new file mode 100644 index 0000000000..f59825bd5d --- /dev/null +++ b/docs/APIs/memory_files/file_system.md @@ -0,0 +1 @@ +# Managing the memory and file system \ No newline at end of file diff --git a/docs/APIs/memory_files/memory.md b/docs/APIs/memory_files/memory.md new file mode 100644 index 0000000000..f59825bd5d --- /dev/null +++ b/docs/APIs/memory_files/memory.md @@ -0,0 +1 @@ +# Managing the memory and file system \ No newline at end of file diff --git a/docs/APIs/memory_files/memory_files.md b/docs/APIs/memory_files/memory_files.md new file mode 100644 index 0000000000..f59825bd5d --- /dev/null +++ b/docs/APIs/memory_files/memory_files.md @@ -0,0 +1 @@ +# Managing the memory and file system \ No newline at end of file diff --git a/docs/APIs/security/security.md b/docs/APIs/security/security.md new file mode 100644 index 0000000000..1a8d0358e1 --- /dev/null +++ b/docs/APIs/security/security.md @@ -0,0 +1 @@ +# Securing devices and connections \ No newline at end of file diff --git a/docs/APIs/security/tls.md b/docs/APIs/security/tls.md new file mode 100644 index 0000000000..1a8d0358e1 --- /dev/null +++ b/docs/APIs/security/tls.md @@ -0,0 +1 @@ +# Securing devices and connections \ No newline at end of file diff --git a/docs/APIs/security/uvisor.md b/docs/APIs/security/uvisor.md new file mode 100644 index 0000000000..1a8d0358e1 --- /dev/null +++ b/docs/APIs/security/uvisor.md @@ -0,0 +1 @@ +# Securing devices and connections \ No newline at end of file diff --git a/docs/APIs/tasks/rtos.md b/docs/APIs/tasks/rtos.md new file mode 100644 index 0000000000..693040761a --- /dev/null +++ b/docs/APIs/tasks/rtos.md @@ -0,0 +1 @@ +# Managing tasks \ No newline at end of file diff --git a/docs/APIs/tasks/tasks.md b/docs/APIs/tasks/tasks.md new file mode 100644 index 0000000000..693040761a --- /dev/null +++ b/docs/APIs/tasks/tasks.md @@ -0,0 +1 @@ +# Managing tasks \ No newline at end of file diff --git a/docs/APIs/tasks/timers.md b/docs/APIs/tasks/timers.md new file mode 100644 index 0000000000..693040761a --- /dev/null +++ b/docs/APIs/tasks/timers.md @@ -0,0 +1 @@ +# Managing tasks \ No newline at end of file diff --git a/docs/Build_Tools/C9/C9.md b/docs/Build_Tools/C9/C9.md deleted file mode 100644 index dd510953e2..0000000000 --- a/docs/Build_Tools/C9/C9.md +++ /dev/null @@ -1 +0,0 @@ -# Cloud9 IDE diff --git a/docs/Build_Tools/Intro.md b/docs/Build_Tools/Intro.md deleted file mode 100644 index 65df5fc8f7..0000000000 --- a/docs/Build_Tools/Intro.md +++ /dev/null @@ -1,17 +0,0 @@ -# mbed build tools - -mbed supports four build tools: one command line tool and three IDEs. We introduce these tools through importing and building our sample program Blinky. - -## Command line - -* [mbed CLI](mbed_CLI/mbed_CLI.md) - -## IDEs - -* [mbed Classic](mbed_IDE/mbed_IDE.md) -* [Cloud9](C9/C9.md) -* [ARM Keil uVision](Keil/Keil.md) - -## Third party integrations - -If you want to work with other tools, please see our [Third Party Integrations](https://docs.mbed.com/docs/third-party-integrations/en/latest/) guide. \ No newline at end of file diff --git a/docs/Build_Tools/Keil/Keil.md b/docs/Build_Tools/Keil/Keil.md deleted file mode 100644 index 1003fa8d61..0000000000 --- a/docs/Build_Tools/Keil/Keil.md +++ /dev/null @@ -1 +0,0 @@ -# ARM Keil uVision IDE diff --git a/docs/Build_Tools/mbed_CLI/mbed_CLI.md b/docs/Build_Tools/mbed_CLI/mbed_CLI.md deleted file mode 100644 index 2217497918..0000000000 --- a/docs/Build_Tools/mbed_CLI/mbed_CLI.md +++ /dev/null @@ -1,91 +0,0 @@ -# Getting Started with mbed OS using the command line interface - -To get started with mbed OS using our command line interface (mbed CLI), we're going to build a program called Blinky to blink an LED on your board. - -## Installing mbed CLI - -### Requirements - -Make sure you’ve installed the following software: - -* Python (tested with [2.7](https://www.python.org/download/releases/2.7/) and [3.5](https://www.python.org/downloads/release/python-350/)). -* [Git](https://git-scm.com/), and optionally [Mercurial](https://www.mercurial-scm.org/).
Tip: remember that the directories containing the executables of ``hg`` and ``git`` need to be in your system's PATH. -* [GCC ARM Embedded](https://launchpad.net/gcc-arm-embedded). - -You also need to install two Python packages: - -``` -$ pip install colorama -$ pip install jinja2 -``` - -### Installing - -To install mbed CLI: - -1. Open a terminal. - -1. Clone the repository [https://github.com/ARMmbed/mbed-cli](https://github.com/ARMmbed/mbed-cli): - - ``$ git clone https://github.com/ARMmbed/mbed-cli`` - -1. Navigate to the ``mbed-cli`` folder. - -1. Install *mbed-cli* as a Python package: - - ``$ python setup.py install`` - -**Tip:** on Linux/Mac, you may need to run this command with ``sudo``. - -## Importing Blinky - -Use `mbed import` to clone an existing program (or library) and all its dependencies to your machine: - -``` -$ mbed import https://developer.mbed.org/teams/Morpheus/code/blinky/ -$ cd Blinky -``` - -## Building Blinky - -### Toolchain location - -After importing a program or creating a new one, you need to tell mbed CLI where to find the toolchains that you want to use for compiling your source tree. mbed CLI gets this information from the file `mbed_settings.py`, which is automatically created at the top of your cloned repository (if it doesn't already exist). - -**Tip:** ``mbed_settings.py`` holds the location of your build tools, but doesn't force mbed CLI to use one or the other - you can select a different tool each time you build. - -To set the location of your build tools: - -* If you want to use the [armcc toolchain](https://developer.arm.com/products/software-development-tools/compilers/arm-compiler-5/downloads), set ``ARM_PATH`` to the *base* directory of your armcc installation (example: c:\software\armcc5.06). The recommended version of the armcc toolchain is 5.06 (5.05 will very likely work too). -* If you want to use the [GCC ARM Embedded toolchain](https://launchpad.net/gcc-arm-embedded), set ``GCC_ARM_PATH`` to the *binary* directory of your GCC ARM installation (example: c:\software\GNUToolsARMEmbedded\4.82013q4\bin). Use versions 4.8 or 4.9 of GCC ARM Embedded, but **not** version 5.0 or any version above it. - -### Compiling your program - -Use `mbed compile` to compile the code: - -``` -$ mbed compile -t ARM -m K64F -j 0 -``` - -The arguments for `compile` are: - -* `-m ` to select a compilation target. At the moment, the only supported value for `mcu` is `K64F` (for the FRDM_K64F board). -* `-t ` to select a toolchain, where `toolchain` can be either ARM (armcc compiler) or GCC_ARM (GNU ARM Embedded). Don't forget to set their location in ``mbed_settings.py``, as explained above. -* `-j ` (optional) to use multiple threads on your machine to compile the source. Use 0 to infer the number of threads from the number of cores on your machine, or an actual number to specify the maximum number of threads. -* `-c ` (optional): will build from scratch; a clean build or rebuild. - -The compiled binary (and ELF image) can be found in the `.build` subdirectory of your program. - -## Running Blinky - -Finally, run Blinky on your K64F board: - -1. Plug your board into your computer and it will appear as a USB drive. - -1. Drag and drop your ``blinky.bin`` file onto the drive. - -1. Your board should blink the RGB LED. - -## Where next - -To learn more about mbed CLI, see ** MISSING LINK - should go to docs.mbed ** diff --git a/docs/Build_Tools/mbed_IDE/mbed_IDE.md b/docs/Build_Tools/mbed_IDE/mbed_IDE.md deleted file mode 100644 index 1b7bc670fd..0000000000 --- a/docs/Build_Tools/mbed_IDE/mbed_IDE.md +++ /dev/null @@ -1,40 +0,0 @@ -# mbed IDE - - - -## Prerequisites - -A (free) [mbed user account](https://developer.mbed.org/account/signup/). - - -## Building your first program - -To build your first program, you'll: - -1. Import an existing program (Blinky). -1. Select your build target. -1. Build the program. -1. Flash the program to your board. - -We'll look at these steps in detail now. - -### Importing a program into the IDE - - - -#### The quick method - -Click "Import to IDE" here: - -(The code inclusion doesn't work because the source repo is private - also not sure it's the right version of Blinky) - -[![View code](https://www.mbed.com/embed/?url=https://github.com/ARMmbed/mbed-os/)](https://github.com/ARMmbed/mbed-os/blob/master/TESTS/integration/threaded_blinky/main.cpp) - -#### The manual method - - -### Selecting your build target - - - -1. Add a new target: diff --git a/docs/CMSIS/CMSIS-DAP-MDK.md b/docs/CMSIS/CMSIS-DAP-MDK.md deleted file mode 100644 index c5e4e52a3e..0000000000 --- a/docs/CMSIS/CMSIS-DAP-MDK.md +++ /dev/null @@ -1,99 +0,0 @@ -# CMSIS DAP MDK - -## Current limitations - -For the purpose of this trial, it will not be possible to debug applications that use semi-hosting calls to the mbed interface. Examples of these calls are : - -* Accessing the local file system - -* Ethernet applications where the MAC address is provided by the interface (default) - -* Accessing the power down functions of the interface - -This is because the MDK does not currently support the use of semihosting calls. - -Getting started - -To try the mbed CMSIS-DAP upgrade you will need : - -* The firmware that supports CMSIS-DAP for your target. - -* An offline tool that supports CMSIS-DAP - [Keil MDK v4.60](https://www.keil.com/demo/eval/arm.htm) for example. - -* An example project you wish to debug. - -## Upgrading your board - -### Select your board - -Select your board and follow the firmware upgrade process for your board. - -###Install the latest serial driver - -Download and install the [serial driver](../Going_Further/Serial_Conf.md). - -### Results - -There will now be three mbed USB devices in device manager : - -* USB disk -* mbed Serial port -* mbed CMSIS-DAP - -![](../Images/CMSIS/CMSIS1.png) - -**Warning: Driver issue**
-If the serial is not recognised by the host: -- Go into the device manager -- Right click on "mbed composite" -- Uninstall the driver -- Disconnect and connect your mbed -- Install the [serial driver](../Going_Further/Serial_Conf.md)
- -##Install an offline tool - -The recommended offline tool is [Keil MDK v4.60](https://www.keil.com/demo/eval/arm.htm). Follow the links and instructions to set up the evaluation copy. - -##Export a project - -[uVision](http://www.keil.com/uvision) is one of the external offline toolchains supported by the mbed platform. - -For a complete overview of the export feature, please refer to our general: [Exporting to offline toolchains](../Going_Further/Export.md). - -To export your mbed program for use in uVision, right-click the program in your program workspace. From the dialog, you can select the "Export To" as "Keil uVision4", and the target microcontroller you wish to export for. - -When you choose export, a zip file containing all the files you need for uVision will be generated. Unzip it and open the uVision project file (In this case, "project.uvproj"): - -![](../Images/CMSIS/CMSIS2.png) - -## Compile, download, debug! - -Once you have unzipped and opened the ".uvproj" file, your project should appear in the uVision IDE much in the same way it appeared in the online compiler. You can browse the project files by navigating in the left panel, and the code will appear in the main panel. - -### Compile - -When the project has successfully compiled, "fromelf" will automatically run, to extract a binary file. This could be drag and dropped onto the mbed flash disk. - -![](../Images/CMSIS/CMSIS3.png) - -### Download - -With the CMSIS-DAP upgrade, clicking the download button within uVision will send the binary directly to the flash of the MCU - -![](../Images/CMSIS/CMSIS4.png) - -### 4.3 Debug - -Add break points (1) by clicking on the line of code you wish to stop at, and use the "run" button (2) to execute the program until the break point it hit. - -![](../Images/CMSIS/CMSIS5.webp) - -The tools enable you to step in various ways over/into/out of - -Use the tool bar to add registers, memory, call stack, symbol and watch windows. This gives visibility on the system status when a breakpoint is reached. - -![](../Images/CMSIS/CMSIS6.png) - -### Conclusion - -A simple firmware upgrade of your board enables the on-board programming interface to communicate with debugging tools over the new CMSIS-DAP protocol. Over time we hope this will mean mbed will become interoperable with a wide range of offline tools, proving professional debug capabilities when they are needed. diff --git a/docs/CMSIS/CMSIS.md b/docs/CMSIS/CMSIS.md deleted file mode 100644 index 548f4526ca..0000000000 --- a/docs/CMSIS/CMSIS.md +++ /dev/null @@ -1,49 +0,0 @@ -# CMSIS-DAP - -The mbed HDK and mbed-enabled hardware support the CMSIS-DAP debug interface. It provides a standardised way to access the CoreSight Debug Access Port (DAP) of an ARM Cortex microcontroller via USB. CMSIS-DAP is generally implemented as an on-board interface chip, providing direct USB connection from a development board to a debugger running on a host computer on one side, and over Joint Test Action Group (JTAG) or Serial Wire Debug (SWD) to the target device to access the CoreSight DAP on the other. - -You can access the documentation on the [ARM website](https://silver.arm.com/browse/CMSISDAP). You will need to register for an ARM silver account to access the documentation. - -## Why the need for CMSIS-DAP? - -There are several reasons for the introduction of CMSIS-DAP: - -* Before the CMSIS-DAP standard, a lot of USB wigglers implemented their own protocols. With this configuration, the host debugger has to be aware of these different protocols and has to implement all of them, which produces a lot of fragmentation and re-inventing the wheel. At the same time, the protocols were usually defined at the JTAG level, meaning they were slow. CMSIS-DAP provides a standardised interface for debuggers that is defined at the CoreSight DAP level, allowing for a standard interface and fast driverless implementations. -* With the new CMSIS-DAP layer, the host debugger can debug targets over SWD or JTAG without the need to implement these two protocols. -* The USB connection uses the HID driver class. As HID drivers are bundled with all operating systems, there is no need to install a specific driver on the host computer. - -## How can CMSIS-DAP be integrated? - -As mentioned earlier, CMSIS-DAP has to be implemented on an Interface Chip. This chip provides the link between the host computer (over USB for instance) and the target that has to be debugged (over SWD or JTAG). - -On the mbed hardware, the CMSIS-DAP firmware has been implemented on the [mbed interface](../Introduction/mbed_Interface.md) as part of the mbed HDK. In addition to the Mass Storage and the Virtual Serial Port interfaces, an HID endpoint is used to establish a CMSIS-DAP communication link with a debugger. - -![Communication with a debugger](../Development/Images/CMSIS.png)CMSIS-DAP communication with a debugger across a USB connection - -## Overview of the CMSIS-DAP standard - -Packets are exchanged between the host debugger and the interface chip: the host sends a command and the debug unit sends the response to the command. - -Different types of commands can be issued by the host: - -* **General commands**: request information and control the debug unit. Also used to connect and disconnect the debug unit. -* **Common SWD/JTAG commands**: for example, set the clock speed. -* **SWD-specific commands**: configure the parameters for SWD mode. -* **JTAG-specific commands**: configure the JTAG device chain. -* **Transfer commands**: read/write [CoreSight](http://www.arm.com/products/system-ip/coresight/index.php) registers. These commands are independent of the transport protocol (SWD or JTAG). - -## Example: read memory over CMSIS-DAP - -Let's say that a debugger needs to read the value at a specific location in memory. The following commands have to be sent by the host: - -* **Transfer Command**: write the ``CSW register`` (Control/Status Word Register). This will configure the transfer (32bits/16bits/8bits transfer). - -* **Transfer Command**: write the ``TAR register`` (Transfer Address Register) with the address of the memory location. - -* **Transfer Command**: read the ``DRW register`` (Data Read/Write register) to read the value at the location specified earlier. - -## Conclusion - -CMSIS-DAP provides a standardised interface for debuggers. It will probably become the de facto standard that debuggers and debug units will implement; this is why mbed chose to take advantage of this new standard to provide debug capabilities. For instance, Keil uVision, which combines an IDE, debugger and simulation environment already supports CMSIS-DAP. - -**Tip:** If you have a project you want to debug, you can try the new [mbed interface with CMSIS-DAP](CMSIS-DAP-MDK.md). diff --git a/docs/CMSIS/Interface_Firmware.md b/docs/CMSIS/Interface_Firmware.md deleted file mode 100644 index 081587f9e4..0000000000 --- a/docs/CMSIS/Interface_Firmware.md +++ /dev/null @@ -1,173 +0,0 @@ -# CMSIS-DAP Interface Firmware - -The source code of the mbed HDK (tools + libraries) is available in [the mbedmicro repository](https://github.com/mbedmicro/CMSIS-DAP). - -## What It Provides - -The CMSIS-DAP Interface Firmware provides: - -* USB Mass Storage Device for drag and drop programming of the target chip -* USB Communications Device Class for Serial Communication with the target chip -* USB HID CMSIS-DAP for debugging -* USB bootloader for updating the interface firmware itself - -## Hardware Interfaces - -The following image shows how an Onboard Interface running the CMSIS-DAP Interface Firmware might be used to build an evaluation board: - -![](../Development/Images/EvaluationBoard.png) - -When the Onboard Interface is plugged to an host PC it enumerates as a composite device with the following interfaces: - -* MSD, mass storage device class -* CDC, communications device class -* HID, human interface device class - -It is connected to the following pins of the target microcontroller: - -* SWD + Reset -* UART -* Sleep and Wake (Not currently implemented, reserved for future use) - -![](../Development/Images/CMSISDAPInterface.png) - -## Shared Code - -The Bootloader and CMSIS-DAP Interface Firmware for every target share common middleware and components in the folder ***shared***: - -* ``shared\cmsis``: The CMSIS-CORE software layer -* ``shared\rtos``: The RTX operating system -* ``shared\USBStack``: The USB Device middleware - -## Bootloader - -The bootloader allows a firmware update of the interface chip. - -Currently, this project support only the !LPC11U35. Its project file is located in ``bootloader\mdk\lpc11u35\lpc11u35_bootloader.uvproj`` - -At startup it checks the state of a given pin, default high by pull-up resistor: - -* If the pin is high: it simply relocates the vector table to point to the interrupt handlers of the CMSIS-DAP Interface Firmware and then it jumps to its start address. -* If the pin is low: it enumerates as a mass storage device, waiting for a new firmware image to be flashed using In Application Programming (IAP). - -![](../Development/Images/CMSIS_Bootloader.png) - -### Porting to a New Chip - -When you are porting to a new chip, you should first be sure to have the correspondent CMSIS-CORE files in the ``shared\cmsis`` folder. - -To simplify the effort of porting this bootloader to a new target chip, we have kept together the majority of the target dependent code in the directory ``bootloader\hal``: - -* ``flash.c``: functions to provide In Application Programming (IAP) -* ``gpio.c``: functions to init the on board led/reset button interrupt -* ``read_uid.c``: Read of the chip unique ID -* ``usbd_XXX.c``: low-level driver for the USB device controller. This file contains all the low level functions used by the MDK USB device stack to access the USB controller -* ``vector_table.c``: Relocation of the interrupt vector table - -The current implementations are: - -* **LPC11U35**: ``bootloader\hal\TARGET_NXP\TARGET_LPC11U35`` - -## Flash Algorithms - -The CMSIS-DAP Interface Firmware, to be able to flash a new image on the target microcontroller, needs to have a flash algorithm (a sequence of binary instructions) to be loaded on the RAM of the target itself. - -The flash algorithm is developed as a small application compiled as *position independent* code and stored in the interface code as a "binary blob". - -We provide two such MDK projects for generating the flash algorithms for two family of microcontrollers: - -* ``interface\flash_algo_mdk\LPC_IAP\LPC_IAP.uvproj``: flash algorithm for NXP LPC family -* ``interface\flash_algo_mdk\MKXXX\MKXX.uvproj``: flash algorithm for Freescale MK family - -These projects have multiple configurations for the different sizes of the flash memory within the supported family of microcontrollers. - -Once you have generated the position independent flash algorithm, we provide scripts for generating the code to be included in the interface project for your target. - -Copy the output elf binary ".axf" to ``tools\tmp\flash_algo.axf`` and run: - -```python -tools> python flash_algo_gen.py -``` - -This will generate a text file named ``**tools\tmp\flash_algo.txt**`` that will look like this: - -``` -const uint32_t flash_algo_blob[] = { - 0xE00ABE00, 0x062D780D, 0x24084068, 0xD3000040, 0x1E644058, 0x1C49D1FA, 0x2A001E52, 0x4770D1F2, - - /*0x020*/ 0x28100b00, 0x210ed302, 0xd0eb01, 0x494f4770, 0x607af44f, 0x60084449, 0x2100484d, 0x21aa7001, - /*0x040*/ 0x21557301, 0x21017301, 0x1c40f800, 0x47702000, 0x47702000, 0x41f0e92d, 0x20324c46, 0x2500444c, - /*0x060*/ 0xe884261dL, 0xf1040061L, 0x4f430114, 0x46204688, 0x696047b8, 0x2034b960, 0x61e884, 0x4641483b, - /*0x080*/ 0x68004448, 0x462060e0, 0x696047b8, 0xd0002800L, 0xe8bd2001L, 0xe92d81f0L, 0xf7ff41f0L, 0x4d35ffc1, - /*0x0A0*/ 0x444d4604, 0xe9c52032L, 0xf1050400L, 0x4e320114, 0x4628460f, 0x47b060ac, 0xb9686968L, 0xe9c52034L, - /*0x0C0*/ 0x482a0400, 0x444860ac, 0x68004639, 0x462860e8, 0x696847b0, 0xd0dc2800L, 0xe7da2001L, 0x41f0e92d, - /*0x0E0*/ 0x64614, 0x4825d11d, 0x12fcf8d4, 0xd03a4281L, 0x42814823, 0x4823d037, 0xd0344281L, 0x4030ea4f, - /*0x100*/ 0xd0304281L, 0x100e9d4, 0xe9d44408L, 0x44111202, 0x69214408, 0x69614408, 0x69a14408, 0x42404408, - /*0x120*/ 0x463061e0, 0xff7cf7ffL, 0x21324d12, 0x4f12444d, 0x1000e9c5, 0x114f105, 0x468860a8, 0x47b84628, - /*0x140*/ 0xb9806968L, 0xe9c52033L, 0xf44f0600L, 0xe9c57000L, 0x48064002, 0x44484641, 0x61286800, 0x47b84628, - /*0x160*/ 0x28006968, 0x2001d095, 0xe793, 0x4, 0x400fc080, 0x8, 0x1fff1ff1, 0x4e697370, - /*0x180*/ 0x12345678, 0x87654321L, 0x0, 0x0, -}; - -static const TARGET_FLASH flash = { - 0x1000002F, // Init - 0x10000051, // UnInit - 0x10000055, // EraseChip - 0x10000097, // EraseSector - 0x100000DD, // ProgramPage -``` - -## Interface - -Currently, two microcontrollers are supported: - -* **LPC11U35**: ``interface\mdk\lpc11u35\lpc11u35_interface.uvproj`` -* **KL25Z**: ``interface\mdk\kl25z\kl25z_interface.uvproj`` - -Each of these projects provides multiple configurations, to: - -* Support different targets: providing a different flash algorithm and reset/unlock sequences. -* Standalone build at address ``0x0`` (useful during development for better debugging) / Bootloader build at address ``0x5000`` ready to be loaded by the bootloader. - -### Supporting a new target - -We keep the target dependent code in two files: - -* ``target_flash.h``: Implements an API to load a new binary into the flash of the target, largely generated from the above Flash Algorithm project -* ``target_reset.c``: provides function in order to unlock/set the target in a specific state - -The current target implementations are: - -* **LPC812**: ``interface\target\hal\DBG_NXP\DBG_LPC812`` -* **LPC1768**: ``interface\target\hal\DBG_NXP\DBG_LPC1768`` -* **KL25Z**: ``interface\target\hal\DBG_Freescale\DBG_KL25Z`` -* **KL46Z**: ``interface\target\hal\DBG_Freescale\DBG_KL46Z`` -* **KL05Z**: ``interface\target\hal\DBG_Freescale\DBG_KL05Z`` - -### Porting to a New Interface Chip - -When you are porting the CMSIS-DAP Interface Firmware to a new chip, you should first be sure to have the correspondent CMSIS-CORE files in the ``shared\cmsis`` folder. - -To simplify the effort of porting the bootloader to a new interface chip, we have kept together the majority of the target dependent code in the directory ``interface\hal``: - -* ``DAP_config.h``: implements gpio driver to drive the SWD lines of the target chip. -* ``gpio.c``: functions to init the on board led/reset button interrupt. -* ``read_uid.c``: Read of the chip unique ID. -* ``usbd_XXX.c``: low-level driver for the USB device controller. This file contains all the low level functions used by the MDK USB device stack to access the USB controller. -* ``uart.c``: provides low level driver to access the uart for the usb <-> uart pipe. -* ``usb_buf.h``: declares the usb_buffer array. This is interface dependent because the developer may want to put this array into a specific location in memory. - -The current implementations are: - -* **LPC11U35**: ``interface\interface\hal\TARGET_NXP\TARGET_LPC11U35`` -* **MK20DX**: ``interface\interface\hal\TARGET_Freescale\TARGET_MK20DX`` - -## Concatenated Production Image - -The final production image will be a single binary containing the bootloader code at address ``0x0`` and the interface firmware at address ``0x5000``. We do provide a simple script for concatenating these two images that is knowledgeable of the path conventions for the generate elf file of the different projects. It takes as input option the name of the interface and target microcontrollers. For example, for generating the image for an LPC11U35 interface targeting a LPC1768, you can use the following command line: - -```python -tools> python concat.py -i LPC11U35 -t LPC1768 -``` - -This will generate the file: ``tools\tmp\if_lpc11u35_target_lpc1768.bin`` diff --git a/docs/Community/Collab.md b/docs/Community/Collab.md deleted file mode 100644 index d390dbea1c..0000000000 --- a/docs/Community/Collab.md +++ /dev/null @@ -1,4 +0,0 @@ -Very interesting info - but how much of it is relevant for Morpehus? - -http://developer.mbed.org/handbook/Collaboration -http://developer.mbed.org/handbook/Collaboration/Getting-started diff --git a/docs/Community/Edu.md b/docs/Community/Edu.md deleted file mode 100644 index 9c3a37eefa..0000000000 --- a/docs/Community/Edu.md +++ /dev/null @@ -1 +0,0 @@ -#Intro \ No newline at end of file diff --git a/docs/Community/Intro.md b/docs/Community/Intro.md deleted file mode 100644 index d3f004d321..0000000000 --- a/docs/Community/Intro.md +++ /dev/null @@ -1,11 +0,0 @@ -#Worldwide Developer Community - -Using mbed means a huge shared context with other developers, and that means when you have a question, there is less pre-amble, less explanation and less time reproducing issues, and more time getting answers. We're proud that this has helped us grow an active and friendly community of skilled developers that are collectively helping get prototypes made even faster. - -But where it really gets interesting is with code. Our developers are sharing thousands of open source repositories and building an extensive cookbook of recipes that you can reuse to build your products. - -We've also made contributing back is easy; you can publish a library to mbed.org with a few clicks in the IDE, and let others build on your hard work. In fact, this is how some of our users end up collaborating on hard problems, and even getting contract work. - -You can join the [discussions on the forum](http://forums.mbed.com/) or ask [questions](https://www.mbed.com/en/development/community-help/stack-overflow/). And don't forget to [read the blog](http://blog.mbed.com/). - -For information about asking questions and dealing with problems, see [the Getting Help section](../Getting_Started/Questions.md). diff --git a/docs/Development/API_Libs_Breakdown.md b/docs/Development/API_Libs_Breakdown.md deleted file mode 100644 index 9bc997b9c2..0000000000 --- a/docs/Development/API_Libs_Breakdown.md +++ /dev/null @@ -1,5 +0,0 @@ -# API Breakdown - -The mbed library provides the C/C++ software platform and libraries to build your applications. - -We have a full API reference avilable ** MISSING LINK ** diff --git a/docs/Development/Debug.md b/docs/Development/Debug.md deleted file mode 100644 index 6ab1c8032f..0000000000 --- a/docs/Development/Debug.md +++ /dev/null @@ -1,170 +0,0 @@ -#Debugging - -This guide examines some techniques for generating debug information to help find and fix problems with your code, and how to deal with problems that are being reported. - -##Compile time errors - -Compile time errors and warnings are caused by incorrect syntax, or misuse of variables or functions. An error will prevent the compile process from completing (and therefore no binary file will be created). A warning will not prevent the binary from being created, but you should still review the warning as it may mean that your code is not going to do what you had intended. - -Common errors are: - -* Missing declarations of variables and interfaces, leading to "Identifier undefined" errors. -* Missing semicolons ";". Semicolons are required at the end of each line. -* Missing quotes of brackets, "",(),[] or {}. These are used in pairs to contain various types of statement. The compiler will report an error if you have not used them in correct pairings. - -Always tackle the very first error that is reported, as later errors might be as a result of the first one, and will disappear when the first one is corrected. - -If you are seeing a compile time error or warning that you do not understand, [Google](http://www.google.co.uk) will usually find explanations of the error message, or post to the mbed [Forum](http://developer.mbed.org/forum/). - -##Runtime errors - -Runtime errors are caused either by code that is correct but tries to do something that is invalid, or when malfunctioning hardware cannot be accessed. - -The example below shows a PwmOut interface being configured on pin p20. The PwmOut interface is being correctly used, and so the code compiles without warning or error. When the code runs, it tries to create a -PwmOut to pin p20. Because PwmOut is not available on pin p20, a run time error is triggered. - - -**Siren Lights:** When a run time error is encountered, the board will flash its LEDs in a distinctive pattern to let you know that an error has occurred and that the program has stopped running. - - - -![Warning lights](/Going_Further/Images/Debug/FRDM_KL25Z.gif)![](/Adv_Dev/Images/Debug/LPC11U24.gif)![](/Going_Further/Images/Debug/LPC1768.gif) - - -When the program below starts a run time error is caused, leading to the siren lights. - -``Example of a run time error`` - -```c - - #include "mbed.h" - - PwmOut led(p20); - int main() { - while(1) { - for(float p = 0.0f; p < 1.0f; p += 0.1f) { - led = p; - wait(0.1); - } - } - } -``` - -##Runtime bugs - -When your code compiles and runs without error and warning, it still may not behave as you'd expect or hope. This is usually because the code you have written is correct, but not what you had intended. This is usually caused by the program flowing in a way you'd not intended because of a logical mistake or values being computed incorrectly due to an incorrect expression. - -Fortunately there are some useful techniques that you can apply to help find and correct these bugs: - -* Flash LEDs - Turn LEDs on and off, also to indicate where the program is. - -* Debug messages - Print messages and variable values over the serial port. - -##Debug messaging - -The mbed libraries contain some features for reporting runtime errors. - -The main things to use are: - -* ``printf()`` - Print a formatted message to the USB Serial Port (stdout default) - -* ``error()`` - Print a formatted message to the USB Serial Port, then die with "Siren Lights" - - -**Debug to a serial console:** The debug functions mentioned above all cause debug information to be printed over the USB serial port. *This is generally the way to debug running programs on your mbed microcontroller.* - -For more information on using the USB Serial port, see the [SerialPC](/Development/PC_Com/) page. - -``Example showing serial terminal debug messages`` - -```c - - #include "mbed.h" - - DigitalIn button(p21); - AnalogIn pot(p20); - - int main() { - while(pot > 0.0) { - printf("Pot value = %f", pot.read()); - wait(0.1); - } - error("Loop unexpectedly terminated"); - } -``` - -##Debugging program flow control - -Most programs of a even a low level of sophistication will have loops, if-else and case statements, all of which make a decision based on some logic or arithmetic. If your program is not flowing as expected, you can used LEDs and print data values to determine why. - -Below is an example of how you might use LEDs to determine the flow of your program. In this example, the status of the button is being echoed to LED2, so it is clear to see if the program sees the button as being pressed. LED3 is set by the if-else statement, so it is clear how the program control flow is operating. - -```c - - #include "mbed.h" - - DigitalIn button(p19); - AnalogIn pot(p20); - PwmOut led1(LED1); - DigitalOut led3(LED3); // use for debug - - int main() { - while(1) { - if (button && (pot < 0.7)) { - led3 = 0; - led1 = pot; - } else { - led3 = 1; - led1 = 0.0; - } - } - } -``` - -##Debugging incorrect data values - -It is often useful to find out the values of variables in your program at a given time. The example is the same as the one above, except that we are are now using the serial port to print out the value of the AnalogIn. You might need to use this method if you are using a data value to determine the program flow. - -``Example showing variable value debugging`` - -```c - - - #include "mbed.h" - - DigitalIn button(p19); - AnalogIn pot(p20); - PwmOut led1(LED1); - - int main() { - while(1) { - printf("Value of pot is %.3f\n", pot.read()); - wait (0.1); - if (button && (pot < 0.7)) { - led1 = pot; - } else { - led1 = 0.0; - } - } - } -``` - -##What's next - -All the different techniques mentioned previously are sometimes inefficient and have strong disadvantages: - -* **Delays are introduced** in the code. So if a piece of code is time dependent, it can change the original behaviour of a program. - -* It **slows down** considerably the execution. - -* It is very **ad hoc**. Code is temporarily added, to be removed as soon as the bug is solved. For the next bug, similar code is added... - -Try out the [mbed CMSIS-DAP interface with Keil MDK](http://mbed.org/handbook/CMSIS-DAP-MDK), if you need full debug capabilities: - -* set **breakpoints** to stop the program at some event or at a specified instruction to examine the current state. - -* **step by step** execute a program to track the control flow. - -* **check variables values**. - -* **inspect and modify memory** contents. \ No newline at end of file diff --git a/docs/Development/Images/CMSIS.png b/docs/Development/Images/CMSIS.png deleted file mode 100644 index 40c3623562..0000000000 Binary files a/docs/Development/Images/CMSIS.png and /dev/null differ diff --git a/docs/Development/Images/CMSISDAPInterface.png b/docs/Development/Images/CMSISDAPInterface.png deleted file mode 100644 index 0d36ee1479..0000000000 Binary files a/docs/Development/Images/CMSISDAPInterface.png and /dev/null differ diff --git a/docs/Development/Images/CMSIS_Bootloader.png b/docs/Development/Images/CMSIS_Bootloader.png deleted file mode 100644 index 38ca5228d5..0000000000 Binary files a/docs/Development/Images/CMSIS_Bootloader.png and /dev/null differ diff --git a/docs/Development/Images/Dev_Fun.png b/docs/Development/Images/Dev_Fun.png deleted file mode 100644 index 38ca5228d5..0000000000 Binary files a/docs/Development/Images/Dev_Fun.png and /dev/null differ diff --git a/docs/Development/Images/EvaluationBoard.png b/docs/Development/Images/EvaluationBoard.png deleted file mode 100644 index 180fa60920..0000000000 Binary files a/docs/Development/Images/EvaluationBoard.png and /dev/null differ diff --git a/docs/Development/Images/sdk_logos.png b/docs/Development/Images/sdk_logos.png deleted file mode 100644 index 7fe576eb63..0000000000 Binary files a/docs/Development/Images/sdk_logos.png and /dev/null differ diff --git a/docs/Development/Images/sdk_open_source.png b/docs/Development/Images/sdk_open_source.png deleted file mode 100644 index 8da7568e29..0000000000 Binary files a/docs/Development/Images/sdk_open_source.png and /dev/null differ diff --git a/docs/Development/Intro.md b/docs/Development/Intro.md deleted file mode 100644 index 3b9e9a97b8..0000000000 --- a/docs/Development/Intro.md +++ /dev/null @@ -1,4 +0,0 @@ -#Intro - -This section covers: - diff --git a/docs/Development/PC_Com.md b/docs/Development/PC_Com.md deleted file mode 100644 index 74bfa88e34..0000000000 --- a/docs/Development/PC_Com.md +++ /dev/null @@ -1,166 +0,0 @@ -#Serial Communication with a PC - -The mbed Microcontroller can communicate with a host PC through a "USB Virtual Serial Port" over the same USB cable that is used for programming. - -This enables you to: - -* Print out messages to a host PC terminal (useful for debugging!) - -* Read input from the host PC keyboard - -* Communicate with applications and programming languages running on the host PC that can communicate with a serial port, e.g. perl, python, java and so on. - -##Hello World! - -```c - - #include "mbed.h" - - Serial pc(USBTX, USBRX); // tx, rx - - int main() { - pc.printf("Hello World!\n"); - } -``` - -##Host interface and terminal applications - -Your mbed Microcontroller can appear on your computer as a serial port. On Mac and Linux, this will happen by default. For Windows, you need to install a driver: - - -**Warning:** See [Windows serial configuration](http://developer.mbed.org/handbook/Windows-serial-configuration) for full details about setting up Windows for *serial communication* with your mbed Microcontroller. - - -It is common to use a //terminal application// on the host PC to communicate with the mbed Microcontroller. This allows the mbed Microcontroller to print to your PC screen, and for you to send characters back. - -* [Terminals](/Going_Further/Terminals/) - Using Terminal applications to communicate between the Host PC and the mbed Micrcontroller. - -Some terminal programs (e.g. TeraTerm) list the available serial ports by name. However, if you do need to know the identity of the serial port so that you can attach a terminal or an application to it: - -* *Windows* - Look under the "Ports" section in "Device Manager" (''Start -> Control Panel -> System -> Hardware -> Device Manager''). The name will be ''mbed Serial Port (COMx)'', where ''x'' is the number of the COM port allocated. - -* *Mac OS X* - Use the command ls /dev/tty.usbmodem* - -* *Linux* - Use the command ls /dev/ttyACM* - -##Terminal Applications - -###Details - -Communication over the USB Serial port simply uses the standard [Serial](/Going_Further/Serial/) Interface, specifying the internal (USBTX, USBRX) pins to connect to the Serial Port routed over USB. - -The Serial Interface defaults to a 9600 baud standard serial connection (8 bits, 1 stop bit, no parity), so your host program should be set to the same settings. If you want to communicate at a different standard baud rate, ensure you modify the settings of both the Serial Interface and the Host PC application! - -###Examples - -####Echo back characters you type - -```c - - #include "mbed.h" - - Serial pc(USBTX, USBRX); - - int main() { - pc.printf("Echoes back to the screen anything you type\n"); - while(1) { - pc.putc(pc.getc()); - } - } -``` - - -####Connect to your mbed Microcontroller with a Terminal program and uses the 'u' and 'd' keys to make LED1 brighter or dimmer - -```c - - - #include "mbed.h" - - Serial pc(USBTX, USBRX); // tx, rx - PwmOut led(LED1); - - float brightness = 0.0; - - int main() { - pc.printf("Press 'u' to turn LED1 brightness up, 'd' to turn it down\n"); - - while(1) { - char c = pc.getc(); - if((c == 'u') && (brightness < 0.5)) { - brightness += 0.01; - led = brightness; - } - if((c == 'd') && (brightness > 0.0)) { - brightness -= 0.01; - led = brightness; - } - } - } -``` - -####Pass through characters in both directions between the PC and Serial Port - -```c - - #include "mbed.h" - - Serial pc(USBTX, USBRX); - Serial uart(p28, p27); - - DigitalOut pc_activity(LED1); - DigitalOut uart_activity(LED2); - - int main() { - while(1) { - if(pc.readable()) { - uart.putc(pc.getc()); - pc_activity = !pc_activity; - } - if(uart.readable()) { - pc.putc(uart.getc()); - uart_activity = !uart_activity; - } - } - } -``` - -####The C stdin, stdout and stderr file handles are also defaulted to the PC serial connection - -```c - - #include "mbed.h" - - int main() { - printf("Hello World!\n"); - } -``` - -####Read in to a buffer - -```c - - #include "mbed.h" - - DigitalOut myled(LED1); - Serial pc(USBTX, USBRX); - - int main() { - char c; - char buffer[128]; - - pc.gets(buffer, 4); - - pc.printf("I got '%s'\n", buffer); - } -``` - - -**Troubleshooting** -
-
If you have difficulties with USB serial communication: -
1. Make sure you have installed the driver if you are working on Windows - [Windows Serial Configuration](/Going_Further/Serial_Conf). -
2. Learn how to use the [Serial](/Going_Further/Serial/) port. -
3. Read up on using [Terminals](/Going_Further/Terminals/) programs. -

**If you have any problems, or think this tutorial could be improved, please tell us in the [forum](http://developer.mbed.org/forum)** -
\ No newline at end of file diff --git a/docs/Development/Write_Publish.md b/docs/Development/Write_Publish.md deleted file mode 100644 index d841ac2505..0000000000 --- a/docs/Development/Write_Publish.md +++ /dev/null @@ -1,270 +0,0 @@ -#Writing and Publishing Code - -This page discusses the steps in writing and publishing an mbed library. It covers: - -* What is a library -* How to code a library -* How to publish a library - -##What is a Library? - -A library is a collection of code, usually focused on enabling a specific component, peripheral or functionality. - -The main point of a library is to package something useful up so you and others don't need to keep re-inventing the wheel when you want to use some device or functionality. You can think of it as a building block for a program. Importantly, it is not a program in itself. i.e. it doesn't have a ``main()`` function, but will be a useful and reusable component in a program. - -For reference, here are some existing examples: - -* [Servo Library](http://developer.mbed.org/users/simon/code/Servo/) is a library for controlling a R/C servo, containing Servo.h and Servo.cpp files - -* [Servo Hello World](http://developer.mbed.org/users/simon/code/Servo_HelloWorld/) is a program that uses this library to control a servo, containing main.cpp and the Servo library - -You'll see the Servo library is a reusable component including the API documentation to make it easy to use, and the Servo Hello World pulls in this library, only having to worry about what it is going to do with the servo. - -##How to code a library - -A good library has a clear purpose, nice clean interface, and doesn't include the code doing other things - that is what the user's program is for. - -Most libraries actually start as some code that turns out to be useful, is then [re-factored](http://en.wikipedia.org/wiki/Code_refactoring) in to a useful class or set of functions that can be reused in multiple places in a program, and then finally separated out so any program can include and use it. Lets work through an example to see how this might work... - -###Step 1 - Refactoring - -To start with, here is some code I might have ended up with after some programming: - -``main.cpp``: -```c - - #include "mbed.h" - - DigitalOut pin(LED2); - - int main() { - // do something... - - // flash 5 times - for(int i=0; i<10; i++) { - pin = !pin; - wait(0.2); - } - - // do something else - - // flash 2 times - for(int i=0; i<4; i++) { - pin = !pin; - wait(0.2); - } - - // do another thing - - } - -``` - -The program might do what I want, but it is obvious that some of the code is doing very similar things, perhaps as the result of copy-paste of bits I found useful. In this case, it is good practice to re-factor the code so we create a function that can do the flashing for us; define the code in one place, use it in many places. - -So our code might become: - -``main.cpp``: -```c - - #include "mbed.h" - - DigitalOut pin(LED2); - - void flash(int n) { - for(int i=0; i -![Publish](/Going_Further/Images/Publish/Publish1.png) -
- -Using the same convention that a class called Flasher should have a header file Flasher.h, we suggest you make your library have the same name i.e. "Flasher". - -To create a library, right-click on your program, select "New Library..." and enter "Flasher"; it'll add a folder to your program, but you'll notice a little cog on it indicating it is actually a library in edit mode. You can now drag your files that will be part of the library in to it, and you'll end up with: - - -![Publish](/Going_Further/Images/Publish/Publish2.png) - - -Your program should still build fine, but now there is a little bit more structure. - -The next step is to publish it. To do this, just right-click the library and choose "Publish Library...". You'll be asked to enter a description, some tags and any message specific to that particular version (e.g. first revision, bug fixes). Once done, hit OK and you'll get a message: - - -![Publish](/Going_Further/Images/Publish/Publish3.png) - - -Your library is now live! You can go to the URL and see it on the mbed.org website, and tell all your friends! You'll also see your project has been updated: - - -![Publish](/Going_Further/Images/Publish/Publish4.png) - - -It now just contains a reference to the published library, just like anyone else will get when they choose to import your library. - -##How to make updates to a library (or edit someone else's library) - -So, now lets say you wanted to edit the library some more. Perhaps you wanted to add some Doxygen documentation so users of your library get nice documentation of your library so they know how to use it. We'll that's nice and easy. Just right-click the library and choose "Edit Library...". You'll be back to a editable library folder: - - -![Publish](/Going_Further/Images/Publish/Publish5.png) - - -Make your changes, then re-publish it as before, and your updates are pushed live! Go to the URL and you'll be able to look through the history. Anyone using your library will be able to see a newer version exists, and choose to update in a single click. Magic :) - -Note that you can also edit a library that someone else wrote. Just import it, click edit library and go nuts. The only difference is when you come to publish it, it'll publish under your libraries area rather than theirs. - -##Documenting your library - -The mbed site will also automatically generate API documentation for your library if you mark it up. See the [API Documentation section](/Going_Further/Docu/). \ No newline at end of file diff --git a/docs/Getting_Started/First_Pro.md b/docs/Getting_Started/First_Pro.md deleted file mode 100644 index c48987c907..0000000000 --- a/docs/Getting_Started/First_Pro.md +++ /dev/null @@ -1,223 +0,0 @@ -#Blinky - -The first program we'll use is a test program - it's meant to show you that your board is functional and that you're compiling for the right platform. It's called [Blinky](http://developer.mbed.org/teams/mbed/code/mbed_blinky/). - -#What you need - -To get this program going, all you need is: - -+ A BLE-enabled mbed board. Don't forget to [add it to your compiler and select it as the target](/Getting_Started/User_Plat_Reg#Platform/). - -+ A user account on [developer.mbed.org](https://developer.mbed.org/account/signup/) to access the compiler. - -#Getting Blinky on your board - -You can get Blinky working in just a few minutes. - -2. Import [``Blinky``](http://developer.mbed.org/teams/mbed/code/mbed_blinky/) to your compiler. If you forgot how that's done, see the [IDE section](/Getting_Started/Using_IDE/). - -3. Compile the code. When prompted, save it to your Downloads folder. - -4. Drag and drop the compiled file to your board. - -5. If your board does not restart itself, restart it manually by pressing the Restart button. - -6. The LED will flash. - -#Understanding and changing the code - -The [next section](#understand) explains the code line by line. If you're comfortable with the code, skip to the fun bits - [changing the code](#change) - to see some more possibilities. - - -##Understanding the code - - -``Blinky`` is a very short piece of code. In the compiler, click ``main.cpp`` to see the code. - - -![Blinky main.cpp](/Getting_Started/Images/Blinky/OpeningBlinky.png) - -*Clicking on ``main.cpp`` in the tree opens that file in the main area* - -Let's review it line by line: - -``#include "mbed.h"`` - -Our program relies on pre-existing code, available in a file called ``mbed.h`` that was imported along with ``main.cpp()``. But just because we imported them together doesn't mean that the compiler will know to keep them together; if we want the file to be included when we build our program (and we do, because we're using code that exists in it) we have to explicitly tell the compiler to include it. - -``DigitalOut myled(LED1);`` - -DigitalOut is the [API class](http://developer.mbed.org/handbook/DigitalOut) that handles output to digital pins. In this line, we created a new object of type ``DigitalOut``, call it "myled" and specify that it refers to ``LED1`` - the first LED on the board. - - -**Tip:** exactly which LED is LED1 depends on your board. You can see the full schematics, including LEDs, on your board's [platform page](http://developer.mbed.org/platforms/). - - -``int main()`` - -This line declares that we've reached the main function - the function that runs be default every time the board is switched on (or restarted). You'll see soon that it contains a loop; if it didn't, it would stop running when it reached the last line of the code. - -``while(1)`` - -While is a type of loop that says "keep running the code I contain so long as my condition is met, ie held to be true". The condition of this particular loop is "1". "1" means "TRUE", to a computer, so this loop's condition is always met, and the loop will never stop running. If we didn't use this loop, we'd turn the LED on and off only once, instead of continuously. - -``myled = 1;`` - -As we said above, "1" to a computer means "TRUE". In the context of output (sending a command) to a digital pin (our LED), this means "send high current". If the LED is positive, it will be turned on; if it's negative, it will be turned off. - -``wait(0.2);`` - -"Wait" is a delay in the function's run. Since the program runs from line to line (sequentially) as fast as it can, if we want the LED to be on or off for a period that the human eye can actually perceive, we have to ask the program to wait between turning the LED on and off. In this case, we tell it to wait 0.2 seconds. - - -**Tip:** we don't need to specify that it's seconds; the ``wait`` function, as defined on the API, simply assumes that any value you send is in seconds. There are other functions that use different values, such as microseconds (``wait_us``) or milliseconds (``wait_ms``). - - -``myled = 0`` - -"0" is the opposite of "1", and means "FALSE". In the context of output (sending a command) to a digital pin (our LED), this means "send low current". If the LED is positive, it will be turned off; if it's negative, it will be turned on. - - -``wait(0.2)`` - -We again ask the program to wait before moving on to the next line. - -This is the end of the loop; since the loop's condition is "1", meaning it's always TRUE and never stops running, we'll now go back to our first line: ``myled = 1``, and turn the LED on again. And so on and so forth. - - -##Changing the code - - -You can use ``Blinky`` to get used to mbed and the compiler before moving on to [your prototyping](/Introduction/Rapid_Prototyping/). - -###Sequential LEDs - -Your board likely has more than one LED; you can have your LEDs blink in sequence: - -```c - - #include "mbed.h" - - DigitalOut myled1(LED1); - DigitalOut myled2(LED2); //adds another myled object, referring to the second LED on the board - - int main() { - while(1) { - myled1 = 1; //turn on first LED - wait(0.2); - myled1 = 0; //turn off first LED - wait(0.2); - myled2 = 1; //turn on second LED - wait(0.2); - myled2 = 0; //turn off second LED - wait(0.2); - } - } -``` - -###Concurrent LEDs - -Alternatively, you can have both LEDs blink at the same time: - -```c - - #include "mbed.h" - - DigitalOut myled1(LED1); - DigitalOut myled2(LED2); - - - int main() { - while(1) { - myled1 = 1; - myled2 = 1; //although these lines are executed one after the other, not both at once, the time between them is so short that to us it seems concurrent - wait(0.2); - myled1 = 0; - myled2 = 0; - wait(0.2); - } - } -``` - -###Changing LED timing - -The ``wait()`` function delays the execution of the next line of code. We can change its values to change the timing of the LED sequence: - -```c - - #include "mbed.h" - - // My board has four LEDs, numbered from 1 to 4, so I create four LED objects - DigitalOut myled1(LED1); - DigitalOut myled2(LED2); - DigitalOut myled3(LED3); - DigitalOut myled4(LED4); - - int main() { - while(1) { - // The total time for each LED is five seconds, made up of (time on) + (time off) - myled1 = 1; //my board's LEDs are positive, so the output 1 (high current) turns them on - wait(1); - myled1 = 0; - wait(4); - myled2 = 1; - wait(2); - myled2 = 0; - wait(2); - myled3 = 1; - wait(3); - myled3 = 0; - wait(4); - myled4 = 1; - wait(4); - myled4 = 0; - wait(1); - } - } -``` - -###Multi-colour LEDs - -Some boards have LEDs with more than one colour. For example, [this platform](http://developer.mbed.org/platforms/FRDM-K64F/) has three LEDs: red, green and blue. The platform's page shows as a schematic that - among other things - shows us the pins that are mapped to each LED: - - -![LED mapping](/Getting_Started/Images/Blinky/RGB_LEDs.png) - -*LED1 is red, LED2 is green and LED3 is blue* - -Because the multi-colour LEDs are mapped to LED1, LED2 and LED3 we can use one of our earlier Blinky variations to run the multi-coloured LEDs. For example, if I want to run the program from the pervious section (which focused on ``wait()``), the only thing I need to do is remove the fourth LED from the code (since there are only three LEDs on my multi-colour board): - -```c - - #include "mbed.h" - - // This board has three LEDs, so I create three objects - DigitalOut myled1(LED1); - DigitalOut myled2(LED2); - DigitalOut myled3(LED3); - - int main() { - while(1) { - myled1 = 1; //this is the red LED - wait(1); - myled1 = 0; - wait(4); - myled2 = 1; //this is the green LED - wait(2); - myled2 = 0; - wait(2); - myled3 = 1; //this is the blue LED - wait(3); - myled3 = 0; - wait(4); - } - } -``` - -It would have been neater to change the timings, as the five-second total was designed for a four-LED board, but we wanted to see that the only important change is accounting for the correct number of LEDs. - -#Summary - -mbed boards require a knowledge of C++, but thanks to the API abstractions you don't have to understand the hardware other than at the basic level of recognising the correct name of the circuit you're trying to work with (using the schematics available for each board). As we saw in the Blinky samples, the APIs also provide commonly used functions such as ``wait()``. - -To explore other samples and learn of more API functions and abstractions, see our [code samples](http://developer.mbed.org/teams/mbed_example/) and the [API breakdown](/Development/API_Libs_Breakdown/). diff --git a/docs/Getting_Started/IDE_Shortcuts.md b/docs/Getting_Started/IDE_Shortcuts.md deleted file mode 100644 index ec44b985ee..0000000000 --- a/docs/Getting_Started/IDE_Shortcuts.md +++ /dev/null @@ -1,96 +0,0 @@ -#Compiler Shortcuts and Controls - -##Compiler editor keyboard shortcuts - -###Navigation - - - - - - - - - - - - - - - - -
ShortcutDescription
Hold CtrlInteractive mode
Shift-HomeGo to beginning of line and select from current position
Shift-EndGo to end of line and select from current position
Ctrl-HomeGo to beginning of file
Ctrl-EndGo to end of file
Ctrl-Shift-HomeGo to beginning of file and select from current position
Ctrl-Shift-EndGo to end of file and select from current position
Shift-PageUpScroll a page up and select from current position
Shift-PageDownScroll a page down and select from current position
Shift-Any ArrowExtend/Reduce text selection
Ctrl-Left ArrowGo to the beginning of previous word
Ctrl-Right ArrowGo to the beginning of next word
Ctrl-Up ArrowScroll up 1 row
Ctrl-Down ArrowScroll down 1 row
- -
-###Ctrl-key sequences - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ShortcutDescription
Ctrl-ASelect All
Ctrl-BCompile Only (no download prompt)
Ctrl-Shift-BCompile All & Download (clean build)
Ctrl-CCopy(with text selection only)
Ctrl-Shift-CCommit
Ctrl-DCompile & Download
Ctrl-Shift-DDuplicate line
Ctrl-EErase line (current line)
Ctrl-FFind & Replace
Ctrl-Alt-FFind in Files
Ctrl-Shift-FFormat code (text selection or current file)
Ctrl-HFind & Replace
Ctrl-KFind & Replace
Ctrl-LTo lower case (with text selection only)
Ctrl-RRevisions History (of current file, single file mode)
Ctrl-SSave (current file)
Ctrl-Alt-SSave As
Ctrl-Shift-SSave All
Ctrl-UTo upper case (with text selection only)
Ctrl-VPaste(with text selection only)
Ctrl-WClose (current file, doesn't work on Chrome)
Ctrl-Shift-WClose All (doesn't work on Chrome)
Ctrl-XCut(with text selection only)
Ctrl-YRedo
Ctrl-ZUndo
Ctrl-/Toggle line comment (using slashes)
Ctrl-Shift-/Toggle block comment (using /* ... */ markup)
- -
-###Misc - - - - - - - - - - - - -
ShortcutDescription
TabIncrease indent of text selection
Shift-TabDecrease indent of text selection
ESCClose Find or toggle Fullscreen
InsToggle Insert Mode
Ctrl-InsCopy (with text selection only)
Shift-InsPaste (with text selection only)
Shift-DelCut (with text selection only)
F8Compile Only (no download prompt)
F9Compile & Download
F10Compile All & Download (clean build)
- -
-##Touch device shortcuts - -###Editor - - - - - - - -
ShortcutDescription
Single TapMove the cursor
Double TapText selection on the tapped word (opens context menu)
Triple TapText selection on the tapped row (opens context menu)
Tap HoldContext menu
Touch-DragText selection until the touch is released (opens context menu)
- -
-###Compiler IDE - - - - - - -
ShortcutDescription
Single TapEquivalent to single mouse click
Double TapEquivalent to double mouse click
Tap HoldEquivalent to right click (context menu)
Touch-DragEquivalent to mouse dragging
-
-
\ No newline at end of file diff --git a/docs/Getting_Started/Images/Adding_Platform.png b/docs/Getting_Started/Images/Adding_Platform.png deleted file mode 100644 index e821899215..0000000000 Binary files a/docs/Getting_Started/Images/Adding_Platform.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Blinky/OpeningBlinky.png b/docs/Getting_Started/Images/Blinky/OpeningBlinky.png deleted file mode 100644 index a343b9180d..0000000000 Binary files a/docs/Getting_Started/Images/Blinky/OpeningBlinky.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Blinky/RGB_LEDs.png b/docs/Getting_Started/Images/Blinky/RGB_LEDs.png deleted file mode 100644 index 58808c9843..0000000000 Binary files a/docs/Getting_Started/Images/Blinky/RGB_LEDs.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Board.png b/docs/Getting_Started/Images/Board.png deleted file mode 100644 index 2e139e1588..0000000000 Binary files a/docs/Getting_Started/Images/Board.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Compiler/Compiler1.png b/docs/Getting_Started/Images/Compiler/Compiler1.png deleted file mode 100644 index 145bd232fa..0000000000 Binary files a/docs/Getting_Started/Images/Compiler/Compiler1.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Compiler/Compiler2.png b/docs/Getting_Started/Images/Compiler/Compiler2.png deleted file mode 100644 index 37337dbfa1..0000000000 Binary files a/docs/Getting_Started/Images/Compiler/Compiler2.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Compiler/Compiler3.png b/docs/Getting_Started/Images/Compiler/Compiler3.png deleted file mode 100644 index d9e4d2bc03..0000000000 Binary files a/docs/Getting_Started/Images/Compiler/Compiler3.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Compiler/Compiler4.png b/docs/Getting_Started/Images/Compiler/Compiler4.png deleted file mode 100644 index 307269e41c..0000000000 Binary files a/docs/Getting_Started/Images/Compiler/Compiler4.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Compiler/Compiler5.png b/docs/Getting_Started/Images/Compiler/Compiler5.png deleted file mode 100644 index 58732d1556..0000000000 Binary files a/docs/Getting_Started/Images/Compiler/Compiler5.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Compiler/Compiler6.png b/docs/Getting_Started/Images/Compiler/Compiler6.png deleted file mode 100644 index 15631488dc..0000000000 Binary files a/docs/Getting_Started/Images/Compiler/Compiler6.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Compiler/Compiler7.png b/docs/Getting_Started/Images/Compiler/Compiler7.png deleted file mode 100644 index f6b7fba61e..0000000000 Binary files a/docs/Getting_Started/Images/Compiler/Compiler7.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Compiler/Compiler8.png b/docs/Getting_Started/Images/Compiler/Compiler8.png deleted file mode 100644 index 50da5b2767..0000000000 Binary files a/docs/Getting_Started/Images/Compiler/Compiler8.png and /dev/null differ diff --git a/docs/Getting_Started/Images/Components.png b/docs/Getting_Started/Images/Components.png deleted file mode 100644 index c90990dbc2..0000000000 Binary files a/docs/Getting_Started/Images/Components.png and /dev/null differ diff --git a/docs/Getting_Started/Images/DeviceOnMac.png b/docs/Getting_Started/Images/DeviceOnMac.png deleted file mode 100644 index 3339376429..0000000000 Binary files a/docs/Getting_Started/Images/DeviceOnMac.png and /dev/null differ diff --git a/docs/Getting_Started/Images/IDE_Empty.png b/docs/Getting_Started/Images/IDE_Empty.png deleted file mode 100644 index f5a5c6b656..0000000000 Binary files a/docs/Getting_Started/Images/IDE_Empty.png and /dev/null differ diff --git a/docs/Getting_Started/Images/IDE_Select_Platform.png b/docs/Getting_Started/Images/IDE_Select_Platform.png deleted file mode 100644 index 6ab37f81e0..0000000000 Binary files a/docs/Getting_Started/Images/IDE_Select_Platform.png and /dev/null differ diff --git a/docs/Getting_Started/Images/compile.png b/docs/Getting_Started/Images/compile.png deleted file mode 100644 index 464a5cd912..0000000000 Binary files a/docs/Getting_Started/Images/compile.png and /dev/null differ diff --git a/docs/Getting_Started/Images/fullmbedprocess.png b/docs/Getting_Started/Images/fullmbedprocess.png deleted file mode 100644 index dce5ec07f2..0000000000 Binary files a/docs/Getting_Started/Images/fullmbedprocess.png and /dev/null differ diff --git a/docs/Getting_Started/Images/mbed_Interface.webp b/docs/Getting_Started/Images/mbed_Interface.webp deleted file mode 100644 index ce9d0065e0..0000000000 Binary files a/docs/Getting_Started/Images/mbed_Interface.webp and /dev/null differ diff --git a/docs/Getting_Started/Intro.md b/docs/Getting_Started/Intro.md deleted file mode 100644 index ad298c30d3..0000000000 --- a/docs/Getting_Started/Intro.md +++ /dev/null @@ -1,24 +0,0 @@ -#Working with mbed - -This section will lead you through the process of creating a prototype on an mbed board: - -
- -
-
-The standard process is to get a board (and maybe a few extending components), write a bit of code and import it to the board. Simple. -
- -We'll look at the extended process, which includes creating a user and registering a platform. We'll also review our online compiler and show you how to build your first program: - -2. [User and platform registration](/Getting_Started/User_Plat_Reg/). - -1. [Boards and components](/Introduction/Plat_Comp_Intro/). - -3. [Working with the mbed compiler](/Getting_Started/Using_IDE/) and [some shortcuts](/Getting_Started/IDE_Shortcuts/). - -4. [Your first program](/Getting_Started/First_Pro/). - -5. Where to [get help](/Getting_Started/Questions/). - -The program you'll create in this section is called `Blinky`. If you've already set up your IDE and have a board, you can skip ahead to the [Blinky example](/Getting_Started/First_Pro/). \ No newline at end of file diff --git a/docs/Getting_Started/Questions.md b/docs/Getting_Started/Questions.md deleted file mode 100644 index ea59096ca2..0000000000 --- a/docs/Getting_Started/Questions.md +++ /dev/null @@ -1,90 +0,0 @@ -#Getting Help - -##Where to find answers to questions - -You can get answers to most common questions by searching the mbed website. - -Places you may find answers to your questions: - - * The Handbook - What you're reading now. The 'official' source for information, created and maintained by the mbed team - * [The Cookbook](http://developer.mbed.org/cookbook/Homepage) - The place for user contributed documentation - * [The Notebooks](http://developer.mbed.org/notebooks/) - The place for user contributed notes and how-to's which may be useful - * [The Questions Page](http://developer.mbed.org/questions/) - The place to ask questions. See [below](#questions ) for more info - * [The Forum](http://developer.mbed.org/forum/) - The place to discuss topics of interest - * If you'd like to speak to the mbed team - just email us at and we'll get back to you as soon as possible. Alternatively, you could try our [unofficial IRC channel](http://developer.mbed.org/irc/). - -##How can I get additional mbed accounts - -You can signup without access to an mbed platform. Then you can add platforms to your mbed Compiler by finding the appropriate platform on the [platforms page](http://developer.mbed.org/platforms) and clicking "Add to mbed Compiler", this will allow you to compile for that platform. - -##My mbed is broken! - -Is your mbed dead? [Here](http://developer.mbed.org/cookbook/deadmbed) are some things you can try! - -##How to ask for help - -If you can't find the answer you're looking for, please don't hesitate to post in the appropriate part of the [Forum](http://developer.mbed.org/forum/). mbed users are a friendly bunch and will be pleased to help you. If you have a specific question, please post it in [Questions](http://developer.mbed.org/questions/). - - -**How to ask for help with code** -
-A good way to get help with a piece of code that's not working for you is to *Publish* the program. To do this, right click the program in the Compiler and choose Publish. Include the URL returned in your post. -
-This way users can very easily check over your complete program and therefore help you better. -
- -##How to report problems or suggestions related to mbed - -You are very welcome to post in the [Bugs and Suggestions forum](http://developer.mbed.org/forum/bugs-suggestions). - -Finally, if you have an urgent problem or wish to discuss something privately, please email . - - -#Questions - - -##Introduction - -The [Questions](http://developer.mbed.org/questions/) section of mbed is designed to provide a high quality resource of common (and not so common) questions and answers. This means that instead of searching long forum threads for the answer to a query or problem, both the question and answer will hopefully be captured succinctly on a single page. - -##How to use the feature - -###What is a good question? - -A good question is: - -* Answerable - ie, not a topic of debate. - -* Specific - try and accurately describe the problem. - -* Reproducible - If your question is about a specific bit of code, publish the program in question and include it in your question. - -Open-ended questions which can have several different 'correct' answers are better suited to the forum. - -###What is a good answer? - -Read the question carefully and make sure your answer tries to provide a solution – or a viable alternative. Use the formatting available to make to answer more clear, and provide links and source code where possible. If you need the original author to clarify or provide more details, please ask them to do so in the **comments** section of their question. - -###When and why should I accept an answer? - -If a user of mbed has posted a suitable answer that has solved your problem, then you should mark the question as **Accepted**. This means that the user knows you value their answer and lets future readers know which is the best answer. - -###When should I use comments? - -If you do not have a solution to the question, however you have something useful to add then you should **Post a comment** under the related question or answer. - -##FAQ - - -###What can I do to help? - -* Ask questions! - -* Post answers! - -We want to encourage all our users to ask questions in the Questions area. If you have a question that you think could have a specific answer, then this is the place. If you want to discuss a particular topic, then the forum would be better place for that. - - -###Where can I leave feedback or suggestions? - -Post in [here](http://developer.mbed.org/forum/bugs-suggestions) about your ideas. \ No newline at end of file diff --git a/docs/Getting_Started/User_Plat_Reg.md b/docs/Getting_Started/User_Plat_Reg.md deleted file mode 100644 index 08d7446061..0000000000 --- a/docs/Getting_Started/User_Plat_Reg.md +++ /dev/null @@ -1,35 +0,0 @@ -#Creating a User - -If you want to use the [online IDE](https://developer.mbed.org/compiler/) or participate in the [mbed community](https://developer.mbed.org/forum/), you'll need a user on [developer.mbed.org](https://developer.mbed.org/account/signup/). - - -#Platform Registration - - -Once you have an account you can register platforms - they will be associated with your account and you'll be able to select them as a target in the compiler. - -The easiest way to register a platform is using the HTML file that is pre-installed on it: - -1. Log in to mbed [site](https://developer.mbed.org) with your mbed account. - -2. Plug your board into your computer's USB port. The board will be displayed in your file browser as a removable storage (similar to plugging in your phone or a USB stick). - - -![Adding board](/Getting_Started/Images/DeviceOnMac.png) - - -3. In your file browser, double-click the board to see its files. By default, every board has an HTML file. - -4. Double click the board's .HTML file to navigate to its page on the mbed site. - -5. On the board's page, click *Add to your mbed Compiler*. - - -![Adding board](/Getting_Started/Images/Adding_Platform.png) - - -6. The compiler will open with your board. You're ready to program. - - -![Adding board](/Getting_Started/Images/IDE_Empty.png) - diff --git a/docs/Going_Further/Coding_Style.md b/docs/Going_Further/Coding_Style.md deleted file mode 100644 index aac1316a17..0000000000 --- a/docs/Going_Further/Coding_Style.md +++ /dev/null @@ -1,167 +0,0 @@ -#Coding Style - -This page describes mbed coding style. Our goal is the files written in mbed SDK conform this standard (exceptions are there, for instance 3rd libraries supplied by partners). - -Be consistent. - -The mbed SDK code follows [K&R style](http://en.wikipedia.org/wiki/Indent_style#K.26R_style) with at least two exceptions that can be found in the list below the code snippet. - -```c - - static const PinMap PinMap_ADC[] = { - {PTC2, ADC0_SE4b, 0}, - {NC , NC , 0} - }; - - uint32_t adc_function(analogin_t *obj, uint32_t options) - { - uint32_t instance = obj->adc >> ADC_INSTANCE_SHIFT; - switch (options) { - case 1: - timeout = 6; - break; - default: - timeout = 10; - break; - } - - while (!adc_hal_is_conversion_completed(instance, 0)) { - if (timeout == 0) { - break; - } else { - timeout--; - } - } - - if (obj->adc == ADC_CHANNEL0) { - adc_measure_channel(instance); - adc_stop_channel(instance); - } else { - error("channel not available"); - } - - #if DEBUG - for (uint32_t i = 0; i < 10; i++) { - printf("Loop : %d", i); - } - #endif - return adc_hal_get_conversion_value(instance, 0); - } -``` - -##Rules - -* Indentation - 4 spaces. Please do not use tabs. -* Braces - K&R, except for functions where the opening brace is on the new line. -* 1 TBS - use braces for statements if, else, while, for [exception from K&R](http://en.wikipedia.org/wiki/Indent_style#Variant:_1TBS) -* One line per statement -* Preprocessor macro starts at the beginning of a new line, the code inside is indented accordingly the code above it -* Cases within switch are indented (exception from K&R) -* Space after statements if, while, for, switch, same applies to binary and ternary operators -* Each line has preferably at most 120 characters -* For pointers, '*' is adjacent to a name (analogin_t *obj) -* Don't leave trailing spaces at the end of lines -* Empty lines should have no trailing spaces -* Unix line endings are default option for files -* Use capital letters for macros -* A file should have an empty line at the end - -##Naming convention - -Classes - -* Begins with a capital letter, and each word in it begins also with a capital letter (AnalogIn, BusInOut). -* Methods contain small letters, distinct words separated by underscore. -* Private members starts with an underscore. - -User defined types (typedef) - -* Structures - suffix _t - to denote it is user defined type -* Enumeration - the type name and values name - same naming convention as classes (e.g MyNewEnum) - -Functions - -* contain lower case letters (as methods within classes) -* distinct words separated by underscore (wait_ms, read_u16) - -```c - - #define ADC_INSTANCE_SHIFT 8 - - class AnalogIn { - public: - /** Create an AnalogIn, connected to the specified pin - * - * @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 - */ - uint32_t read() { - return analogin_read(&_adc, operation); - } - - protected: - analogin_t _adc; - }; - - typedef enum { - ADC0_SE0 = (0 << ADC_INSTANCE_SHIFT) | 0, - } ADCName; - - struct analogin_s { - ADCName adc; - }; - - typedef struct analogin_s analogin_t; -``` - -##Doxygen documentation - -All functions/methods should contain a documentation using doxygen javadoc in a header file. More information regarding writing API Documentation, follow the [link](/Going_Further/Docu/). - -```c - - #ifndef ADC_H - #define ADC_H - - #ifdef __cplusplus - extern "C" { - #endif - - /** ADC Measurement method - * - * @param obj Pointer to the analogin object. - * @param options Options to be enabled by ADC peripheral. - * - * @returns - * Measurement value on defined ADC channel. - */ - uint32_t adc_function(analogin_t *obj, uint32_t options) - - #ifdef __cplusplus - } - #endif - - #endif -``` - -##Source code indenter - -In Mbed project you can use AStyle ([Artistic Style](http://astyle.sourceforge.net/)) source code indenter to help you auto format your source code. It will for sure not correct all your coding styles but for sure will eliminate most of them. -You can download AStyle from this [location](http://sourceforge.net/projects/astyle/files/). - -Official Mbed SDK styles include below AStyle styles (defined by command line switched): - -``--style=kr --indent=spaces=4 --indent-switches`` - -To format your file you can execute below command. Just replace **$(FULL_CURRENT_PATH)** with path to your source file. - -``astyle.exe --style=kr --indent=spaces=4 --indent-switches $(FULL_CURRENT_PATH)`` \ No newline at end of file diff --git a/docs/Going_Further/Comp_Ver_Cont.md b/docs/Going_Further/Comp_Ver_Cont.md deleted file mode 100644 index abbcde433b..0000000000 --- a/docs/Going_Further/Comp_Ver_Cont.md +++ /dev/null @@ -1,52 +0,0 @@ -#Compiler Version Control - -You can use the version control features to let you version, branch and merge code, with a nice representation of the state of your project history: - - -![](/Going_Further/Images/Compiler/Compiler1.png) - - -The approach should be familiar to those of you with experience of distributed version control models (as used by mercurial/git); each program and library has its own local repository, so you can commit and perform actions on it within your own workspace (such as switching, branching, showing changes). - -The main things you can do with a local repository include: - -* **Commit** a version of your project, and view the revision history -* **View** changes a version made, and **compare** changes between versions -* **Switch** and **revert** to a different version -* **Branch** and **merge** versions - - -**Warning:** You can also do collaboration aspects with this - fork, push, pull, send pull request. These are covered in the [Collaboration pages](/Community/Collab/). - - -Your program is the "Working Copy". You can "Commit" changes to its local repository to create new "Revisions". - -You can choose to "Switch" to a particular revision, which updates your working copy to that revision (e.g. a state of your program in the past). This is the way you can "Branch"; do some commits, switch to a previous revision, do some more commits; you now have two branches of development derived from a common revision. - -You can then "Merge" a revision, often the head of one branch, in to your working copy. This creates a working copy that is the merge of these two branches, and when you commit, your back to one (less) branch of development. - -There is also the option to "Discard" your working copy, and "Revert" your working copy to a particular revision; unlike "Switch", this creates a working copy with the changes you need to get back to that previous state, more like an "undo" than a branch. - -You can see the changes between your current working copy to the previous revision, and changes between revisions. - - -![](/Going_Further/Images/Compiler/Compiler2.png) - - -##Sub-repositories and synchronization - -Programs and libraries can depend on other published code to deliver a functionality. These dependencies are stored in reference files (e.g. name.lib) that are present in the code base of the repository and when you import it the mbed Compiler will follow these references and import other sub-repositories, including referenced sub-sub-repositories. - -This synchronization mechanism ensures that the imported repository and all its sub-repositories will be restored to the exact state they were when the author committed the changes to the parent repository (usually a program) and published it. This also makes it easy for everyone to use the code without worrying about dependencies, imports, revisions numbers etc. - -The following is required when you publish to ensure that the repository can be imported successfully: - -* All sub-repositories (even sub-sub-repositories) must be published on the mbed Developer Site -* All sub-repositories shouldn't contain uncommitted or unpublished changes. - -Here is the video that shows how you get started: - - - - diff --git a/docs/Going_Further/Docu.md b/docs/Going_Further/Docu.md deleted file mode 100644 index af2dd29324..0000000000 --- a/docs/Going_Further/Docu.md +++ /dev/null @@ -1,312 +0,0 @@ -#API Documentation - -##What is API documentation? - -API documentation is a quick and concise reference containing what you need to know to use a library or work with a program. It details functions, classes, return types, and more. - -In mbed, API documentation for programs and libraries is fully supported both within the Compiler and in the code listings on the public site. - -##Browsing API documentation from within the mbed Compiler - - -![](/Going_Further/Images/API_Docs/APIDOCS1.png) - - -Each documentation group contains only the documented definitions for that group as follows: - -* Classes - documented classes and methods - -* Structs - documented struct and union data types - -* Files - documented functions, variables, enums, defines, also references to struct and unions, but no namespaces and classes - -* Groups - defined by the author, grouped documentation elements like files, namespaces, classes, functions, variables, enums, typedefs, defines and other groups for quick reference - e.g. [mbed library Device Peripheral Registers](http://developer.mbed.org/users/mbed_official/code/mbed/). - - -**Note:** Classes, methods, functions, etc which exist in the source code but aren't documented won't appear in the documentation. - - -The documentation preview contains references presented as standard links (default in blue) that point to sub-sections of the document or point to other documents, and which once activated would open inside the mbed Compiler. - - -![](/Going_Further/Images/API_Docs/APIDOCS2.png) - - -Clicking one of the "Definition at line of file source.c" links would open the definition source file in the Editor (see below). The definition source file can also be opened with "Go to definition" option in the context menu from the navigation tree. - - -![](/Going_Further/Images/API_Docs/APIDOCS3.png) - - -Another notable feature of the API documentation in the mbed Compiler is the ability to create new files from documentation examples, making it easier to try them. The mbed Compiler would prompt for file name and may suggest main.cpp as name if it doesn't exist in the program root. - - -**Warning:** The documentation groups and individual documents **do not exist in your workspace**. They are meta navigation items that reflect the API documentation as present in the library home page, and as such they cannot be moved, deleted, renamed, etc. - - -##How to add documentation to your own programs and libraries - -The documentation is created out of comment blocks in your code, usually located above declarations and definitions. Let's take the following example: - -```c - - class HelloWorld { - public: - HelloWorld(); - printIt(uint32_t delay = 0); - }; -``` - -**First** important thing about documenting a code is to give hint to the documentation system that a comment is intended for documenting, that it's not an ordinary comment. To do that a comment block should start with ``/**`` or ``/*!`` sequences (as opposed to ``/*``), and that comment block should be just above the definition: - -```c - - /** My HelloWorld class. - * Used for printing "Hello World" on USB serial. - */ - class HelloWorld { - public: - /** Create HelloWorld instance */ - HelloWorld(); - - /** Print the text */ - printIt(uint32_t delay = 0); - }; -``` - -It's also possible to use single line comments starting with ``///`` or ``//!``. - -```c - - //! My HelloWorld class. Used for printing "Hello World" on USB serial. - class HelloWorld { - public: - /// Create HelloWorld instance - HelloWorld(); - - /// Print the text - printIt(uint32_t delay = 0); - }; -``` - -It requires almost no effort to translate scattered comments in code into well formatted documentation descriptions! - -**Second** important thing about the documentation process is the documentation markup to describe parameters and return values, but also to notes, groups, code examples and more. -Doxygen accepts reserved words prefixed with ``\`` or ``@``, where some of the commonly used are: - -* @param text - -* @return text (synonym @returns) - -* @note text - -* @group - -* @code example @endcode - -* @see ref [, ref2...] (synonym @sa) - -Here is an example of advanced documentation: - -```c - - /** My HelloWorld class. - * Used for printing "Hello World" on USB serial. - * - * Example: - * @code - * #include "mbed.h" - * #include "HelloWorld.h" - * - * HelloWorld hw(); - * - * int main() { - * hw.printIt(2); - * } - * @endcode - */ - class HelloWorld { - public: - /** Create HelloWorld instance - */ - HelloWorld(); - - /** Print the text - * - * @param delay Print delay in milliseconds - * @returns - * 1 on success, - * 0 on serial error - */ - printIt(uint32_t delay = 0); - }; -``` - -To generate documentation for the example above, you have to click the **Update Docs** menu item in the **Compile** dropdown: - - -![](/Going_Further/Images/API_Docs/APIDOCS5.png) - - -Once generated the navigation tree would refresh and the formatted documentation would look like this: - - -![](/Going_Further/Images/API_Docs/APIDOCS4.png) - - -Congratulations! You now know how to document a library. - -##Extra Features - -Not only do you get the API documentation, but you can insert code and API documentation in to your wiki pages, notebook pages, questions, forum posts, etc. - -##Example - -

Import library

- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- - - Public Member Functions -

-
-   - - - Servo - - (PinName pin) -
- Create a servo object connected to the specified PwmOut pin. - - -
-
- void  - - - write - - (float percent) -
- Set the servo position, normalised to it's full range. - - -
-
- float  - - - read - -
- Read the servo motors current position. - - -
-
- void  - - - position - - (float degrees) -
- Set the servo position. - - -
-
- void  - - - calibrate - - (float range=0.0005, float degrees=45.0) -
- Allows calibration of the range and angles for a particular servo. - - -
-
- - Servo - - &  - - - operator= - - (float percent) -
- Shorthand for the write and read functions. - - -
-
-
- - -These are done using the ``library`` macro and the URLs of the documentation you wish to pull in: - -``` - - <> - - <> - - <> -``` - -Each public documentation page has a handy Embed code box which you can copy and paste into your wikipage. - -Note the difference URL above with 'tip' and the one with a mercurial revision hash. Linking to documentation with a 'tip' URL will mean that the page will always show the latest documentation for your library. - -See [Wiki syntax](http://mbed.org/cookbook/Wiki-Syntax) for more details. - -##Additional notes - -Last but not least, a few notes about Doxygen as being the core of the documentation generation in the mbed ecosystem: - -* Doxygen is compatible with Javadoc and other documentation styles. Refer to the [Doxygen manual](http://www.stack.nl/~dimitri/doxygen/manual.html) for more information. - -* Doxygen won't process the ``main.cpp`` file unless referenced in another file using ```/** @file main.cpp */``` markup. It's generally good idea to split definitions and defines into library (libraries) instead and do not rely on ``main.cpp`` file documentation. - -* Doxygen can process comments located right next to definitions and declarations, and also at other places. Refer to [documentation at other places](http://www.stack.nl/~dimitri/doxygen/docblocks.html#structuralcommands) in the Doxygen manual. - -##Final words - -There is so much more to be said about API documentation that isn't covered by this guide. How it improves direct and indirect collaborative development of complex programs and libraries. How the documentation preview can improved even further with groups, brief descriptions, etc. No doubt that documenting a code is an added effort on top of the code development. But if that extra effort could enable everyone to efficiently utilize the code and its features, then may be that effort is as important as the code itself. - -For further information about the Doxygen markup and more examples you can visit the [Doxygen manual](http://www.stack.nl/~dimitri/doxygen/manual/index.html) on their website. \ No newline at end of file diff --git a/docs/Going_Further/Export.md b/docs/Going_Further/Export.md deleted file mode 100644 index bac31a5095..0000000000 --- a/docs/Going_Further/Export.md +++ /dev/null @@ -1,172 +0,0 @@ -#Exporting to Offline Toolchains - - -Our goal with mbed is to enable a consistent and stable fully integrated development platform that just works. This helps provide a consistent context for development, code sharing, and questions and answers with other developers that helps you be more productive, especially when prototyping. - -However, the mbed C/C++ SDK used with the mbed Online Compiler is also compatible with a number of other popular ARM microcontroller toolchains! - -If you'd like to use the mbed C/C++ SDK with an alternate tool, or migrate to one as your project develops past prototype, you can choose to export an mbed project for the toolchain of your choice: - -* [Exporting to uVision](#uVision). - -* [Exporting to Eclipse IDEs](#Eclipse) (LPCXpresso, Kinetis Design Studio, etc). - -* [Exporting to Make](#Make) (GCC ARM Embedded, Code Sourcery). - -* [Exporting to IAR Embedded Workbench](#IAR). - -This helps give you the flexibility to use the mbed libraries and resources with other toolchains, and also can help as you move your prototype in to production. - - -**Warning:** Changing the compiler toolchain introduces many degrees of freedom in the system; these differences include the translation of C/C++ code to assembly code, the link time optimizations, differences because of the implementations of the C standard libraries, and differences based on compile and link options. It also makes it a lot harder to share code and questions with other developers, as the context needs to be shared too! -

-Whilst we support exporting your project and the libraries to an alternate toolchain, we cannot guarantee the same consistency as using the mbed Online Compiler. We will do our best to maintain the exported libraries, project file and makefiles, but please understand we can not cover all cases, combinations or provide support for use of these alternate tools themselves! -
- - -![](/Going_Further/Images/Exporting/Export1.png) - - -![](/Going_Further/Images/Exporting/Export2.png) - - -_______ - - -##uVision - - - -[uVision](http://www.keil.com/uvision|) is one of the external offline toolchains supported by the mbed platform. - -To export your mbed program for use in uVision, right-click the program in your program workspace. From the dialog, you can select the "Export To" as "Keil uVision4", and the target microcontroller you wish to export for. - -When you choose export, a zip file containing all the files you need for uVision will be generated. Unzip it and open the uVision project file ("project.uvproj"): - -After building the project, the binary file (".bin"), ready to be flashed on the mbed, will be generated in the "build" directory. - - -![](/Going_Further/Images/Exporting/uVision1.png) - - -![](/Going_Further/Images/Exporting/uVision2.png) - - -________ - - -##Eclipse IDE - - -[Eclipse](https://eclipse.org/) is a widely-used, open source IDE that supports multiple languages. It is used by many offline toolchains, including [LPCXpresso](http://www.lpcware.com/lpcxpresso) and [Kinetis Design Studio](http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=KDS_IDE). The setup process for each IDE will vary depending on the distribution; however, the user interface between these distributions will not change much, so these instructions should be easy to apply to all Eclipse-based IDEs. - - -![](/Going_Further/Images/Exporting/Eclipse1.png) - - -To export your mbed program for use in an Eclipse-based IDE, right-click the program in your program workspace. From the dialog, you can select your desired toolchain for the "Export Toolchain" field. Also, be sure to select the correct target platform under the "Export Target" field. - -When you choose export, a zip file containing all the files you need will be generated. Unzip it anywhere and open your Eclipse-based IDE. - - -**NOTE:** All of the following screenshots will be using a plain Eclipse IDE installation with no embedded development plugins installed. This was done to keep these instructions as general as possible. Your IDE's user interface will most likely not match the -following screenshots exactly, but it should be very similar. - - - -![](/Going_Further/Images/Exporting/Eclipse2.png) - - -Click File > Import… - - -![](/Going_Further/Images/Exporting/Eclipse3.png) - - -In the dialog that pops up, under “General”, select “Existing Projects into Workspace” and click Next. - - -![](/Going_Further/Images/Exporting/Eclipse4.png) - - -Next to the “Select root directory” field, click Browse. In the dialog that pops up, navigate to where you unzipped the downloaded program and select the folder. Hit “OK”. - - -![](/Going_Further/Images/Exporting/Eclipse5.png) - - -In the “Projects” area, you should see the project name listed. Ensure the checkbox next to it is checked. Hit “Finish”. - -Now your project should appear in the "Project Explorer" on the left side of the IDE. - -After the build, your binary will be generated in the "Release", or "Debug" directory, depending on the selected configuration. - -______ - - -##Make - - - -> "[GNU Make](http://www.gnu.org/software/make/) is a tool which controls the generation of executables and other non-source files of a program from the program's source files." -> ->(Taken verbatim from the GNU Make website). - -Make itself does not compile source code. It relies on a compiler like [GCC ARM Embedded](https://launchpad.net/gcc-arm-embedded) or [Code Sourcery (Sourcery CodeBench)](http://www.mentor.com/embedded-software/sourcery-tools/sourcery-codebench/overview/). Sourcery CodeBench is a paid tool and can be purchased on the [Mentor](http://www.mentor.com/) website. GCC ARM Embedded can be installed for free using instructions found [here](http://gnuarmeclipse.livius.net/blog/toolchain-install/). - - - -**Warning:** The current Makefile requires that your compiler is added to your PATH variable. This contradicts the instruction given on the installation website because those instructions are intended for Eclipse, not Make. - - - -![](/Going_Further/Images/Exporting/Make1.png) - - -To export your mbed program for use in Make, right-click the program in your program workspace. From the dialog, you can select your desired compiler under the "Export Toolchain" field. Also, be sure to select the correct target platform under the "Export Target" field. - -When you choose export, a zip file containing all the files you need for Make will be generated. Unzip it and you are ready to launch make: - -```c - - $ cd /my/program/directory/ - $ ls - main.cpp Makefile mbed mbed.lib - - $ make - arm-none-eabi-g++ -c -Os -fno-common -fmessage-length=0 -Wall -fno-exceptions -mcpu=cortex-m3 -mthumb -ffunction-sections -fdata-sections -DTARGET_LPC1768 - DTOOLCHAIN_GCC_CS -DNDEBUG -std=gnu++98 -I./mbed -I./mbed/LPC1768 -I./mbed/LPC1768/GCC_CS -o main.o main.cpp - arm-none-eabi-gcc -mcpu=cortex-m3 -mthumb -Wl,--gc-sections -Tmbed/LPC1768/GCC_CS/LPC1768.ld -L./mbed -L./mbed/LPC1768 -L./mbed/LPC1768/GCC_CS -o my_program.elf main.o mbed/LPC1768/GCC_CS/startup_LPC17xx.o mbed/LPC1768/GCC_CS/sys.o mbed/LPC1768/GCC_CS/cmsis_nvic.o mbed/LPC1768/GCC_CS/c ore_cm3.o mbed/LPC1768/GCC_CS/system_LPC17xx.o -lmbed -lcapi -lstdc++ -lsupc++ -lm -lc -lgcc -lmbed -lcapi -lstdc++ -lsupc++ -lm -lc -lgcc - arm-none-eabi-objcopy -O binary my_program.elf my_program.bin - - $ ls - main.cpp main.o Makefile mbed mbed.lib my_program.bin my_program.elf -``` - -The binary file ``.bin`` is ready to be flashed on the mbed. - -_______ - - -##IAR - - - -The [IAR Embedded Workbench](http://www.iar.com/en/Products/IAR-Embedded-Workbench/) is one of the external offline toolchains supported by the mbed platform. - - -**Warning:** The support for the IAR toolchain has been added very recently (Jan 2013), if you are trying to export an old project make sure to update the mbed library to the latest build first. - - -To export your mbed program for use in the IAR Embedded Workbench, right-click the program in your program workspace. From the dialog, you can select the "Export To" as "IAR Systems", and the target microcontroller you wish to export for (currently, only the LPC1768 is supported): - - -![](/Going_Further/Images/Exporting/IAR1.png) - - -When you choose export, a zip file containing all the files you need for the IAR Embedded Workbench will be generated. Unzip it and open the IAR Embedded Workbench workspace file ``.eww``. - -After building the project, the binary file ``.bin``, ready to be flashed on the mbed, will be generated in the "Debug\Exe" directory: - - -![](/Going_Further/Images/Exporting/IAR2.png) - \ No newline at end of file diff --git a/docs/Going_Further/Intro.md b/docs/Going_Further/Intro.md deleted file mode 100644 index 9c3a37eefa..0000000000 --- a/docs/Going_Further/Intro.md +++ /dev/null @@ -1 +0,0 @@ -#Intro \ No newline at end of file diff --git a/docs/Going_Further/Lib_Internals.md b/docs/Going_Further/Lib_Internals.md deleted file mode 100644 index 06272a32d4..0000000000 --- a/docs/Going_Further/Lib_Internals.md +++ /dev/null @@ -1,439 +0,0 @@ -#mbed Library Internals - -This document describes the internals of the mbed library. It should be helpful for: -* Porting the mbed library to a new microcontroller -* Adding a driver for a new peripheral -* Providing support for a new toolchain - -This document assumes that you are familiar with the C Programming Language, but it does not assume a deep knowledge of microcontrollers. - -##Design Overview - -The mbed library provides abstractions for the microcontroller (MCU) hardware (in particular drivers for the MCU peripherals) and it is divided in the following software layers and APIs: - - -![](/Going_Further/Images/Lib_Intern/Layers.png) - - -To port the mbed library to a new microcontroller you will have to provide the two software layers marked as "MCU dependent" in the above diagram. - -To present the role of each of these layers in a peripheral driver, we will show how the driver for the General Purpose Input/Output (GPIO) for the LPC1768 is structured, from the bottom up. For each layer we will also provide an implementation of the same simple example application: the toggling of an LED ("blinky"). - -###mbed library sources in the online IDE - - -If you need to edit the mbed library, you can delete the binary build of the mbed library from your project and [import its sources](http://developer.mbed.org/users/mbed_official/code/mbed-src/). - - -###Directory Structure - -In the image below you can see the directory structure of the sources constituting the mbed library as they are published on the official [mbed github repository](https://github.com/mbedmicro/mbed). - -Three target independent directories: - -* ``mbed/api``: The headers defining the actual mbed library API - -* ``mbed/common``: mbed common sources - -* ``mbed/hal``: The HAL API to be implemented by every target - -Two target dependent directories: - -* ``mbed/targets/hal``: The HAL implementations - -* ``mbed/targets/cmsis``: CMSIS-CORE sources - - -![](/Going_Further/Images/Lib_Intern/Direct.png) - - -##MCU Registers - -###Peripherals - -If you come from a software background and you want to understand the behaviour of a microcontroller peripheral using a software analogy, you can think of a peripheral like a software thread being executed by a separate core. You have only one communication channel with this thread: a shared area of memory. Each single addressable byte of this area of memory, used to communicate with the hardware, is called: register. You communicate with the peripherals writing and reading these registers. - -###LPC17xx GPIO - -Silicon Vendors, like NXP, provide detailed user manuals describing the registers of each peripheral. - -This is a page from the [|LPC17xx user manual](http://www.nxp.com/documents/user_manual/UM10360.pdf describing the registers of the GPIO peripheral: - - -![](/Going_Further/Images/Lib_Intern/GPIO_R.png) - - -###Blinky example poking registers - -Let's see how to blink an LED on our LPC1768 mbed simply poking these registers: - - -![](/Going_Further/Images/Lib_Intern/Blinky1.png) - - - -![](/Going_Further/Images/Lib_Intern/Blinky2.png) - - -```c - - #include "mbed.h" - - // Reuse initialization code from the mbed library - DigitalOut led1(LED1); // P1_18 - - int main() { - unsigned int mask_pin18 = 1 << 18; - - volatile unsigned int *port1_set = (unsigned int *)0x2009C038; - volatile unsigned int *port1_clr = (unsigned int *)0x2009C03C; - - while (true) { - *port1_set |= mask_pin18; - wait(0.5); - - *port1_clr |= mask_pin18; - wait(0.5); - } - } -``` - - -##CMSIS-CORE - -The [CMSIS-CORE](http://www.arm.com/products/processors/cortex-m/cortex-microcontroller-software-interface-standard.php) headers provide you a suitable data structure to access these low level registers: - -```c - - typedef struct { - __IO uint32_t FIODIR; - uint32_t RESERVED0[3]; - __IO uint32_t FIOMASK; - __IO uint32_t FIOPIN; - __IO uint32_t FIOSET; - __O uint32_t FIOCLR; - } LPC_GPIO_TypeDef; - - #define LPC_GPIO_BASE (0x2009C000UL) - - #define LPC_GPIO0 ((LPC_GPIO_TypeDef *) (LPC_GPIO_BASE + 0x00000)) - #define LPC_GPIO1 ((LPC_GPIO_TypeDef *) (LPC_GPIO_BASE + 0x00020)) - #define LPC_GPIO2 ((LPC_GPIO_TypeDef *) (LPC_GPIO_BASE + 0x00040)) - #define LPC_GPIO3 ((LPC_GPIO_TypeDef *) (LPC_GPIO_BASE + 0x00060)) - #define LPC_GPIO4 ((LPC_GPIO_TypeDef *) (LPC_GPIO_BASE + 0x00080)) -``` - -As you can see the ``LPC_GPIO_TypeDef`` structure is a one to one map of its related GPIO port 32 bytes registers: - -```c - - FIODIR : 4 bytes - RESERVED0: 12 bytes - FIOMASK : 4 bytes - FIOPIN : 4 bytes - FIOSET : 4 bytes - FIOCLR : 4 bytes - tot : 32 bytes = 0x20 bytes -``` - -For example, in the GPIO documentation you can read that the address of the FIOPIN register of port 1 is: ``0x2009C034``. - -We can point the content of that location using the ``LPC_GPIO_TypeDef`` like that: - -```c - - #include "mbed.h" - - int main() { - printf("LPC_GPIO1->FIOSET: %p\n", &LPC_GPIO1->FIOSET); - } -``` - -The above program will print: - -```c - - LPC_GPIO1->FIOSET: 2009c038 -``` - -###Blinky example using CMSIS-CORE - -Let's see how to blink an LED on our LPC1768 mbed using the CMSIS-CORE API: - -```c - - #include "mbed.h" - - // Reuse initialization code from the mbed library - DigitalOut led1(LED1); // P1_18 - - int main() { - unsigned int mask_pin18 = 1 << 18; - - while (true) { - LPC_GPIO1->FIOSET |= mask_pin18; - wait(0.5); - - LPC_GPIO1->FIOCLR |= mask_pin18; - wait(0.5); - } - } - -``` - -###mbed additions to CMSIS-CORE - -The mbed library provides certain additions to the CMSIS-CORE layer: - -* startup file for each of the [Supported Toolchains](/Going_Further/Export/) - -* linker file and support functions to define the [Memory Map](/Going_Further/Mem_Mo/) - -* functions to set and get Interrupt Service Routines (ISR) addresses from the [Nested Vectored Interrupt Controller (NVIC)](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/BABEDCBC.html) and to program [Vector Table Offset Register (VTOR)](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/Ciheijba.html). - -##mbed HAL API - -###Target independent API - -The target independent HAL API is our foundation for the mbed target independent library. This is the GPIO HAL API: - -```c - - typedef struct gpio_s gpio_t; - - void gpio_init (gpio_t *obj, PinName pin, PinDirection direction); - - void gpio_mode (gpio_t *obj, PinMode mode); - void gpio_dir (gpio_t *obj, PinDirection direction); - - void gpio_write(gpio_t *obj, int value); - int gpio_read (gpio_t *obj); -``` - - -**Warning:** The HAL API is an internal interface used to help porting the mbed library to a new target and it is subject to change. If you want to "future proof" your application avoid using this API and use the mbed API instead. - - -###Target dependent implementation - -The implementation of the mbed HAL API should encapsulate all the required target dependent code. - -There are multiple ways to implement such API, with different trade-offs. In our implementation for the LPC family of processors (LPC2368, LPC1768, LPC11U24) we decided to keep all the differences among these processors in the GPIO object initialization keeping all the GPIO "methods" small, fast and target independent. Additionally, for speed optimization, we allow the GPIO functions to be completely inlined by the compiler. - -In this document, to have a clear presentation of the code, we are removing the preprocessor directives for target conditional code and we are grouping together function definitions from multiple sources (``.c`` and ``.h``): - -```c - - struct gpio_s { - PinName pin; - uint32_t mask; - - __IO uint32_t *reg_dir; - __IO uint32_t *reg_set; - __IO uint32_t *reg_clr; - __I uint32_t *reg_in; - }; - - void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) { - if(pin == NC) return; - - obj->pin = pin; - obj->mask = gpio_set(pin); - - LPC_GPIO_TypeDef *port_reg = (LPC_GPIO_TypeDef *) ((int)pin & ~0x1F); - - obj->reg_set = &port_reg->FIOSET; - obj->reg_clr = &port_reg->FIOCLR; - obj->reg_in = &port_reg->FIOPIN; - obj->reg_dir = &port_reg->FIODIR; - - gpio_dir(obj, direction); - switch (direction) { - case PIN_OUTPUT: pin_mode(pin, PullNone); break; - case PIN_INPUT : pin_mode(pin, PullDown); break; - } - } - - void gpio_mode(gpio_t *obj, PinMode mode) - pin_mode(obj->pin, mode); - } - - void gpio_dir(gpio_t *obj, PinDirection direction) { - switch (direction) { - case PIN_INPUT : *obj->reg_dir &= ~obj->mask; break; - case PIN_OUTPUT: *obj->reg_dir |= obj->mask; break; - } - } - - void gpio_write(gpio_t *obj, int value) { - if (value) - *obj->reg_set = obj->mask; - else - *obj->reg_clr = obj->mask; - } - - int gpio_read(gpio_t *obj) { - return ((*obj->reg_in & obj->mask) ? 1 : 0); - } -``` - -###mbed internal conventions - -As a practical convention, the ``PinName`` enum definition for each target contains information for both the ``port`` and the ``pin number``. How this information is stored can be target dependent. - -For example, in the LPC1768 a ``PinName`` entry is the ``port address`` plus the ``pin number`` stored in the rightmost 5 bits. To extract the port address from an LPC1768 ``PinName`` we simply have to create a mask ignoring the rightmost 5 bits: - -```c - - LPC_GPIO_TypeDef *port_reg = (LPC_GPIO_TypeDef *) ((int)pin & ~0x1F); -``` - -##mbed API - -The mbed API is providing the actual friendly, object oriented API to the final user. This is the API used by the majority of the programs developed on the mbed platform. - -We also define basic operators to provide intuitive casting to primitive types and assignments: - - -```c - - class DigitalInOut { - - public: - DigitalInOut(PinName pin) { - gpio_init(&gpio, pin, PIN_INPUT); - } - - void write(int value) { - gpio_write(&gpio, value); - } - - int read() { - return gpio_read(&gpio); - } - - void output() { - gpio_dir(&gpio, PIN_OUTPUT); - } - - void input() { - gpio_dir(&gpio, PIN_INPUT); - } - - void mode(PinMode pull) { - gpio_mode(&gpio, pull); - } - - DigitalInOut& operator= (int value) { - write(value); - return *this; - } - - DigitalInOut& operator= (DigitalInOut& rhs) { - write(rhs.read()); - return *this; - } - - operator int() { - return read(); - } - - protected: - gpio_t gpio; - }; -``` - -###Blinky example using the mbed API - -This is the final, microcontroller independent, GPIO abstraction provided by the mbed library: - -```c - - #include "mbed.h" - - DigitalOut led1(LED1); - - int main() { - while (true) { - led1 = 1; - wait(0.5); - - led1 = 0; - wait(0.5); - } - } -``` - -##C library retargeting - -The C standard library stdio module provides many functions for file input and output. - -The C standard library implementations provided by the various toolchains give the possibility to customise how these input/output are named and redirected. This customization is often called "C library retargeting". - -The mbed library defines this C library retargeting in this file: ``mbed/src/common/stdio.cpp``. - -This is an excerpt of the retargeting of (stdout, stdin and stderr) to an UART: - -```c - - #if DEVICE_SERIAL - extern int stdio_uart_inited; - extern serial_t stdio_uart; - #endif - - static void init_serial() { - #if DEVICE_SERIAL - if (stdio_uart_inited) return; - serial_init(&stdio_uart, STDIO_UART_TX, STDIO_UART_RX); - serial_format(&stdio_uart, 8, ParityNone, 1); - serial_baud(&stdio_uart, 9600); - #endif - } - - extern "C" FILEHANDLE PREFIX(_open)(const char* name, int openmode) { - /* Use the posix convention that stdin,out,err are filehandles 0,1,2. - */ - if (std::strcmp(name, __stdin_name) == 0) { - init_serial(); - return 0; - } else if (std::strcmp(name, __stdout_name) == 0) { - init_serial(); - return 1; - } else if (std::strcmp(name,__stderr_name) == 0) { - init_serial(); - return 2; - } - [...] - - #if defined(__ICCARM__) - extern "C" size_t __write (int fh, const unsigned char *buffer, size_t length) { - #else - extern "C" int PREFIX(_write)(FILEHANDLE fh, const unsigned char *buffer, unsigned int length, int mode) { - #endif - int n; // n is the number of bytes written - if (fh < 3) { - #if DEVICE_SERIAL - if (!stdio_uart_inited) init_serial(); - for (unsigned int i = 0; i < length; i++) { - serial_putc(&stdio_uart, buffer[i]); - } - #endif - n = length; - } else { - [...] - - #if defined(__ICCARM__) - extern "C" size_t __read (int fh, unsigned char *buffer, size_t length) { - #else - extern "C" int PREFIX(_read)(FILEHANDLE fh, unsigned char *buffer, unsigned int length, int mode) { - #endif - int n; // n is the number of bytes read - if (fh < 3) { - // only read a character at a time from stdin - #if DEVICE_SERIAL - *buffer = serial_getc(&stdio_uart); - #endif - n = 1; - } else { - [...] -``` diff --git a/docs/Going_Further/Mem_Mo.md b/docs/Going_Further/Mem_Mo.md deleted file mode 100644 index f3ebc63150..0000000000 --- a/docs/Going_Further/Mem_Mo.md +++ /dev/null @@ -1,111 +0,0 @@ -#The mbed Memory Model - - -This is a basic overview of the memory model used by mbed. - -##Microcontroller Memory - -A single-chip microcontroller contains two types of memory: - -[FLASH](http://en.wikipedia.org/wiki/Flash_memory) - This is the [non-volatile](http://en.wikipedia.org/wiki/Non-volatile_memory) memory that primarily stores the program's instructions, and also any "constant" data values. In general, you only read from this memory, and it is only written when you download new code to the mbed. - -[RAM](http://en.wikipedia.org/wiki/Static_random_access_memory) - This is the [volatile](http://en.wikipedia.org/wiki/Volatile_memory) memory that is the working data space for storing all variables whilst the program is running. In C, this is static variables, the heap, and the stack. - -RAM is therefore much more scarce and valuable than FLASH, so it is worth understanding a little about the memory model to help make best use of the memory. - -[EEPROM](http://en.wikipedia.org/wiki/EEPROM) - Some microcontrollers have special non-volatile memory that can be erased and written byte for byte rather than in blocks or sectors. This memory is typically used by the application to store special data or configuration. This memory requires special access by a peripheral and is not directly addressable. - -##C Memory Model - -The C runtime memory model can be divided in to three types; global/static memory, the heap, and the stack. These all share the RAM available on the microcontroller. - -###Global/static memory - -Global and static memory are values that are allocated for the entire lifetime of the program. For example: - -```c - - int x = 5; - int main() {} -``` - -Here, "x" would be allocated a dedicated slot in RAM, that is never used by anything else. In this case it is initialised to 5, and it's value might be changed throughout the lifetime of the program. - -If for some reason you have data that is fixed (such as a lookup table), you'd be much better off making sure the compiler can allocate it in FLASH to save valuable RAM space. In the previous example, we could use the C keyword "const" to tell the compiler the variable will never be changed: - -```c - - const int x = 5; - int main() {} -``` - -###The Stack - -The [Stack](http://en.wikipedia.org/wiki/Stack_(data_structure)) is used to store types of variables that have a fixed lifetime based on how C programs run. It is a section of RAM that grows and shrinks as the program runs. When you call a function, its parameters and any variables you have defined in that function (which are not static) are stored on the stack. - -```c - - void foo() { - int x; - } - int main() {} -``` - -In this example, "x" will only exist for the duration of the call to foo(). As you start calling functions from within other functions, your stack grows downwards. As you return back up the call tree, your stack decreases in size. - -###The Heap - -The heap is used for [dynamic memory allocation](http://en.wikipedia.org/wiki/Dynamic_memory_allocation). When you create a new instance of an object using 'new', or if you allocate a block of memory using malloc and friends, you use memory in the heap. - -```c - - int *p; - int main() { - p = new int; - } -``` - -If there is a piece of unused memory in the heap which is big enough for what you need, then that is used. If there is not, then the heap grows upwards to fit the new instance/memory block. When you use delete or free, the memory it was using inside the heap is deallocated, ready for use again. However, unless the memory you released was at the very end of the heap, the heap does not shrink. - -##Memory Sections - -The information in your program is made up of several sorts based on the memory model: - -* Executable code -* Constants and other read-only data -* Initialised global/static variables -* Uninitialised global/static variables -* Local variables -* Dynamically created data - -Each of these groups get allocated to a region of the memory space called a section. - -The executable code, constants and other read-only data get put in a section called "RO" (for read-only), which is stored in the FLASH memory of the device. Initialised static and global variables go into a section called "RW" (read-write), and the uninitialised ones in to one called "ZI" (Zero Initialise). I'll come on to the local and dynamic data in a bit, but these along with RW and ZI need to live in RAM. - -On reset, the RAM is an undefined state and those initialised variables have to be setup for your program to work correctly. This setup is actually part of your program binary, as the compiler automatically inserts some housework code before main() as part of setting up the C environment which copies from FLASH to RAM what these variables should be initialised to; this becomes the runtime RW section. One of the other things it does is to zero fill the next section of RAM, which is where the ZI section lives. - - -![](/Going_Further/Images/Memory/Memory_Sections.png) - - -###Heap and Stack - -The last two sorts of information are the local variables which will exist on the stack, and the dynamically created data which will exist in the heap. - -The sizes of these two regions vary during program execution, and only have fixed starting points. We use the single memory space shared stack/heap model which allows flexibility in the size of each, limited only by our available RAM. What this means is that the heap starts at the first address after the end of ZI, growing up into higher memory addresses, and the stack starts at the last memory address of RAM, and grows downwards into lower memory addresses: - - -![](/Going_Further/Images/Memory/Heap_Stack.png) - - -###Collisions - -Obviously, looking at this, it is possible to for your heap and stack to collide, which is never going to end well! If that happens, you have hit the limit of your RAM, and need to find out ways to help ensure your program uses less memory. - -To try and help you prevent detect when this would happen, the routines that allocate memory on the heap (new, malloc and friends) tell you when you don't have enough memory. Instead of passing you a pointer to the newly allocated block, they pass you the value NULL. - -If your stack and your heap do collide, despite your best efforts, then the results will be unpredictable. You may get data corruption, or you may get a hard fault. You can write a hard fault handler and/or implement a watchdog to recover from some of these faults, but you basically have to restart the system! - - -Also see the [RTOS Memory Model](/Going_Further/RTOS_Mem/). - \ No newline at end of file diff --git a/docs/Going_Further/RTOS_Mem.md b/docs/Going_Further/RTOS_Mem.md deleted file mode 100644 index c50c6d3f24..0000000000 --- a/docs/Going_Further/RTOS_Mem.md +++ /dev/null @@ -1,24 +0,0 @@ -#RTOS Memory Model - -This is a basic overview of the memory model used by the mbed RTOS. - -##Threads - -Each thread of execution in the RTOS has its separate stack. - -When you use the RTOS, before explicitly initializing any additional thread, you will have 4 separate stacks: - -* The stack of the ``Main Thread`` (executing the ``main`` function). -* The ``Idle Thread`` executed each time all the other threads are waiting for external, or scheduled events. This is particularly useful to implement energy saving strategies. (ie ``sleep``). -* The ``Timer Thread`` that executes all the time scheduled tasks (periodic and non periodic). -* The stack of ``OS Scheduler`` itself (also used by the ISRs). - - -![](/Going_Further/Images/Memory/RTOS.png) - - - - -Also see the [the mbed Memory Model](/Going_Further/Mem_Mo/). - - diff --git a/docs/Going_Further/SDK_Porting.md b/docs/Going_Further/SDK_Porting.md deleted file mode 100644 index c27f422da6..0000000000 --- a/docs/Going_Further/SDK_Porting.md +++ /dev/null @@ -1,300 +0,0 @@ -#mbed SDK Porting - -The porting of the mbed SDK to a new target is divided in four steps: - -* Add the new target to the build system -* Add a CMSIS module for the given target -* Implement the mbed HAL API for the given target -* Validate the new target with the test suite - -The source code of the mbed SDK (tools + libraries) is available in [this repository](https://github.com/mbedmicro/mbed). - -Before starting the mbed SDK porting, you might want to familiarize with the [mbed library internals](Going_Further/Lib_Internals/) first. - -For discussing the development of the mbed SDK itself (Addition/support of microcontrollers/toolchains, build and test system, Hardware Abstraction Layer API, etc) please join our [mbed-devel mailing list](https://groups.google.com/forum/?fromgroups#!forum/mbed-devel). - -##Coding style - -mbed SDK coding style is described in detail in mbed SDK team's wiki page, please visit for further details [mbed SDK coding style](/Going_Further/Coding_Style/). - -##Build System - -You can get an introduction about the mbed SDK command line tools, from a user perspective, reading the [mbed-tools handbook page](/Going_Further/Tools/). - -Adding a new target to the build system is as easy as adding a new ``Target`` class to this python module: [workspace_tools/targets.py](https://github.com/mbedmicro/mbed/blob/master/workspace_tools/targets.py). - -For example, this is the Target class for the LPC1768: - -```python - - class LPC1768(Target): - def __init__(self): - Target.__init__(self) - - self.core = "Cortex-M3" - - self.extra_labels = ['LPC176X'] - - self.supported_toolchains = ["ARM", "GCC_ARM", "GCC_CS", "GCC_CR", "IAR"] -``` - -An instance of this new ``Target`` class has to be added to the ``TARGETS`` list: - -```python - - TARGETS = [ - LPC2368(), - LPC1768(), - LPC11U24(), - KL25Z(), - LPC812(), - LPC4088(), - LPC4330(), - ] -``` - -The target and toolchain specified for a given build define a set of ``TARGET_`` and ``TOOLCHAIN_`` "labels". For example: - -``` - - Targets: - * LPC1768 : ['TARGET_LPC1768', 'TARGET_M3', 'TARGET_LPC176X'] - * LPC11U24: ['TARGET_LPC11U24', 'TARGET_M0', 'TARGET_LPC11UXX'] - * KL25Z : ['TARGET_KL25Z', 'TARGET_M0P'] - - Toolchains: - * ARM : ['TOOLCHAIN_ARM_STD', 'TOOLCHAIN_ARM'] - * uARM : ['TOOLCHAIN_ARM_MICRO', 'TOOLCHAIN_ARM'] - * GCC_ARM: ['TOOLCHAIN_GCC_ARM', 'TOOLCHAIN_GCC'] - * IAR : ['TOOLCHAIN_IAR'] -``` - -When the build system scans for resources to be compiled, it filters out all the ``TARGET_`` and ``TOOLCHAIN_`` directories that are not in the set of "labels" defined by the current build. - - -**IDE:** You can develop the code for adding support for a new target in you favourite IDE. As a starting point, you can export the following program to one of the supported [offline toolchains](Going_Further/Export/): [Hello World using the mbed library sources](http://developer.mbed.org/users/mbed_official/code/mbed-src-program/). - - -##CMSIS Module - -Each target has its standalone CMSIS directory under its vendor directory, for example: - -* [libraries/mbed/targets/cmsis/Freescale/TARGET_KL25Z](https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/cmsis/Freescale/TARGET_KL25Z). -* [libraries/mbed/targets/cmsis/NXP/TARGET_LPC176X](https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/cmsis/NXP/TARGET_LPC176X). - -###CMSIS Sources - -There are three sources for a "cmsis" module used by an mbed target. - -The ARM CMSIS-CORE module is providing the files that are specific to the Cortex-M cores: - -* ``core_cmFunc.h`` -* ``core_cmInstr.h`` -* ``cortex_cm0.h`` / ``cortex_cm0plus.h`` / ``core_cm3.h`` / ``cortex_cm4.h`` - -The Silicon Vendor is providing the files for the startup, system initialization, the structures and addressed of the peripherals registers, for a given DEVICE: - -* ``startup_DEVICE.s`` -* ``system_DEVICE.c`` -* ``system_DEVICE.h`` -* ``DEVICE.h`` - -The mbed SDK has to provide additional files to dynamically set the vector table and to configure the [memory model](/Going_Further/Mem_Mo/) for the given C standard library: - -* ``cmsis_nvic.c`` -* ``cmsis_nvic.h`` -* ``sys.cpp`` -* ``TARGET.sct`` -* ``cmsis.h`` - - -**Info: CMSIS sources** -Usually, silicon vendors provide source packages containing both the CMSIS-CORE and the CMSIS device specific files. - - -##mbed HAL - -Each target does have a standalone directory containing the implementation of the mbed HAL API, for example: - -* [libraries/mbed/targets/hal/Freescale/TARGET_KL25Z](https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/Freescale/TARGET_KL25Z). -* [libraries/mbed/targets/hal/NXP/TARGET_LPC176X](https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/NXP/TARGET_LPC176X). - -Probably the most important file, at the beginning of a port to a new target, is [device.h](https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/targets/hal/NXP/TARGET_LPC176X/device.h). - -``device.h`` contains all the defines that enable/disable the inclusion of a certain set of peripherals in the mbed library. - -When you start a port for a new target, setting all these defines to ``0`` will quickly allow you to compile the whole mbed library and start running tests. - -Currently, the bare minimum you should implement to start running the first tests is: - -* [GPIO API](https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/hal/gpio_api.h) -* [us ticker API](https://github.com/mbedmicro/mbed/blob/master/libraries/mbed/hal/us_ticker_api.h): - * ``void us_ticker_init(void);`` - * ``uint32_t us_ticker_read(void)`` - -Having this initial block in place will allow you to run simple programs like the mbed ``hello world``: - - -```c - - #include "mbed.h" - - DigitalOut myled(LED1); - - int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); - } - } -``` - -This is the full list of the mbed drivers API that could be potentially implemented for a target: - -* [analogin_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/analogin_api.h) -* [analogout_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/analogout_api.h) -* [can_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/can_api.h) -* [ethernet_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/ethernet_api.h) -* [gpio_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/gpio_api.h) -* [gpio_irq_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/gpio_irq_api.h) -* [|i2c_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/i2c_api.h) -* [pinmap.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/pinmap.h) -* [port_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/port_api.h) -* [pwmout_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/pwmout_api.h) -* [rtc_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/rtc_api.h) -* [serial_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/serial_api.h) -* [sleep_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/sleep_api.h) -* [spi_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/spi_api.h) -* [us_ticker_api.h](https://github.com/mbedmicro/mbed/tree/master/libraries/mbed/hal/us_ticker_api.h) - -##Testing - -The mbed SDK provides a test system to validate the addition of your new target. - -You may want to familiarize with the command line interface and structure of the test system reading the [mbed-tools handbook page](/Going_Further/Tools/#test-system). - -The description of the tests aimed at validating the mbed SDK are prefixed with the string ``MBED:``. - - -**Warning:** You will need to edit the source code of many of the tests adding, under conditional compilation, the pinout of your new target board. - - - -**Warning:** Not all the tests are yet automated presenting a clear ``{success}` or ``{failure}`` result string. Some of the tests still require additional instrumentation like a logic analyser and human intervention to verify the output. - - -###Smoke Test - -``[ 0] MBED: Basic`` is the first [smoke test](http://en.wikipedia.org/wiki/Smoke_testing#Software_development) that represents the basis to execute all the other tests in the mbed SDK suite. - -```c - - #include "test_env.h" - - int main() { - notify_completion(true); - } -``` - -This is an example command line test run: - -``` - - mbed> python workspace_tools\make.py -m LPC1768 -t ARM -s COM41 -d E:\ -p 0 - - >>> BUILD PROJECT: BASIC (LPC1768, ARM) - Compile: main.cpp - Compile: test_env.cpp - Link: basic - Elf2Bin: basic - Image: C:/Users/emimon01/mbed/build\test\LPC1768\ARM\MBED_A1\basic.bin - {success} - {end} -``` - -###C/C++ environment initialization - -* ``MBED: Heap & Stack`` - setting of the single area memory model with heap and stack collision detection. -* ``MBED: C++`` - initialization of static C++ objects - -##Digital I/O and IRQ - -For this set of tests you will need to connect together a pair of pins: - -* ``MBED: DigitalInOut`` - Setting digital I/O functionality, direction and value. -* ``MBED: InterruptIn`` - Triggering and handling of GPIO IRQs - -###Timing functionalities - -For this set of functionalities it is preferable to use a logic analyser to verify the correctness of the time intervals. Ideally the following tests should be repeated changing the time periods across a wide time interval (from micro-seconds, to seconds): - -* ``MBED: Time us`` - simple us_ticker init/read functionality -* ``MBED: Ticker 2`` - correct triggering of timing events - -###PWM - -For this set of functionalities it is preferable to use a logic analyser to verify the correctness of the time intervals. Ideally the following tests should be repeated changing the time periods across a wide time interval (from micro-seconds, to seconds): - -* ``MBED: PWM`` - PWM - -###I2C - -The I2C tests require the wiring of additional peripherals: - -* ``MBED: I2C TMP102`` - [TMP102 Temperature Sensor](http://developer.mbed.org/cookbook/TMP102-Temperature-Sensor) -* ``MBED: I2C MMA7660`` - [MMA7660 Accelerometer](http://developer.mbed.org/cookbook/MMA7660-Accelerometer) -* ``MBED: I2C SRF08`` - [SRF08 Ultrasonic Ranger](http://developer.mbed.org/cookbook/SRF08-Ultrasonic-Ranger) - -###SPI - -The SPI tests require the wiring of additional peripherals: - -* ``MBED: SPI ADXL345`` - See [ADXL345 Accelerometer](http://developer.mbed.org/cookbook/ADXL345-Accelerometer) -* ``MBED: SD File System`` - See [SDFileSystem](http://developer.mbed.org/handbook/SDFileSystem) - -###UART - -The basic UART functionalities are used to communicate the results of all the other test, but the following tests are stressing some of the other UART APIs: - -* ``MBED: Serial Echo at 115200`` - change baud rate to 115200 and test transmission -* ``MBED: Serial Interrupt`` and ``MBED: Serial Interrupt 2`` - serial tx/rx interrupt handlers - -###ADC/DAC - -This test relies on a connection among one ADC pin and one DAQ pin on the same target: - -* ``MBED: Analog`` - -###Port - -Testing the Port API requires connecting at least a couple of pins from a port to a couple of pins in another port: - -* ``MBED: PortInOut`` - -### RTC - -* ``MBED: RTC`` - -###Sleep - -* ``MBED: Sleep`` -* ``MBED: Sleep Timeout`` - -###Semihosting - -The following tests are used to verify the semihosting functionalities that may be provided by the "mbed interface" - -* ``MBED: semihost file system`` - Local file system -* ``MBED: Semihost`` - mbed unique ID -* ``MBED: SW Reset`` - request to the interface chip a complete reset - -##Contributing - -To contribute your new target to the official mbed SDK: - -* Open a [pull request](https://help.github.com/articles/using-pull-requests) to the [official mbed SDK repository](https://github.com/mbedmicro/mbed), containing: - * all the changes to the C/C++ libraries and the Python tools. - * information about the reference target board -* logged in with your mbed.org account, sign our [Apache Contribution Agreement](http://developer.mbed.org/contributor_agreement/) and [send us a Private Message](http://developer.mbed.org/users/emilmont/) with the URL of the pull request. \ No newline at end of file diff --git a/docs/Going_Further/Serial.md b/docs/Going_Further/Serial.md deleted file mode 100644 index 18af2d7b6c..0000000000 --- a/docs/Going_Further/Serial.md +++ /dev/null @@ -1,284 +0,0 @@ -#The Serial Protocol - -Serial is a generic protocol used by computers and electronic modules to send and receive control information and data. The Serial link has two unidirection channels, one for sending and one for receiving. The link is asynchronous, and so both ends of the serial link must be configured to use the same settings. - -One of the Serial connections goes via the mbed USB port, allowing you to easily communicate with your host PC. - -##Hello World! - - -[Import the program](http://developer.mbed.org/users/mbed_official/code/Serial_HelloWorld_Mbed/docs/879aa9d0247b/main_8cpp_source.html) - - -##API summary - -

Import library

- - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

- - - Public Member Functions -

-
-   - - - Serial - - (PinName tx, PinName rx, const char *name=NULL) -
Create a - - Serial - - port, connected to the specified transmit and receive pins. - - -
-
- void  - - - baud - - (int baudrate) -
- Set the baud rate of the serial port. - - -
-
- void  - - - format -
- Set the transmission format used by the serial port. -
- -
-
- int  - - - readable - - () -
- Determine if there is a character available to read. - - -
-
- int  - - - writeable - - () -
- Determine if there is space available to write a character. - - -
-
- void  - - - attach - - (void(*fptr)(void), IrqType type=RxIrq) -
-Attach a function to call whenever a serial interrupt is generated. - - -
-
- void  - - - attach - - (T *tptr, void(T::*mptr)(void), IrqType type=RxIrq) -
- Attach a member function to call whenever a serial interrupt is generated. - - -
-
- void  - - - send_break - - () -
- Generate a break condition on the serial line. - - -
-
- void  - - - set_flow_control - - (Flow type, PinName flow1=NC, PinName flow2=NC) -
- Set the flow control type on the serial port. - - -
-
-
- -##Interface - -The Serial Interface can be used on supported pins and USBTX/USBRX - - -![The pinout page](/Going_Further/Images/Serial_Pinout.png) - - -[See the Pinout page for more details](http://developer.mbed.org/handbook/Pinouts). - - -Note that USBTX/USBRX are not DIP pins; they represent the pins that route to the interface USB Serial port so you can communicate with a host PC. - - -If you want to send data to a host PC, take a look at [SerialPC](/Development/PC_Com/) - Communicating between mbed and a host PC. -

-Note that on a windows machine, you will need to install a USB Serial driver, see: [Windows serial configuration](/Going_Further/Serial_Conf/). -
- -Serial channels have a number of configurable parameters: - -* *Baud Rate* - There are a number of standard baud rates ranging from a few hundred bits per seconds, to megabits per second. The default setting for a Serial connection on the mbed Microcontroller is 9600 baud. - -* *Data length* - Data transferred can be either 7 or 8 bits long. The default setting for a Serial connection on the mbed Microcontroller is 8 bits. - -* *Parity* - An optional parity bit can be added. The parity bit will be automatically set to make the number of 1's in the data either odd or even. Parity settings are Odd, Even or None. The default setting for a Serial connection on the mbed microcontroller is for the parity to be set to None. - -* *Stop Bits* - After data and parity bits have been transmitted, 1 or 2 stop bit is inserted to "frame" the data. The default setting for a Serial connection on the mbed microcontroller is for one stop bit to be added. - -The default settings for the mbed microcontroller are described as //9600 8N1//, and this is common notation for Serial port settings. - -##See Also - - * [Communication with a PC](/Development/PC_Com/) - -##Reference - - * [Serial Port on Wikipedia](http://en.wikipedia.org/wiki/Serial_port) - -##Examples - -``Write a message to a device at a 19200 baud`` - -```c - - #include "mbed.h" - - Serial device(p9, p10); // tx, rx - - int main() { - device.baud(19200); - device.printf("Hello World\n"); - } -``` - -``Provide a serial pass-through between the PC and an external UART`` - -```c - - #include "mbed.h" - - Serial pc(USBTX, USBRX); // tx, rx - Serial device(p9, p10); // tx, rx - - int main() { - while(1) { - if(pc.readable()) { - device.putc(pc.getc()); - } - if(device.readable()) { - pc.putc(device.getc()); - } - } - } -``` - -``Attach to RX Interrupt`` - -```c - - #include "mbed.h" - - DigitalOut led1(LED1); - DigitalOut led2(LED2); - - Serial pc(USBTX, USBRX); - - void callback() { - // Note: you need to actually read from the serial to clear the RX interrupt - printf("%c\n", pc.getc()); - led2 = !led2; - } - - int main() { - pc.attach(&callback); - - while (1) { - led1 = !led1; - wait(0.5); - } - } -``` - - -See [full attach API](http://mbed.org/projects/libraries/api/mbed/trunk/Serial#Serial.attach) - \ No newline at end of file diff --git a/docs/Going_Further/Serial_Conf.md b/docs/Going_Further/Serial_Conf.md deleted file mode 100644 index cbf0284f42..0000000000 --- a/docs/Going_Further/Serial_Conf.md +++ /dev/null @@ -1,35 +0,0 @@ -#Windows Serial Configuration - -The mbed serial port works by default on Mac and Linux, but Windows needs a driver. These instructions explain how to setup the mbed Microcontroller to use the USB serial port on Windows. - -##Download the mbed Windows serial port driver - -[Download the installer](http://developer.mbed.org/media/downloads/drivers/mbedWinSerial_16466.exe) to your PC, e.g. your desktop. - -##Run the installer - -With your ``mbed plugged in``, and *no explorer drive windows open*, run the installer: - -It will take some time (especially on Vista), and pop up a few 'unsigned driver' warnings, but after a while you should have a Serial port. - -###Where Next - -* [Serial PC](/Development/PC_Com/) - Communication with a PC -* [Terminals](/Going_Further/Terminals/) - Guide to using terminal applications - - -***Troubleshooting*** -
-
-**If you have multiple mbed microcontrollers, but the serial port only appears for one of them:** Make sure you run the installer for every mbed; windows loads the driver based on the serial number, so it needs to be run for each mbed you use. -

-**If the installer fails because "No mbed Microcontrollers were found":** Check your mbed Microcontroller is plugged in. -

-**If the installer reports the message "mbedWinSerial_nnnnn.exe is not a valid Win32 application":** -
* It is likely you are using Internet Explorer to download the installer file, which sometimes seems to only download part of the installer application for an unknown reason. -
* To solve this, download the installer with a different browser (Firefox, Chrome), and try again; this should solve the issue. -

-**If the Installer appears to hang:** Check if windows has popped-up a "unsigned driver/permission" window; these often get hidden behind other windows with nothing to indicate so in the taskbar! Windows may be waiting for you to click "OK"! -

-**If you have any problems, or think this tutorial could be improved, please tell us in the [Forum](http://developer.mbed.org/forum).** -
\ No newline at end of file diff --git a/docs/Going_Further/Terminals.md b/docs/Going_Further/Terminals.md deleted file mode 100644 index 76372437f9..0000000000 --- a/docs/Going_Further/Terminals.md +++ /dev/null @@ -1,62 +0,0 @@ -#Terminal Applications - -Terminal applications run on your host PC, and provide a window for your mbed Microcontroller to print to, and a means for you to type characters back to your mbed Microcontroller. - -**Serial configuration:** The standard setup for the USB Serial Port is 9600 baud, 8 bits, 1 stop bit, no parity (aka 9600-8-N-1) - - -##Windows users - -###Install a Terminal Application - -Download and install a Terminal application. - -In this example we recommend the latest version of [Teraterm](http://sourceforge.jp/projects/ttssh2/files). - -Other terminal applications are available: - -* [Putty](http://www.chiark.greenend.org.uk/~sgtatham/putty/) -* [Terminal by Bray](http://sites.google.com/site/braypp/terminal) - -Some Windows PCs come with ''Hyperterminal'' installed; you can use this too, but we have found Tera Term is just a bit more friendly to use. - -###Configure the Connection - -Open and Setup Teraterm - -* File -> New Connection (or just press Alt+N) -* Select the ''Serial'' radio button and choose the ''mbed Serial Port'' from the drop down menu. -* Click ''OK'' - -Setup New-line format (to print out new line characters correctly) - -* Setup -> Terminal... -* Under "New-line", set Receive to "LF" - -Your terminal program is now configured and connected. - -To change the baud rate, go to Setup -> Serial Port... - -##Mac/Linux Users - -###Install a Terminal Application - -If you do not already have it, install [GNU Screen](http://en.wikipedia.org/wiki/GNU_Screen). - -###Setup the Connection - -* Connect using screen by typing the command ``screen /dev/`` in your console window -* To find the device name of your mbed Serial Port, see the [SerialPC](/Going_Further/PC_Com/) *Host Interface* section -* To exit screen, press Ctrl-A, then ":quit" - - -**Troubleshooting:** -

-You can check the connection is working by typing keys in the terminal application; nothing useful will happen, but the Status light on the mbed Microcontroller should flicker as the characters are received. -

-**If you have any problems, or think this tutorial could be improved, please tell us in the [Forum](http://developer.mbed.org/forum)** -
- - - - diff --git a/docs/Going_Further/Tools.md b/docs/Going_Further/Tools.md deleted file mode 100644 index 6e9f9b8182..0000000000 --- a/docs/Going_Further/Tools.md +++ /dev/null @@ -1,228 +0,0 @@ -#mbed Tools - -The tools used to develop the mbed libraries are released under the permissive open source license Apache Version 2.0 in the following online code repositories: - -* [GitHub/mbed](https://github.com/mbedmicro/mbed) - -The tools, stored in the ``workspace_tools`` directory, are written in Python (platform independent: tested on Windows and Linux). - -##Settings configuration - -The mbed tools are providing sensible defaults for all the required settings in the file: - -* ``workspace_tools/settings.py`` - -You can configure your settings changing the value of any of the settings variables in the file: - -* ``workspace_tools/private_settings.py`` - -We configured our version control systems (ie: git) to ignore this file. - -For example, if you want to change the path to your [GNU Tools for ARM Embedded Processors](https://launchpad.net/gcc-arm-embedded/4.7/4.7-2012-q4-major) to a path like ``c:/arm_gcc/bin``, you simply need to have a ``private_settings.py`` containing the following line: - -```python - - GCC_ARM_PATH = "c:/arm_gcc/bin" -``` - - -**Warning: Windows path in a Python string** -
-In a Python string ``\`` is used as an escape character to specify special characters (``\n``, ``\t``, etc). If you want to add a ``\`` in a Python string, you need to write ``{{{\\}}}``. Otherwise, as path separator you can use the forward slash: ``/`` (see above example). -
- -##Build System - -The mbed build system is composed of two scripts: - -* One to build the libraries: ``workspace_tools/build.py`` -* One to build and run the test projects: ``workspace_tools/make.py`` - -Both share a subset of options to specify the target microcontroller and the toolchain: - -```python - - -m MCU -t TOOLCHAIN -``` - -The available target ``MCU``s are: - -* ``LPC1768`` -* ``LPC11U24`` -* ``LPC2368`` -* ``LPC812`` -* ``KL25Z`` - -The available ``TOOLCHAIN``s are: - -* ``ARM``: ARMCC toolchain with the standard C library -* ``uARM``: ARMCC toolchain with the micro C library -* ``GCC_ARM``: GCC toolchain from ARM -* ``GCC_CS``: GCC toolchain from CodeSourcery -* ``GCC_CR``: GCC toolchain from CodeRed -* ``IAR``: IAR toolchain - -###build.py - -If a target and a toolchain are not specified, the build script will build the mbed library for all the available targets and toolchains. - -If, for example, you want to build the mbed library for the LPC1768 mbed using the ARM GCC toolchain: - -```python - - > python workspace_tools\build.py -m LPC1768 -t GCC_ARM -``` - -This is an example output: - -```python - - >>> BUILD LIBRARY CMSIS (LPC1768, GCC_ARM) - Copy: LPC1768.ld - Assemble: startup_LPC17xx.s - Compile: cmsis_nvic.c - Compile: core_cm3.c - [...] - Compile: TimerEvent.cpp - Library: libmbed.a - - Completed in: (6.31)s - - Build successes: - * GCC_ARM::LPC1768 -``` - -The following options are used to request the build of additional libraries: - -* ``-r``: build the RTOS library -* ``-e``: build the Ethernet library -* ``-u``: build the USB device library -* ``-d``: build the DSP library - -##Test System - -###make.py - -Make is used to build and run one of the test projects defined in the following python file: ``workspace_tools/tests.py`` - -Each test project is specified by a simple python dictionary of the type: - - -```python - - TESTS = [ - # Automated MBED tests - { - "id": "MBED_A1", "description": "MBED: Basic", - "source_dir": join(TEST_DIR, "mbed", "basic"), - "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB], - "automated": True, - }, - { - "id": "MBED_A2", "description": "MBED: semihost file system", - "source_dir": join(TEST_DIR, "mbed", "file"), - "dependencies": [MBED_LIBRARIES, TEST_MBED_LIB], - "automated": True, - "mcu": ["LPC1768", "LPC2368", "LPC11U24"] - }, -``` - -All these project specifications are contained in the ``TEST`` list. If you launch the "make" script without any option, the script will print a list of all the available tests with their correspondent number: - -```python - - > python workspace_tools\make.py - - [ 0] MBED: Basic - [ 1] MBED: semihost file system - [ 2] MBED: C++ STL - [ 3] MBED: I2C TMP102 - [ 4] MBED: DigitalIn DigitalOut - [ 5] MBED: DigitalInOut - [ 6] MBED: InterruptIn - [ 7] MBED: Analog - [ 8] MBED: Serial Echo at 115200 - [ 9] MBED: PortOut PortIn - [10] MBED: PortInOut - [11] MBED: SD File System - [12] MBED: I2C MMA7660 - [...] -``` - -On top of building a test project, the "make" script can actually program and reset a target mbed and display all the output printed on the target serial port: - -* ``-d``: specifies the target mbed disk (ie: ``E:\`` on Windows, or ``/media/mbed`` on Linux) -* ``-s``: specifies the target serial port (ie: ``COM4`` on Windows, or ``/dev/ttyACM0`` on Linux) - -For example, to build the "Basic" test project (number: ``0``) for a ``LPC1768`` mbed using the ``ARM GCC`` toolchain, flashing the resulting binary on the disk ``E:\`` and interfacing to the serial port ``COM4``: - -```python - - > python workspace_tools\make.py -m LPC1768 -t GCC_ARM -d E:\ -s COM41 -p 0 -``` - - -**Warning: Python Serial Port Extension** -
-To drive the serial port with ``make.py`` you will need to install the [pyserial package](https://pypi.python.org/pypi/pyserial) -
- -This is an example output: - - -```python - - >>> BUILD PROJECT: BASIC (LPC1768, GCC_ARM) - Compile: main.cpp - Compile: test_env.cpp - Link: basic - Elf2Bin: basic - Image: C:\Users\emimon01\mbed\build\test\LPC1768\GCC_ARM\MBED_A1\basic.bin - {success} - {end} -``` - -All the text appearing after the "Image:" path is actually printed through the serial port by the program running on the mbed. - -If you specify a serial port with the ``-s`` option, immediately after the copy of the project binary on the mbed, the "make" script enters in a loop reading the specified serial port. To interrupt the loop simply send a keyboard interrupt (ie: ``CTRL+c``). - -####Adding a test - -Adding a new test project is as easy as: - -* Add the sources of your project in a new directory under the ``libraries/tests`` tree. -* Add a dictionary entry to the ``workspace_tools/tests.py`` ``TEST`` list. - -These are the mandatory keys of a test project dictionary: - -* ``id``: A unique ID string to identify the test (used only internally by the automated test system) -* ``description``: A human friendly description of the test displayed on the command line "help" message -* ``source_dir``: The directory containing the sources of your test project. As good practice write the path joining it with the root ``TEST_DIR`` directory. - -These are the optional keys of a test project dictionary: - -* ``dependencies``: A list of directory paths containing the sources of the libraries this project is depending on. (default: None) -* ``automated``: Boolean specifying if the test project can communicate automatically the result of the test without the supervision of a human using specific strings. (default: False). -* ``duration``: The maximum time taken by an automated test to complete. If the test takes longer than that to complete, it is reported as a failure. (default: (10)s) -* ``mcu``: a list of types of mbed that can run the program. (default: every mbed). -* ``peripherals``: a list of peripherals needed to run the test. (default: None). -* ``host_test``: Specific host test to be launched to verify the success of the test. (defualt: 'host_test' simply checking the special strings in curly braces ``{success}`` or ``{failure}``). -* ``extra_files``: A list of file to be copied on the mbed (for example data files to be read by the mbed program during execution). - -The "automated" test projects use specific strings in curly braces to communicate to the host the result of automated tests: - -* ``{success}`` and ``{failure}`` are used to communicate the result of a single check. -* ``{end}`` is used to communicate the end of the test. - -##Export System - -To test exporter scripts run the project.py with options for the MCU and the target compiler. This provides a handy way of checking your export scripts and testing new chips you are creating. This is the same script the online compiler will use to export projects for users to download. - -``example_Keil_uVision_project_for_FRDM-K64F_with_test_0`` - -```python - - $ python project.py -m K64F -i uvision -p 0 -``` - -The script will tell you where the zip file of your project is exported to. \ No newline at end of file diff --git a/docs/Going_Further/mbed_rtos.md b/docs/Going_Further/mbed_rtos.md deleted file mode 100644 index 122cd31fc6..0000000000 --- a/docs/Going_Further/mbed_rtos.md +++ /dev/null @@ -1,167 +0,0 @@ -*** Editing: https://docs.google.com/document/d/10v8n0elbDH9gonE-x_T5EnTmk4vUrUDCuv4Jw7bRR-M/edit *** - -# mbed-rtos - -*** Not sure which link should go here... this one doesn't seem right *** - -[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed-rtos/docs/4c105b8d7cae/rtos_8h_source.html) - -## Thread - -The ``Thread`` class allows defining, creating, and controlling thread functions in the system. The function ``main`` is a special thread function that is started at system initialization and has the initial priority ``osPriorityNormal``. - -[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/rtos_basic/)](https://developer.mbed.org/users/mbed_official/code/rtos_basic/file/tip/main.cpp) - -**Note:** The ``main`` function is already the first thread scheduled by the rtos. - -[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed-rtos/docs/tip/classrtos_1_1Thread.html) - -![](../Images/Thread/thread_priority.png) - - -A ``Thread`` can be in the following states: - -* **RUNNING**: The thread that is currently running is in the RUNNING state. Only one thread at a time can be in this state. -* **READY**: Threads which are ready to run are in the READY state. Once the RUNNING thread has terminated or is WAITING the next READY thread with the highest priority becomes the RUNNING thread. -* **WAITING**: Threads that are waiting for an event to occur are in the WAITING state. -* **INACTIVE**: Threads that are not created or terminated are in the INACTIVE state. These threads typically consume no system resources. - -![](../Images/Thread/thread_status.png) - -## Mutex - -A ``Mutex`` is used to synchronize the execution of threads, for example to protect the access to a shared resource. - - **Warning:** ISR -
The ``Mutex`` methods cannot be called from interrupt service routines (ISR).
- -![](../Images/Thread/Mutex.png) - -[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/rtos_mutex/)](https://developer.mbed.org/users/mbed_official/code/rtos_mutex/file/tip/main.cpp) - -**Note:** C standard library mutexes -
The ARM C standard library has already mutexes in place to protect the access to stdio, therefore on the M3 mbed the above example is not necessary. On the contrary, ARM microlib (used on the M0 mbed) does not provide default stdio mutexes making the above example a necessity.
-**Warning:** stdio (printf, putc, getc, etc), malloc & new in ISR -
Because of the mutexes in the ARM C standard library you cannot use stdio (``printf``, ``putc``, ``getc``, etc), ``malloc`` and ``new`` in ISR!
- -[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed-rtos/docs/tip/classrtos_1_1Mutex.html) - -## Semaphore - -A ``Semaphore`` is particularly useful to manage thread access to a pool of shared resources of a certain type. - -![](../Images/Thread/Semaphore.png) - -[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/rtos_semaphore/)](https://developer.mbed.org/users/mbed_official/code/rtos_semaphore/file/tip/main.cpp) - -[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed-rtos/docs/tip/classrtos_1_1Semaphore.html) - -## Signals - -Each ``Thread`` can be notified and wait for signals: - -[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/rtos_signals/)](https://developer.mbed.org/users/mbed_official/code/rtos_signals/file/tip/main.cpp) - -## Queue - -A ``Queue`` allows you to queue pointers to data from producers threads to consumers threads: - -![](../Images/Thread/queue.png) - -``` -Queue queue; - -message_t *message; - -queue.put(message); - -osEvent evt = queue.get(); -if (evt.status == osEventMessage) { - message_t *message = (message_t*)evt.value.p; -``` - -[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/rtos_queue/)](https://developer.mbed.org/users/mbed_official/code/rtos_queue/file/tip/main.cpp) - -[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed-rtos/docs/tip/classrtos_1_1Queue.html) - -## MemoryPool - -The MemoryPool class is used to define and manage fixed-size memory pools: - -``` -MemoryPool mpool; - -message_t *message = mpool.alloc(); - -mpool.free(message); -``` - -[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/rtos_queue/)](https://developer.mbed.org/users/mbed_official/code/rtos_queue/file/tip/main.cpp) - -[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed-rtos/docs/tip/classrtos_1_1MemoryPool.html) - -## Mail - -A ``Mail`` works like a queue with the added benefit of providing a memory pool for allocating messages (not only pointers). - -![](../Images/Thread/mail_queue.png) - -[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/rtos_mail/)](https://developer.mbed.org/users/mbed_official/code/rtos_mail/file/tip/main.cpp) - -[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed-rtos/docs/tip/classrtos_1_1Mail.html) - -## RTOS Timer - -The ``RtosTimer`` class allows creating and and controlling of timer functions in the system. A timer function is called when a time period expires whereby both one-shot and periodic timers are possible. A timer can be started, restarted, or stopped. Timers are handled in the thread ``osTimerThread``. Callback functions run under control of this thread and may use CMSIS-RTOS API calls. - -![](../Images/Thread/rtos_timer.png) - -[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/rtos_timer/)](https://developer.mbed.org/users/mbed_official/code/rtos_timer/file/tip/main.cpp) - -[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/mbed-rtos/docs/tip/classrtos_1_1RtosTimer.html) - -## Interrupt Service Routines - -The same RTOS API can be used in ISR. The only two warnings are: - -* ``Mutex`` can not be used. -* Wait in ISR is not allowed: all the timeouts in method parameters have to be set to 0 (no wait). - -[![View code](https://www.mbed.com/embed/?url=https://developer.mbed.org/users/mbed_official/code/rtos_isr/)](https://developer.mbed.org/users/mbed_official/code/rtos_isr/file/tip/main.cpp) - -## Default Timeouts - -The mbed rtos API has made the choice of defaulting to ``0`` timeout (no wait) for the producer methods, and ``osWaitForever`` (infinitive wait) for the consumer methods. - -A typical scenario for a producer could be a peripheral triggering an interrupt to notify an event: in the corresponding interrupt service routine you cannot wait (this would deadlock the entire system). On the other side, the consumer could be a background thread waiting for events: in this case the desired default behaviour is not using CPU cycles until this event is produced, hence the osWaitForever. - -**Warning**: No wait in ISR
When calling an rtos object method in an ISR all the timeout parameters have to be set to 0 (no wait): waiting in ISR is not allowed.
- -## Status and Error Codes - -The Status and Error Codes section lists all the return values that the CMSIS-RTOS functions will return: - -* ``osOK``: function completed; no event occurred. -* ``osEventSignal``: function completed; signal event occurred. -* ``osEventMessage``: function completed; message event occurred. -* ``osEventMail``: function completed; mail event occurred. -* ``osEventTimeout``: function completed; timeout occurred. -* ``osErrorParameter``: parameter error: a mandatory parameter was missing or specified an incorrect object. -* ``osErrorResource``: resource not available: a specified resource was not available. -* ``osErrorTimeoutResource``: resource not available within given time: a specified resource was not available within the timeout period. -* ``osErrorISR``: not allowed in ISR context: the function cannot be called from interrupt service routines. -* ``osErrorISRRecursive``: function called multiple times from ISR with same object. -* ``osErrorPriority``: system cannot determine priority or thread has illegal priority. -* ``osErrorNoMemory``: system is out of memory: it was impossible to allocate or reserve memory for the operation. -* ``osErrorValue``: value of a parameter is out of range. -* ``osErrorOS``: unspecified RTOS error: run-time error but no other error message fits. - -## osEvent - -The ``osEvent`` data structure is returned by ``get`` methods of ``Queue`` and ``Mail`` objects. This data structure contains both an error code and a pointer to the actual data: - -[![View code](https://www.mbed.com/embed/?type=library)](https://developer.mbed.org/users/mbed_official/code/rtx/docs/tip/structosEvent.html) - -## Implementation - -The mbed RTOS is based on the [CMSIS RTOS](CMSIS-RTOS). ** MISSING LINK ** diff --git a/docs/Images/API_Docs/APIDOCS1.png b/docs/Images/API_Docs/APIDOCS1.png deleted file mode 100644 index 3db2bbfea9..0000000000 Binary files a/docs/Images/API_Docs/APIDOCS1.png and /dev/null differ diff --git a/docs/Images/API_Docs/APIDOCS2.png b/docs/Images/API_Docs/APIDOCS2.png deleted file mode 100644 index 9bdc0a1a8a..0000000000 Binary files a/docs/Images/API_Docs/APIDOCS2.png and /dev/null differ diff --git a/docs/Images/API_Docs/APIDOCS3.png b/docs/Images/API_Docs/APIDOCS3.png deleted file mode 100644 index c92aa75f72..0000000000 Binary files a/docs/Images/API_Docs/APIDOCS3.png and /dev/null differ diff --git a/docs/Images/API_Docs/APIDOCS4.png b/docs/Images/API_Docs/APIDOCS4.png deleted file mode 100644 index 14cd452b3e..0000000000 Binary files a/docs/Images/API_Docs/APIDOCS4.png and /dev/null differ diff --git a/docs/Images/API_Docs/APIDOCS5.png b/docs/Images/API_Docs/APIDOCS5.png deleted file mode 100644 index 9df7e08811..0000000000 Binary files a/docs/Images/API_Docs/APIDOCS5.png and /dev/null differ diff --git a/docs/Images/CMSIS/CMSIS1.png b/docs/Images/CMSIS/CMSIS1.png deleted file mode 100644 index 551a92ecd3..0000000000 Binary files a/docs/Images/CMSIS/CMSIS1.png and /dev/null differ diff --git a/docs/Images/CMSIS/CMSIS2.png b/docs/Images/CMSIS/CMSIS2.png deleted file mode 100644 index b8da66fa52..0000000000 Binary files a/docs/Images/CMSIS/CMSIS2.png and /dev/null differ diff --git a/docs/Images/CMSIS/CMSIS3.png b/docs/Images/CMSIS/CMSIS3.png deleted file mode 100644 index bb247a5cae..0000000000 Binary files a/docs/Images/CMSIS/CMSIS3.png and /dev/null differ diff --git a/docs/Images/CMSIS/CMSIS4.png b/docs/Images/CMSIS/CMSIS4.png deleted file mode 100644 index c5c647824b..0000000000 Binary files a/docs/Images/CMSIS/CMSIS4.png and /dev/null differ diff --git a/docs/Images/CMSIS/CMSIS5.webp b/docs/Images/CMSIS/CMSIS5.webp deleted file mode 100644 index 3af982dc2d..0000000000 Binary files a/docs/Images/CMSIS/CMSIS5.webp and /dev/null differ diff --git a/docs/Images/CMSIS/CMSIS6.png b/docs/Images/CMSIS/CMSIS6.png deleted file mode 100644 index 41ff8d051a..0000000000 Binary files a/docs/Images/CMSIS/CMSIS6.png and /dev/null differ diff --git a/docs/Images/Compiler/Compiler1.png b/docs/Images/Compiler/Compiler1.png deleted file mode 100644 index 48e3d0692d..0000000000 Binary files a/docs/Images/Compiler/Compiler1.png and /dev/null differ diff --git a/docs/Images/Compiler/Compiler2.png b/docs/Images/Compiler/Compiler2.png deleted file mode 100644 index 974240b628..0000000000 Binary files a/docs/Images/Compiler/Compiler2.png and /dev/null differ diff --git a/docs/Images/Debug/FRDM_KL25Z.gif b/docs/Images/Debug/FRDM_KL25Z.gif deleted file mode 100644 index 0f8c23d415..0000000000 Binary files a/docs/Images/Debug/FRDM_KL25Z.gif and /dev/null differ diff --git a/docs/Images/Debug/LPC11U24.gif b/docs/Images/Debug/LPC11U24.gif deleted file mode 100644 index d4e829619b..0000000000 Binary files a/docs/Images/Debug/LPC11U24.gif and /dev/null differ diff --git a/docs/Images/Debug/LPC1768.gif b/docs/Images/Debug/LPC1768.gif deleted file mode 100644 index cf0458a9a0..0000000000 Binary files a/docs/Images/Debug/LPC1768.gif and /dev/null differ diff --git a/docs/Images/Exporting/Eclipse1.png b/docs/Images/Exporting/Eclipse1.png deleted file mode 100644 index 1c9a3fb32b..0000000000 Binary files a/docs/Images/Exporting/Eclipse1.png and /dev/null differ diff --git a/docs/Images/Exporting/Eclipse2.png b/docs/Images/Exporting/Eclipse2.png deleted file mode 100644 index 6f4b8df1ee..0000000000 Binary files a/docs/Images/Exporting/Eclipse2.png and /dev/null differ diff --git a/docs/Images/Exporting/Eclipse3.png b/docs/Images/Exporting/Eclipse3.png deleted file mode 100644 index 2b97e2f931..0000000000 Binary files a/docs/Images/Exporting/Eclipse3.png and /dev/null differ diff --git a/docs/Images/Exporting/Eclipse4.png b/docs/Images/Exporting/Eclipse4.png deleted file mode 100644 index 9490a1e9e4..0000000000 Binary files a/docs/Images/Exporting/Eclipse4.png and /dev/null differ diff --git a/docs/Images/Exporting/Eclipse5.png b/docs/Images/Exporting/Eclipse5.png deleted file mode 100644 index f33fa554ab..0000000000 Binary files a/docs/Images/Exporting/Eclipse5.png and /dev/null differ diff --git a/docs/Images/Exporting/Export1.png b/docs/Images/Exporting/Export1.png deleted file mode 100644 index dc205ae06e..0000000000 Binary files a/docs/Images/Exporting/Export1.png and /dev/null differ diff --git a/docs/Images/Exporting/Export2.png b/docs/Images/Exporting/Export2.png deleted file mode 100644 index 50da5b2767..0000000000 Binary files a/docs/Images/Exporting/Export2.png and /dev/null differ diff --git a/docs/Images/Exporting/IAR1.png b/docs/Images/Exporting/IAR1.png deleted file mode 100644 index f4f3d9c6b0..0000000000 Binary files a/docs/Images/Exporting/IAR1.png and /dev/null differ diff --git a/docs/Images/Exporting/IAR2.png b/docs/Images/Exporting/IAR2.png deleted file mode 100644 index 41b389072c..0000000000 Binary files a/docs/Images/Exporting/IAR2.png and /dev/null differ diff --git a/docs/Images/Exporting/Make1.png b/docs/Images/Exporting/Make1.png deleted file mode 100644 index 1c9a3fb32b..0000000000 Binary files a/docs/Images/Exporting/Make1.png and /dev/null differ diff --git a/docs/Images/Exporting/uVision1.png b/docs/Images/Exporting/uVision1.png deleted file mode 100644 index b383043f29..0000000000 Binary files a/docs/Images/Exporting/uVision1.png and /dev/null differ diff --git a/docs/Images/Exporting/uVision2.png b/docs/Images/Exporting/uVision2.png deleted file mode 100644 index 61fc26cafc..0000000000 Binary files a/docs/Images/Exporting/uVision2.png and /dev/null differ diff --git a/docs/Images/Lib_Intern/Blinky1.png b/docs/Images/Lib_Intern/Blinky1.png deleted file mode 100644 index 68728fa03d..0000000000 Binary files a/docs/Images/Lib_Intern/Blinky1.png and /dev/null differ diff --git a/docs/Images/Lib_Intern/Blinky2.png b/docs/Images/Lib_Intern/Blinky2.png deleted file mode 100644 index 78d17bb0c8..0000000000 Binary files a/docs/Images/Lib_Intern/Blinky2.png and /dev/null differ diff --git a/docs/Images/Lib_Intern/Direct.png b/docs/Images/Lib_Intern/Direct.png deleted file mode 100644 index 9c2889cb30..0000000000 Binary files a/docs/Images/Lib_Intern/Direct.png and /dev/null differ diff --git a/docs/Images/Lib_Intern/GPIO_R.png b/docs/Images/Lib_Intern/GPIO_R.png deleted file mode 100644 index c93846febc..0000000000 Binary files a/docs/Images/Lib_Intern/GPIO_R.png and /dev/null differ diff --git a/docs/Images/Lib_Intern/Layers.png b/docs/Images/Lib_Intern/Layers.png deleted file mode 100644 index fa392db3c0..0000000000 Binary files a/docs/Images/Lib_Intern/Layers.png and /dev/null differ diff --git a/docs/Images/Memory/Heap_Stack.png b/docs/Images/Memory/Heap_Stack.png deleted file mode 100644 index b10b09d6f3..0000000000 Binary files a/docs/Images/Memory/Heap_Stack.png and /dev/null differ diff --git a/docs/Images/Memory/Memory_Sections.png b/docs/Images/Memory/Memory_Sections.png deleted file mode 100644 index 189431779c..0000000000 Binary files a/docs/Images/Memory/Memory_Sections.png and /dev/null differ diff --git a/docs/Images/Memory/RTOS.png b/docs/Images/Memory/RTOS.png deleted file mode 100644 index 5db4d2f000..0000000000 Binary files a/docs/Images/Memory/RTOS.png and /dev/null differ diff --git a/docs/Images/Publish/Publish1.png b/docs/Images/Publish/Publish1.png deleted file mode 100644 index d48c3c316e..0000000000 Binary files a/docs/Images/Publish/Publish1.png and /dev/null differ diff --git a/docs/Images/Publish/Publish2.png b/docs/Images/Publish/Publish2.png deleted file mode 100644 index e3a97a1372..0000000000 Binary files a/docs/Images/Publish/Publish2.png and /dev/null differ diff --git a/docs/Images/Publish/Publish3.png b/docs/Images/Publish/Publish3.png deleted file mode 100644 index 4db7824229..0000000000 Binary files a/docs/Images/Publish/Publish3.png and /dev/null differ diff --git a/docs/Images/Publish/Publish4.png b/docs/Images/Publish/Publish4.png deleted file mode 100644 index 08423ca1b2..0000000000 Binary files a/docs/Images/Publish/Publish4.png and /dev/null differ diff --git a/docs/Images/Publish/Publish5.png b/docs/Images/Publish/Publish5.png deleted file mode 100644 index e3a97a1372..0000000000 Binary files a/docs/Images/Publish/Publish5.png and /dev/null differ diff --git a/docs/Images/Serial_Pinout.png b/docs/Images/Serial_Pinout.png deleted file mode 100644 index 50f784191f..0000000000 Binary files a/docs/Images/Serial_Pinout.png and /dev/null differ diff --git a/docs/Images/Thread/Mutex.png b/docs/Images/Thread/Mutex.png deleted file mode 100644 index 020da3d19b..0000000000 Binary files a/docs/Images/Thread/Mutex.png and /dev/null differ diff --git a/docs/Images/Thread/Semaphore.png b/docs/Images/Thread/Semaphore.png deleted file mode 100644 index f1939c01b9..0000000000 Binary files a/docs/Images/Thread/Semaphore.png and /dev/null differ diff --git a/docs/Images/Thread/mail_queue.png b/docs/Images/Thread/mail_queue.png deleted file mode 100644 index 42af6cd831..0000000000 Binary files a/docs/Images/Thread/mail_queue.png and /dev/null differ diff --git a/docs/Images/Thread/queue.png b/docs/Images/Thread/queue.png deleted file mode 100644 index 3ff42fca44..0000000000 Binary files a/docs/Images/Thread/queue.png and /dev/null differ diff --git a/docs/Images/Thread/rtos_timer.png b/docs/Images/Thread/rtos_timer.png deleted file mode 100644 index 3b849d11f4..0000000000 Binary files a/docs/Images/Thread/rtos_timer.png and /dev/null differ diff --git a/docs/Images/Thread/thread_priority.png b/docs/Images/Thread/thread_priority.png deleted file mode 100644 index ad51d35ee0..0000000000 Binary files a/docs/Images/Thread/thread_priority.png and /dev/null differ diff --git a/docs/Images/Thread/thread_status.png b/docs/Images/Thread/thread_status.png deleted file mode 100644 index 45a05645ba..0000000000 Binary files a/docs/Images/Thread/thread_status.png and /dev/null differ diff --git a/docs/Introduction/API_Libs.md b/docs/Introduction/API_Libs.md deleted file mode 100644 index dacc58b77e..0000000000 --- a/docs/Introduction/API_Libs.md +++ /dev/null @@ -1,19 +0,0 @@ -#High-level Peripheral APIs - -The mbed SDK gives you an API-driven approach to microcontroller coding. - -We've done all the hard work of implementing drivers for the different [mbed platforms](http://developer.mbed.org/platforms/) so you won't have to. It is liberating to fire up an interface, knowing it'll just work! - -You can code using meaningful abstract objects and API calls, so you don't need to learn the microcontroller hardware details to get going. There is even a **Hello World!** example for every peripheral, just to get you started. - -Take a look at some of these interfaces to get a feel of how it works: [digital out](http://developer.mbed.org/handbook/DigitalOut), [analog in](http://developer.mbed.org/handbook/AnalogIn), [SPI](http://developer.mbed.org/handbook/SPI), [USB mouse](http://developer.mbed.org/handbook/USBMouse), [Timer](http://developer.mbed.org/handbook/Timer) or [CAN](http://developer.mbed.org/handbook/CAN). - -If needed, you can bypass the APIs and talk directly to the microcontroller hardware using the low-level [Cortex Microcontroller Software Interface Standard (CMSIS) APIs](/CMSIS/CMSIS/). Ideal when just one aspect needs specific low-level control. - - -For all the mbed C/C++ SDK APIs, see the [API breakdown](/Development/API_Libs_Breakdown/)
- -[link to how to write a library or to API_Documentation (which is a mpage I'm not sure we have)] - -
- diff --git a/docs/Introduction/Code_Base.md b/docs/Introduction/Code_Base.md deleted file mode 100644 index 78d858b4c7..0000000000 --- a/docs/Introduction/Code_Base.md +++ /dev/null @@ -1,10 +0,0 @@ -mbed OS code base - -The mbed OS code base is at: - -https://github.com/ARMmbed/mbed-os - -https://github.com/mbedmicro/mbed - - -[These will probably become a single one when we go live] diff --git a/docs/Introduction/HDK.md b/docs/Introduction/HDK.md deleted file mode 100644 index 90364baee0..0000000000 --- a/docs/Introduction/HDK.md +++ /dev/null @@ -1,62 +0,0 @@ -#mbed HDK - -The mbed Hardware Development Kit (HDK) provides full microcontroller sub-system design files and firmware for building development boards and custom products that benefit from the native support of the mbed SDK and free mbed Online Compiler and mbed Developer Platform. - -The mbed HDK specifies all support components and circuits including the CMSIS-DAP Interface design that provides simple USB drag-n-drop programming and CMSIS-DAP debug interface for the target microcontroller. - -Development boards that are already based on the mbed HDK are the quickest way to get started with the mbed platform. We manufacture official mbed Microcontroller modules that are specifically optimised for flexible rapid prototyping, and are available from distributors worldwide. Our partners are now also creating mbed-enabled hardware such as ultra low-cost ARM evaluation boards in the popular Arduino form-factor. - - -**Creating your own mbed-enabled platforms**
-Are you are a hardware company that would like to create an mbed-enabled platform of your own that is supported within the mbed platforms database and tools? If so, then please email us at and we can help you with your questions and support you through the process. -
- -##Microcontroller Sub-systems - -Each of the subsystems designs include - - * Hardware design schematics (Eagle format) - * Interface binary for the CMSIS-DAP interface - -An example of how a microcontroller sub-system might be used to build an evaluation board: - - -![eveulation](/Development/Images/EvaluationBoard.png) - - -##CMSIS-DAP interface - -The CMSIS-DAP Interface is a microcontroller-based single chip solution that provides drag and drop programming, [CMSIS-DAP](/CMSIS/CMSIS/) debugger and USB serial interface to a range of Cortex-M based microcontrollers. The small footprint, low number of passive components and rich feature set provide a low cost, low overhead solution that can easily be integrated on a PCB. - -The firmware required to turn the low cost microcontroller into a powerful programming, debug and communication interface is included with the HDK and can be used freely, even in commercial products. - - -![CMSIS](/Development/Images/CMSISDAPInterface.png) - - -The CMSIS-DAP interface provides three main functions over a single physical USB connection : - -* USB Disk drag and drop programming - ideal for fast turnaround prototyping or in-field upgradable products. -* Debug interface using the [CMSIS-DAP](/CMSIS/CMSIS) - provides full debug capability with tools like [Keil MDK](/CMSIS/CMSIS-DAP-MDK/). -* USB Serial interface between the host computer and the target. - - - -For more information see the [CMSIS-DAP section](/CMSIS/CMSIS/). - - -##Benefits of the HDK - -There are various benefits to building a custom design onto of the mbed HDK. The ready made schematics are a great short cut, so you can get started on all the things that make your design, without worrying if you've correctly implemented all the "necessary bits" of the design. The mbed HDK incorporates the CMSIS-DAP interface. This provides USB drag and drop programming, [CMSIS-DAP](/CMSIS/CMSIS/) debugging and USB serial communication. The [mbed SDK](/Introduction/SDK/) supports each of the exact configurations of HDK designs, and libraries that have been written to the APIs in the mbed SDK are highly reusable. Lastly, the mbed community has developed a wealth of libraries, applications and code examples using the SDK/HDK, and this active community offers a lot of opportunities for support and even hiring in required skills. - - -##Sources - -1. The mbed HDK, complete with PCB Layout files and schematics, can be downloaded from the repository [mbed-HDK](http://developer.mbed.org/teams/mbed/code/mbed-HDK/). - -2. The sources of the [CMSIS-DAP Interface Firmware](http://developer.mbed.org/handbook/cmsis-dap-interface-firmware). - - -For support, design review and other help making your platform, email . - - diff --git a/docs/Introduction/How_mbed_Works.md b/docs/Introduction/How_mbed_Works.md deleted file mode 100644 index ffa545ebcf..0000000000 --- a/docs/Introduction/How_mbed_Works.md +++ /dev/null @@ -1,40 +0,0 @@ -#How mbed Works - -The mbed hardware architecture is designed to give you a really reliable and accessible platform to be able to quickly pick up and prototype with, whilst giving you bare-metal access to the underlying target microcontroller without needing any form of bootloader or monitor. Here is how it works... - -##Architecture diagram - -This is the basic architecture of the mbed Microcontroller board: - - -![](/Getting_Started/Images/mbed_Interface.webp) - - -##How programming works - -When you plug in an mbed Microcontroller in to your PC using USB, it appears like a USB flash disk. This small disk is presented by the mbed Interface, and allows you to save ARM microcontroller binaries you want to run directly on to the mbed, without needing drivers. Note that when you save a binary file to the mbed disk, it is not immediately loaded in to the internal microcontroller FLASH memory. - -When you hit reset, the [mbed interface](/Introduction/mbed_Interface/) looks at the disk for the newest .bin file it can find. If there is a new file, it will load it in to the microcontroller's internal FLASH memory using the JTAG interface. If the newest binary is already loaded, it won't load it again. It then starts the microcontroller running. - -This means if you hit reset again, it will simply reset the target microcontroller and start it running again, as the latest binary is already loaded. - -If there is no binary on the mbed disk, the target microcontroller will simply be kept held in reset. - -##How USB serial works - -The mbed Interface also presents a USB serial/com interface. This is basically a UART-USB bridge, and connects to UART0 of the interface. So if you send characters out of UART0 of the target microcontroller, they will be read by the mbed interface and transfered over the USB link. When you printf(), it is just sendin characters to UART0. This means if you make your own PCB, these characters will still appear on UART0. - - -##Notes - -The USB interface used for programming the microcontroller is not using the USB interface of the target LPC1768 microcontroller. This means the target USB interface is still available on the mbed pins (D+, D-), allowing your applications to have their own USB interfaces. - -The .bin files the mbed Microcontroller accepts are standard raw ARM binaries, and can be generated by any compiler you like. You have bare-metal control of the target microcontroller, as the separate interface manages programming over JTAG i.e. we don't use a bootloader or monitor on the target. So you really are just loading on a raw binary. This means you can build your own PCB using the same target microcontroller, and the same program binary will run on that. - - -See also: -

-[The mbed compiler](/Introduction/IDE_API/) -

-[The mbed interface](/Introduction/mbed_Interface/) -
diff --git a/docs/Introduction/IDE_API.md b/docs/Introduction/IDE_API.md deleted file mode 100644 index 77236e2db8..0000000000 --- a/docs/Introduction/IDE_API.md +++ /dev/null @@ -1,153 +0,0 @@ -#The mbed Compiler - -**Instant access to your lightweight C/C++ microcontroller development environment** - - -![](/Getting_Started/Images/Compiler/Compiler1.png) - - -The mbed Compiler provides a lightweight online C/C++ IDE that is pre-configured to let you quickly write programs, compile and download them to run on your mbed Microcontroller. In fact, you don't have to install or set up anything to get running with mbed. Because it is a web app, you can log in from anywhere and carry on where you left off, and you are free to work on Windows, Mac, iOS, Android, Linux, or all of them. - -Watch a demonstration: - - - - - -**It is online and lightweight, but it is also powerful.** - -The compiler uses the professional ARMCC compiler engine, so it produces efficient code that can be used free-of-charge, even in commercial applications. The IDE includes [workspace version control](/Going_Further/Comp_Ver_Cont/), code formatting and [auto-generation](/Going_Further/Docu/) of documentation for published libraries. The mbed tools are focused on prototyping and are designed for fast experimentation, and complement other professional production-level tools; you can even export directly to [other toolchains](/Going_Further/Export/) if you choose, as you progress to productise your design. - -You can [publish projects](/Development/Write_Publish/) directly from your Compiler workspace to the mbed.org website to [share code](http://developer.mbed.org/code/) with others, and pull existing libraries in to your workspace to get a head start. - -##Feature Highlights - -###Online Compiler IDE - -Every mbed user account gets their own private Compiler workspace which contains their programs. This is private to you, and available wherever you login to mbed. - -The IDE includes a full code editor including syntax highlighting, standard editor keyboard shortcuts, undo/redo, cut/copy/paste, tabs, block/line comment, and even a code auto-formater. This is where you work on your personal workspace, with multiple files, folders, programs, including a drag and drop folder interface: - - -![](/Getting_Started/Images/Compiler/Compiler2.png) - - -The editor also includes features like find and searching across multiple files and filetypes; for example, searching across your whole program. When you search, the results will appear as a list in the compiler output window where you can jump to any of them with a click: - - -![](/Getting_Started/Images/Compiler/Compiler3.png) - - -![](/Getting_Started/Images/Compiler/Compiler4.png) - - -###Integrated Version Control - -You can use the built-in version control features to let you version, branch and merge code, with a nice representation of the state of your project history: - - -![](/Getting_Started/Images/Compiler/Compiler5.png) - - -The approach should be familiar to those of you with experience of distributed version control models (as used by mercurial/git); each program has its own local repository, so you can commit and perform actions on it within your own workspace (such as updating, branching and showing changes). - -The main things you can do include: - -* Commit a version of your project, and view the revision history - -* View changes a version made, and compare changes between versions - -* Update or revert to a different version - -* Branch and merge - - -See also [Version Control](/Going_Further/Comp_Ver_Cont/). - - -###Importing Libraries or Example Programs - -The Import Wizard allows you to import programs and libraries published by mbed users. This is useful for importing code that has been packaged as a reusable library component (e.g. a class for a peripheral), so you can quickly pull in the building blocks for your project. - - -![](/Getting_Started/Images/Compiler/Compiler6.png) - - - -See also [Importing code](/Getting_Started/Using_IDE/). - - -###Compilation - -To perform the actual compilation the mbed Compiler uses the industry standard [ARM RVDS 4.1](http://www.arm.com/products/tools/software-tools/rvds/arm-compiler.php) compiler engine, in the default configuration, to give excellent code size and performance. There are no limitations on code size (apart from the limits of the device itself!), and the generated code can be used freely for commercial and non-commercial use. - -When you compile a program, you'll get a display of the memory usage. This shows the size of program code and any constant (const) variables that will end up in FLASH, and size of data variables that end up in main RAM. - - -![](/Getting_Started/Images/Compiler/Compiler7.png) - - -Note, this doesn't include the runtime allocated variables (i.e. the heap and stack), which live in any remaining RAM. - - -See also the mbed [Memory Model](/Going_Further/Mem_Mo/). - - -###Export to Offline Toolchains - -The [mbed C/C++ SDK](/Introduction/SDK/) used with the mbed Online Compiler is also compatible with a number of other popular ARM microcontroller toolchains, so we've also built in the ability to export directly to these toolchains! For example, if you'd like to migrate to a different toolchain as your project develops past prototype, you can choose to export an mbed project by right-clicking on it: - - -![](/Getting_Started/Images/Compiler/Compiler8.png) - - - -See also the [SDK](/Introduction/SDK/) and [Exporting to offline toolchains](/Going_Further/Export). - - -##Feature Overview - -Code IDE - -* All the core features you expect from a code editor including syntax highlighting, standard [editor keyboard shortcuts](/Getting_Started/IDE_Shortcuts/), copy/paste, etc. - -* Personal workspace with multiple files, folders, programs, including drag and drop folder interface. - -* Code auto-formatter, print-friendly code preview. - -Compile Engine - -* Pre-configured compile engine that "just works", delivering .bin binary file to save to mbed microcontroller. - -* Switch between different mbed targets with a drop-down selector. - -* Output of compile-time messages, including click to go to error and error message wiki. - -* Build information including graphical display of code size and RAM usage. - -Built-in Version Control and Collaboration tools - -* [Built-in version control](/Going_Further/Comp_Ver_Cont/) (DVCS). - -* Publish, fork, push and pull code in [collaboration-enabled environment](/Community/Collab/). - -* View graphs, diffs, change sets. - -Importing and Exporting - -* Import programs from online catalogue of [published programs](http://developer.mbed.org/code/). - -* Publish your code directly from the mbed Compiler to the mbed Developer Website. - -* Import from and export to local source files and zip archives. - -* [Export directly](/Going_Further/Export) to other popular ARM toolchains. - -Accessibility - -* Access the mbed Compiler on all major browsers, on all modern operating systems. - -* Develop and prototype right on your [tablet device](http://developer.mbed.org/handbook/Guide-to-mbed-Compiler-on-tablet-device) (Android, iOS) with the integrated [touch support](http://developer.mbed.org/blog/entry/compiler-touch-support/). - -* Backward compatible up to Internet Explorer 6. \ No newline at end of file diff --git a/docs/Introduction/Plat_Comp_Intro.md b/docs/Introduction/Plat_Comp_Intro.md deleted file mode 100644 index a38e1022e2..0000000000 --- a/docs/Introduction/Plat_Comp_Intro.md +++ /dev/null @@ -1,30 +0,0 @@ -##Overview - -mbed provides a way of prototyping hardware-based projects and products by giving you the hardware (ARM-processors on a board, and external components) and the ability to write software to control it (using the mbed API and IDE). - -##Platforms and Components - -All mbed programs are written for one or more [platforms](http://developer.mbed.org/platforms/): a board with an ARM microcontroller and various capabilities such as receiving and processing input, generating output and storing small bits of information. - -You need to select a platform that matches what you're trying to achieve, as they all have different capabilities. But platforms don't have to be used on their own - you can add external [components](http://developer.mbed.org/components/) to enhance functionality. - -##Platform Programming - -Platform programming is done in C++; it relies on APIs that abstract the hardware, protocols and component support. - - -**Tip:** for more information about the software development kit, see our [SDK section](/Introduction/SDK/). - - -All platforms run a `.hex` file generated by either our [online compiler](https://developer.mbed.org/compiler/) or an offline tool of your choosing. - -##Platform Interoperability - -To help you experiment and prototype, we've moved the interoperability of platforms behind the scenes. You write one program, and the IDE can then compile it to fit as many different platforms as you require, without any manual recoding. - -
- -
-
The IDE lets you select a target platform at any stage in the process
- - diff --git a/docs/Introduction/Rapid_Prototyping.md b/docs/Introduction/Rapid_Prototyping.md deleted file mode 100644 index da5665867a..0000000000 --- a/docs/Introduction/Rapid_Prototyping.md +++ /dev/null @@ -1,116 +0,0 @@ -#Rapid Prototyping With mbed - -If you have a [board](http://developer.mbed.org/platforms/) and a [user on the mbed compiler](https://developer.mbed.org/account/signup/), you can build your first prototype. - -You can reuse a wealth of open source code and technical know-how from the official Handbook, community Cookbook and Components database as the foundation of your products. - -You can also contribute back fixes, libraries and support for other developers to help everyone get things done even faster. - -##Assemble components - -The Components database contains community contributions for hundreds of popular components and peripherals. These include specifications, wiring diagrams, reusable libraries and “Hello World” examples on how to use each peripheral. - -When you are deciding which components to use, browsing the components database can help narrow down to devices people have found success with and that are already supported. - -There are also various existing domain-specific baseboards that pre-integrate useful components to help you prototype your software before designing the hardware. - - -See our [components page](http://developer.mbed.org/components/), [cookbook](http://developer.mbed.org/cookbook/Homepage) and [baseboards list](http://developer.mbed.org/cookbook/Homepage#baseboards). - - -##Import libraries and get coding - -Jump start your code by importing libraries and examples for components. Simply click “import” on any library or example you find around the site, and it can be imported in to your private compiler workspace. - -After you’ve got your libraries, it’s time to get coding. The compiler includes full C/C++ error reporting, with each linked to a wiki page with help to you squish coding bugs faster. - -You can use the built-in version control to keep track of working version of your code, and even publish your program to the community in a couple of clicks; this is excellent if you want help, as it makes it very easy for others to reproduce your problems quickly. - - -See our explanation on how to [import](/Getting_Started/Using_IDE/) or [publish](Development/Write_Publish/). - - -##Build on existing middleware - -While lots of libraries are maintained by mbed users, we directly maintain certain important core libraries. - -The mbed SDK is at the core of all programs and libraries on mbed, providing the high level object oriented library for the onboard interfaces and features of microcontrollers. - -The mbed Networking stack provides a full Berkeley sockets layer TCP/IP implementation based on LwIP, and supports various transports such as Ethernet, WiFi and 3G Modems. - -Other middleware includes libraries like Bluetooth Smart, HTTP, CoAP and other connectivity protocols essential for building connected products. - - -See our page on working [with the mbed community](Community/Intro/). - - -##Collaborate with other developers - -Take some time to explore the tools we provide to help you collaborate with other developers. It can enable you to work on a your own projects and to help improve a public library. - -If you fix a bug in a library you can contribute the fix back. Coding new libraries is simple, and you can add API documentation using the built-in Doxygen engine and publish it to the community for others to use in their projects. - -We use Mercurial on the backend to support distributed version control; forking, pulling, merging and pushing all happen neatly from within the mbed Compiler. You can also grant developers access to your own repositories, so you can create a virtual team. - - -See our pages on working [with the mbed community](Community/Intro/) or [writing a library](Development/Write_Publish/). - - -##Going to production - - - - - -When your prototype proves a success, the mbed platform can also help support you as you develop it into a product. - -The HDK is free for use in custom commercial designs, and the compiler can export to other professional toolchains if needed. - -Choosing the mbed platform means you are in the company of tens of thousands of developers who know the tools and have the expertise to help you on the path to production. - -###Manufacturing your own hardware - -The mbed platform is designed to make it very fast to build and iterate prototypes, so you build the right product. - -Once you have your final prototype you’ll likely want to build your own custom hardware. Both the mbed SDK and HDK are free for commercial use, so you can move to the production phase of your project with confidence. - -Going to production can be daunting if you haven’t done it before. The prototype to production guide in the cookbook, board schematic / layout files in the HDK and the expertise in the mbed community can help with understanding the process of taking your prototype through to a manufacturable product. - - -See our page on the [mbed HDK](/Introduction/HDK/). - - -###Exporting to other professional tools - -As you progress to production, you may want to perform rigorous optimisation and testing of your software, or hand-off to a contractor or engineer familiar with different tools. - -The mbed Compiler is capable of exporting your projects to other professional toolchains. This export process packages up your code with any library dependencies and generates the tool specific project files to make the transition simple. - -Combined with the CMSIS-DAP support built-in to the USB Onboard Interface, it is easy to move your project to full professional debugger tools without changing your hardware. - - -See our page on [exporting to other toolchains](/Going_Further/Export/). - - -###Support and Contracting - -Once you have built a proof-of-concept that proves your product idea, it is worth considering how best to get it to production; finishing the last 10% is often 90% of the work. - -You are lucky enough to be among thousands of highly skilled developers, all who know the platform you are working with, and each with expertise in different areas that could complement your own; reach out to them! - -Whether you are looking for hardware or PCB design, low-level software, device drivers or even with your application, there are developers with the right skills and experience to help you with your project, and mbed.org is a great place to find them. - -If you are a developer looking for contracting work, your profile and work history are a great way to advertise your skills and help you win challenging and interesting work. - -###Finished products - -The mbed platform is being used in companies across the world to develop new generations of products. Most companies that we enable are quietly working away on their designs, getting help from and contributing to the community to do amazing things. - -We're always interested to hear your case studies so we can share details of products you have been creating, and help inform and inspire other developers that are earlier on in their journey to a finished product. - -If you or your company have an advanced prototype or product success you’d be happy to share, please let us know! We love to cross post to our blog and social media to help get the word out. Also consider adding your product to our showcase at [hackster.io/mbed](http://www.hackster.io/mbed/). - -###Prototype to hardware - -If you want to read about moving from prototyping to hardware, see [here](http://developer.mbed.org/users/chris/notebook/prototype-to-hardware/). \ No newline at end of file diff --git a/docs/Introduction/SDK.md b/docs/Introduction/SDK.md deleted file mode 100644 index cf3ce99ddb..0000000000 --- a/docs/Introduction/SDK.md +++ /dev/null @@ -1,72 +0,0 @@ -#The mbed SDK - -The mbed Software Development Kit (SDK) is a C/C++ microcontroller software platform relied upon by tens of thousands of developers to build projects fast. We've worried about creating and testing startup code, C runtime, libraries and peripheral APIs, so you can worry about coding the smarts of your next product. - -The SDK is licensed under the permissive Apache 2.0 licence, so you can use it in both commercial and personal projects with confidence. - -The mbed SDK has been designed to provide enough hardware abstraction to be intuitive and concise, yet powerful enough to build complex projects. It is built on the low-level ARM CMSIS APIs, allowing you to code down to the metal if needed. In addition to RTOS, USB and Networking libraries, a cookbook of hundreds of reusable peripheral and module libraries have been built on top of the SDK by the mbed Developer Community. - -##Hello World! - -Startup code, check. C Library integration, check. Peripheral libraries, check. We've worked hard to help you get to the point: - - -[Import the code](http://developer.mbed.org/teams/mbed/code/mbed_blinky/) - - -```c - - #include "mbed.h" - - DigitalOut myled(LED1); - - int main() { - while(1) { - myled = 1; - wait(0.2); - myled = 0; - wait(0.2); - } - } -``` - - -##Support for Multiple Targets - -The abstraction provided by the mbed SDK APIs enables libraries and example code to be reused by any microcontroller target that the mbed SDK targets. - - -![logos](/Development/Images/sdk_logos.png) - - -##Support for Multiple Toolchains - -Our goal with the mbed Compiler and mbed SDK is to enable a consistent and stable fully integrated development platform that just works. This helps provide a consistent context for development, code sharing, and questions and answers with other developers that helps you be more productive, especially when prototyping. - -However, the mbed C/C++ SDK used with the mbed Online Compiler is also compatible with a number of other popular ARM microcontroller toolchains! - -If you'd like to use the [mbed platforms](http://developer.mbed.org/platforms/) or mbed C/C++ SDK with an alternate tool, or simply migrate to one as your project develops past prototype, you can choose to export an mbed project to the toolchain of your choice by right-clicking on them in the IDE. - - -You can read more about this on the [Exporting to offline toolchains](/Going_Further/Export/) handbook page. - - -##Open Source - - -![open source](/Development/Images/sdk_open_source.png) - - -The mbed SDK is licensed under the permissive Apache 2.0 open source licence. - -We wanted to make sure the license we chose made it possible to use the SDK in both commercial and personal projects with confidence, including no obligations to open source your own code if you didn't want to. Whilst we encourage sharing of code and experience to be reusable by others, we certainly don't want to enforce it, and a permissive license provides that freedom for our users to keep the options open. - -If you are interested in delving in the depth of the mbed SDK implementation you can take a look at the documentation of the [mbed library internals](/Going_Further/Lib_Internals/). - -and you can use the mbed library sources, instead of one of its builds: -[Import the code](http://developer.mbed.org/users/mbed_official/code/mbed-src/) - -If you are interested in [porting the mbed SDK](/Going_Further/SDK_Porting/) to a new target we provide the sources of all the official mbed libraries, tests and [tools (build and test system)](/Going_Further/Tools/) in [this github repository](https://github.com/mbedmicro/mbed). - -##See also -Check out the rest of the mbed platform, and [explore](http://mbed.org/explore/) what it can do for you! \ No newline at end of file diff --git a/docs/Introduction/mbed_Interface.md b/docs/Introduction/mbed_Interface.md deleted file mode 100644 index c3f2d6a51c..0000000000 --- a/docs/Introduction/mbed_Interface.md +++ /dev/null @@ -1,46 +0,0 @@ -#The mbed Interface - -Since the beginning of mbed, there has been a certain amount of interest and speculation around the "magic interface chip" on the underside of the mbed microcontroller. - -There has been some information published surrounding this part, which is now collated on this page. - -The full schematics of the mbed Microcontroller, including the mbed interface are now available in the handbook. - -##Connectivity - -The best representation of the connectivity of the mbed interface was in Simon's official unoffical diagram: - - -![](/Getting_Started/Images/mbed_Interface.webp) - - -The headlines are that it: - -- Provides a USB connection to the host computer, which exposes a Mass Storage (flash disk) and a USB Serial Port - -- Connects with the Serial Flash device, which implements the USB flash disk file storage - -- Has a JTAG connection to the target, so that it can program the target flash. Semihosting of the USB flash drive (LocalFileSystem) is implemented over this JTAG connection - -- A physical UART connection exists between the target and the interface which is relayed over interface USB Serial port - -##Operation - -There are a few facts and rules about how the interface interacts with the host computer and the target, the most significant ones are: - -- The USB Drive is really a flash drive that can store multiple binary files. On power up/reset, the interface will always program the newest file into the target, unless the newest binary has already been programmed. - -- When there is no binary file on the USB flash disk, the target is held in reset - -- The reset button on the mbed Microcontroller doesn't directly resets the target. Instead it requests that the interface resets the target, checking first to see if there is a newer binary on the USB flash disk to be programmed. - -- If a file is opened by the target using LocalFileSystem, the USB flash disk will disappear from the host computer until the file is closed, as the filesystem can not appear in two places at once. - -- Should the USB flash drive fail to appear when you plug in your mbed, it might be because your current program is using the local file system. Press and hold the reset button to keep the target in reset, and the flash drive will appear. - - -See also: -

-[How mbed Works](/Introduction/How_mbed_Works/) -
- diff --git a/docs/Targets/Intro.md b/docs/Targets/Intro.md deleted file mode 100644 index 158f006b03..0000000000 --- a/docs/Targets/Intro.md +++ /dev/null @@ -1 +0,0 @@ -# Working with targets \ No newline at end of file diff --git a/docs/advanced/DAP.md b/docs/advanced/DAP.md new file mode 100644 index 0000000000..d100870fff --- /dev/null +++ b/docs/advanced/DAP.md @@ -0,0 +1 @@ +# CMSIS-DAP and DAPLink \ No newline at end of file diff --git a/docs/advanced/config_system.md b/docs/advanced/config_system.md new file mode 100644 index 0000000000..3133d587af --- /dev/null +++ b/docs/advanced/config_system.md @@ -0,0 +1 @@ +# The mbed Configuration System \ No newline at end of file diff --git a/docs/advanced/debugging.md b/docs/advanced/debugging.md new file mode 100644 index 0000000000..77630915e1 --- /dev/null +++ b/docs/advanced/debugging.md @@ -0,0 +1 @@ +# Debugging applications \ No newline at end of file diff --git a/docs/advanced/targets.md b/docs/advanced/targets.md new file mode 100644 index 0000000000..fe03c85550 --- /dev/null +++ b/docs/advanced/targets.md @@ -0,0 +1 @@ +# Using target configuration with your applications \ No newline at end of file diff --git a/docs/advanced/versions.md b/docs/advanced/versions.md new file mode 100644 index 0000000000..27f303ff05 --- /dev/null +++ b/docs/advanced/versions.md @@ -0,0 +1 @@ +# Version control \ No newline at end of file diff --git a/docs/advanced/writing_apps.md b/docs/advanced/writing_apps.md new file mode 100644 index 0000000000..941eac14d3 --- /dev/null +++ b/docs/advanced/writing_apps.md @@ -0,0 +1 @@ +# Writing applications on top of mbed OS 4.0 \ No newline at end of file diff --git a/docs/advanced/writing_libs.md b/docs/advanced/writing_libs.md new file mode 100644 index 0000000000..595cc57f2e --- /dev/null +++ b/docs/advanced/writing_libs.md @@ -0,0 +1 @@ +# Writing libraries for mbed OS \ No newline at end of file diff --git a/docs/build_tools/cli.md b/docs/build_tools/cli.md new file mode 100644 index 0000000000..8d2610b93e --- /dev/null +++ b/docs/build_tools/cli.md @@ -0,0 +1 @@ +# mbed CLI \ No newline at end of file diff --git a/docs/build_tools/ide.md b/docs/build_tools/ide.md new file mode 100644 index 0000000000..3acc66b443 --- /dev/null +++ b/docs/build_tools/ide.md @@ -0,0 +1 @@ +# mbed IDE \ No newline at end of file diff --git a/docs/build_tools/offline.md b/docs/build_tools/offline.md new file mode 100644 index 0000000000..65bd5a2393 --- /dev/null +++ b/docs/build_tools/offline.md @@ -0,0 +1,5 @@ +# Offline build tools + +## Keil + +## Third party integrations \ No newline at end of file diff --git a/docs/build_tools/options.md b/docs/build_tools/options.md new file mode 100644 index 0000000000..bd5a7c36a5 --- /dev/null +++ b/docs/build_tools/options.md @@ -0,0 +1,9 @@ +# Build tool options + +## mbed Studio + +## mbed IDE + +## mbed CLI + +## Offline build tools \ No newline at end of file diff --git a/docs/build_tools/studio.md b/docs/build_tools/studio.md new file mode 100644 index 0000000000..4317a77406 --- /dev/null +++ b/docs/build_tools/studio.md @@ -0,0 +1 @@ +# mbed Studio \ No newline at end of file diff --git a/docs/coding/Contributing.md b/docs/coding/Contributing.md deleted file mode 100644 index e93f3206e8..0000000000 --- a/docs/coding/Contributing.md +++ /dev/null @@ -1 +0,0 @@ -# Contribution guide diff --git a/docs/coding/code_style.md b/docs/coding/code_style.md deleted file mode 100644 index c87a35b1b6..0000000000 --- a/docs/coding/code_style.md +++ /dev/null @@ -1 +0,0 @@ -# Code style guide diff --git a/docs/getting_started/first_program.md b/docs/getting_started/first_program.md new file mode 100644 index 0000000000..57cb37d6cf --- /dev/null +++ b/docs/getting_started/first_program.md @@ -0,0 +1,32 @@ +# Your first application + +We have an example application called [Blinky](https://github.com/ARMmbed/mbed-blinky-morpheus) that you can use to familiarize yourself with mbed OS and the build tools. + +You can try any of these tools: + +* [mbed Studio](#blinky-on-mbed-studio) +* [mbed Online Compiler](#blinky-on-mbed-online-compiler) +* [mbed CLI](#blinky-on-mbed-cli) +* [Third party integration](#blinky-on-third-party-tools) + +## Blinky on mbed Studio + +Before you begin: + +1. If you don't already have one, please get an [mbed account](). + +[TODO: Do I need any other account to work with C9?] + +## Blinky on mbed Online Compiler + +Before you begin: + +1. If you don't already have one, please get an [mbed account](). + +## Blinky on mbed CLI + +Before you begin: + +1. If you don't already have one, please get an [mbed account](). + +## Blinky on third party tools diff --git a/docs/getting_started/what_need.md b/docs/getting_started/what_need.md new file mode 100644 index 0000000000..fef8da3ad2 --- /dev/null +++ b/docs/getting_started/what_need.md @@ -0,0 +1,8 @@ +# What you need + +## User account + +## Hardware + +## Window serial driver + diff --git a/docs/index.md b/docs/index.md index 531e666bc8..d4a26976b9 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1 +1,26 @@ -# mbed handbook \ No newline at end of file +# Introduction to mbed OS 5.0 + +mbed OS lets you write applications that run on embedded devices. + +Your application code - written in C++ - uses the *application programing interfaces* (APIs) presented by mbed OS to receive information from the hardware and send instructions to it. This means you don't need to understand how the hardware works to be able to control it. + +## Where to start + +The easiest way to work with mbed OS is using one of our tools. We've set up an example that you can try with each tool. + +Our online IDEs let you write and build applications for multiple devices. You can choose between our in-house [mbed Online Compiler]() and [mbed Studio](), which is based on the Cloud9 IDE. + +You can also use [mbed CLI](), our command line tool. This requires having a toolchain installed on your machine. + +## How to continue + +When you've tried our example and picked your work environment, it's time to learn how mbed OS enables the features your application needs. + +We've organized our APIs by feature, and have an introduction, a "hello world" sample and an API reference for each: + +* [Hardware inputs and outputs](): +* [Digital interfaces and USB](): +* [Networking and communication](): +* [Device and networking security](): +* [Task management](): +* [Memory and file system](): diff --git a/docs/porting/background.md b/docs/porting/background.md new file mode 100644 index 0000000000..735f0aa67b --- /dev/null +++ b/docs/porting/background.md @@ -0,0 +1 @@ +# Porting to mbed OS 4.0 \ No newline at end of file diff --git a/docs/porting/other_ports.md b/docs/porting/other_ports.md new file mode 100644 index 0000000000..cea8fc388a --- /dev/null +++ b/docs/porting/other_ports.md @@ -0,0 +1,3 @@ +# Porting to mbed OS 4.0 + +should this link to thread safety, or should thread safety be part of this guide? diff --git a/docs/porting/porting_process.md b/docs/porting/porting_process.md new file mode 100644 index 0000000000..735f0aa67b --- /dev/null +++ b/docs/porting/porting_process.md @@ -0,0 +1 @@ +# Porting to mbed OS 4.0 \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 0451144bed..6560bb7ced 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,9 +1,73 @@ -site_name: mbed Handbook +site_name: mbed OS 5.0 docs_dir: docs pages: -- ['index.md','Introduction to the mbed handbook'] -- ['Introduction/Code_Base.md','Introduction','mbed OS code base'] -- ['Build_Tools/Intro.md', 'Build Tools' ,'Introduction to the build tools'] -- ['Build_Tools/mbed_CLI/mbed_CLI.md', 'Build Tools' ,'mbed CLI'] +- ['index.md','Introduction to mbed OS 5.0'] +- ['getting_started/what_need.md', 'Getting started', 'What you need'] +- ['getting_started/first_program.md', 'Getting started', 'First application'] +- ['APIs/intro.md', 'Getting started', 'Writing applications with the mbed OS APIs'] +- ['APIs/io/inputs_outputs.md', 'Input and output APIs', 'Handling inputs and outputs'] +- ['APIs/io/AnalogIn.md', 'Input and output APIs', 'AnalogIn'] +- ['APIs/io/AnalogOut.md', 'Input and output APIs', 'AnalogOut'] +- ['APIs/io/DigitalIn.md', 'Input and output APIs', 'DigitalIn'] +- ['APIs/io/DigitalOut.md', 'Input and output APIs', 'DigitalOut'] +- ['APIs/io/DigitalInOut.md', 'Input and output APIs', 'DigitalInOut'] +- ['APIs/io/BusIn.md', 'Input and output APIs', 'BusIn'] +- ['APIs/io/BusOut.md', 'Input and output APIs', 'BusOut'] +- ['APIs/io/BusInOut.md', 'Input and output APIs', 'BusInOut'] +- ['APIs/io/PortIn.md', 'Input and output APIs', 'PortIn'] +- ['APIs/io/PortOut.md', 'Input and output APIs', 'PortOut'] +- ['APIs/io/PortInOut.md', 'Input and output APIs', 'PortInOut'] +- ['APIs/io/PwmOut.md', 'Input and output APIs', 'PwmOut'] +- ['APIs/io/InterruptIn.md', 'Input and output APIs', 'InterruptIn'] +- ['APIs/interfaces/interfaces.md', 'Interface APIs', 'Interface options'] +- ['APIs/interfaces/digital/Serial.md', 'Interface APIs', 'Serial'] +- ['APIs/interfaces/digital/SPI.md', 'Interface APIs', 'SPI'] +- ['APIs/interfaces/digital/SPISlave.md', 'Interface APIs', 'SPISlave'] +- ['APIs/interfaces/digital/I2C.md', 'Interface APIs', 'I2C'] +- ['APIs/interfaces/digital/I2CSlave.md', 'Interface APIs', 'I2CSlave'] +- ['APIs/interfaces/digital/CAN.md', 'Interface APIs', 'CAN'] +- ['APIs/interfaces/USBDevice/USBMouse.md', 'Interface APIs', 'USBMouse'] +- ['APIs/interfaces/USBDevice/USBKeyboard.md', 'Interface APIs', 'USBKeyboard'] +- ['APIs/interfaces/USBDevice/USBMouseKeyboard.md', 'Interface APIs', 'USBMouseKeyboard'] +- ['APIs/interfaces/USBDevice/USBHID.md', 'Interface APIs', 'USBHID'] +- ['APIs/interfaces/USBDevice/USBMIDI.md', 'Interface APIs', 'USBMIDI'] +- ['APIs/interfaces/USBDevice/USBSerial.md', 'Interface APIs', 'USBSerial'] +- ['APIs/interfaces/USBDevice/USBAudio.md', 'Interface APIs', 'USBAudio'] +- ['APIs/interfaces/USBDevice/USBMSD.md', 'Interface APIs', 'USBMSD'] +- ['APIs/interfaces/USBHost/USBHostMouse.md', 'Interface APIs', 'USBHostMouse'] +- ['APIs/interfaces/USBHost/USBHostKeyboard.md', 'Interface APIs', 'USBHostKeyboard'] +- ['APIs/interfaces/USBHost/USBHostMSD.md', 'Interface APIs', 'USBHostMSD'] +- ['APIs/interfaces/USBHost/USBHostSerial.md', 'Interface APIs', 'USBHostSerial'] +- ['APIs/interfaces/USBHost/USBHostHub.md', 'Interface APIs', 'USBHostHub'] +- ['APIs/communication/communication.md', 'Communication APIs', 'Communication options'] +- ['APIs/communication/network_stack.md', 'Communication APIs', 'Network stack'] +- ['APIs/communication/ble.md', 'Communication APIs', 'BLE'] +- ['APIs/communication/ethernet.md', 'Communication APIs', 'Ethernet'] +- ['APIs/communication/wifi.md', 'Communication APIs', 'WiFi'] +- ['APIs/communication/radio.md', 'Communication APIs', 'Radio'] +- ['APIs/security/security.md', 'Security APIs', 'Securing devices and connections'] +- ['APIs/security/uvisor.md', 'Security APIs', 'mbed uVisor'] +- ['APIs/security/tls.md', 'Security APIs', 'mbed TLS'] +- ['APIs/tasks/tasks.md', 'Task management APIs', 'Managing tasks'] +- ['APIs/tasks/timers.md', 'Task management APIs', 'Timers'] +- ['APIs/tasks/rtos.md', 'Task management APIs', 'RTOS'] +- ['APIs/memory_files/memory_files.md', 'Memory and file system APIs', 'Managing the memory and file system'] +- ['APIs/memory_files/memory.md', 'Memory and file system APIs', 'Memory'] +- ['APIs/memory_files/file_system.md', 'Memory and file system APIs', 'File system'] +- ['build_tools/options.md', 'Build tools', 'Build tool options'] +- ['build_tools/studio.md', 'Build tools', 'mbed Studio'] +- ['build_tools/ide.md', 'Build tools', 'mbed IDE'] +- ['build_tools/cli.md', 'Build tools', 'mbed CLI'] +- ['build_tools/offline.md', 'Build tools', 'Offline build tools'] +- ['advanced/writing_apps.md', 'Advanced tutorials', 'Writing applications'] +- ['advanced/versions.md', 'Advanced tutorials', 'Version control'] +- ['advanced/debugging.md', 'Advanced tutorials', 'Debugging'] +- ['advanced/DAP.md', 'Advanced tutorials', 'CMSIS-DAP and DAPLink'] +- ['advanced/targets.md', 'Advanced tutorials', 'Targets'] +- ['advanced/config_system.md', 'Advanced tutorials', 'Configuration system'] +- ['advanced/writing_libs.md', 'Advanced tutorials', 'Writing libraries'] +- ['porting/background.md', 'Porting to mbed OS 5.0', 'Porting overview'] +- ['porting/porting_process.md', 'Porting to mbed OS 5.0', 'Porting process'] +- ['porting/other_ports.md', 'Porting to mbed OS 5.0', 'Porting to other components']