Demo of the usage USBDevice library with Blue Pill STM32F103C8T6 board.

Dependencies:   USBDevice

STM32F103C8T6 USBSerial Demo

This project contains demo of the USB serial usage for a cheap developer board Blue Pill with STM32F103C8T6 mcu.

/media/uploads/vznncv/stm32f103c8_usbserial.jpg

The USB serial port provides a good communication channel between PC and microcontroller. Especially it can be useful for a debug purposes.

Notes

  • by the specifications this board has only 64KB of the flash, but actually it can have 128KB, that will be useful for a debug builds as it requires about 100KB of the flash for this demo.
  • the board can have some problems with an USB because it has wrong value of the pull-up resistor
  • for steady reading of data from a serial port, the project contains python script serial_reader.py (it requires PySerial and six python libraries), that is steady to the board reloading
  • the project depends on the fork of the USBDevice library. This fork contains some fixes and support of the BLUE_PILL_STM32F103C8 target.
  • the mbed-os now contains correct code for a clock initialization of the BLUE_PILL_STM32F103C8 target, so you don't need to adjust the board clocks separately

Files at this revision

API Documentation at this revision

Comitter:
Konstantin Kochin
Date:
Fri Aug 04 18:41:22 2017 +0300
Commit message:
Initial release

The project contains autogenerated makefile for a debug build,
the program itself (main.cpp) and the helper python script
'serial_reader.py' to read a data from a serial port.

Changed in this revision

