simulator: fix serial_write

printf("%s") will print a NULL terminated string, while rt_serial_write
should print buffer for size length. This also fix segfault when the
string is not null terminated but specified by size.
Merge pull request #88 from grissiom/fix-sim-serial

simulator: fix serial_write
Merge pull request #88 from grissiom/fix-sim-serial

simulator: fix serial_write
make Host can halt endpoints
Merge pull request #93 from heyuanjie87/ForPullRequest

For pull request
add rm48x50 bsp and libcpu

We currently only support building with CCS and SCons is not using.
bsp/rm48x50/HALCoGen/HALCoGen.{hcg,dil} is the HALCoGen project file.
You may need to regenerate the source file as you like, providing that:

    1, IRQ is in Dispatch Mode and the table entry is IRQ_Handler. The
    channel 5 in enabled and connected to IRQ.

    2, RTI driver is enabled and compare3 source is selected to counter1
    and the compare3 will generate tick in the period of 10ms. This
    value is coresponding with RT_TICK_PER_SECOND in rtconfig.h.

In CCS, you need to create a new CCS project and create link folders
pointing at bsp/rm48x50, libcpu/arm/rm48x50 and src/, include/. Remember
to add the include path to the Build Properties.
cdc_vcom: reset the vcom state in proper cases

Reset the vcom state in class_{run,stop} and when the PC is not
receiving data from me.
Merge pull request #94 from grissiom/vcom

cdc_vcom: reset the vcom state in proper cases
usbdevice/core: add reset function to support hotplug

When the USB got RESET packet from the host and the address is setup,
all the classes will got reset. The reset is done by class stop and than
class run. So the classes should reset their internal state in
class_{run,stop}.

Besides, the USB device driver could post a USB_MSG_RESET message on
every RESET packet.
Merge pull request #95 from grissiom/vcom

usbdevice/core: add reset function to support hotplug
use __rt_ffs instead of ffs
Merge pull request #96 from weety/at91sam9260

use __rt_ffs instead of ffs
rm48x50: utilize CPS instruction and remove some useless code
rm48x50: optimize context_switch_interrupt_do

Substitude STMFD, MOV, ADD with STMFD, SUB. It reduce one instruction.
Tested on board and it works like a charm.
rm48x50: add reg_test from FreeRTOS

The code is GPLv2 so I think we could use it for free(both free beer and
free speech).
rm48x50: fix bug in reg_test from FreeRTOS

It does not satisfy AAPCS.
rm48x50: add vRegTestTask2
rm48x50: temperately disable the VFP register test
rm48x50: optimize context_switch_interrupt_to by reuse registers

When saving thread registers in context_switch_interrupt_to, we don't
change them, just move them. So there is no need to always r0-r3 from
stack to the real r0-r3. So just use the intermediate registers and
eliminate 2 MOV.
rm48x50: optimize a BEQ

Use condition flag in the ORR. This could eliminate a BEQ.