summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f84e3e9)
raw | patch | inline | side by side (parent: f84e3e9)
author | Vikram Adiga <vikram.adiga@ti.com> | |
Wed, 7 Oct 2015 03:29:20 +0000 (20:29 -0700) | ||
committer | Vikram Adiga <vikram.adiga@ti.com> | |
Wed, 7 Oct 2015 19:56:19 +0000 (12:56 -0700) |
16 files changed:
diff --git a/sample_apps/subscribe_publish_sample/aws_iot_config.h b/sample_apps/subscribe_publish_sample/aws_iot_config.h
index c705cc0f9786f55af9d707368404b656e1f631b4..2651b3922160538c24e969671cfa8b39e7dab163 100644 (file)
// =================================================
#define AWS_IOT_MQTT_HOST "" ///< Customer specific MQTT HOST. The same will be used for Thing Shadow
#define AWS_IOT_MQTT_PORT 8883 ///< default port for MQTT/S
-#define AWS_IOT_MQTT_CLIENT_ID "c-sdk-client-id" ///< MQTT client ID should be unique for every device
-#define AWS_IOT_MY_THING_NAME "AWS-IoT-C-SDK" ///< Thing Name of the Shadow this device is associated with
-#define AWS_IOT_ROOT_CA_FILENAME "aws-iot-rootCA.crt" ///< Root CA file name
-#define AWS_IOT_CERTIFICATE_FILENAME "cert.pem" ///< device signed certificate file name
-#define AWS_IOT_PRIVATE_KEY_FILENAME "privkey.pem" ///< Device private key filename
+#define AWS_IOT_MQTT_CLIENT_ID "ccclientid" ///< MQTT client ID should be unique for every device
+#define AWS_IOT_MY_THING_NAME "ccthingname" ///< Thing Name of the Shadow this device is associated with
+#define AWS_IOT_ROOT_CA_FILENAME "/cert/cacert.der" ///< Root CA file name
+#define AWS_IOT_CERTIFICATE_FILENAME "/cert/clientcert.der" ///< device signed certificate file name
+#define AWS_IOT_PRIVATE_KEY_FILENAME "/cert/clientkey.der" ///< Device private key filename
// =================================================
// MQTT PubSub
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/Board.h b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/Board.h
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#ifndef __BOARD_H
+#define __BOARD_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "CC3200_LAUNCHXL.h"
+
+#define Board_initDMA CC3200_LAUNCHXL_initDMA
+#define Board_initGeneral CC3200_LAUNCHXL_initGeneral
+#define Board_initGPIO CC3200_LAUNCHXL_initGPIO
+#define Board_initI2C CC3200_LAUNCHXL_initI2C
+#define Board_initI2S CC3200_LAUNCHXL_initI2S
+#define Board_initPWM CC3200_LAUNCHXL_initPWM
+#define Board_initSDSPI CC3200_LAUNCHXL_initSDSPI
+#define Board_initSPI CC3200_LAUNCHXL_initSPI
+#define Board_initUART CC3200_LAUNCHXL_initUART
+#define Board_initWatchdog CC3200_LAUNCHXL_initWatchdog
+
+#define Board_LED_ON CC3200_LAUNCHXL_LED_ON
+#define Board_LED_OFF CC3200_LAUNCHXL_LED_OFF
+#define Board_LED0 CC3200_LAUNCHXL_LED_D7
+ /*
+ * CC3200_LAUNCHXL_LED_D5 and CC3200_LAUNCHXL_LED_D6 are shared with the I2C
+ * and PWM peripherals. In order for those examples to work, these LEDs are
+ * taken out of gpioPinCOnfig[]
+ */
+#define Board_LED1 CC3200_LAUNCHXL_LED_D7
+#define Board_LED2 CC3200_LAUNCHXL_LED_D7
+#define Board_BUTTON0 CC3200_LAUNCHXL_SW2
+#define Board_BUTTON1 CC3200_LAUNCHXL_SW3
+
+#define Board_I2C0 CC3200_LAUNCHXL_I2C0
+#define Board_I2C_TMP CC3200_LAUNCHXL_I2C0
+
+#define Board_I2S0 CC3200_LAUNCHXL_I2S0
+
+#define Board_PWM0 CC3200_LAUNCHXL_PWM6
+#define Board_PWM1 CC3200_LAUNCHXL_PWM7
+
+#define Board_SDSPI0 CC3200_LAUNCHXL_SDSPI0
+
+#define Board_SPI0 CC3200_LAUNCHXL_SPI0
+
+#define Board_UART0 CC3200_LAUNCHXL_UART0
+#define Board_UART1 CC3200_LAUNCHXL_UART1
+
+#define Board_WATCHDOG0 CC3200_LAUNCHXL_WATCHDOG0
+
+/* Board specific I2C addresses */
+#define Board_TMP006_ADDR (0x41)
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __BOARD_H */
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/CC3200_LAUNCHXL.c b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/CC3200_LAUNCHXL.c
--- /dev/null
@@ -0,0 +1,611 @@
+/*
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * ======== CC3200_LAUNCHXL.c ========
+ * This file is responsible for setting up the board specific items for the
+ * CC3200_LAUNCHXL board.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+#include <xdc/runtime/System.h>
+#include <ti/sysbios/family/arm/m3/Hwi.h>
+
+#include <inc/hw_ints.h>
+#include <inc/hw_memmap.h>
+#include <inc/hw_types.h>
+
+#include <driverlib/gpio.h>
+#include <driverlib/pin.h>
+#include <driverlib/prcm.h>
+#include <driverlib/rom.h>
+#include <driverlib/rom_map.h>
+#include <driverlib/spi.h>
+#include <driverlib/timer.h>
+#include <driverlib/uart.h>
+#include <driverlib/udma.h>
+#include <driverlib/wdt.h>
+
+#include "CC3200_LAUNCHXL.h"
+#include "pin_mux_config.h"
+
+#include <ti/drivers/Power.h>
+#include <ti/drivers/power/PowerCC3200.h>
+
+/*
+ * This define determines whether to use the UARTCC3200DMA driver
+ * or the UARTCC3200 (no DMA) driver. Set to 1 to use the UARTCC3200DMA
+ * driver.
+ */
+#ifndef TI_DRIVERS_UART_DMA
+#define TI_DRIVERS_UART_DMA 0
+#endif
+
+/*
+ * =============================== DMA ===============================
+ */
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_ALIGN(dmaControlTable, 1024)
+#elif defined(__IAR_SYSTEMS_ICC__)
+#pragma data_alignment=1024
+#elif defined(__GNUC__)
+__attribute__ ((aligned (1024)))
+#endif
+static tDMAControlTable dmaControlTable[64];
+static bool dmaInitialized = false;
+
+/* Hwi_Struct used in the initDMA Hwi_construct call */
+static Hwi_Struct dmaHwiStruct;
+
+/*
+ * ======== dmaErrorHwi ========
+ */
+static Void dmaErrorHwi(UArg arg)
+{
+ System_printf("DMA error code: %d\n", MAP_uDMAErrorStatusGet());
+ MAP_uDMAErrorStatusClear();
+ System_abort("DMA error!!");
+}
+
+/*
+ * ======== CC3200_LAUNCHXL_initDMA ========
+ */
+void CC3200_LAUNCHXL_initDMA(void)
+{
+ Error_Block eb;
+ Hwi_Params hwiParams;
+
+ if (!dmaInitialized) {
+ Error_init(&eb);
+ Hwi_Params_init(&hwiParams);
+ Hwi_construct(&(dmaHwiStruct), INT_UDMAERR, dmaErrorHwi,
+ &hwiParams, &eb);
+ if (Error_check(&eb)) {
+ System_abort("Couldn't construct DMA error hwi");
+ }
+
+ MAP_PRCMPeripheralClkEnable(PRCM_UDMA, PRCM_RUN_MODE_CLK);
+ MAP_PRCMPeripheralReset(PRCM_UDMA);
+ MAP_uDMAEnable();
+ MAP_uDMAControlBaseSet(dmaControlTable);
+
+ dmaInitialized = true;
+ }
+}
+
+/*
+ * =============================== General ===============================
+ */
+/*
+ * ======== CC3200_LAUNCHXL_initGeneral ========
+ */
+void CC3200_LAUNCHXL_initGeneral(void)
+{
+ PinMuxConfig();
+ Power_init();
+}
+
+/*
+ * =============================== GPIO ===============================
+ */
+/* Place into subsections to allow the TI linker to remove items properly */
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_SECTION(GPIOCC3200_config, ".const:GPIOCC3200_config")
+#endif
+
+#include <ti/drivers/GPIO.h>
+#include <ti/drivers/gpio/GPIOCC3200.h>
+
+/*
+ * Array of Pin configurations
+ * NOTE: The order of the pin configurations must coincide with what was
+ * defined in CC3200_LAUNCHXL.h
+ * NOTE: Pins not used for interrupts should be placed at the end of the
+ * array. Callback entries can be omitted from callbacks array to
+ * reduce memory usage.
+ */
+GPIO_PinConfig gpioPinConfigs[] = {
+ /* input pins with callbacks */
+ /* CC3200_LAUNCHXL_SW2 */
+ GPIOCC3200_GPIO_22 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING,
+ /* CC3200_LAUNCHXL_SW3 */
+ GPIOCC3200_GPIO_13 | GPIO_CFG_IN_PU | GPIO_CFG_IN_INT_RISING,
+
+ /* output pins */
+ /* CC3200_LAUNCHXL_LED_D7 */
+ GPIOCC3200_GPIO_09 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
+
+ /*
+ * CC3200_LAUNCHXL_LED_D5 and CC3200_LAUNCHXL_LED_D6 are shared with the
+ * I2C and PWM peripherals. In order for those examples to work, these
+ * LEDs are taken out of gpioPinCOnfig[]
+ */
+ /* CC3200_LAUNCHXL_LED_D6 */
+ //GPIOCC3200_GPIO_10 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
+ /* CC3200_LAUNCHXL_LED_D5 */
+ //GPIOCC3200_GPIO_11 | GPIO_CFG_OUT_STD | GPIO_CFG_OUT_STR_HIGH | GPIO_CFG_OUT_LOW,
+};
+
+/*
+ * Array of callback function pointers
+ * NOTE: The order of the pin configurations must coincide with what was
+ * defined in CC3200_LAUNCHXL.h
+ * NOTE: Pins not used for interrupts can be omitted from callbacks array to
+ * reduce memory usage (if placed at end of gpioPinConfigs array).
+ */
+GPIO_CallbackFxn gpioCallbackFunctions[] = {
+ NULL, /* CC3200_LAUNCHXL_SW2 */
+ NULL /* CC3200_LAUNCHXL_SW3 */
+};
+
+/* The device-specific GPIO_config structure */
+const GPIOCC3200_Config GPIOCC3200_config = {
+ .pinConfigs = (GPIO_PinConfig *)gpioPinConfigs,
+ .callbacks = (GPIO_CallbackFxn *)gpioCallbackFunctions,
+ .numberOfPinConfigs = sizeof(gpioPinConfigs)/sizeof(GPIO_PinConfig),
+ .numberOfCallbacks = sizeof(gpioCallbackFunctions)/sizeof(GPIO_CallbackFxn),
+ .intPriority = (~0)
+};
+
+/*
+ * ======== CC3200_LAUNCHXL_initGPIO ========
+ */
+void CC3200_LAUNCHXL_initGPIO(void)
+{
+ /* Initialize peripheral and pins */
+ GPIO_init();
+}
+
+/*
+ * =============================== I2C ===============================
+ */
+/* Place into subsections to allow the TI linker to remove items properly */
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_SECTION(I2C_config, ".const:I2C_config")
+#pragma DATA_SECTION(i2cCC3200HWAttrs, ".const:i2cCC3200HWAttrs")
+#endif
+
+#include <ti/drivers/I2C.h>
+#include <ti/drivers/i2c/I2CCC3200.h>
+
+I2CCC3200_Object i2cCC3200Objects[CC3200_LAUNCHXL_I2CCOUNT];
+
+const I2CCC3200_HWAttrs i2cCC3200HWAttrs[CC3200_LAUNCHXL_I2CCOUNT] = {
+ {
+ .baseAddr = I2CA0_BASE,
+ .intNum = INT_I2CA0,
+ .intPriority = (~0)
+ }
+};
+
+const I2C_Config I2C_config[] = {
+ {
+ .fxnTablePtr = &I2CCC3200_fxnTable,
+ .object = &i2cCC3200Objects[0],
+ .hwAttrs = &i2cCC3200HWAttrs[0]
+ },
+ {NULL, NULL, NULL}
+};
+
+/*
+ * ======== CC3200_initI2C ========
+ */
+void CC3200_LAUNCHXL_initI2C(void)
+{
+ I2C_init();
+}
+
+/*
+ * =============================== I2S ===============================
+ */
+/* Place into subsections to allow the TI linker to remove items properly */
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_SECTION(I2S_config, ".const:I2S_config")
+#pragma DATA_SECTION(i2sCC3200HWAttrs, ".const:i2sCC3200HWAttrs")
+#endif
+
+#include <ti/drivers/I2S.h>
+#include <ti/drivers/i2s/I2SCC3200DMA.h>
+
+I2SCC3200DMA_Object i2sCC3200Objects[CC3200_LAUNCHXL_I2SCOUNT];
+
+const I2SCC3200DMA_HWAttrs i2sCC3200HWAttrs[CC3200_LAUNCHXL_I2SCOUNT] = {
+ {
+ .baseAddr = I2S_BASE,
+ .intNum = INT_I2S,
+ .intPriority = (~0),
+ .rxChannelIndex = UDMA_CH4_I2S_RX,
+ .txChannelIndex = UDMA_CH5_I2S_TX
+ }
+};
+
+const I2S_Config I2S_config[] = {
+ {
+ .fxnTablePtr = &I2SCC3200DMA_fxnTable,
+ .object = &i2sCC3200Objects[0],
+ .hwAttrs = &i2sCC3200HWAttrs[0]
+ },
+ {NULL, NULL, NULL}
+};
+
+/*
+ * ======== CC3200_LAUNCHXL_initI2S ========
+ */
+void CC3200_LAUNCHXL_initI2S(void)
+{
+ CC3200_LAUNCHXL_initDMA();
+ I2S_init();
+}
+
+/*
+ * =============================== Power ===============================
+ * In this configuration, Power management is disabled since runPolicy
+ * is set to 0. Power management can be enabled from main() by calling
+ * Power_enablePolicy(), or by changing runPolicy to 1 in this structure.
+ */
+const PowerCC3200_Config PowerCC3200_config = {
+ .policyInitFxn = &PowerCC3200_initPolicy,
+ .policyFxn = &PowerCC3200_sleepPolicy,
+ .enterLPDSHookFxn = NULL,
+ .resumeLPDSHookFxn = NULL,
+ .enablePolicy = false,
+ .enableGPIOWakeupLPDS = true,
+ .enableGPIOWakeupShutdown = false,
+ .enableNetworkWakeupLPDS = false,
+ .wakeupGPIOSourceLPDS = PRCM_LPDS_GPIO13,
+ .wakeupGPIOTypeLPDS = PRCM_LPDS_FALL_EDGE,
+ .wakeupGPIOSourceShutdown = 0,
+ .wakeupGPIOTypeShutdown = 0,
+ .ramRetentionMaskLPDS = PRCM_SRAM_COL_1 | PRCM_SRAM_COL_2 |
+ PRCM_SRAM_COL_3 | PRCM_SRAM_COL_4
+};
+
+/*
+ * =============================== PWM ===============================
+ */
+/* Place into subsections to allow the TI linker to remove items properly */
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_SECTION(PWM_config, ".const:PWM_config")
+#pragma DATA_SECTION(pwmTimerCC3200HWAttrs, ".const:pwmTimerCC3200HWAttrs")
+#endif
+
+#include <ti/drivers/PWM.h>
+#include <ti/drivers/pwm/PWMTimerCC3200.h>
+
+PWMTimerCC3200_Object pwmTimerCC3200Objects[CC3200_LAUNCHXL_PWMCOUNT];
+
+const PWMTimerCC3200_HWAttrs pwmTimerCC3200HWAttrs[CC3200_LAUNCHXL_PWMCOUNT] = {
+ { /* CC3200_LAUNCHXL_PWM6 */
+ .baseAddr = TIMERA3_BASE,
+ .timer = TIMER_A
+ },
+ { /* CC3200_LAUNCHXL_PWM7 */
+ .baseAddr = TIMERA3_BASE,
+ .timer = TIMER_B
+ }
+};
+
+const PWM_Config PWM_config[] = {
+ {
+ .fxnTablePtr = &PWMTimerCC3200_fxnTable,
+ .object = &pwmTimerCC3200Objects[0],
+ .hwAttrs = &pwmTimerCC3200HWAttrs[0]
+ },
+ {
+ .fxnTablePtr = &PWMTimerCC3200_fxnTable,
+ .object = &pwmTimerCC3200Objects[1],
+ .hwAttrs = &pwmTimerCC3200HWAttrs[1]
+ },
+ {NULL, NULL, NULL}
+};
+
+/*
+ * ======== CC3200_LAUNCHXL_initPWM ========
+ */
+void CC3200_LAUNCHXL_initPWM(void)
+{
+ PWM_init();
+}
+
+/*
+ * =============================== SDSPI ===============================
+ */
+/* Place into subsections to allow the TI linker to remove items properly */
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_SECTION(SDSPI_config, ".const:SDSPI_config")
+#pragma DATA_SECTION(sdspiCC3200HWattrs, ".const:sdspiCC3200HWattrs")
+#endif
+
+#include <ti/drivers/SDSPI.h>
+#include <ti/drivers/sdspi/SDSPICC3200.h>
+
+SDSPICC3200_Object sdspiCC3200Objects[CC3200_LAUNCHXL_SDSPICOUNT];
+
+/* SDSPI configuration structure, describing which pins are to be used */
+const SDSPICC3200_HWAttrs sdspiCC3200HWattrs[CC3200_LAUNCHXL_SDSPICOUNT] = {
+ {
+ .baseAddr = GSPI_BASE,
+ .spiPRCM = PRCM_GSPI,
+
+ .csGPIOBase = GPIOA0_BASE,
+ .csGPIOPin = GPIO_PIN_7,
+
+ .txGPIOBase = GPIOA2_BASE,
+ .txGPIOPin = GPIO_PIN_0,
+ .txGPIOMode = PIN_MODE_0,
+ .txSPIMode = PIN_MODE_7,
+ .txPackPin = PIN_07
+ }
+};
+
+const SDSPI_Config SDSPI_config[] = {
+ {
+ .fxnTablePtr = &SDSPICC3200_fxnTable,
+ .object = &sdspiCC3200Objects[0],
+ .hwAttrs = &sdspiCC3200HWattrs[0]
+ },
+ {NULL, NULL, NULL}
+};
+
+/*
+ * ======== CC3200_LAUNCHXL_initSDSPI ========
+ */
+void CC3200_LAUNCHXL_initSDSPI(void)
+{
+ /* Raise the CS pin to deselect the SD card */
+ MAP_GPIOPinWrite(GPIOA0_BASE, GPIO_PIN_7, GPIO_PIN_7);
+
+ SDSPI_init();
+}
+
+/*
+ * =============================== SPI ===============================
+ */
+/* Place into subsections to allow the TI linker to remove items properly */
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_SECTION(SPI_config, ".const:SPI_config")
+#pragma DATA_SECTION(spiCC3200DMAHWAttrs, ".const:spiCC3200DMAHWAttrs")
+#endif
+
+#include <ti/drivers/SPI.h>
+#include <ti/drivers/spi/SPICC3200DMA.h>
+
+SPICC3200DMA_Object SPICC3200DMAObjects[CC3200_LAUNCHXL_SPICOUNT];
+
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_ALIGN(spiCC3200DMAscratchBuf, 32)
+#elif defined(__IAR_SYSTEMS_ICC__)
+#pragma data_alignment=32
+#elif defined(__GNUC__)
+__attribute__ ((aligned (32)))
+#endif
+uint32_t spiCC3200DMAscratchBuf[CC3200_LAUNCHXL_SPICOUNT];
+
+const SPICC3200DMA_HWAttrs spiCC3200DMAHWAttrs[CC3200_LAUNCHXL_SPICOUNT] = {
+ {
+ .baseAddr = GSPI_BASE,
+ .intNum = INT_GSPI,
+ .intPriority = (~0),
+ .spiPRCM = PRCM_GSPI,
+ .csControl = SPI_HW_CTRL_CS,
+ .csPolarity = SPI_CS_ACTIVELOW,
+ .pinMode = SPI_4PIN_MODE,
+ .turboMode = SPI_TURBO_OFF,
+ .scratchBufPtr = &spiCC3200DMAscratchBuf[0],
+ .defaultTxBufValue = 0,
+ .rxChannelIndex = UDMA_CH6_GSPI_RX,
+ .txChannelIndex = UDMA_CH7_GSPI_TX
+ }
+};
+
+const SPI_Config SPI_config[] = {
+ {
+ .fxnTablePtr = &SPICC3200DMA_fxnTable,
+ .object = &SPICC3200DMAObjects[0],
+ .hwAttrs = &spiCC3200DMAHWAttrs[0]
+ },
+ {NULL, NULL, NULL},
+};
+
+/*
+ * ======== CC3200_LAUNCHXL_initSPI ========
+ */
+void CC3200_LAUNCHXL_initSPI(void)
+{
+ CC3200_LAUNCHXL_initDMA();
+ SPI_init();
+}
+
+/*
+ * =============================== UART ===============================
+ */
+/* Place into subsections to allow the TI linker to remove items properly */
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_SECTION(UART_config, ".const:UART_config")
+#pragma DATA_SECTION(uartCC3200HWAttrs, ".const:uartCC3200HWAttrs")
+#endif
+
+#include <ti/drivers/UART.h>
+#if TI_DRIVERS_UART_DMA
+#include <ti/drivers/uart/UARTCC3200DMA.h>
+
+UARTCC3200DMA_Object uartCC3200Objects[CC3200_LAUNCHXL_UARTCOUNT];
+
+/* UART configuration structure */
+const UARTCC3200DMA_HWAttrs uartCC3200HWAttrs[CC3200_LAUNCHXL_UARTCOUNT] = {
+ {
+ .baseAddr = UARTA0_BASE,
+ .intNum = INT_UARTA0,
+ .intPriority = (~0),
+ .rxChannelIndex = DMA_CH8_UARTA0_RX,
+ .txChannelIndex = UDMA_CH9_UARTA0_TX
+ },
+ {
+ .baseAddr = UARTA1_BASE,
+ .intNum = INT_UARTA1,
+ .intPriority = (~0),
+ .rxChannelIndex = UDMA_CH10_UARTA1_RX,
+ .txChannelIndex = UDMA_CH11_UARTA1_TX
+ },
+};
+
+const UART_Config UART_config[] = {
+ {
+ .fxnTablePtr = &UARTCC3200DMA_fxnTable,
+ .object = &uartCC3200Objects[0],
+ .hwAttrs = &uartCC3200HWAttrs[0]
+ },
+ {
+ .fxnTablePtr = &UARTCC3200DMA_fxnTable,
+ .object = &uartCC3200Objects[1],
+ .hwAttrs = &uartCC3200HWAttrs[1]
+ },
+ {NULL, NULL, NULL}
+};
+#else
+#include <ti/drivers/uart/UARTCC3200.h>
+
+UARTCC3200_Object uartCC3200Objects[CC3200_LAUNCHXL_UARTCOUNT];
+unsigned char uartCC3200RingBuffer[CC3200_LAUNCHXL_UARTCOUNT][32];
+
+/* UART configuration structure */
+const UARTCC3200_HWAttrs uartCC3200HWAttrs[CC3200_LAUNCHXL_UARTCOUNT] = {
+ {
+ .baseAddr = UARTA0_BASE,
+ .intNum = INT_UARTA0,
+ .intPriority = (~0),
+ .flowControl = UART_FLOWCONTROL_NONE,
+ .ringBufPtr = uartCC3200RingBuffer[0],
+ .ringBufSize = sizeof(uartCC3200RingBuffer[0]),
+ },
+ {
+ .baseAddr = UARTA1_BASE,
+ .intNum = INT_UARTA1,
+ .intPriority = (~0),
+ .flowControl = UART_FLOWCONTROL_NONE,
+ .ringBufPtr = uartCC3200RingBuffer[1],
+ .ringBufSize = sizeof(uartCC3200RingBuffer[1]),
+ }
+};
+
+const UART_Config UART_config[] = {
+ {
+ .fxnTablePtr = &UARTCC3200_fxnTable,
+ .object = &uartCC3200Objects[0],
+ .hwAttrs = &uartCC3200HWAttrs[0]
+ },
+ {
+ .fxnTablePtr = &UARTCC3200_fxnTable,
+ .object = &uartCC3200Objects[1],
+ .hwAttrs = &uartCC3200HWAttrs[1]
+ },
+ {NULL, NULL, NULL}
+};
+#endif /* TI_DRIVERS_UART_DMA */
+
+/*
+ * ======== CC3200_LAUNCHXL_initUART ========
+ */
+void CC3200_LAUNCHXL_initUART(void)
+{
+#if TI_DRIVERS_UART_DMA
+ CC3200_LAUNCHXL_initDMA();
+#endif
+ UART_init();
+}
+
+/*
+ * =============================== Watchdog ===============================
+ */
+/* Place into subsections to allow the TI linker to remove items properly */
+#if defined(__TI_COMPILER_VERSION__)
+#pragma DATA_SECTION(Watchdog_config, ".const:Watchdog_config")
+#pragma DATA_SECTION(watchdogCC3200HWAttrs, ".const:watchdogCC3200HWAttrs")
+#endif
+
+#include <ti/drivers/Watchdog.h>
+#include <ti/drivers/watchdog/WatchdogCC3200.h>
+
+WatchdogCC3200_Object watchdogCC3200Objects[CC3200_LAUNCHXL_WATCHDOGCOUNT];
+
+const WatchdogCC3200_HWAttrs watchdogCC3200HWAttrs[CC3200_LAUNCHXL_WATCHDOGCOUNT] = {
+ {
+ .baseAddr = WDT_BASE,
+ .intNum = INT_WDT,
+ .intPriority = (~0),
+ .reloadValue = 80000000 // 1 second period at default CPU clock freq
+ },
+};
+
+const Watchdog_Config Watchdog_config[] = {
+ {
+ .fxnTablePtr = &WatchdogCC3200_fxnTable,
+ .object = &watchdogCC3200Objects[0],
+ .hwAttrs = &watchdogCC3200HWAttrs[0]
+ },
+ {NULL, NULL, NULL},
+};
+
+/*
+ * ======== CC3200_LAUNCHXL_initWatchdog ========
+ */
+void CC3200_LAUNCHXL_initWatchdog(void)
+{
+ MAP_PRCMPeripheralClkEnable(PRCM_WDT, PRCM_RUN_MODE_CLK);
+ MAP_PRCMPeripheralReset(PRCM_WDT);
+
+ Watchdog_init();
+}
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/CC3200_LAUNCHXL.cmd b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/CC3200_LAUNCHXL.cmd
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/* 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. */
+/* */
+/* --library=rtsv7M3_T_le_eabi.lib*/
+/* __HEAP_SIZE=0x00008000; */
+/* __STACK_SIZE=0x1000; */
+
+/* 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 (RWX) : origin = 0x20004000, length = 0x00040000 - 0x4000
+}
+
+/* Section allocation in memory */
+
+SECTIONS
+{
+ .intvecs: > RAM_BASE
+ .text : > SRAM
+ .const : > SRAM
+ .cinit : > SRAM
+ .pinit : > SRAM
+ .init_array : > SRAM
+
+ .vtable : > SRAM
+ .data : > SRAM
+ .bss : > SRAM
+ .sysmem : > SRAM
+ .stack : > SRAM
+}
+
+__STACK_TOP = __stack + __STACK_SIZE;
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/CC3200_LAUNCHXL.h b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/CC3200_LAUNCHXL.h
--- /dev/null
@@ -0,0 +1,254 @@
+/*
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+/** ============================================================================
+ * @file C3200_LP.h
+ *
+ * @brief CC3200 Board Specific APIs
+ *
+ * The CC3200_LAUNCHXL header file should be included in an application as
+ * follows:
+ * @code
+ * #include <CC3200_LAUNCHXL.h>
+ * @endcode
+ *
+ * ============================================================================
+ */
+#ifndef __CC3200_LAUNCHXL_H
+#define __CC3200_LAUNCHXL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CC3200_LAUNCHXL_LED_OFF (0)
+#define CC3200_LAUNCHXL_LED_ON (1)
+
+/*!
+ * @def CC3200_LAUNCHXL_GPIOName
+ * @brief Enum of GPIO names on the CC3200_LAUNCHXL dev board
+ */
+typedef enum CC3200_LAUNCHXL_GPIOName {
+ CC3200_LAUNCHXL_SW2 = 0,
+ CC3200_LAUNCHXL_SW3,
+ CC3200_LAUNCHXL_LED_D7,
+
+ /*
+ * CC3200_LAUNCHXL_LED_D5 and CC3200_LAUNCHXL_LED_D6 are shared with the
+ * I2C and PWM peripherals. In order for those examples to work, these
+ * LEDs are taken out of gpioPinCOnfig[]
+ */
+ //CC3200_LAUNCHXL_LED_D6,
+ //CC3200_LAUNCHXL_LED_D5,
+
+ CC3200_LAUNCHXL_GPIOCOUNT
+} CC3200_LAUNCHXL_GPIOName;
+
+/*!
+ * @def CC3200_LAUNCHXL_I2CName
+ * @brief Enum of I2C names on the CC3200_LAUNCHXL dev board
+ */
+typedef enum CC3200_LAUNCHXL_I2CName {
+ CC3200_LAUNCHXL_I2C0 = 0,
+
+ CC3200_LAUNCHXL_I2CCOUNT
+} CC3200_LAUNCHXL_I2CName;
+
+/*!
+ * @def CC3200_LAUNCHXL_I2SName
+ * @brief Enum of I2S names on the CC3200_LAUNCHXL dev board
+ */
+typedef enum CC3200_LAUNCHXL_I2SName {
+ CC3200_LAUNCHXL_I2S0 = 0,
+
+ CC3200_LAUNCHXL_I2SCOUNT
+} CC3200_LAUNCHXL_I2SName;
+
+/*!
+ * @def CC3200_LAUNCHXL_PWMName
+ * @brief Enum of PWM names on the CC3200_LAUNCHXL dev board
+ */
+typedef enum CC3200_LAUNCHXL_PWMName {
+ CC3200_LAUNCHXL_PWM6 = 0,
+ CC3200_LAUNCHXL_PWM7,
+
+ CC3200_LAUNCHXL_PWMCOUNT
+} CC3200_LAUNCHXL_PWMName;
+
+/*!
+ * @def CC3200_LAUNCHXL_SDSPIName
+ * @brief Enum of SDSPI names on the CC3200_LAUNCHXL dev board
+ */
+typedef enum CC3200_LAUNCHXL_SDSPIName {
+ CC3200_LAUNCHXL_SDSPI0 = 0,
+
+ CC3200_LAUNCHXL_SDSPICOUNT
+} CC3200_LAUNCHXL_SDSPIName;
+
+/*!
+ * @def CC3200_LAUNCHXL_SPIName
+ * @brief Enum of SPI names on the CC3200_LAUNCHXL dev board
+ */
+typedef enum CC3200_LAUNCHXL_SPIName {
+ CC3200_LAUNCHXL_SPI0 = 0,
+
+ CC3200_LAUNCHXL_SPICOUNT
+} CC3200_LAUNCHXL_SPIName;
+
+/*!
+ * @def CC3200_LAUNCHXL_UARTName
+ * @brief Enum of UARTs on the CC3200_LAUNCHXL dev board
+ */
+typedef enum CC3200_LAUNCHXL_UARTName {
+ CC3200_LAUNCHXL_UART0 = 0,
+ CC3200_LAUNCHXL_UART1,
+
+ CC3200_LAUNCHXL_UARTCOUNT
+} CC3200_LAUNCHXL_UARTName;
+
+/*!
+ * @def CC3200_LAUNCHXL_WatchdogName
+ * @brief Enum of Watchdogs on the CC3200_LAUNCHXL dev board
+ */
+typedef enum CC3200_LAUNCHXL_WatchdogName {
+ CC3200_LAUNCHXL_WATCHDOG0 = 0,
+
+ CC3200_LAUNCHXL_WATCHDOGCOUNT
+} CC3200_LAUNCHXL_WatchdogName;
+
+/*!
+ * @brief Initialize board specific DMA settings
+ *
+ * This function creates a hwi in case the DMA controller creates an error
+ * interrupt, enables the DMA and supplies it with a uDMA control table.
+ */
+extern void CC3200_LAUNCHXL_initDMA(void);
+
+/*!
+ * @brief Initialize the general board specific settings
+ *
+ * This function initializes the general board specific settings.
+ */
+extern void CC3200_LAUNCHXL_initGeneral(void);
+
+/*!
+ * @brief Initialize board specific GPIO settings
+ *
+ * This function initializes the board specific GPIO settings and
+ * then calls the GPIO_init API to initialize the GPIO module.
+ *
+ * The GPIOs controlled by the GPIO module are determined by the GPIO_PinConfig
+ * variable.
+ */
+extern void CC3200_LAUNCHXL_initGPIO(void);
+
+/*!
+ * @brief Initialize board specific I2C settings
+ *
+ * This function initializes the board specific I2C settings and then calls
+ * the I2C_init API to initialize the I2C module.
+ *
+ * The I2C peripherals controlled by the I2C module are determined by the
+ * I2C_config variable.
+ */
+extern void CC3200_LAUNCHXL_initI2C(void);
+
+/*!
+ * @brief Initialize board specific I2S settings
+ *
+ * This function initializes the board specific I2S settings and then calls
+ * the I2S_init API to initialize the I2S module.
+ *
+ * The I2S peripherals controlled by the I2S module are determined by the
+ * I2S_config variable.
+ */
+extern void CC3200_LAUNCHXL_initI2S(void);
+
+/*!
+ * @brief Initialize board specific PWM settings
+ *
+ * This function initializes the board specific PWM settings and then calls
+ * the PWM_init API to initialize the PWM module.
+ *
+ * The PWM peripherals controlled by the PWM module are determined by the
+ * PWM_config variable.
+ */
+extern void CC3200_LAUNCHXL_initPWM(void);
+
+/*!
+ * @brief Initialize board specific SDSPI settings
+ *
+ * This function initializes the board specific SDSPI settings and then calls
+ * the SDSPI_init API to initialize the SDSPI module.
+ *
+ * The SDSPI peripherals controlled by the SDSPI module are determined by the
+ * SDSPI_config variable.
+ */
+extern void CC3200_LAUNCHXL_initSDSPI(void);
+
+/*!
+ * @brief Initialize board specific SPI settings
+ *
+ * This function initializes the board specific SPI settings and then calls
+ * the SPI_init API to initialize the SPI module.
+ *
+ * The SPI peripherals controlled by the SPI module are determined by the
+ * SPI_config variable.
+ */
+extern void CC3200_LAUNCHXL_initSPI(void);
+
+/*!
+ * @brief Initialize board specific UART settings
+ *
+ * This function initializes the board specific UART settings and then calls
+ * the UART_init API to initialize the UART module.
+ *
+ * The UART peripherals controlled by the UART module are determined by the
+ * UART_config variable.
+ */
+extern void CC3200_LAUNCHXL_initUART(void);
+
+/*!
+ * @brief Initialize board specific Watchdog settings
+ *
+ * This function initializes the board specific Watchdog settings and then
+ * calls the Watchdog_init API to initialize the Watchdog module.
+ *
+ * The Watchdog peripherals controlled by the Watchdog module are determined
+ * by the Watchdog_config variable.
+ */
+extern void CC3200_LAUNCHXL_initWatchdog(void);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __CC3200_LAUNCHXL_H */
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/UARTUtils.c b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/UARTUtils.c
--- /dev/null
@@ -0,0 +1,308 @@
+/*
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * ======== UARTUtils.c ========
+ */
+
+/* XDCtools Header files */
+#include <xdc/std.h>
+#include <xdc/runtime/Assert.h>
+#include <xdc/runtime/Diags.h>
+#include <xdc/runtime/Log.h>
+#include <xdc/runtime/System.h>
+
+/* BIOS Header files */
+#include <ti/sysbios/BIOS.h>
+
+/* TI-RTOS Header files */
+#include <ti/drivers/UART.h>
+
+/* Example/Board Header files */
+#include "Board.h"
+#include "UARTUtils.h"
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdio.h>
+#include <string.h>
+
+#define NUM_PORTS 1
+
+/* Typedefs */
+typedef struct {
+ UART_Handle handle; /* Handle for all UART APIs */
+ unsigned int base; /* Base address of the UART */
+ unsigned int open; /* Number of users for this UART */
+ bool binary; /* UART has been opened in binary mode */
+} UARTPorts;
+
+/* Static variables and handles */
+static UART_Handle systemHandle = NULL;
+static UART_Handle loggerHandle = NULL;
+
+/* This example only uses UART0 */
+static UARTPorts ports[NUM_PORTS] = {{NULL, Board_UART0, 0, false}};
+
+/*
+ * ======== openHandle ========
+ * The UART driver will return NULL if there was an error creating a UART
+ *
+ * @param index Index into the ports array of UARTPorts
+ * @param binary Open the UART in binary mode
+ * @return UART_Handle to the opened UART
+ */
+static UART_Handle openHandle(unsigned int index, bool binary)
+{
+ UART_Params uartParams;
+
+ /* Only UART 0 is supported in this example. */
+ if (index >= NUM_PORTS) {
+ System_printf("UART index %d not supported, valid range is 0-%d", index, (NUM_PORTS - 1));
+ return (NULL);
+ }
+
+ /* The UART driver only allows creating once, return if its already open. */
+ if (ports[index].open) {
+ /* Make sure the index is not already opened in the wrong mode */
+ if (binary != ports[index].binary) {
+ return (NULL);
+ }
+ ports[index].open++;
+ return (ports[index].handle);
+ }
+
+ /* Create a UART with the parameters below. */
+ UART_Params_init(&uartParams);
+ if (binary == true) {
+ uartParams.readEcho = UART_ECHO_OFF;
+ uartParams.writeDataMode = UART_DATA_BINARY;
+ ports[index].binary = true;
+ }
+ else {
+ ports[index].binary = false;
+ uartParams.baudRate = 9600;
+ }
+ ports[index].handle = UART_open(ports[index].base, &uartParams);
+ if (ports[index].handle != NULL) {
+ ports[index].open = 1;
+ }
+
+ return (ports[index].handle);
+}
+
+/*
+ * ======== closeHandle ========
+ */
+static void closeHandle(unsigned int index)
+{
+ ports[index].open--;
+ if (ports[index].open == 0) {
+ UART_close(ports[index].handle);
+ }
+}
+
+/*
+ * ======== UARTUtils_loggerIdleInit ========
+ */
+void UARTUtils_loggerIdleInit(unsigned int index)
+{
+ Assert_isTrue(ports[index].open == false, NULL);
+ loggerHandle = openHandle(index, true);
+ if (loggerHandle == NULL) {
+ System_printf("Failed to open UART %d", index);
+ }
+}
+
+/*
+ * ======== UARTUtils_loggerIdleSend ========
+ * Plugged into LoggerIdle to send log data during idle.
+ */
+Int UARTUtils_loggerIdleSend(UChar *a, Int size)
+{
+ /* Make sure UART is initialized */
+ if (loggerHandle) {
+ /*
+ * Write up to 16 bytes at a time. This function runs during idle and
+ * should not tie up other idle functions from running. The idle loop
+ * is generally short enough that this function will run again before all
+ * 16 bytes have been transmitted from the FIFO.
+ */
+ if (size < 16) {
+ return (UART_writePolling(loggerHandle, (void *)a, size));
+ }
+ else {
+ return (UART_writePolling(loggerHandle, (void *)a, 16));
+ }
+ }
+ else {
+ return (0);
+ }
+}
+
+/*
+ * ======== UARTUtils_deviceclose ========
+ */
+int UARTUtils_deviceclose(int fd)
+{
+ /* Return if a UART other than UART 0 was specified. */
+ if (fd != 0) {
+ return (-1);
+ }
+
+ closeHandle(fd);
+
+ return (0);
+}
+
+/*
+ * ======== UARTUtils_devicelseek ========
+ */
+off_t UARTUtils_devicelseek(int fd, off_t offset, int origin)
+{
+ return (-1);
+}
+
+/*
+ * ======== UARTUtils_deviceopen ========
+ */
+int UARTUtils_deviceopen(const char *path, unsigned flags, int mode)
+{
+ int fd;
+ UART_Handle handle;
+
+
+ /* Get the UART specified for opening. */
+ fd = path[0] - '0';
+
+ handle = openHandle(fd, false);
+
+ if(handle == NULL) {
+ return (-1);
+ }
+ else {
+ return (fd);
+ }
+}
+
+/*
+ * ======== UARTUtils_deviceread ========
+ */
+int UARTUtils_deviceread(int fd, char *buffer, unsigned size)
+{
+ int ret;
+
+ /* Return if a UART other than UART 0 was specified. */
+ if (fd != 0) {
+ return (-1);
+ }
+
+ /* Read character from the UART and block until a newline is received. */
+ ret = UART_read(ports[fd].handle, (uint8_t *)buffer, size);
+
+ return (ret);
+}
+
+/*
+ * ======== UARTUtils_devicewrite ========
+ */
+int UARTUtils_devicewrite(int fd, const char *buffer, unsigned size)
+{
+ int ret;
+
+ /* Return if a UART other than UART 0 was specified. */
+ if (fd != 0) {
+ return (-1);
+ }
+
+ /* Write to the UART and block until the transfer is finished. */
+ ret = UART_write(ports[fd].handle, (uint8_t *)buffer, size);
+
+ return (ret);
+}
+
+/*
+ * ======== UARTUtils_deviceunlink ========
+ */
+int UARTUtils_deviceunlink(const char *path)
+{
+ return (-1);
+}
+
+/*
+ * ======== UARTUtils_devicerename ========
+ */
+int UARTUtils_devicerename(const char *old_name, const char *new_name)
+{
+ return (-1);
+}
+
+/*
+ * ======== UARTUtils_systemAbort ========
+ */
+Void UARTUtils_systemAbort(String str)
+{
+ /* Make sure UART is initialized */
+ if (systemHandle) {
+ UART_writePolling(systemHandle, (uint8_t *)str, strlen(str));
+ }
+}
+
+/*
+ * ======== UARTUtils_systemInit ========
+ */
+void UARTUtils_systemInit(unsigned int index)
+{
+ systemHandle = openHandle(index, false);
+ if (systemHandle == NULL) {
+ Log_print1(Diags_USER1, "Failed to open UART %d", index);
+ }
+}
+
+/*
+ * ======== UARTUtils_systemPutch ========
+ */
+Void UARTUtils_systemPutch(Char a)
+{
+ /* Make sure UART is initialized */
+ if (systemHandle) {
+ UART_writePolling(systemHandle, (void *)&a, 1);
+ }
+}
+
+/*
+ * ======== UARTUtils_systemReady ========
+ */
+Bool UARTUtils_systemReady(Void)
+{
+ return (systemHandle ? TRUE : FALSE);
+}
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/UARTUtils.h b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/UARTUtils.h
--- /dev/null
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+/** ============================================================================
+ * @file UARTUtils.h
+ *
+ * @brief UART related utilities
+ *
+ * The UARTUtils header file should be included in an application as follows:
+ * @code
+ * #include <UARTUtils.h>
+ * @endcode
+ *
+ * ============================================================================
+ */
+
+#ifndef __UARTUtils_H
+#define __UARTUtils_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <xdc/std.h>
+
+#include <stdio.h>
+
+#if defined(__TI_COMPILER_VERSION__)
+#include <file.h>
+#endif
+
+/*!
+ * @brief Open the UART to be used with LoggerIdle
+ *
+ * This function opens the UART to be used by the LoggerIdle plugged function.
+ *
+ * @param index UART to use for LoggerIdle's send function from the ports
+ * array. Matches the same number uart base (0 -> UART_BASE0).
+ */
+extern void UARTUtils_loggerIdleInit(unsigned int index);
+
+/*!
+ * @brief Sends Log data out the UART
+ *
+ * This function should not be called directly, it will be called by the
+ * LoggerIdle module during Idle.
+ *
+ * @param a Pointer to unsigned char buffer
+ * @param len length of unsigned char buffer
+ * @return Number of bytes sent
+ *
+ * To configure LoggerIdle to upload via UART in the .cfg:
+ * @code
+ * var LoggingSetup = xdc.useModule('ti.uia.sysbios.LoggingSetup');
+ * LoggingSetup.loggerType = LoggingSetup.UploadMode_IDLE;
+ * var LoggerIdle = xdc.useModule('ti.uia.sysbios.LoggerIdle');
+ * LoggerIdle.transportFxn = "&UARTUtils_loggerIdleSend";
+ * LoggerIdle.transportType = LoggerIdle.TransportType_UART;
+ * @endcode
+ *
+ */
+extern Int UARTUtils_loggerIdleSend(UChar *a, Int len);
+
+/*!
+ * @brief close function for add_device rts function
+ *
+ * This function should not be called directly
+ */
+extern int UARTUtils_deviceclose(int fd);
+
+/*!
+ * @brief seek function for add_device rts function
+ *
+ * This function should not be called directly
+ */
+extern off_t UARTUtils_devicelseek(int fd, off_t offset, int origin);
+
+/*!
+ * @brief open function for add_device rts function
+ *
+ * This function should not be called directly
+ */
+extern int UARTUtils_deviceopen(const char *path, unsigned flags, int mode);
+
+/*!
+ * @brief read function for add_device rts function
+ *
+ * This function should not be called directly
+ */
+extern int UARTUtils_deviceread(int fd, char *buffer, unsigned size);
+
+/*!
+ * @brief rename function for add_device rts function
+ *
+ * This function should not be called directly
+ */
+extern int UARTUtils_devicerename(const char *old_name, const char *new_name);
+
+/*!
+ * @brief unlink function for add_device rts function
+ *
+ * This function should not be called directly
+ */
+extern int UARTUtils_deviceunlink(const char *path);
+
+/*!
+ * @brief write function for add_device rts function
+ *
+ * This function should not be called directly
+ */
+extern int UARTUtils_devicewrite(int fd, const char *buffer, unsigned size);
+
+/*!
+ * @brief abort function called within System_abort
+ *
+ * This function should not be called directly
+ */
+extern Void UARTUtils_systemAbort(String str);
+
+/*!
+ * @brief Opens the UART to be used with SysCallback
+ *
+ * This function opens the UART to be used by the SysCallback plugged functions.
+ *
+ * @param index UART to use for System output from ports array. Matches the
+ * same number uart base (0 -> UART_BASE0).
+ */
+extern void UARTUtils_systemInit(unsigned int index);
+
+/*!
+ * @brief putch function for System_printf
+ *
+ * This function should not be called directly
+ */
+extern Void UARTUtils_systemPutch(Char a);
+
+/*!
+ * @brief ready function for System module
+ *
+ * This function should not be called directly
+ */
+extern Bool UARTUtils_systemReady();
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __UARTUtils_H */
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/main.c b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/main.c
--- /dev/null
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+/*
+ * ======== main.c ========
+ */
+#include <xdc/runtime/System.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Task.h>
+
+#include <ti/drivers/GPIO.h>
+
+#include "Board.h"
+#include "UARTUtils.h"
+
+#include <simplelink.h>
+
+/* USER STEP: update to current date-time */
+#define DAY 29
+#define MONTH 9
+#define YEAR 2015
+#define HOUR 6
+#define MINUTE 21
+#define SECOND 0
+
+extern void NetWiFi_init(void);
+extern void runAWSClient(void);
+
+/*
+ * ======== slTask ========
+ */
+void slTask(unsigned int arg0, unsigned int arg1)
+{
+ SlDateTime_t dt;
+
+ /*
+ * Add the UART device to the system.
+ * All UART peripherals must be setup and the module must be initialized
+ * before opening. This is done by Board_initUART(). The functions used
+ * are implemented in UARTUtils.c.
+ */
+ add_device("UART", _MSA, UARTUtils_deviceopen,
+ UARTUtils_deviceclose, UARTUtils_deviceread,
+ UARTUtils_devicewrite, UARTUtils_devicelseek,
+ UARTUtils_deviceunlink, UARTUtils_devicerename);
+
+ /* Open UART0 for writing to stdout and set buffer */
+ freopen("UART:0", "w", stdout);
+ setvbuf(stdout, NULL, _IOLBF, 128);
+
+ /* Open UART0 for writing to stderr and set buffer */
+ freopen("UART:0", "w", stderr);
+ setvbuf(stderr, NULL, _IOLBF, 128);
+
+ /* Open UART0 for reading from stdin and set buffer */
+ freopen("UART:0", "r", stdin);
+ setvbuf(stdin, NULL, _IOLBF, 128);
+
+ /*
+ * Initialize UART port 0 used by SysCallback. This and other SysCallback
+ * UART functions are implemented in UARTUtils.c. Calls to System_printf
+ * will go to UART0, the same as printf.
+ */
+ UARTUtils_systemInit(0);
+
+ /* Initialize SimpleLink */
+ NetWiFi_init();
+
+ /* Set Date to validate certificate */
+ dt.sl_tm_day = DAY;
+ dt.sl_tm_mon = MONTH;
+ dt.sl_tm_year = YEAR;
+ dt.sl_tm_hour = HOUR;
+ dt.sl_tm_min = MINUTE;
+ dt.sl_tm_sec = SECOND;
+ sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,
+ SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
+ sizeof(SlDateTime_t), (unsigned char *)(&dt));
+
+ runAWSClient();
+}
+
+/*
+ * ======== main ========
+ */
+int main(int argc, char *argv[])
+{
+ Task_Handle taskHandle;
+ Task_Params taskParams;
+
+ Board_initGeneral();
+ Board_initGPIO();
+ Board_initUART();
+
+ GPIO_write(Board_LED0, Board_LED_ON);
+
+ /* Initialize the Spawn Task Mailbox */
+ VStartSimpleLinkSpawnTask(3);
+
+ Task_Params_init(&taskParams);
+ taskParams.stackSize = 4096;
+
+ taskHandle = Task_create((Task_FuncPtr)slTask, &taskParams, NULL);
+ if (taskHandle == NULL) {
+ System_abort("main: failed to create a Task!\n");
+ }
+
+ BIOS_start();
+}
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/makedefs b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/makedefs
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# Copyright (c) 2015, Texas Instruments Incorporated
+# All rights reserved.
+#
+# 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.
+#
+
+CODEGEN_INSTALL_DIR = $(TI_ARM_CODEGEN_INSTALL_DIR)
+CC = $(CODEGEN_INSTALL_DIR)/bin/armcl
+LD = $(CODEGEN_INSTALL_DIR)/bin/armcl -z
+AR = $(CODEGEN_INSTALL_DIR)/bin/armar
+
+XDCPATH = $(NS_INSTALL_DIR)/packages/;$(BIOS_INSTALL_DIR)/packages;$(TIRTOS_INSTALL_DIR)/packages;$(UIA_INSTALL_DIR)/packages;
+CONFIGURO = $(XDCTOOLS_INSTALL_DIR)/xs --xdcpath="$(XDCPATH)" xdc.tools.configuro
+
+TARGET = ti.targets.arm.elf.M4
+PLATFORM = ti.platforms.simplelink:CC3200
+PROFILE = release
+
+CFLAGS = -eo=.o -mv7M4 --float_support=vfplib --abi=eabi -me -ms --c99 -I$(CODEGEN_INSTALL_DIR)/include -I$(CCWARE_INSTALL_DIR) -I$(CCWARE_INSTALL_DIR)/inc -I$(CCWARE_INSTALL_DIR)/driverlib -I$(CC3200SDK_INSTALL_DIR)/oslib -I$(CC3200SDK_INSTALL_DIR)/ti_rtos -I$(CC3200SDK_INSTALL_DIR)/simplelink -I$(CC3200SDK_INSTALL_DIR)/simplelink/include -I$(CC3200SDK_INSTALL_DIR)/simplelink/source -Dccs -DPART_CC3200 -DCCWARE -DSL_FULL -DSL_PLATFORM_MULTI_THREADED -DNET_SL
+
+LFLAGS = --rom_model --warn_sections -i$(CODEGEN_INSTALL_DIR)/lib --reread_libs -l$(CC3200SDK_INSTALL_DIR)/simplelink/ccs/OS/simplelink.a -l$(CC3200SDK_INSTALL_DIR)/oslib/ccs/ti_rtos/ti_rtos.a -l$(CCWARE_INSTALL_DIR)/driverlib/ccs/Release/driverlib.a -llibc.a
+
+%.o : %.c
+ $(CC) $(CFLAGS) -c $<
+
+% : %.cfg
+ $(CONFIGURO) -c $(CODEGEN_INSTALL_DIR) -t $(TARGET) -p $(PLATFORM) -r $(PROFILE) $<
+
+ifeq ("$(SHELL)","sh.exe")
+#For Windows
+ RMDIR = rmdir /S /Q
+ remove = del $(subst /,\,$1)
+ binconv = tools/elf2cc32.exe
+else
+#For Linux
+ RMDIR = rm -rf
+ remove = rm -f $1
+ binconv = tools/elf2cc32
+endif
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/makefile b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/makefile
--- /dev/null
@@ -0,0 +1,94 @@
+#
+# Copyright (c) 2015, Texas Instruments Incorporated
+# All rights reserved.
+#
+# 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.
+#
+
+TREE_ROOT = ../../../../
+include $(TREE_ROOT)/build/platform_tirtos/products.mak
+include makedefs
+
+APP = subscribe_publish_sample
+
+VPATH = ../..:$(TREE_ROOT)/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/platform_tirtos:$(TREE_ROOT)/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper:$(TREE_ROOT)/aws_iot_src/shadow:$(TREE_ROOT)/aws_iot_src/utils:$(TREE_ROOT)/aws_mqtt_embedded_client_lib/MQTTClient-C/src:$(TREE_ROOT)/aws_mqtt_embedded_client_lib/MQTTPacket/src
+
+DEFS = -DIOT_INFO -DIOT_ERROR -DIOT_WARN -DIOT_DEBUG
+
+INCS = -I../.. -I$(TREE_ROOT)/aws_iot_src/protocol/mqtt -I$(TREE_ROOT)/aws_iot_src/utils -I$(TREE_ROOT)/aws_iot_src/shadow -I$(TREE_ROOT)/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper -I$(TREE_ROOT)/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/platform_tirtos -I$(TREE_ROOT)/aws_mqtt_embedded_client_lib/MQTTClient-C/src -I$(TREE_ROOT)/aws_mqtt_embedded_client_lib/MQTTPacket/src
+
+CFLAGS := $(DEFS) $(INCS) -g --cmd_file=./$(APP)/compiler.opt $(CFLAGS)
+
+SOURCES = MQTTFormat.c \
+ MQTTPacket.c \
+ MQTTDeserializePublish.c \
+ MQTTConnectClient.c \
+ MQTTSubscribeClient.c \
+ MQTTSerializePublish.c \
+ MQTTConnectServer.c \
+ MQTTSubscribeServer.c \
+ MQTTUnsubscribeServer.c \
+ MQTTUnsubscribeClient.c \
+ MQTTClient.c \
+ aws_iot_mqtt_embedded_client_wrapper.c \
+ aws_iot_json_utils.c \
+ aws_iot_shadow_actions.c \
+ aws_iot_shadow.c \
+ aws_iot_shadow_json.c \
+ aws_iot_shadow_records.c \
+ jsmn.c \
+ network.c \
+ timer.c
+
+OBJECTS = $(SOURCES:.c=.o)
+
+LIBS = aws_iot_sl.aem4
+
+.PRECIOUS: %/compiler.opt %/linker.cmd
+
+%/compiler.opt %/linker.cmd : %.cfg
+ @$(CONFIGURO) -c $(CODEGEN_INSTALL_DIR) -t $(TARGET) -p $(PLATFORM) -r release $<
+
+%.o : %.c
+
+%.o : %.c $(APP)/compiler.opt aws_iot_config.h
+ @$(CC) $(CFLAGS) -c $<
+
+all: $(APP).out
+
+$(LIBS): $(OBJECTS)
+ @$(AR) rq $@ $^
+
+$(APP).out: $(LIBS) $(APP).o main.o rom_pin_mux_config.o netwifi.o UARTUtils.o CC3200_LAUNCHXL.o CC3200_LAUNCHXL.cmd $(APP)/linker.cmd
+ @echo building $@ ..
+ @$(LD) -o $@ $^ -x -m $@.map $(LFLAGS)
+
+clean:
+ @echo cleaning ..
+ @ $(call remove, *.o *.out *.map $(LIBS))
+ @ $(RMDIR) $(APP)
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/netwifi.c b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/netwifi.c
--- /dev/null
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 2014-2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+#include <stdbool.h>
+
+#include <xdc/std.h>
+#include <xdc/runtime/System.h>
+
+#include <ti/sysbios/knl/Task.h>
+#include <ti/drivers/GPIO.h>
+
+#include "Board.h"
+#include "wificonfig.h"
+
+#include <simplelink.h>
+#include <osi.h>
+
+static uint32_t deviceConnected = false;
+static uint32_t ipAcquired = false;
+static uint32_t currButton, prevButton;
+
+/*
+ * ======== SimpleLinkWlanEventHandler ========
+ * SimpleLink Host Driver callback for handling WLAN connection or
+ * disconnection events.
+ */
+void SimpleLinkWlanEventHandler(SlWlanEvent_t *pArgs)
+{
+ switch (pArgs->Event) {
+ case SL_WLAN_CONNECT_EVENT:
+ deviceConnected = true;
+ break;
+
+ case SL_WLAN_DISCONNECT_EVENT:
+ deviceConnected = false;
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*
+ * ======== SimpleLinkNetAppEventHandler ========
+ * SimpleLink Host Driver callback for asynchoronous IP address events.
+ */
+void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *pArgs)
+{
+ switch (pArgs->Event) {
+ case SL_NETAPP_IPV4_IPACQUIRED_EVENT:
+ ipAcquired = true;
+ break;
+
+ default:
+ break;
+ }
+}
+
+/*
+ * ======== SimpleLinkSockEventHandler ========
+ */
+void SimpleLinkSockEventHandler(SlSockEvent_t *pArgs)
+{
+
+}
+
+/*
+ * ======== SimpleLinkHttpServerCallback ========
+ * SimpleLink Host Driver callback for HTTP server events.
+ */
+void SimpleLinkHttpServerCallback(SlHttpServerEvent_t *pHttpServerEvent,
+ SlHttpServerResponse_t *pHttpServerResponse)
+{
+}
+
+/*
+ * ======== smartConfigFxn ========
+ */
+void smartConfigFxn()
+{
+ uint8_t policyVal;
+
+ /* Set auto connect policy */
+ sl_WlanPolicySet(SL_POLICY_CONNECTION, SL_CONNECTION_POLICY(1,0,0, 0, 0),
+ &policyVal, sizeof(policyVal));
+
+ /* Start SmartConfig using unsecured method. */
+ sl_WlanSmartConfigStart(0, SMART_CONFIG_CIPHER_NONE, 0, 0, 0,
+ NULL, NULL, NULL);
+}
+
+/*
+ * ======== setStationMode ========
+ * Sets the SimpleLink Wi-Fi in station mode and enables DHCP client
+ */
+void setStationMode(void)
+{
+ int mode;
+ int response;
+ unsigned char param;
+
+ mode = sl_Start(0, 0, 0);
+ if (mode < 0) {
+ System_abort("Could not initialize SimpleLink Wi-Fi");
+ }
+
+ /* Change network processor to station mode */
+ if (mode != ROLE_STA) {
+ sl_WlanSetMode(ROLE_STA);
+
+ /* Restart network processor */
+ sl_Stop(0);
+ mode = sl_Start(0, 0, 0);
+ if (mode < 0) {
+ System_abort("Failed to set SimpleLink Wi-Fi to Station mode");
+ }
+ }
+
+ sl_WlanDisconnect();
+ /* Set auto connect policy */
+ response = sl_WlanPolicySet(SL_POLICY_CONNECTION,
+ SL_CONNECTION_POLICY(1, 0, 0, 0, 0), NULL, 0);
+ if (response < 0) {
+ System_abort("Failed to set connection policy to auto");
+ }
+
+ /* Enable DHCP client */
+ param = 1;
+ response = sl_NetCfgSet(SL_IPV4_STA_P2P_CL_DHCP_ENABLE, 1, 1, ¶m);
+ if(response < 0) {
+ System_abort("Could not enable DHCP client");
+ }
+
+ sl_Stop(0);
+
+ /* Set connection variables to initial values */
+ deviceConnected = false;
+ ipAcquired = false;
+}
+
+/*
+ * ======== wlanConnect =======
+ * Secure connection parameters
+ */
+static int wlanConnect()
+{
+ SlSecParams_t secParams = {0};
+ int ret = 0;
+
+ secParams.Key = (signed char *)SECURITY_KEY;
+ secParams.KeyLen = strlen((const char *)secParams.Key);
+ secParams.Type = SECURITY_TYPE;
+
+ ret = sl_WlanConnect((signed char*)SSID, strlen((const char*)SSID),
+ NULL, &secParams, NULL);
+
+ return (ret);
+}
+
+/*
+ * ======== NetWifi_init =======
+ * Initialize Wifi
+ */
+void NetWiFi_init()
+{
+ SlNetCfgIpV4Args_t ipV4;
+ uint8_t len = sizeof(ipV4);
+ uint8_t dhcpIsOn;
+
+ /* Turn LED OFF. It will be used as a connection indicator */
+ GPIO_write(Board_LED0, Board_LED_OFF);
+ GPIO_write(Board_LED1, Board_LED_OFF);
+ GPIO_write(Board_LED2, Board_LED_OFF);
+
+ setStationMode();
+
+ /* Host driver starts the network processor */
+ if (sl_Start(NULL, NULL, NULL) < 0) {
+ System_abort("Could not initialize WiFi");
+ }
+
+ if (wlanConnect() < 0) {
+ System_abort("Could not connect to WiFi AP");
+
+ }
+
+ /*
+ * Wait for the WiFi to connect to an AP. If a profile for the AP in
+ * use has not been stored yet, press Board_BUTTON0 to start SmartConfig.
+ */
+ while ((deviceConnected != true) || (ipAcquired != true)) {
+ /*
+ * Start SmartConfig if a button is pressed. This could be done with
+ * GPIO interrupts, but for simplicity polling is used to check the
+ * button.
+ */
+ currButton = GPIO_read(Board_BUTTON0);
+ if ((currButton == 0) && (prevButton != 0)) {
+ smartConfigFxn();
+ }
+ prevButton = currButton;
+ Task_sleep(50);
+ }
+
+ /* Retrieve & print the IP address */
+ sl_NetCfgGet(SL_IPV4_STA_P2P_CL_GET_INFO, &dhcpIsOn, &len,
+ (unsigned char *)&ipV4);
+ System_printf("CC3200 has connected to AP and acquired an IP address.\n");
+ System_printf("IP Address: %d.%d.%d.%d\n", SL_IPV4_BYTE(ipV4.ipV4,3),
+ SL_IPV4_BYTE(ipV4.ipV4,2), SL_IPV4_BYTE(ipV4.ipV4,1),
+ SL_IPV4_BYTE(ipV4.ipV4,0));
+ System_flush();
+
+ GPIO_write(Board_LED0, Board_LED_ON);
+}
+
+/*
+ * ======== NetWifi_exit =======
+ */
+void NetWiFi_exit()
+{
+}
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/pin_mux_config.h b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/pin_mux_config.h
--- /dev/null
@@ -0,0 +1,50 @@
+//*****************************************************************************
+// pin_mux_config.h
+//
+// configure the device pins for different signals
+//
+// Copyright (C) 2015 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.
+//
+//*****************************************************************************
+
+// This file was automatically generated on 7/29/2014 at 10:06:44 AM
+// by TI PinMux version 3.0.321
+
+//
+//*****************************************************************************
+
+#ifndef __PIN_MUX_CONFIG_H__
+#define __PIN_MUX_CONFIG_H__
+
+extern void PinMuxConfig(void);
+
+#endif // __PIN_MUX_CONFIG_H__
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/rom_pin_mux_config.c b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/rom_pin_mux_config.c
--- /dev/null
@@ -0,0 +1,97 @@
+//*****************************************************************************
+// rom_pin_mux_config.c
+//
+// configure the device pins for different signals
+//
+// Copyright (C) 2015 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.
+//
+//*****************************************************************************
+
+// This file was automatically generated on 7/29/2014 at 10:06:06 AM
+// by TI PinMux version 3.0.321
+
+//
+//*****************************************************************************
+
+#include "pin_mux_config.h"
+#include "hw_types.h"
+#include "hw_memmap.h"
+#include "hw_gpio.h"
+#include "pin.h"
+#include "gpio.h"
+#include "prcm.h"
+#include "rom.h"
+#include "rom_map.h"
+
+//*****************************************************************************
+void PinMuxConfig(void)
+{
+ //
+ // Enable Peripheral Clocks
+ //
+ MAP_PRCMPeripheralClkEnable(PRCM_UARTA1, PRCM_RUN_MODE_CLK);
+ MAP_PRCMPeripheralClkEnable(PRCM_UARTA0, PRCM_RUN_MODE_CLK);
+ MAP_PRCMPeripheralClkEnable(PRCM_GPIOA1, PRCM_RUN_MODE_CLK);
+ MAP_PRCMPeripheralClkEnable(PRCM_GPIOA2, PRCM_RUN_MODE_CLK);
+
+ //
+ // Configure PIN_07 for UART1 UART1_TX
+ //
+ MAP_PinTypeUART(PIN_07, PIN_MODE_5);
+
+ //
+ // Configure PIN_08 for UART1 UART1_RX
+ //
+ MAP_PinTypeUART(PIN_08, PIN_MODE_5);
+
+ //
+ // Configure PIN_55 for UART0 UART0_TX
+ //
+ MAP_PinTypeUART(PIN_55, PIN_MODE_3);
+
+ //
+ // Configure PIN_57 for UART0 UART0_RX
+ //
+ MAP_PinTypeUART(PIN_57, PIN_MODE_3);
+
+ //
+ // Configure PIN_64 for GPIO Output
+ //
+ MAP_PinTypeGPIO(PIN_64, PIN_MODE_0, false);
+ MAP_GPIODirModeSet(GPIOA1_BASE, 0x2, GPIO_DIR_MODE_OUT);
+
+ //
+ // Configure PIN_15 for GPIO Input
+ //
+ MAP_PinTypeGPIO(PIN_15, PIN_MODE_0, false);
+ MAP_GPIODirModeSet(GPIOA2_BASE, 0x40, GPIO_DIR_MODE_IN);
+}
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/subscribe_publish_sample.c b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/subscribe_publish_sample.c
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Copyright 2010-2015 Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License").
+ * You may not use this file except in compliance with the License.
+ * A copy of the License is located at
+ *
+ * http://aws.amazon.com/apache2.0
+ *
+ * or in the "license" file accompanying this file. This file 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.
+ */
+#include <string.h>
+
+#include <ti/sysbios/knl/Task.h>
+
+#include "aws_iot_log.h"
+#include "aws_iot_version.h"
+#include "aws_iot_mqtt_interface.h"
+#include "aws_iot_config.h"
+
+char HostAddress[255] = AWS_IOT_MQTT_HOST;
+uint32_t port = AWS_IOT_MQTT_PORT;
+uint32_t publishCount = 0;
+
+int MQTTcallbackHandler(MQTTCallbackParams params)
+{
+ INFO("Subscribe callback");
+ INFO("%.*s\t%.*s",(int)params.TopicNameLen, params.pTopicName,
+ (int)params.MessageParams.PayloadLen,
+ (char*)params.MessageParams.pPayload);
+
+ return (0);
+}
+
+void disconnectCallbackHandler(void)
+{
+ WARN("MQTT Disconnect");
+}
+
+void runAWSClient(void)
+{
+ IoT_Error_t rc = NONE_ERROR;
+ int32_t i = 0;
+ bool infinitePublishFlag = true;
+
+ INFO("\nAWS IoT SDK Version %d.%d.%d-%s\n", VERSION_MAJOR, VERSION_MINOR,
+ VERSION_PATCH, VERSION_TAG);
+ MQTTConnectParams connectParams = MQTTConnectParamsDefault;
+ connectParams.KeepAliveInterval_sec = 10;
+ connectParams.isCleansession = true;
+ connectParams.MQTTVersion = MQTT_3_1_1;
+ connectParams.pClientID = "CSDK-test-device";
+ connectParams.pHostURL = HostAddress;
+ connectParams.port = port;
+ connectParams.isWillMsgPresent = false;
+ connectParams.pRootCALocation = AWS_IOT_ROOT_CA_FILENAME;
+ connectParams.pDeviceCertLocation = AWS_IOT_CERTIFICATE_FILENAME;
+ connectParams.pDevicePrivateKeyLocation = AWS_IOT_PRIVATE_KEY_FILENAME;
+ connectParams.mqttCommandTimeout_ms = 2000;
+ connectParams.tlsHandshakeTimeout_ms = 5000;
+ connectParams.isSSLHostnameVerify = true;
+ connectParams.disconnectHandler = disconnectCallbackHandler;
+
+ INFO("Connecting...");
+ rc = aws_iot_mqtt_connect(&connectParams);
+ if (NONE_ERROR != rc) {
+ ERROR("Error(%d) connecting to %s:%d", rc, connectParams.pHostURL,
+ connectParams.port);
+ }
+
+ MQTTSubscribeParams subParams = MQTTSubscribeParamsDefault;
+ subParams.mHandler = MQTTcallbackHandler;
+ subParams.pTopic = "sdkTest/sub";
+ subParams.qos = QOS_0;
+
+ if (NONE_ERROR == rc) {
+ INFO("Subscribing...");
+ rc = aws_iot_mqtt_subscribe(&subParams);
+ if (NONE_ERROR != rc) {
+ ERROR("Error subscribing");
+ }
+ }
+
+ MQTTMessageParams Msg = MQTTMessageParamsDefault;
+ Msg.qos = QOS_0;
+ char cPayload[100];
+ sprintf(cPayload, "%s : %d ", "hello from SDK", i);
+ Msg.pPayload = (void *) cPayload;
+ Msg.PayloadLen = strlen(cPayload) + 1;
+
+ MQTTPublishParams Params = MQTTPublishParamsDefault;
+ Params.pTopic = "sdkTest/sub";
+ Params.MessageParams = Msg;
+
+ if(publishCount != 0){
+ infinitePublishFlag = false;
+ }
+
+ while (NONE_ERROR == rc && (publishCount > 0 || infinitePublishFlag)) {
+ rc = aws_iot_mqtt_yield(100);
+ INFO("-->sleep");
+ Task_sleep(1000);
+ sprintf(cPayload, "%s : %d ", "hello from SDK", i++);
+ rc = aws_iot_mqtt_publish(&Params);
+ if(publishCount > 0){
+ publishCount--;
+ }
+ }
+
+ if (NONE_ERROR != rc){
+ ERROR("An error occurred in the loop. Error code = %d\n", rc);
+ }
+ else {
+ INFO("Publish done\n");
+ }
+}
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/subscribe_publish_sample.cfg b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/subscribe_publish_sample.cfg
--- /dev/null
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+
+/*
+ * ======== subscribe_publish_sample.cfg ========
+ */
+
+/* ================ General configuration ================ */
+var Defaults = xdc.useModule('xdc.runtime.Defaults');
+var Diags = xdc.useModule('xdc.runtime.Diags');
+var Error = xdc.useModule('xdc.runtime.Error');
+var Log = xdc.useModule('xdc.runtime.Log');
+var Main = xdc.useModule('xdc.runtime.Main');
+var Memory = xdc.useModule('xdc.runtime.Memory');
+var System = xdc.useModule('xdc.runtime.System');
+var Text = xdc.useModule('xdc.runtime.Text');
+
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+var Clock = xdc.useModule('ti.sysbios.knl.Clock');
+var Task = xdc.useModule('ti.sysbios.knl.Task');
+var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
+var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');
+var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
+var Mailbox = xdc.useModule('ti.sysbios.knl.Mailbox');
+
+/*
+ * Program.stack is ignored with IAR. Use the project options in
+ * IAR Embedded Workbench to alter the system stack size.
+ */
+if (!Program.build.target.$name.match(/iar/)) {
+ /*
+ * Reducing the system stack size (used by ISRs and Swis) to reduce
+ * RAM usage.
+ */
+ Program.stack = 0x400;
+}
+
+/*
+ * Comment this line to allow module names to be loaded on the target.
+ * The module name strings are placed in the .const section. Setting this
+ * parameter to false will save space in the .const section. Error and
+ * Assert messages will contain an "unknown module" prefix instead
+ * of the actual module name.
+ */
+Defaults.common$.namedModule = false;
+
+/*
+ * Minimize exit handler array in System. The System module includes
+ * an array of functions that are registered with System_atexit() to be
+ * called by System_exit().
+ */
+System.maxAtexitHandlers = 2;
+
+/*
+ * Comment this line to allow Error, Assert, and Log strings to be
+ * loaded on the target. These strings are placed in the .const section.
+ * Setting this parameter to false will save space in the .const section.
+ * Error, Assert and Log message will print raw ids and args instead of
+ * a formatted message.
+ */
+Text.isLoaded = false;
+
+/* ================ System configuration ================ */
+var SysCallback = xdc.useModule('xdc.runtime.SysCallback');
+SysCallback.abortFxn = "&UARTUtils_systemAbort";
+SysCallback.putchFxn = "&UARTUtils_systemPutch";
+SysCallback.readyFxn = "&UARTUtils_systemReady";
+System.SupportProxy = SysCallback;
+
+/* Enable Semihosting for GNU targets to print to CCS console */
+if (Program.build.target.$name.match(/gnu/)) {
+ var SemiHost = xdc.useModule('ti.sysbios.rts.gnu.SemiHostSupport');
+}
+
+/* ================ BIOS configuration ================ */
+/*
+ * Disable unused BIOS features to minimize footprint.
+ * This example uses Tasks but not Swis or Clocks.
+ */
+var BIOS = xdc.useModule('ti.sysbios.BIOS');
+BIOS.libType = BIOS.LibType_Custom;
+BIOS.logsEnabled = false;
+BIOS.assertsEnabled = false;
+
+BIOS.heapSize = 32768;
+
+/* Runtime stack checking is performed */
+Task.checkStackFlag = true;
+Hwi.checkStackFlag = true;
+
+/* Reduce the number of task priorities */
+Task.numPriorities = 4;
+
+/* ================ Driver configuration ================ */
+var TIRTOS = xdc.useModule('ti.tirtos.TIRTOS');
+TIRTOS.useGPIO = true;
+TIRTOS.useUART = true;
+
+/* ================ HTTP configuration ================ */
+var Http = xdc.useModule('ti.net.http.Http');
+Http.networkStack = Http.SimpleLink;
diff --git a/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/wificonfig.h b/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/wificonfig.h
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * 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.
+ */
+#ifndef WIFICONFIG_H
+#define WIFICONFIG_H
+
+/* USER STEP: Update these macros */
+#define SSID ""
+#define SECURITY_KEY ""
+#define SECURITY_TYPE SL_SEC_TYPE_WPA
+
+#endif