.hgignore Show annotated file Show diff for this revision Revisions of this file
.mbed Show annotated file Show diff for this revision Revisions of this file
Makefile Show annotated file Show diff for this revision Revisions of this file
libs/USBDevice.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
mbed_config.h Show annotated file Show diff for this revision Revisions of this file
mbed_settings.py Show annotated file Show diff for this revision Revisions of this file
patches/STM32F103C8T6_128KB.ld Show annotated file Show diff for this revision Revisions of this file
serial_reader.py Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 24604e97c40c .hgignore
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hgignore	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,20 @@
+syntax: glob
+
+## python files
+__pycache__/
+*.py[cod]
+*$py.class
+
+## mbed-os directory
+mbed-os
+
+## build directory
+BUILD
+
+## IDE files
+# qtcreator 
+*.config
+*.creator
+*.creator.user
+*.files
+*.includes
diff -r 000000000000 -r 24604e97c40c .mbed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.mbed	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,3 @@
+ROOT=.
+TOOLCHAIN=GCC_ARM
+TARGET=BLUEPILL_F103C8
diff -r 000000000000 -r 24604e97c40c Makefile
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,584 @@
+# This file was automagically generated by mbed.org. For more information, 
+# see http://mbed.org/handbook/Exporting-to-GCC-ARM-Embedded
+
+###############################################################################
+# Boiler-plate
+
+# cross-platform directory manipulation
+ifeq ($(shell echo $$OS),$$OS)
+    MAKEDIR = if not exist "$(1)" mkdir "$(1)"
+    RM = rmdir /S /Q "$(1)"
+else
+    MAKEDIR = '$(SHELL)' -c "mkdir -p \"$(1)\""
+    RM = '$(SHELL)' -c "rm -rf \"$(1)\""
+endif
+
+OBJDIR := BUILD
+# Move to the build directory
+ifeq (,$(filter $(OBJDIR),$(notdir $(CURDIR))))
+.SUFFIXES:
+mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
+MAKETARGET = '$(MAKE)' --no-print-directory -C $(OBJDIR) -f '$(mkfile_path)' \
+		'SRCDIR=$(CURDIR)' $(MAKECMDGOALS)
+.PHONY: $(OBJDIR) clean
+all:
+	+@$(call MAKEDIR,$(OBJDIR))
+	+@$(MAKETARGET)
+$(OBJDIR): all
+Makefile : ;
+% :: $(OBJDIR) ; :
+clean :
+	$(call RM,$(OBJDIR))
+
+else
+
+# trick rules into thinking we are in the root, when we are in the bulid dir
+VPATH = ..
+
+# Boiler-plate
+###############################################################################
+# Project settings
+
+PROJECT := Example1_USBSerial
+
+
+# Project settings
+###############################################################################
+# Objects and Paths
+
+OBJECTS += ./libs/USBDevice/USBAudio/USBAudio.o
+OBJECTS += ./libs/USBDevice/USBDevice/USBDevice.o
+OBJECTS += ./libs/USBDevice/USBHID/USBHID.o
+OBJECTS += ./libs/USBDevice/USBHID/USBKeyboard.o
+OBJECTS += ./libs/USBDevice/USBHID/USBMouse.o
+OBJECTS += ./libs/USBDevice/USBHID/USBMouseKeyboard.o
+OBJECTS += ./libs/USBDevice/USBMIDI/USBMIDI.o
+OBJECTS += ./libs/USBDevice/USBMSD/USBMSD.o
+OBJECTS += ./libs/USBDevice/USBSerial/USBCDC.o
+OBJECTS += ./libs/USBDevice/USBSerial/USBSerial.o
+OBJECTS += ./libs/USBDevice/targets/TARGET_STM/USBHAL_STM32.o
+OBJECTS += ./libs/USBDevice/targets/TARGET_STM/USBHAL_STM32F4.o
+OBJECTS += ./main.o
+OBJECTS += ./mbed-os/drivers/AnalogIn.o
+OBJECTS += ./mbed-os/drivers/BusIn.o
+OBJECTS += ./mbed-os/drivers/BusInOut.o
+OBJECTS += ./mbed-os/drivers/BusOut.o
+OBJECTS += ./mbed-os/drivers/CAN.o
+OBJECTS += ./mbed-os/drivers/Ethernet.o
+OBJECTS += ./mbed-os/drivers/FlashIAP.o
+OBJECTS += ./mbed-os/drivers/I2C.o
+OBJECTS += ./mbed-os/drivers/I2CSlave.o
+OBJECTS += ./mbed-os/drivers/InterruptIn.o
+OBJECTS += ./mbed-os/drivers/InterruptManager.o
+OBJECTS += ./mbed-os/drivers/RawSerial.o
+OBJECTS += ./mbed-os/drivers/SPI.o
+OBJECTS += ./mbed-os/drivers/SPISlave.o
+OBJECTS += ./mbed-os/drivers/Serial.o
+OBJECTS += ./mbed-os/drivers/SerialBase.o
+OBJECTS += ./mbed-os/drivers/Ticker.o
+OBJECTS += ./mbed-os/drivers/Timeout.o
+OBJECTS += ./mbed-os/drivers/Timer.o
+OBJECTS += ./mbed-os/drivers/TimerEvent.o
+OBJECTS += ./mbed-os/drivers/UARTSerial.o
+OBJECTS += ./mbed-os/events/EventQueue.o
+OBJECTS += ./mbed-os/events/equeue/equeue.o
+OBJECTS += ./mbed-os/events/equeue/equeue_mbed.o
+OBJECTS += ./mbed-os/events/equeue/equeue_posix.o
+OBJECTS += ./mbed-os/features/filesystem/Dir.o
+OBJECTS += ./mbed-os/features/filesystem/File.o
+OBJECTS += ./mbed-os/features/filesystem/FileSystem.o
+OBJECTS += ./mbed-os/features/filesystem/bd/ChainingBlockDevice.o
+OBJECTS += ./mbed-os/features/filesystem/bd/HeapBlockDevice.o
+OBJECTS += ./mbed-os/features/filesystem/bd/MBRBlockDevice.o
+OBJECTS += ./mbed-os/features/filesystem/bd/SlicingBlockDevice.o
+OBJECTS += ./mbed-os/features/filesystem/fat/ChaN/ccsbcs.o
+OBJECTS += ./mbed-os/features/filesystem/fat/ChaN/ff.o
+OBJECTS += ./mbed-os/features/filesystem/fat/FATFileSystem.o
+OBJECTS += ./mbed-os/features/frameworks/greentea-client/source/greentea_metrics.o
+OBJECTS += ./mbed-os/features/frameworks/greentea-client/source/greentea_serial.o
+OBJECTS += ./mbed-os/features/frameworks/greentea-client/source/greentea_test_env.o
+OBJECTS += ./mbed-os/features/frameworks/unity/source/unity.o
+OBJECTS += ./mbed-os/features/frameworks/utest/mbed-utest-shim.o
+OBJECTS += ./mbed-os/features/frameworks/utest/source/unity_handler.o
+OBJECTS += ./mbed-os/features/frameworks/utest/source/utest_case.o
+OBJECTS += ./mbed-os/features/frameworks/utest/source/utest_default_handlers.o
+OBJECTS += ./mbed-os/features/frameworks/utest/source/utest_greentea_handlers.o
+OBJECTS += ./mbed-os/features/frameworks/utest/source/utest_harness.o
+OBJECTS += ./mbed-os/features/frameworks/utest/source/utest_shim.o
+OBJECTS += ./mbed-os/features/frameworks/utest/source/utest_stack_trace.o
+OBJECTS += ./mbed-os/features/frameworks/utest/source/utest_types.o
+OBJECTS += ./mbed-os/features/mbedtls/platform/src/mbed_trng.o
+OBJECTS += ./mbed-os/features/mbedtls/src/aes.o
+OBJECTS += ./mbed-os/features/mbedtls/src/aesni.o
+OBJECTS += ./mbed-os/features/mbedtls/src/arc4.o
+OBJECTS += ./mbed-os/features/mbedtls/src/asn1parse.o
+OBJECTS += ./mbed-os/features/mbedtls/src/asn1write.o
+OBJECTS += ./mbed-os/features/mbedtls/src/base64.o
+OBJECTS += ./mbed-os/features/mbedtls/src/bignum.o
+OBJECTS += ./mbed-os/features/mbedtls/src/blowfish.o
+OBJECTS += ./mbed-os/features/mbedtls/src/camellia.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ccm.o
+OBJECTS += ./mbed-os/features/mbedtls/src/certs.o
+OBJECTS += ./mbed-os/features/mbedtls/src/cipher.o
+OBJECTS += ./mbed-os/features/mbedtls/src/cipher_wrap.o
+OBJECTS += ./mbed-os/features/mbedtls/src/cmac.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ctr_drbg.o
+OBJECTS += ./mbed-os/features/mbedtls/src/debug.o
+OBJECTS += ./mbed-os/features/mbedtls/src/des.o
+OBJECTS += ./mbed-os/features/mbedtls/src/dhm.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ecdh.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ecdsa.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ecjpake.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ecp.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ecp_curves.o
+OBJECTS += ./mbed-os/features/mbedtls/src/entropy.o
+OBJECTS += ./mbed-os/features/mbedtls/src/entropy_poll.o
+OBJECTS += ./mbed-os/features/mbedtls/src/error.o
+OBJECTS += ./mbed-os/features/mbedtls/src/gcm.o
+OBJECTS += ./mbed-os/features/mbedtls/src/havege.o
+OBJECTS += ./mbed-os/features/mbedtls/src/hmac_drbg.o
+OBJECTS += ./mbed-os/features/mbedtls/src/md.o
+OBJECTS += ./mbed-os/features/mbedtls/src/md2.o
+OBJECTS += ./mbed-os/features/mbedtls/src/md4.o
+OBJECTS += ./mbed-os/features/mbedtls/src/md5.o
+OBJECTS += ./mbed-os/features/mbedtls/src/md_wrap.o
+OBJECTS += ./mbed-os/features/mbedtls/src/memory_buffer_alloc.o
+OBJECTS += ./mbed-os/features/mbedtls/src/net_sockets.o
+OBJECTS += ./mbed-os/features/mbedtls/src/oid.o
+OBJECTS += ./mbed-os/features/mbedtls/src/padlock.o
+OBJECTS += ./mbed-os/features/mbedtls/src/pem.o
+OBJECTS += ./mbed-os/features/mbedtls/src/pk.o
+OBJECTS += ./mbed-os/features/mbedtls/src/pk_wrap.o
+OBJECTS += ./mbed-os/features/mbedtls/src/pkcs11.o
+OBJECTS += ./mbed-os/features/mbedtls/src/pkcs12.o
+OBJECTS += ./mbed-os/features/mbedtls/src/pkcs5.o
+OBJECTS += ./mbed-os/features/mbedtls/src/pkparse.o
+OBJECTS += ./mbed-os/features/mbedtls/src/pkwrite.o
+OBJECTS += ./mbed-os/features/mbedtls/src/platform.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ripemd160.o
+OBJECTS += ./mbed-os/features/mbedtls/src/rsa.o
+OBJECTS += ./mbed-os/features/mbedtls/src/sha1.o
+OBJECTS += ./mbed-os/features/mbedtls/src/sha256.o
+OBJECTS += ./mbed-os/features/mbedtls/src/sha512.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ssl_cache.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ssl_ciphersuites.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ssl_cli.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ssl_cookie.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ssl_srv.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ssl_ticket.o
+OBJECTS += ./mbed-os/features/mbedtls/src/ssl_tls.o
+OBJECTS += ./mbed-os/features/mbedtls/src/threading.o
+OBJECTS += ./mbed-os/features/mbedtls/src/timing.o
+OBJECTS += ./mbed-os/features/mbedtls/src/version.o
+OBJECTS += ./mbed-os/features/mbedtls/src/version_features.o
+OBJECTS += ./mbed-os/features/mbedtls/src/x509.o
+OBJECTS += ./mbed-os/features/mbedtls/src/x509_create.o
+OBJECTS += ./mbed-os/features/mbedtls/src/x509_crl.o
+OBJECTS += ./mbed-os/features/mbedtls/src/x509_crt.o
+OBJECTS += ./mbed-os/features/mbedtls/src/x509_csr.o
+OBJECTS += ./mbed-os/features/mbedtls/src/x509write_crt.o
+OBJECTS += ./mbed-os/features/mbedtls/src/x509write_csr.o
+OBJECTS += ./mbed-os/features/mbedtls/src/xtea.o
+OBJECTS += ./mbed-os/features/mbedtls/targets/TARGET_STM/aes_alt.o
+OBJECTS += ./mbed-os/features/mbedtls/targets/TARGET_STM/sha1_alt.o
+OBJECTS += ./mbed-os/features/mbedtls/targets/TARGET_STM/sha256_alt.o
+OBJECTS += ./mbed-os/features/netsocket/NetworkInterface.o
+OBJECTS += ./mbed-os/features/netsocket/NetworkStack.o
+OBJECTS += ./mbed-os/features/netsocket/Socket.o
+OBJECTS += ./mbed-os/features/netsocket/SocketAddress.o
+OBJECTS += ./mbed-os/features/netsocket/TCPServer.o
+OBJECTS += ./mbed-os/features/netsocket/TCPSocket.o
+OBJECTS += ./mbed-os/features/netsocket/UDPSocket.o
+OBJECTS += ./mbed-os/features/netsocket/WiFiAccessPoint.o
+OBJECTS += ./mbed-os/features/netsocket/cellular/generic_modem_driver/OnboardCellularInterface.o
+OBJECTS += ./mbed-os/features/netsocket/cellular/generic_modem_driver/PPPCellularInterface.o
+OBJECTS += ./mbed-os/features/netsocket/cellular/generic_modem_driver/UARTCellularInterface.o
+OBJECTS += ./mbed-os/features/netsocket/nsapi_dns.o
+OBJECTS += ./mbed-os/hal/mbed_flash_api.o
+OBJECTS += ./mbed-os/hal/mbed_gpio.o
+OBJECTS += ./mbed-os/hal/mbed_lp_ticker_api.o
+OBJECTS += ./mbed-os/hal/mbed_pinmap_common.o
+OBJECTS += ./mbed-os/hal/mbed_ticker_api.o
+OBJECTS += ./mbed-os/hal/mbed_us_ticker_api.o
+OBJECTS += ./mbed-os/platform/ATCmdParser.o
+OBJECTS += ./mbed-os/platform/CallChain.o
+OBJECTS += ./mbed-os/platform/FileBase.o
+OBJECTS += ./mbed-os/platform/FileHandle.o
+OBJECTS += ./mbed-os/platform/FilePath.o
+OBJECTS += ./mbed-os/platform/FileSystemHandle.o
+OBJECTS += ./mbed-os/platform/LocalFileSystem.o
+OBJECTS += ./mbed-os/platform/Stream.o
+OBJECTS += ./mbed-os/platform/mbed_alloc_wrappers.o
+OBJECTS += ./mbed-os/platform/mbed_application.o
+OBJECTS += ./mbed-os/platform/mbed_assert.o
+OBJECTS += ./mbed-os/platform/mbed_board.o
+OBJECTS += ./mbed-os/platform/mbed_critical.o
+OBJECTS += ./mbed-os/platform/mbed_error.o
+OBJECTS += ./mbed-os/platform/mbed_interface.o
+OBJECTS += ./mbed-os/platform/mbed_mem_trace.o
+OBJECTS += ./mbed-os/platform/mbed_mktime.o
+OBJECTS += ./mbed-os/platform/mbed_poll.o
+OBJECTS += ./mbed-os/platform/mbed_retarget.o
+OBJECTS += ./mbed-os/platform/mbed_rtc_time.o
+OBJECTS += ./mbed-os/platform/mbed_sdk_boot.o
+OBJECTS += ./mbed-os/platform/mbed_semihost_api.o
+OBJECTS += ./mbed-os/platform/mbed_stats.o
+OBJECTS += ./mbed-os/platform/mbed_wait_api_no_rtos.o
+OBJECTS += ./mbed-os/platform/mbed_wait_api_rtos.o
+OBJECTS += ./mbed-os/rtos/Mutex.o
+OBJECTS += ./mbed-os/rtos/RtosTimer.o
+OBJECTS += ./mbed-os/rtos/Semaphore.o
+OBJECTS += ./mbed-os/rtos/Thread.o
+OBJECTS += ./mbed-os/rtos/mbed_boot.o
+OBJECTS += ./mbed-os/rtos/rtos_idle.o
+OBJECTS += ./mbed-os/rtos/rtx4/cmsis_os1.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/RTX_Config.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/TARGET_M3/TOOLCHAIN_GCC/irq_cm3.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rt_OsEventObserver.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_delay.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_evflags.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_evr.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_kernel.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_lib.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_memory.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_mempool.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_msgqueue.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_mutex.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_semaphore.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_system.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_thread.o
+OBJECTS += ./mbed-os/rtos/rtx5/TARGET_CORTEX_M/rtx_timer.o
+OBJECTS += ./mbed-os/rtos/rtx5/mbed_rtx_handlers.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/PeripheralPins.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/device/TOOLCHAIN_GCC_ARM/startup_stm32f103xb.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/device/system_clock.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/analogin_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_adc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_adc_ex.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_can.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_cec.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_cortex.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_crc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_dac.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_dac_ex.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_dma.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_eth.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_flash.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_flash_ex.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_gpio.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_gpio_ex.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_hcd.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_i2c.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_i2s.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_irda.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_iwdg.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_mmc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_nand.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_nor.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_pccard.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_pcd.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_pcd_ex.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_pwr.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_rcc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_rcc_ex.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_rtc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_rtc_ex.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_sd.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_smartcard.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_spi.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_spi_ex.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_sram.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_tim.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_tim_ex.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_uart.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_usart.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_hal_wwdg.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_adc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_crc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_dac.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_dma.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_exti.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_fsmc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_gpio.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_i2c.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_pwr.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_rcc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_rtc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_sdmmc.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_spi.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_tim.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_usart.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_usb.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/stm32f1xx_ll_utils.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/device/system_stm32f1xx.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/gpio_irq_device.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/pwmout_device.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/serial_device.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/TARGET_STM32F1/spi_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/analogout_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/can_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/gpio_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/gpio_irq_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/hal_tick_16b.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/hal_tick_32b.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/i2c_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/lp_ticker.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/mbed_overrides.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/pinmap.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/port_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/pwmout_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/rtc_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/serial_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/sleep.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/stm_spi_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/trng_api.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/us_ticker_16b.o
+OBJECTS += ./mbed-os/targets/TARGET_STM/us_ticker_32b.o
+
+
+INCLUDE_PATHS += -I../
+INCLUDE_PATHS += -I../.
+INCLUDE_PATHS += -I.././libs
+INCLUDE_PATHS += -I.././libs/USBDevice
+INCLUDE_PATHS += -I.././libs/USBDevice/USBAudio
+INCLUDE_PATHS += -I.././libs/USBDevice/USBDevice
+INCLUDE_PATHS += -I.././libs/USBDevice/USBHID
+INCLUDE_PATHS += -I.././libs/USBDevice/USBMIDI
+INCLUDE_PATHS += -I.././libs/USBDevice/USBMSD
+INCLUDE_PATHS += -I.././libs/USBDevice/USBSerial
+INCLUDE_PATHS += -I.././libs/USBDevice/targets
+INCLUDE_PATHS += -I.././libs/USBDevice/targets/TARGET_STM
+INCLUDE_PATHS += -I.././libs/USBDevice/targets/TARGET_STM/TARGET_STM32F1
+INCLUDE_PATHS += -I.././libs/USBDevice/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8
+INCLUDE_PATHS += -I.././mbed-os
+INCLUDE_PATHS += -I.././mbed-os/cmsis
+INCLUDE_PATHS += -I.././mbed-os/cmsis/TARGET_CORTEX_M
+INCLUDE_PATHS += -I.././mbed-os/cmsis/TARGET_CORTEX_M/TOOLCHAIN_GCC
+INCLUDE_PATHS += -I.././mbed-os/drivers
+INCLUDE_PATHS += -I.././mbed-os/events
+INCLUDE_PATHS += -I.././mbed-os/events/equeue
+INCLUDE_PATHS += -I.././mbed-os/features
+INCLUDE_PATHS += -I.././mbed-os/features/filesystem
+INCLUDE_PATHS += -I.././mbed-os/features/filesystem/bd
+INCLUDE_PATHS += -I.././mbed-os/features/filesystem/fat
+INCLUDE_PATHS += -I.././mbed-os/features/filesystem/fat/ChaN
+INCLUDE_PATHS += -I.././mbed-os/features/frameworks
+INCLUDE_PATHS += -I.././mbed-os/features/frameworks/greentea-client
+INCLUDE_PATHS += -I.././mbed-os/features/frameworks/greentea-client/greentea-client
+INCLUDE_PATHS += -I.././mbed-os/features/frameworks/greentea-client/source
+INCLUDE_PATHS += -I.././mbed-os/features/frameworks/unity
+INCLUDE_PATHS += -I.././mbed-os/features/frameworks/unity/source
+INCLUDE_PATHS += -I.././mbed-os/features/frameworks/unity/unity
+INCLUDE_PATHS += -I.././mbed-os/features/frameworks/utest
+INCLUDE_PATHS += -I.././mbed-os/features/frameworks/utest/source
+INCLUDE_PATHS += -I.././mbed-os/features/frameworks/utest/utest
+INCLUDE_PATHS += -I.././mbed-os/features/mbedtls
+INCLUDE_PATHS += -I.././mbed-os/features/mbedtls/importer
+INCLUDE_PATHS += -I.././mbed-os/features/mbedtls/inc
+INCLUDE_PATHS += -I.././mbed-os/features/mbedtls/inc/mbedtls
+INCLUDE_PATHS += -I.././mbed-os/features/mbedtls/platform
+INCLUDE_PATHS += -I.././mbed-os/features/mbedtls/platform/inc
+INCLUDE_PATHS += -I.././mbed-os/features/mbedtls/platform/src
+INCLUDE_PATHS += -I.././mbed-os/features/mbedtls/src
+INCLUDE_PATHS += -I.././mbed-os/features/mbedtls/targets
+INCLUDE_PATHS += -I.././mbed-os/features/mbedtls/targets/TARGET_STM
+INCLUDE_PATHS += -I.././mbed-os/features/nanostack
+INCLUDE_PATHS += -I.././mbed-os/features/netsocket
+INCLUDE_PATHS += -I.././mbed-os/features/netsocket/cellular
+INCLUDE_PATHS += -I.././mbed-os/features/netsocket/cellular/generic_modem_driver
+INCLUDE_PATHS += -I.././mbed-os/features/netsocket/cellular/utils
+INCLUDE_PATHS += -I.././mbed-os/features/storage
+INCLUDE_PATHS += -I.././mbed-os/hal
+INCLUDE_PATHS += -I.././mbed-os/hal/storage_abstraction
+INCLUDE_PATHS += -I.././mbed-os/platform
+INCLUDE_PATHS += -I.././mbed-os/rtos
+INCLUDE_PATHS += -I.././mbed-os/rtos/rtx4
+INCLUDE_PATHS += -I.././mbed-os/rtos/rtx5
+INCLUDE_PATHS += -I.././mbed-os/rtos/rtx5/TARGET_CORTEX_M
+INCLUDE_PATHS += -I.././mbed-os/rtos/rtx5/TARGET_CORTEX_M/TARGET_M3
+INCLUDE_PATHS += -I.././mbed-os/rtos/rtx5/TARGET_CORTEX_M/TARGET_M3/TOOLCHAIN_GCC
+INCLUDE_PATHS += -I.././mbed-os/targets
+INCLUDE_PATHS += -I.././mbed-os/targets/TARGET_STM
+INCLUDE_PATHS += -I.././mbed-os/targets/TARGET_STM/TARGET_STM32F1
+INCLUDE_PATHS += -I.././mbed-os/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8
+INCLUDE_PATHS += -I.././mbed-os/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/device
+INCLUDE_PATHS += -I.././mbed-os/targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/device/TOOLCHAIN_GCC_ARM
+INCLUDE_PATHS += -I.././mbed-os/targets/TARGET_STM/TARGET_STM32F1/device
+INCLUDE_PATHS += -I.././patches
+
+LIBRARY_PATHS :=
+LIBRARIES :=
+LINKER_SCRIPT ?= patches/STM32F103C8T6_128KB.ld
+
+# Objects and Paths
+###############################################################################
+# Tools and Flags
+
+AS      = 'arm-none-eabi-gcc' '-x' 'assembler-with-cpp' '-c' '-Wall' '-Wextra' '-Wno-unused-parameter' '-Wno-missing-field-initializers' '-fmessage-length=0' '-fno-exceptions' '-fno-builtin' '-ffunction-sections' '-fdata-sections' '-funsigned-char' '-MMD' '-fno-delete-null-pointer-checks' '-fomit-frame-pointer' '-O0' '-g3' '-DMBED_DEBUG' '-DMBED_TRAP_ERRORS_ENABLED=1' '-mcpu=cortex-m3' '-mthumb'
+CC      = 'arm-none-eabi-gcc' '-std=gnu99' '-c' '-Wall' '-Wextra' '-Wno-unused-parameter' '-Wno-missing-field-initializers' '-fmessage-length=0' '-fno-exceptions' '-fno-builtin' '-ffunction-sections' '-fdata-sections' '-funsigned-char' '-MMD' '-fno-delete-null-pointer-checks' '-fomit-frame-pointer' '-O0' '-g3' '-DMBED_DEBUG' '-DMBED_TRAP_ERRORS_ENABLED=1' '-mcpu=cortex-m3' '-mthumb'
+CPP     = 'arm-none-eabi-g++' '-std=gnu++98' '-fno-rtti' '-Wvla' '-c' '-Wall' '-Wextra' '-Wno-unused-parameter' '-Wno-missing-field-initializers' '-fmessage-length=0' '-fno-exceptions' '-fno-builtin' '-ffunction-sections' '-fdata-sections' '-funsigned-char' '-MMD' '-fno-delete-null-pointer-checks' '-fomit-frame-pointer' '-O0' '-g3' '-DMBED_DEBUG' '-DMBED_TRAP_ERRORS_ENABLED=1' '-mcpu=cortex-m3' '-mthumb'
+LD      = 'arm-none-eabi-gcc'
+ELF2BIN = 'arm-none-eabi-objcopy'
+PREPROC = 'arm-none-eabi-cpp' '-E' '-P' '-Wl,--gc-sections' '-Wl,--wrap,main' '-Wl,--wrap,_malloc_r' '-Wl,--wrap,_free_r' '-Wl,--wrap,_realloc_r' '-Wl,--wrap,_memalign_r' '-Wl,--wrap,_calloc_r' '-Wl,--wrap,exit' '-Wl,--wrap,atexit' '-Wl,-n' '-mcpu=cortex-m3' '-mthumb'
+
+
+C_FLAGS += -std=gnu99
+C_FLAGS += -DMBED_BUILD_TIMESTAMP=1501851115.89
+C_FLAGS += -D__MBED__=1
+C_FLAGS += -DDEVICE_I2CSLAVE=1
+C_FLAGS += -DTARGET_LIKE_MBED
+C_FLAGS += -DDEVICE_PORTOUT=1
+C_FLAGS += -DDEVICE_PORTINOUT=1
+C_FLAGS += -D__MBED_CMSIS_RTOS_CM
+C_FLAGS += -DTARGET_STM32F1
+C_FLAGS += -DTOOLCHAIN_object
+C_FLAGS += -D__CMSIS_RTOS
+C_FLAGS += -DTOOLCHAIN_GCC
+C_FLAGS += -DDEVICE_I2C_ASYNCH=1
+C_FLAGS += -DTARGET_BLUEPILL_F103C8
+C_FLAGS += -DTARGET_CORTEX_M
+C_FLAGS += -DTARGET_DEBUG
+C_FLAGS += -DARM_MATH_CM3
+C_FLAGS += -DTARGET_STM32F103C8
+C_FLAGS += -DTARGET_UVISOR_UNSUPPORTED
+C_FLAGS += -DTARGET_M3
+C_FLAGS += -DDEVICE_SERIAL=1
+C_FLAGS += -DDEVICE_SPI_ASYNCH=1
+C_FLAGS += -DDEVICE_INTERRUPTIN=1
+C_FLAGS += -DDEVICE_I2C=1
+C_FLAGS += -DTRANSACTION_QUEUE_SIZE_SPI=2
+C_FLAGS += -D__CORTEX_M3
+C_FLAGS += -DTARGET_FAMILY_STM32
+C_FLAGS += -DTARGET_STM
+C_FLAGS += -DDEVICE_PORTIN=1
+C_FLAGS += -DDEVICE_SLEEP=1
+C_FLAGS += -DTOOLCHAIN_GCC_ARM
+C_FLAGS += -DINITIAL_SP=0x20005000UL
+C_FLAGS += -DDEVICE_SPI=1
+C_FLAGS += -DDEVICE_SPISLAVE=1
+C_FLAGS += -DDEVICE_ANALOGIN=1
+C_FLAGS += -DDEVICE_PWMOUT=1
+C_FLAGS += -DTARGET_LIKE_CORTEX_M3
+C_FLAGS += -include
+C_FLAGS += mbed_config.h
+
+CXX_FLAGS += -std=gnu++98
+CXX_FLAGS += -fno-rtti
+CXX_FLAGS += -Wvla
+CXX_FLAGS += -DMBED_BUILD_TIMESTAMP=1501851115.89
+CXX_FLAGS += -D__MBED__=1
+CXX_FLAGS += -DDEVICE_I2CSLAVE=1
+CXX_FLAGS += -DTARGET_LIKE_MBED
+CXX_FLAGS += -DDEVICE_PORTOUT=1
+CXX_FLAGS += -DDEVICE_PORTINOUT=1
+CXX_FLAGS += -D__MBED_CMSIS_RTOS_CM
+CXX_FLAGS += -DTARGET_STM32F1
+CXX_FLAGS += -DTOOLCHAIN_object
+CXX_FLAGS += -D__CMSIS_RTOS
+CXX_FLAGS += -DTOOLCHAIN_GCC
+CXX_FLAGS += -DDEVICE_I2C_ASYNCH=1
+CXX_FLAGS += -DTARGET_BLUEPILL_F103C8
+CXX_FLAGS += -DTARGET_CORTEX_M
+CXX_FLAGS += -DTARGET_DEBUG
+CXX_FLAGS += -DARM_MATH_CM3
+CXX_FLAGS += -DTARGET_STM32F103C8
+CXX_FLAGS += -DTARGET_UVISOR_UNSUPPORTED
+CXX_FLAGS += -DTARGET_M3
+CXX_FLAGS += -DDEVICE_SERIAL=1
+CXX_FLAGS += -DDEVICE_SPI_ASYNCH=1
+CXX_FLAGS += -DDEVICE_INTERRUPTIN=1
+CXX_FLAGS += -DDEVICE_I2C=1
+CXX_FLAGS += -DTRANSACTION_QUEUE_SIZE_SPI=2
+CXX_FLAGS += -D__CORTEX_M3
+CXX_FLAGS += -DTARGET_FAMILY_STM32
+CXX_FLAGS += -DTARGET_STM
+CXX_FLAGS += -DDEVICE_PORTIN=1
+CXX_FLAGS += -DDEVICE_SLEEP=1
+CXX_FLAGS += -DTOOLCHAIN_GCC_ARM
+CXX_FLAGS += -DINITIAL_SP=0x20005000UL
+CXX_FLAGS += -DDEVICE_SPI=1
+CXX_FLAGS += -DDEVICE_SPISLAVE=1
+CXX_FLAGS += -DDEVICE_ANALOGIN=1
+CXX_FLAGS += -DDEVICE_PWMOUT=1
+CXX_FLAGS += -DTARGET_LIKE_CORTEX_M3
+CXX_FLAGS += -include
+CXX_FLAGS += mbed_config.h
+
+ASM_FLAGS += -x
+ASM_FLAGS += assembler-with-cpp
+ASM_FLAGS += -DTRANSACTION_QUEUE_SIZE_SPI=2
+ASM_FLAGS += -D__CORTEX_M3
+ASM_FLAGS += -DINITIAL_SP=0x20005000UL
+ASM_FLAGS += -DARM_MATH_CM3
+ASM_FLAGS += -D__MBED_CMSIS_RTOS_CM
+ASM_FLAGS += -D__CMSIS_RTOS
+
+
+LD_FLAGS :=-Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -mcpu=cortex-m3 -mthumb 
+LD_SYS_LIBS :=-Wl,--start-group -lstdc++ -lsupc++ -lm -lc -lgcc -lnosys -Wl,--end-group
+
+# Tools and Flags
+###############################################################################
+# Rules
+
+.PHONY: all lst size
+
+
+all: $(PROJECT).bin $(PROJECT).hex size
+
+
+.asm.o:
+	+@$(call MAKEDIR,$(dir $@))
+	+@echo "Assemble: $(notdir $<)"
+	@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $<
+
+.s.o:
+	+@$(call MAKEDIR,$(dir $@))
+	+@echo "Assemble: $(notdir $<)"
+	@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $<
+
+.S.o:
+	+@$(call MAKEDIR,$(dir $@))
+	+@echo "Assemble: $(notdir $<)"
+	@$(AS) -c $(ASM_FLAGS) $(INCLUDE_PATHS) -o $@ $<
+
+.c.o:
+	+@$(call MAKEDIR,$(dir $@))
+	+@echo "Compile: $(notdir $<)"
+	@$(CC) $(C_FLAGS) $(INCLUDE_PATHS) -o $@ $<
+
+.cpp.o:
+	+@$(call MAKEDIR,$(dir $@))
+	+@echo "Compile: $(notdir $<)"
+	@$(CPP) $(CXX_FLAGS) $(INCLUDE_PATHS) -o $@ $<
+
+
+$(PROJECT).link_script.ld: $(LINKER_SCRIPT)
+	@$(PREPROC) $< -o $@
+
+
+
+$(PROJECT).elf: $(OBJECTS) $(SYS_OBJECTS) $(PROJECT).link_script.ld 
+	+@echo "link: $(notdir $@)"
+	@$(LD) $(LD_FLAGS) -T $(filter %.ld, $^) $(LIBRARY_PATHS) --output $@ $(filter %.o, $^) $(LIBRARIES) $(LD_SYS_LIBS)
+
+
+$(PROJECT).bin: $(PROJECT).elf
+	$(ELF2BIN) -O binary $< $@
+	+@echo "===== bin file ready to flash: $(OBJDIR)/$@ =====" 
+
+$(PROJECT).hex: $(PROJECT).elf
+	$(ELF2BIN) -O ihex $< $@
+
+
+# Rules
+###############################################################################
+# Dependencies
+
+DEPS = $(OBJECTS:.o=.d) $(SYS_OBJECTS:.o=.d)
+-include $(DEPS)
+endif
+
+# Dependencies
+###############################################################################
diff -r 000000000000 -r 24604e97c40c libs/USBDevice.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libs/USBDevice.lib	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,1 @@
+https://mbed.org/users/vznncv/code/USBDevice/#da92595e61da
diff -r 000000000000 -r 24604e97c40c main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,27 @@
+/**
+ * The example of the program for STM32F103C8T6 (Blue Pill board).
+ *
+ * This program demonstrate led and usb serial port usage.
+ *
+ * @author Kochin Konstantin
+ */
+#include "USBSerial.h"
+#include "mbed.h"
+#include "stdio.h"
+
+DigitalOut myled(LED1);
+USBSerial usbSerial(0x1f00, 0x2012, 0x0001, false);
+
+int main()
+{
+    uint32_t counter = 0;
+
+    while (true) {
+        usbSerial.printf("I am a USB serial port. Tick %d.\n", counter);
+        counter++;
+
+        myled = !myled;
+
+        wait_ms(1000);
+    }
+}
diff -r 000000000000 -r 24604e97c40c mbed-os.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed-os.lib	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,1 @@
+https://github.com/ARMmbed/mbed-os/#acdd7dd424268ece2c32438ee752100907f16329
diff -r 000000000000 -r 24604e97c40c mbed_app.json
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_app.json	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,9 @@
+{
+    "target_overrides": {
+        "BLUEPILL_F103C8": {
+            "target.macros_add": [
+                "INITIAL_SP=0x20005000UL"
+            ]
+        }
+    }
+}
\ No newline at end of file
diff -r 000000000000 -r 24604e97c40c mbed_config.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_config.h	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,42 @@
+/*
+ * mbed SDK
+ * Copyright (c) 2017 ARM Limited
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// Automatically generated configuration file.
+// DO NOT EDIT, content will be overwritten.
+
+#ifndef __MBED_CONFIG_DATA__
+#define __MBED_CONFIG_DATA__
+
+// Configuration parameters
+#define MBED_CONF_DRIVERS_UART_SERIAL_RXBUF_SIZE       256    // set by library:drivers
+#define MBED_CONF_DRIVERS_UART_SERIAL_TXBUF_SIZE       256    // set by library:drivers
+#define MBED_CONF_NSAPI_PRESENT                        1      // set by library:nsapi
+#define MBED_CONF_FILESYSTEM_PRESENT                   1      // set by library:filesystem
+#define MBED_CONF_PPP_CELL_IFACE_BAUD_RATE             115200 // set by library:ppp-cell-iface
+#define MBED_CONF_PLATFORM_STDIO_CONVERT_NEWLINES      0      // set by library:platform
+#define MBED_CONF_PPP_CELL_IFACE_APN_LOOKUP            0      // set by library:ppp-cell-iface
+#define MBED_CONF_EVENTS_PRESENT                       1      // set by library:events
+#define MBED_CONF_RTOS_PRESENT                         1      // set by library:rtos
+#define MBED_CONF_PPP_CELL_IFACE_AT_PARSER_BUFFER_SIZE 256    // set by library:ppp-cell-iface
+#define MBED_CONF_PLATFORM_STDIO_BAUD_RATE             9600   // set by library:platform
+#define MBED_CONF_PLATFORM_DEFAULT_SERIAL_BAUD_RATE    9600   // set by library:platform
+#define MBED_CONF_PPP_CELL_IFACE_AT_PARSER_TIMEOUT     8000   // set by library:ppp-cell-iface
+#define MBED_CONF_PLATFORM_STDIO_FLUSH_AT_EXIT         1      // set by library:platform
+// Macros
+#define UNITY_INCLUDE_CONFIG_H                                // defined by library:utest
+
+#endif
diff -r 000000000000 -r 24604e97c40c mbed_settings.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed_settings.py	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,45 @@
+"""
+mbed SDK
+Copyright (c) 2016 ARM Limited
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+from os.path import join, abspath, dirname
+
+#ROOT = abspath(join(dirname(__file__), "."))
+
+##############################################################################
+# Build System Settings
+##############################################################################
+#BUILD_DIR = abspath(join(ROOT, "build"))
+
+# ARM
+#ARM_PATH = "C:/Program Files/ARM"
+
+# GCC ARM
+#GCC_ARM_PATH = ""
+
+# GCC CodeRed
+#GCC_CR_PATH = "C:/code_red/RedSuite_4.2.0_349/redsuite/Tools/bin"
+
+# IAR
+#IAR_PATH = "C:/Program Files (x86)/IAR Systems/Embedded Workbench 7.0/arm"
+
+# Goanna static analyser. Please overload it in private_settings.py
+#GOANNA_PATH = "c:/Program Files (x86)/RedLizards/Goanna Central 3.2.3/bin"
+
+#BUILD_OPTIONS = []
+
+# mbed.org username
+#MBED_ORG_USER = ""
diff -r 000000000000 -r 24604e97c40c patches/STM32F103C8T6_128KB.ld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/STM32F103C8T6_128KB.ld	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,155 @@
+/* Linker script for Blue Pill STM32F103C8T6 with 128KB flash memory. */
+/* Linker script to configure memory regions. */
+MEMORY
+{ 
+  FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
+  RAM (rwx) : ORIGIN = 0x200000EC, LENGTH = 20K - 0xEC
+}
+
+/* Linker script to place sections and symbol values. Should be used together
+ * with other linker script that defines memory regions FLASH and RAM.
+ * It references following symbols, which must be defined in code:
+ *   Reset_Handler : Entry of reset handler
+ * 
+ * It defines following symbols, which code can use without definition:
+ *   __exidx_start
+ *   __exidx_end
+ *   __etext
+ *   __data_start__
+ *   __preinit_array_start
+ *   __preinit_array_end
+ *   __init_array_start
+ *   __init_array_end
+ *   __fini_array_start
+ *   __fini_array_end
+ *   __data_end__
+ *   __bss_start__
+ *   __bss_end__
+ *   __end__
+ *   end
+ *   __HeapLimit
+ *   __StackLimit
+ *   __StackTop
+ *   __stack
+ *   _estack
+ */
+ENTRY(Reset_Handler)
+
+SECTIONS
+{
+    .text :
+    {
+        KEEP(*(.isr_vector))
+        *(.text*)
+        KEEP(*(.init))
+        KEEP(*(.fini))
+
+        /* .ctors */
+        *crtbegin.o(.ctors)
+        *crtbegin?.o(.ctors)
+        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
+        *(SORT(.ctors.*))
+        *(.ctors)
+
+        /* .dtors */
+        *crtbegin.o(.dtors)
+        *crtbegin?.o(.dtors)
+        *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
+        *(SORT(.dtors.*))
+        *(.dtors)
+
+        *(.rodata*)
+
+        KEEP(*(.eh_frame*))
+    } > FLASH
+
+    .ARM.extab : 
+    {
+        *(.ARM.extab* .gnu.linkonce.armextab.*)
+    } > FLASH
+
+    __exidx_start = .;
+    .ARM.exidx :
+    {
+        *(.ARM.exidx* .gnu.linkonce.armexidx.*)
+    } > FLASH
+    __exidx_end = .;
+
+    __etext = .;
+    _sidata = .;
+
+    .data : AT (__etext)
+    {
+        __data_start__ = .;
+        _sdata = .;
+        *(vtable)
+        *(.data*)
+
+        . = ALIGN(4);
+        /* preinit data */
+        PROVIDE_HIDDEN (__preinit_array_start = .);
+        KEEP(*(.preinit_array))
+        PROVIDE_HIDDEN (__preinit_array_end = .);
+
+        . = ALIGN(4);
+        /* init data */
+        PROVIDE_HIDDEN (__init_array_start = .);
+        KEEP(*(SORT(.init_array.*)))
+        KEEP(*(.init_array))
+        PROVIDE_HIDDEN (__init_array_end = .);
+
+
+        . = ALIGN(4);
+        /* finit data */
+        PROVIDE_HIDDEN (__fini_array_start = .);
+        KEEP(*(SORT(.fini_array.*)))
+        KEEP(*(.fini_array))
+        PROVIDE_HIDDEN (__fini_array_end = .);
+
+        KEEP(*(.jcr*))
+        . = ALIGN(4);
+        /* All data end */
+        __data_end__ = .;
+        _edata = .;
+
+    } > RAM
+
+    .bss :
+    {
+        . = ALIGN(4);
+        __bss_start__ = .;
+        _sbss = .;
+        *(.bss*)
+        *(COMMON)
+        . = ALIGN(4);
+        __bss_end__ = .;
+        _ebss = .;
+    } > RAM
+    
+    .heap (COPY):
+    {
+        __end__ = .;
+        end = __end__;
+        *(.heap*)
+        __HeapLimit = .;
+    } > RAM
+
+    /* .stack_dummy section doesn't contains any symbols. It is only
+     * used for linker to calculate size of stack sections, and assign
+     * values to stack symbols later */
+    .stack_dummy (COPY):
+    {
+        *(.stack*)
+    } > RAM
+
+    /* Set stack top to end of RAM, and stack limit move down by
+     * size of stack_dummy section */
+    __StackTop = ORIGIN(RAM) + LENGTH(RAM);
+    _estack = __StackTop;
+    __StackLimit = __StackTop - SIZEOF(.stack_dummy);
+    PROVIDE(__stack = __StackTop);
+    
+    /* Check if data + heap + stack exceeds RAM limit */
+    ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
+}
+
diff -r 000000000000 -r 24604e97c40c serial_reader.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/serial_reader.py	Fri Aug 04 18:41:22 2017 +0300
@@ -0,0 +1,107 @@
+#!/usr/bin/env python
+from __future__ import print_function
+
+import argparse
+import sys
+from time import sleep
+
+import serial
+from serial.tools.list_ports import comports
+from six import binary_type
+
+_DEFAULT_BAUD_RATE = 115200
+
+
+def _reset_baud_drate(serial):
+    original_baudrate = serial.baudrate
+    i = serial.BAUDRATES.index(original_baudrate)
+    if i == -1:
+        raise ValueError("Unknown baudrate {}".format(original_baudrate))
+
+    if i > 1:
+        tmp_baud_rate = serial.BAUDRATES[i - 1]
+    elif len(serial.BAUDRATES) > 1:
+        tmp_baud_rate = serial.BAUDRATES[i + 1]
+    else:
+        raise ValueError("Only one baudreate is available")
+
+    serial.baudrate = tmp_baud_rate
+    serial.baudrate = original_baudrate
+
+
+def _read_from_serial_device(port, out=sys.stdout, reconnect_on_error=True, repeat_delay=2, **port_params):
+    print('Read from the serial port "{}" (use Ctrl+C to exit)'.format(port))
+    while True:
+        try:
+            with serial.Serial(port=port, **port_params) as com_port:
+                # hack:
+                # when you connect usb-com port of the stm32f1 first time, it will work
+                # but if you reconnect it, then it stop working, although com port readers doesn't show
+                # any error.
+                # However I found that it can be solved by 2 ways:
+                # - host rebooting (but it's very inconvenient)
+                # - changing baudrate. The new value doesn't matter, it should only be different than previous.
+                #   Moreover the old values without any problems can be reverted without any problems.
+                # TODO: find reason of such strange behavior
+                _reset_baud_drate(com_port)
+                for line in com_port:
+                    if isinstance(line, binary_type):
+                        line = line.decode('utf-8')
+                    out.write(line)
+                    out.flush()
+
+        except serial.SerialException as e:
+            print("Error: {}".format(e))
+            if not reconnect_on_error:
+                break
+            sleep(repeat_delay)
+
+
+def _guess_serial_device_name():
+    ports = list(comports())
+    if len(ports) == 1:
+        port = ports[0].device
+    elif len(ports) == 0:
+        raise ValueError("No serial devices found")
+    else:
+        print("Several serial devices are found. Please specify one of them explicitly:")
+        for port_info in ports:
+            print("- {}".format(port_info.device))
+        raise ValueError("Multiple serial devices are found.")
+
+    return port
+
+
+def main(args=None):
+    parser = argparse.ArgumentParser(prog='serial_reader',
+                                     description='Helper program that read text from a serial port. '
+                                                 'Unlike other com programs it automatically reconnect '
+                                                 'to serial port if any error occurs. It is useful for '
+                                                 'microcntrollers debugging when you want to reboot it and'
+                                                 'the connection will be lost for some time.')
+    parser.add_argument('port', nargs='?', help='Serial port device name. It it is not specifies, then'
+                                                'it will be found automatically if it is possible')
+    parser.add_argument('--baudrate', default=_DEFAULT_BAUD_RATE,
+                        help="baud rate. Default: {}".format(_DEFAULT_BAUD_RATE))
+    parsed_args = parser.parse_args(args)
+
+    if parsed_args.port is None:
+        try:
+            port = _guess_serial_device_name()
+        except Exception as e:
+            print(e)
+            sys.exit(1)
+    else:
+        port = parsed_args.port
+
+    try:
+        _read_from_serial_device(
+            port,
+            baudrate=parsed_args.baudrate
+        )
+    except KeyboardInterrupt:
+        print("Exit ...")
+
+
+if __name__ == '__main__':
+    main()