diff --git a/examples/CC3200/ccs/MG_hello/.ccsproject b/examples/CC3200/ccs/MG_hello/.ccsproject
new file mode 100644
index 00000000..e5975ba8
--- /dev/null
+++ b/examples/CC3200/ccs/MG_hello/.ccsproject
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/CC3200/ccs/MG_hello/.cproject b/examples/CC3200/ccs/MG_hello/.cproject
new file mode 100644
index 00000000..cabf0628
--- /dev/null
+++ b/examples/CC3200/ccs/MG_hello/.cproject
@@ -0,0 +1,209 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/CC3200/ccs/MG_hello/.project b/examples/CC3200/ccs/MG_hello/.project
new file mode 100644
index 00000000..b7593f52
--- /dev/null
+++ b/examples/CC3200/ccs/MG_hello/.project
@@ -0,0 +1,61 @@
+
+
+ MG_hello
+
+
+ Mongoose
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ com.ti.ccstudio.core.ccsNature
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.ccnature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
+
+ gpio_if.c
+ 1
+ CC3200_SDK_ROOT/example/common/gpio_if.c
+
+
+ network_common.c
+ 1
+ CC3200_SDK_ROOT/example/common/network_common.c
+
+
+ startup_ccs.c
+ 1
+ CC3200_SDK_ROOT/example/common/startup_ccs.c
+
+
+ wifi.c
+ 1
+ PARENT-2-PROJECT_LOC/wifi.c
+
+
+ wifi.h
+ 1
+ PARENT-2-PROJECT_LOC/wifi.h
+
+
+
+
+ CC3200_SDK_ROOT
+ $%7BTI_PRODUCTS_DIR%7D/CC3200SDK_1.2.0/cc3200-sdk
+
+
+
diff --git a/examples/CC3200/ccs/MG_hello/cc3200v1p32.cmd b/examples/CC3200/ccs/MG_hello/cc3200v1p32.cmd
new file mode 100644
index 00000000..9532c611
--- /dev/null
+++ b/examples/CC3200/ccs/MG_hello/cc3200v1p32.cmd
@@ -0,0 +1,82 @@
+//*****************************************************************************
+// cc3200v1p32.cmd
+//
+// CCS linker configuration file for cc3200 ES 1.32.
+//
+// Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/
+//
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the
+// distribution.
+//
+// Neither the name of Texas Instruments Incorporated nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+//*****************************************************************************
+
+
+--retain=g_pfnVectors
+
+//*****************************************************************************
+// The following command line options are set as part of the CCS project.
+// If you are building using the command line, or for some reason want to
+// define them here, you can uncomment and modify these lines as needed.
+// If you are using CCS for building, it is probably better to make any such
+// modifications in your CCS project and leave this file alone.
+//*****************************************************************************
+
+
+//*****************************************************************************
+// The starting address of the application. Normally the interrupt vectors
+// must be located at the beginning of the application.
+//*****************************************************************************
+#define RAM_BASE 0x20004000
+
+/* System memory map */
+
+MEMORY
+{
+ /* Application uses internal RAM for program and data */
+ SRAM_CODE (RWX) : origin = 0x20004000, length = 0x20000
+ SRAM_DATA (RWX) : origin = 0x20024000, length = 0x1C000
+}
+
+/* Section allocation in memory */
+
+SECTIONS
+{
+ .intvecs: > RAM_BASE
+ .init_array : > SRAM_CODE
+ .vtable : > SRAM_CODE
+ .text : > SRAM_CODE
+ .const : > SRAM_CODE
+ .cinit : > SRAM_CODE
+ .pinit : > SRAM_CODE
+ .data : > SRAM_DATA
+ .bss : > SRAM_DATA
+ .sysmem : > SRAM_DATA
+ .stack : > SRAM_DATA(HIGH)
+}
+
diff --git a/examples/CC3200/ccs/MG_hello/main.c b/examples/CC3200/ccs/MG_hello/main.c
new file mode 100644
index 00000000..62308270
--- /dev/null
+++ b/examples/CC3200/ccs/MG_hello/main.c
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2014-2016 Cesanta Software Limited
+ * All rights reserved
+ */
+
+/* Set up an AP or connect to existing WiFi network. */
+#define WIFI_AP_SSID "Mongoose"
+#define WIFI_AP_PASS ""
+#define WIFI_AP_CHAN 6
+// #define WIFI_STA_SSID "YourWiFi"
+// #define WIFI_STA_PASS "YourPass"
+
+#define MG_TASK_PRIORITY 3
+#define MG_TASK_STACK_SIZE 8192
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+#include
+
+/* Mongoose.h brings in SimpleLink support. Do not include simplelink.h. */
+#include
+
+#include
+
+#include "wifi.h"
+
+static const char *upload_form = "\
+
Upload file
\
+";
+
+static struct mg_str upload_fname(struct mg_connection *nc,
+ struct mg_str fname) {
+ struct mg_str lfn;
+ lfn.len = fname.len + 3;
+ lfn.p = malloc(lfn.len);
+ memcpy((char *) lfn.p, "SL:", 3);
+ memcpy((char *) lfn.p + 3, fname.p, fname.len);
+ return lfn;
+}
+
+void mg_ev_handler(struct mg_connection *nc, int ev, void *ev_data) {
+ LOG(LL_DEBUG, ("%p ev %d", nc, ev));
+
+ switch (ev) {
+ case MG_EV_ACCEPT: {
+ char addr[32];
+ mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr),
+ MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT);
+ LOG(LL_INFO, ("Connection %p from %s", nc, addr));
+ break;
+ }
+ case MG_EV_HTTP_REQUEST: {
+ char addr[32];
+ struct http_message *hm = (struct http_message *) ev_data;
+ cs_stat_t st;
+ mg_sock_addr_to_str(&nc->sa, addr, sizeof(addr),
+ MG_SOCK_STRINGIFY_IP | MG_SOCK_STRINGIFY_PORT);
+ LOG(LL_INFO,
+ ("HTTP request from %s: %.*s %.*s", addr, (int) hm->method.len,
+ hm->method.p, (int) hm->uri.len, hm->uri.p));
+ if (mg_vcmp(&hm->uri, "/upload") == 0 ||
+ (mg_vcmp(&hm->uri, "/") == 0 &&
+ mg_stat("SL:index.html", &st) != 0)) {
+ mg_send(nc, upload_form, strlen(upload_form));
+ nc->flags |= MG_F_SEND_AND_CLOSE;
+ break;
+ }
+ struct mg_serve_http_opts opts;
+ memset(&opts, 0, sizeof(opts));
+ opts.document_root = "SL:";
+ mg_serve_http(nc, hm, opts);
+ break;
+ }
+ case MG_EV_CLOSE: {
+ LOG(LL_INFO, ("Connection %p closed", nc));
+ break;
+ }
+ case MG_EV_HTTP_PART_BEGIN:
+ case MG_EV_HTTP_PART_DATA:
+ case MG_EV_HTTP_PART_END: {
+ struct mg_http_multipart_part *mp =
+ (struct mg_http_multipart_part *) ev_data;
+ if (ev == MG_EV_HTTP_PART_BEGIN) {
+ LOG(LL_INFO, ("Begin file upload: %s", mp->file_name));
+ } else if (ev == MG_EV_HTTP_PART_END) {
+ LOG(LL_INFO, ("End file upload: %s", mp->file_name));
+ }
+ mg_file_upload_handler(nc, ev, ev_data, upload_fname);
+ }
+ }
+}
+
+static void mg_init(struct mg_mgr *mgr) {
+ LOG(LL_INFO, ("MG task running"));
+
+ sl_Start(0, 0, 0);
+
+ sl_fs_init();
+
+#if defined(WIFI_STA_SSID)
+ if (!wifi_setup_sta(WIFI_STA_SSID, WIFI_STA_PASS)) {
+ LOG(LL_ERROR, ("Error setting up WiFi station"));
+ }
+#elif defined(WIFI_AP_SSID)
+ if (!wifi_setup_ap(WIFI_AP_SSID, WIFI_AP_PASS, WIFI_AP_CHAN)) {
+ LOG(LL_ERROR, ("Error setting up WiFi AP"));
+ }
+#else
+#error WiFi not configured
+#endif
+
+ /* We don't need SimpleLink's web server. */
+ sl_NetAppStop(SL_NET_APP_HTTP_SERVER_ID);
+
+ const char *err = "";
+ struct mg_bind_opts opts;
+ memset(&opts, 0, sizeof(opts));
+ opts.error_string = &err;
+
+ struct mg_connection *nc = mg_bind(mgr, "80", mg_ev_handler);
+ if (nc != NULL) {
+ mg_set_protocol_http_websocket(nc);
+ } else {
+ LOG(LL_ERROR, ("Failed to create listener: %s", err));
+ }
+}
+
+#ifndef USE_TIRTOS
+/* Int vector table, defined in startup_gcc.c */
+extern void (*const g_pfnVectors[])(void);
+#endif
+
+int main() {
+#ifndef USE_TIRTOS
+ MAP_IntVTableBaseSet((unsigned long) &g_pfnVectors[0]);
+#endif
+ MAP_IntEnable(FAULT_SYSTICK);
+ MAP_IntMasterEnable();
+ PRCMCC3200MCUInit();
+
+ setvbuf(stdout, NULL, _IOLBF, 0);
+ setvbuf(stderr, NULL, _IOLBF, 0);
+ cs_log_set_level(LL_INFO);
+ cs_log_set_file(stdout);
+
+ LOG(LL_INFO, ("Hello, world!"));
+
+ /* Set up the red LED. Note that amber and green cannot be used as they share
+ * pins with I2C. */
+ MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
+ MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false);
+ MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT);
+ GPIO_IF_LedConfigure(LED1);
+ GPIO_IF_LedOn(MCU_RED_LED_GPIO);
+
+ if (VStartSimpleLinkSpawnTask(8) != 0) {
+ LOG(LL_ERROR, ("Failed to create SL task"));
+ }
+
+ if (!mg_start_task(MG_TASK_PRIORITY, MG_TASK_STACK_SIZE, mg_init)) {
+ LOG(LL_ERROR, ("Failed to create MG task"));
+ }
+
+ osi_start();
+
+ return 0;
+}
+
+/* These are FreeRTOS hooks for various life situations. */
+void vApplicationMallocFailedHook() {
+}
+
+void vApplicationIdleHook() {
+}
+
+void vApplicationStackOverflowHook(OsiTaskHandle *th, signed char *tn) {
+}
+
+void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *e,
+ SlHttpServerResponse_t *resp) {
+}
+
+void SimpleLinkSockEventHandler(SlSockEvent_t *e) {
+}
+
+void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *e) {
+ LOG(LL_ERROR, ("status %d sender %d", e->EventData.deviceEvent.status,
+ e->EventData.deviceEvent.sender));
+}
diff --git a/examples/CC3200/ccs/MG_hello/targetConfigs/CC3200.ccxml b/examples/CC3200/ccs/MG_hello/targetConfigs/CC3200.ccxml
new file mode 100755
index 00000000..0d9d92f1
--- /dev/null
+++ b/examples/CC3200/ccs/MG_hello/targetConfigs/CC3200.ccxml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/examples/CC3200/ccs/MG_hello/targetConfigs/readme.txt b/examples/CC3200/ccs/MG_hello/targetConfigs/readme.txt
new file mode 100755
index 00000000..af97b62d
--- /dev/null
+++ b/examples/CC3200/ccs/MG_hello/targetConfigs/readme.txt
@@ -0,0 +1,9 @@
+The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
+on the device and connection settings specified in your project on the Properties > General page.
+
+Please note that in automatic target-configuration management, changes to the project's device and/or
+connection settings will either modify an existing or generate a new target-configuration file. Thus,
+if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
+you may create your own target-configuration file for this project and manage it manually. You can
+always switch back to automatic target-configuration management by checking the "Manage the project's
+target-configuration automatically" checkbox on the project's Properties > General page.
\ No newline at end of file
diff --git a/examples/CC3200/ccs/MG_sensor_demo/.project b/examples/CC3200/ccs/MG_sensor_demo/.project
index e8c4a2de..a2b77dd2 100644
--- a/examples/CC3200/ccs/MG_sensor_demo/.project
+++ b/examples/CC3200/ccs/MG_sensor_demo/.project
@@ -29,22 +29,22 @@
bm222.c1
- copy_PARENT/bm222.c
+ PARENT-2-PROJECT_LOC/bm222.cbm222.h1
- copy_PARENT/bm222.h
+ PARENT-2-PROJECT_LOC/bm222.hdata.c1
- copy_PARENT/data.c
+ PARENT-2-PROJECT_LOC/data.cdata.h1
- copy_PARENT/data.h
+ PARENT-2-PROJECT_LOC/data.hgpio_if.c
@@ -59,7 +59,7 @@
main.c1
- copy_PARENT/main.c
+ PARENT-2-PROJECT_LOC/main.cnetwork_common.c
@@ -74,22 +74,22 @@
tmp006.c1
- copy_PARENT/tmp006.c
+ PARENT-2-PROJECT_LOC/tmp006.ctmp006.h1
- copy_PARENT/tmp006.h
+ PARENT-2-PROJECT_LOC/tmp006.hwifi.c1
- copy_PARENT/wifi.c
+ PARENT-2-PROJECT_LOC/wifi.cwifi.h1
- copy_PARENT/wifi.h
+ PARENT-2-PROJECT_LOC/wifi.h
@@ -97,9 +97,5 @@
CC3200_SDK_ROOT$%7BTI_PRODUCTS_DIR%7D/CC3200SDK_1.2.0/cc3200-sdk
-
- copy_PARENT
- file:/Z:/cesanta/dev/mongoose/examples/CC3200
-
diff --git a/examples/CC3200/main.c b/examples/CC3200/main.c
index 31f2211b..b44150e6 100644
--- a/examples/CC3200/main.c
+++ b/examples/CC3200/main.c
@@ -8,29 +8,28 @@
#include
#include
-/* Driverlib includes */
-#include "hw_types.h"
+#include
+#include
+#include
-#include "hw_ints.h"
-#include "hw_memmap.h"
-#include "interrupt.h"
-#include "pin.h"
-#include "prcm.h"
-#include "rom.h"
-#include "rom_map.h"
-#include "uart.h"
-#include "utils.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
-#include "gpio.h"
-#include "gpio_if.h"
-#include "i2c_if.h"
+#include
+#include
-#include "mongoose.h"
-#include "simplelink.h"
-#include "device.h"
+/* Mongoose.h brings in SimpleLink support. Do not include simplelink.h. */
+#include
+
+#include
#include "data.h"
-#include "mongoose.h"
#include "wifi.h"
/* Set up an AP or connect to existing WiFi network. */
@@ -51,6 +50,13 @@
#define BM222_ADDR 0x18
#define TMP006_ADDR 0x41
+static const char *upload_form = "\
+