Commit 129bb6b1 authored by Deomid Ryabkov's avatar Deomid Ryabkov Committed by rojer

Add MSP432 lib and example

PUBLISHED_FROM=57ff02457269938feae805f2972b96b15931d41a
parent c8b09c22
......@@ -7,9 +7,6 @@ PORT ?= auto
MAKEFLAGS += w
all clean:
rm -rf ccs/*/Debug
rm -rf ccs/*/Release
rm -rf ccs/*/.launches
docker run --rm -i -v $(SRC_DIR):/src $(SDK) \
/bin/bash -c "\
make -C /src/mongoose mongoose.c mongoose.h && \
......
......@@ -31,7 +31,7 @@
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.1334773591" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
<listOptionValue builtIn="false" value="CC3200_FS_SLFS=1"/>
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
<listOptionValue builtIn="false" value="USE_FREERTOS"/>
<listOptionValue builtIn="false" value="cc3200"/>
</option>
......@@ -126,7 +126,7 @@
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.709446512" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
<listOptionValue builtIn="false" value="CC3200_FS_SLFS=1"/>
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
<listOptionValue builtIn="false" value="USE_FREERTOS"/>
<listOptionValue builtIn="false" value="cc3200"/>
</option>
......
eclipse.preferences.version=1
inEditor=false
onBuild=false
eclipse.preferences.version=1
environment/project/com.ti.ccstudio.buildDefinitions.TMS470.Release.2030896039/append=true
environment/project/com.ti.ccstudio.buildDefinitions.TMS470.Release.2030896039/appendContributed=true
eclipse.preferences.version=1
org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker
eclipse.preferences.version=1
encoding//Debug/makefile=UTF-8
encoding//Debug/objects.mk=UTF-8
encoding//Debug/sources.mk=UTF-8
encoding//Debug/subdir_rules.mk=UTF-8
encoding//Debug/subdir_vars.mk=UTF-8
encoding//Release/makefile=UTF-8
encoding//Release/objects.mk=UTF-8
encoding//Release/sources.mk=UTF-8
encoding//Release/subdir_rules.mk=UTF-8
encoding//Release/subdir_vars.mk=UTF-8
clean:
rm -rf */Debug */Release */.launches */.settings */.xdchelp */src
......@@ -29,7 +29,7 @@
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.2068422510" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
<listOptionValue builtIn="false" value="CC3200_FS_SLFS=1"/>
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
<listOptionValue builtIn="false" value="cc3200"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION.1338331575" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/>
......@@ -94,7 +94,7 @@
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE.1633469996" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.DEFINE" valueType="definedSymbols">
<listOptionValue builtIn="false" value="MG_ENABLE_HTTP_STREAMING_MULTIPART=1"/>
<listOptionValue builtIn="false" value="SL_PLATFORM_MULTI_THREADED=1"/>
<listOptionValue builtIn="false" value="CC3200_FS_SLFS=1"/>
<listOptionValue builtIn="false" value="MG_FS_SLFS=1"/>
<listOptionValue builtIn="false" value="cc3200"/>
</option>
<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION.627114921" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_5.2.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/>
......
eclipse.preferences.version=1
inEditor=false
onBuild=false
eclipse.preferences.version=1
org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker
eclipse.preferences.version=1
encoding//Debug/makefile=UTF-8
encoding//Debug/objects.mk=UTF-8
encoding//Debug/sources.mk=UTF-8
encoding//Debug/subdir_rules.mk=UTF-8
encoding//Debug/subdir_vars.mk=UTF-8
encoding//Release/makefile=UTF-8
encoding//Release/objects.mk=UTF-8
encoding//Release/sources.mk=UTF-8
encoding//Release/subdir_rules.mk=UTF-8
encoding//Release/subdir_vars.mk=UTF-8
......@@ -228,6 +228,6 @@ void SimpleLinkSockEventHandler(SlSockEvent_t *e) {
}
void SimpleLinkGeneralEventHandler(SlDeviceEvent_t *e) {
LOG(LL_INFO, ("status %d sender %d", e->EventData.deviceEvent.status,
e->EventData.deviceEvent.sender));
LOG(LL_ERROR, ("status %d sender %d", e->EventData.deviceEvent.status,
e->EventData.deviceEvent.sender));
}
<?xml version="1.0" encoding="UTF-8" ?>
<?ccsproject version="1.0"?>
<projectOptions>
<deviceVariant value="MSP432P401R"/>
<deviceFamily value="MSP432"/>
<deviceEndianness value="little"/>
<codegenToolVersion value="5.2.7"/>
<isElfFormat value="true"/>
<rts value="libc.a"/>
<createSlaveProjects value=""/>
<origin value="/home/rojer/cesanta/ti/tirtos_msp43x_2_16_00_08/resources/msp_exp432P401RLaunchpad/networkExamples/tiNetworkExamples/wiFiExamples/com_ti_rtsc_tirtosmsp430_example_101.projectspec"/>
<templateProperties value="id=com_ti_rtsc_tirtosmsp430_example_101.projectspec.tcpEchoCC3X00_MSP_EXP432P401R_TI_MSP432P401R,type=rtsc,products=com.ti.rtsc.TIRTOSmsp430,xdcToolsVersion=3_32_00_06_core,target=ti.targets.arm.elf.M4F,platform=ti.platforms.msp432:MSP432P401R,buildProfile=release,isHybrid=true,configuroOptions= --compileOptions &quot;${COMPILER_FLAGS} &quot;,"/>
<connection value="common/targetdb/connections/TIXDS110_Connection.xml"/>
<isTargetManual value="false"/>
</projectOptions>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MG_hello</name>
<comment></comment>
<projects>
<project>Mongoose</project>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.rtsc.xdctools.buildDefinitions.XDC.xdcNature</nature>
<nature>com.ti.ccstudio.core.ccsNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
</projectDescription>
/*
* 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 "MSP_EXP432P401R.h"
#define Board_initGeneral MSP_EXP432P401R_initGeneral
#define Board_initGPIO MSP_EXP432P401R_initGPIO
#define Board_initI2C MSP_EXP432P401R_initI2C
#define Board_initPWM MSP_EXP432P401R_initPWM
#define Board_initSDSPI MSP_EXP432P401R_initSDSPI
#define Board_initSPI MSP_EXP432P401R_initSPI
#define Board_initUART MSP_EXP432P401R_initUART
#define Board_initWatchdog MSP_EXP432P401R_initWatchdog
#define Board_initWiFi MSP_EXP432P401R_initWiFi
#define Board_LED_ON MSP_EXP432P401R_LED_ON
#define Board_LED_OFF MSP_EXP432P401R_LED_OFF
#define Board_BUTTON0 MSP_EXP432P401R_S1
#define Board_BUTTON1 MSP_EXP432P401R_S2
#define Board_LED0 MSP_EXP432P401R_LED1
#define Board_LED1 MSP_EXP432P401R_LED_RED
#define Board_LED2 MSP_EXP432P401R_LED_RED
/*
* MSP_EXP432P401R_LED_GREEN & MSP_EXP432P401R_LED_BLUE are used for
* PWM examples. Uncomment the following lines if you would like to control
* the LEDs with the GPIO driver.
*/
//#define Board_LED2 MSP_EXP432P401R_LED_GREEN
//#define Board_LED3 MSP_EXP432P401R_LED_BLUE
#define Board_I2C0 MSP_EXP432P401R_I2CB0
#define Board_I2C_TMP MSP_EXP432P401R_I2CB0
#define Board_I2C_NFC MSP_EXP432P401R_I2CB0
#define Board_I2C_TPL0401 MSP_EXP432P401R_I2CB0
#define Board_PWM0 MSP_EXP432P401R_PWM_TA1_1
#define Board_PWM1 MSP_EXP432P401R_PWM_TA1_2
#define Board_SDSPI0 MSP_EXP432P401R_SDSPIB0
#define Board_SPI0 MSP_EXP432P401R_SPIB0
#define Board_SPI1 MSP_EXP432P401R_SPIB2
#define Board_UART0 MSP_EXP432P401R_UARTA0
#define Board_UART1 MSP_EXP432P401R_UARTA2
#define Board_WATCHDOG0 MSP_EXP432P401R_WATCHDOG
#define Board_WIFI MSP_EXP432P401R_WIFI
#define Board_WIFI_SPI MSP_EXP432P401R_SPIB0
/* Board specific I2C addresses */
#define Board_TMP006_ADDR (0x40)
#define Board_RF430CL330_ADDR (0x28)
#define Board_TPL0401_ADDR (0x40)
#ifdef __cplusplus
}
#endif
#endif /* __BOARD_H */
This diff is collapsed.
This diff is collapsed.
/*
* Copyright (c) 2015-2016, 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.
*/
/*
* ======== MSP_EXP432P401R.cmd ========
* Define the memory block start/length for the MSP_EXP432P401R M4
*/
MEMORY
{
MAIN (RX) : origin = 0x00000000, length = 0x00040000
INFO (RX) : origin = 0x00200000, length = 0x00004000
SRAM_CODE (RWX): origin = 0x01000000, length = 0x00010000
SRAM_DATA (RW) : origin = 0x20000000, length = 0x00010000
}
/* Section allocation in memory */
SECTIONS
{
.text : > MAIN
.const : > MAIN
.cinit : > MAIN
.pinit : > MAIN
.data : > SRAM_DATA
.bss : > SRAM_DATA
.sysmem : > SRAM_DATA
.stack : > SRAM_DATA (HIGH)
}
/* Symbolic definition of the WDTCTL register for RTS */
WDTCTL_SYM = 0x4000480C;
/*
* 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 MSP_EXP432P401R.h
*
* @brief MSP_EXP432P401R Board Specific APIs
*
* The MSP_EXP432P401R header file should be included in an application as
* follows:
* @code
* #include <MSP_EXP432P401R.h>
* @endcode
*
* ============================================================================
*/
#ifndef __MSP_EXP432P401R_H
#define __MSP_EXP432P401R_H
#ifdef __cplusplus
extern "C" {
#endif
/* LEDs on MSP_EXP432P401R are active high. */
#define MSP_EXP432P401R_LED_OFF (0)
#define MSP_EXP432P401R_LED_ON (1)
/*!
* @def MSP_EXP432P401R_GPIOName
* @brief Enum of GPIO names on the MSP_EXP432P401R dev board
*/
typedef enum MSP_EXP432P401R_GPIOName {
MSP_EXP432P401R_S1 = 0,
MSP_EXP432P401R_S2,
MSP_EXP432P401R_LED1,
MSP_EXP432P401R_LED_RED,
/*
* MSP_EXP432P401R_LED_GREEN & MSP_EXP432P401R_LED_BLUE are used for
* PWM examples. Uncomment the following lines if you would like to control
* the LEDs with the GPIO driver.
*/
//MSP_EXP432P401R_LED_GREEN,
//MSP_EXP432P401R_LED_BLUE,
MSP_EXP432P401R_GPIOCOUNT
} MSP_EXP432P401R_GPIOName;
/*!
* @def MSP_EXP432P401R_I2CName
* @brief Enum of I2C names on the MSP_EXP432P401R dev board
*/
typedef enum MSP_EXP432P401R_I2CName {
MSP_EXP432P401R_I2CB0 = 0,
MSP_EXP432P401R_I2CCOUNT
} MSP_EXP432P401R_I2CName;
/*!
* @def MSP_EXP432P401R_PWMName
* @brief Enum of PWM names on the MSP_EXP432P401R dev board
*/
typedef enum MSP_EXP432P401R_PWMName {
MSP_EXP432P401R_PWM_TA1_1 = 0,
MSP_EXP432P401R_PWM_TA1_2,
MSP_EXP432P401R_PWMCOUNT
} MSP_EXP432P401R_PWMName;
/*!
* @def MSP_EXP432P401R_SDSPIName
* @brief Enum of SDSPI names on the MSP_EXP432P401R dev board
*/
typedef enum MSP_EXP432P401R_SDSPIName {
MSP_EXP432P401R_SDSPIB0 = 0,
MSP_EXP432P401R_SDSPICOUNT
} EMSP_EXP432P401R_SDSPIName;
/*!
* @def MSP_EXP432P401R_SPIName
* @brief Enum of SPI names on the MSP_EXP432P401R dev board
*/
typedef enum MSP_EXP432P401R_SPIName {
MSP_EXP432P401R_SPIB0 = 0,
MSP_EXP432P401R_SPIB2,
MSP_EXP432P401R_SPICOUNT
} MSP_EXP432P401R_SPIName;
/*!
* @def MSP_EXP432P401R_UARTName
* @brief Enum of UART names on the MSP_EXP432P401R dev board
*/
typedef enum MSP_EXP432P401R_UARTName {
MSP_EXP432P401R_UARTA0 = 0,
MSP_EXP432P401R_UARTA2,
MSP_EXP432P401R_UARTCOUNT
} MSP_EXP432P401R_UARTName;
/*!
* @def MSP_EXP432P401R_WatchdogName
* @brief Enum of Watchdog names on the MSP_EXP432P401R dev board
*/
typedef enum MSP_EXP432P401R_WatchdogName {
MSP_EXP432P401R_WATCHDOG = 0,
MSP_EXP432P401R_WATCHDOGCOUNT
} MSP_EXP432P401R_WatchdogName;
/*!
* @def MSP_EXP432P401R_WiFiName
* @brief Enum of WiFi names on the MSP_EXP432P401R dev board
*/
typedef enum MSP_EXP432P401R_WiFiName {
MSP_EXP432P401R_WIFI = 0,
MSP_EXP432P401R_WIFICOUNT
} MSP_EXP432P401R_WiFiName;
/*!
* @brief Initialize the general board specific settings
*
* This function initializes the general board specific settings.
*/
extern void MSP_EXP432P401R_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 MSP_EXP432P401R_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 MSP_EXP432P401R_initI2C(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 MSP_EXP432P401R_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 MSP_EXP432P401R_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 MSP_EXP432P401R_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 MSP_EXP432P401R_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 MSP_EXP432P401R_initWatchdog(void);
/*!
* @brief Initialize board specific WiFi settings
*
* This function initializes the board specific WiFi settings and then calls
* the WiFi_init API to initialize the WiFi module.
*
* The hardware resources controlled by the WiFi module are determined by the
* WiFi_config variable.
*
* A SimpleLink CC3100 device or module is required and must be connected to
* use the WiFi driver.
*/
extern void MSP_EXP432P401R_initWiFi(void);
#ifdef __cplusplus
}
#endif
#endif /* __MSP_EXP432P401R_H */
/*
* 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 <stdbool.h>
#include <stdio.h>
#include <string.h>
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/runtime/System.h>
/* BIOS Header files */
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
/* TI-RTOS Header files */
#include <ti/drivers/GPIO.h>
#include <ti/drivers/WiFi.h>
/* Example/Board Header file */
#include "Board.h"
/* Mongoose.h brings in SimpleLink support. Do not include simplelink.h. */
#include <mongoose.h>
#include "wifi.h"
void mg_ev_handler(struct mg_connection *nc, int ev, void *p) {
static const char *reply_fmt =
"HTTP/1.0 200 OK\r\n"
"Connection: close\r\n"
"Content-Type: text/plain\r\n"
"\r\n"
"Hello %s\n";
LOG(LL_DEBUG, ("conn %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 *) p;
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));
mg_printf(nc, reply_fmt, addr);
nc->flags |= MG_F_SEND_AND_CLOSE;
break;
}
case MG_EV_CLOSE: {
LOG(LL_INFO, ("Connection %p closed", nc));
break;
}
}
}
static void mg_init(struct mg_mgr *mgr) {
WiFi_Params wifiParams;
WiFi_Handle handle;
LOG(LL_INFO, ("MG task running"));
/* Open WiFi driver */
WiFi_Params_init(&wifiParams);
wifiParams.bitRate = 2000000;
handle = WiFi_open(Board_WIFI, Board_WIFI_SPI, NULL, &wifiParams);
if (handle == NULL) {
System_abort("WiFi driver failed to open.");
}
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));
}
}
int main(void) {
Board_initGeneral();
Board_initGPIO();
Board_initWiFi();
setvbuf(stdout, NULL, _IOLBF, 0);
setvbuf(stderr, NULL, _IOLBF, 0);
cs_log_set_level(LL_INFO);
cs_log_set_file(stdout);
if (!mg_start_task(MG_TASK_PRIORITY, MG_TASK_STACK_SIZE, mg_init)) {
LOG(LL_ERROR, ("Error starting Mongoose task"));
return 1;
}
LOG(LL_INFO, ("OK"));
osi_start();
return 0;
}
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));
}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<configurations XML_version="1.2" id="configurations_0">
<configuration XML_version="1.2" id="configuration_0">
<instance XML_version="1.2" desc="Texas Instruments XDS110 USB Debug Probe" href="connections/TIXDS110_Connection.xml" id="Texas Instruments XDS110 USB Debug Probe" xml="TIXDS110_Connection.xml" xmlpath="connections"/>
<connection XML_version="1.2" id="Texas Instruments XDS110 USB Debug Probe">
<instance XML_version="1.2" href="drivers/tixds510cs_dap.xml" id="drivers" xml="tixds510cs_dap.xml" xmlpath="drivers"/>
<instance XML_version="1.2" href="drivers/tixds510cortexM.xml" id="drivers" xml="tixds510cortexM.xml" xmlpath="drivers"/>
<platform XML_version="1.2" id="platform_0">
<instance XML_version="1.2" desc="MSP432P401R" href="devices/msp432p401r.xml" id="MSP432P401R" xml="msp432p401r.xml" xmlpath="devices"/>
</platform>
</connection>
</configuration>
</configurations>
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
#include "wifi.h"
#include "mongoose.h"
#include "simplelink.h"
#include "wlan.h"
void SimpleLinkWlanEventHandler(SlWlanEvent_t *e) {
switch (e->Event) {
case SL_WLAN_CONNECT_EVENT:
LOG(LL_INFO, ("WiFi: connected"));
break;
case SL_WLAN_STA_CONNECTED_EVENT:
LOG(LL_INFO, ("WiFi: station connected"));
break;
case SL_WLAN_STA_DISCONNECTED_EVENT:
LOG(LL_INFO, ("WiFi: station disconnected"));
break;
default:
LOG(LL_INFO, ("WiFi: event %d", e->Event));
}
}
int ip_acquired = 0;
void SimpleLinkNetAppEventHandler(SlNetAppEvent_t *e) {
if (e->Event == SL_NETAPP_IPV4_IPACQUIRED_EVENT) {
SlIpV4AcquiredAsync_t *ed = &e->EventData.ipAcquiredV4;
LOG(LL_INFO, ("IP acquired: %lu.%lu.%lu.%lu", SL_IPV4_BYTE(ed->ip, 3),
SL_IPV4_BYTE(ed->ip, 2), SL_IPV4_BYTE(ed->ip, 1),
SL_IPV4_BYTE(ed->ip, 0)));
ip_acquired = 1;
} else if (e->Event == SL_NETAPP_IP_LEASED_EVENT) {
LOG(LL_INFO, ("IP leased"));
} else {
LOG(LL_INFO, ("NetApp event %d", e->Event));
}
}
bool wifi_setup_ap(const char *ssid, const char *pass, int channel) {
uint8_t v;
if (sl_WlanSetMode(ROLE_AP) != 0) {
return false;
}
if (sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SSID, strlen(ssid),
(const uint8_t *) ssid) != 0) {
return false;
}
v = strlen(pass) > 0 ? SL_SEC_TYPE_WPA : SL_SEC_TYPE_OPEN;
if (sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_SECURITY_TYPE, 1, &v) != 0) {
return false;
}
if (v == SL_SEC_TYPE_WPA &&
sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_PASSWORD, strlen(pass),
(const uint8_t *) pass) != 0) {
return false;
}
v = channel;
if (sl_WlanSet(SL_WLAN_CFG_AP_ID, WLAN_AP_OPT_CHANNEL, 1, &v) != 0) {
return false;
}
sl_NetAppStop(SL_NET_APP_DHCP_SERVER_ID);
{
SlNetCfgIpV4Args_t ipcfg;
memset(&ipcfg, 0, sizeof(ipcfg));
if (!inet_pton(AF_INET, "192.168.4.1", &ipcfg.ipV4) ||
!inet_pton(AF_INET, "255.255.255.0", &ipcfg.ipV4Mask) ||
/* This means "disable". 0.0.0.0 won't do. */
!inet_pton(AF_INET, "255.255.255.255", &ipcfg.ipV4DnsServer) ||
/* We'd like to disable gateway too, but DHCP server refuses to start.
*/
!inet_pton(AF_INET, "192.168.4.1", &ipcfg.ipV4Gateway) ||
sl_NetCfgSet(SL_IPV4_AP_P2P_GO_STATIC_ENABLE, IPCONFIG_MODE_ENABLE_IPV4,
sizeof(ipcfg), (uint8_t *) &ipcfg) != 0) {
return false;
}
}
{
SlNetAppDhcpServerBasicOpt_t dhcpcfg;
memset(&dhcpcfg, 0, sizeof(dhcpcfg));
dhcpcfg.lease_time = 900;
if (!inet_pton(AF_INET, "192.168.4.20", &dhcpcfg.ipv4_addr_start) ||
!inet_pton(AF_INET, "192.168.4.200", &dhcpcfg.ipv4_addr_last) ||
sl_NetAppSet(SL_NET_APP_DHCP_SERVER_ID, NETAPP_SET_DHCP_SRV_BASIC_OPT,
sizeof(dhcpcfg), (uint8_t *) &dhcpcfg) != 0) {
return false;
}
}
sl_Stop(0);
int role = sl_Start(NULL, NULL, NULL);
if (role != ROLE_AP) {
LOG(LL_ERROR, ("Expected ROLE_AP (%d), got %d", ROLE_AP, role));
return false;
}
if (sl_NetAppStart(SL_NET_APP_DHCP_SERVER_ID) != 0) {
LOG(LL_ERROR, ("DHCP server failed to start"));
return false;
}
LOG(LL_INFO, ("WiFi: AP %s configured", ssid));
return true;
}
bool wifi_setup_sta(const char *ssid, const char *pass) {
SlSecParams_t sp;
LOG(LL_INFO, ("WiFi: connecting to %s", ssid));
if (sl_WlanSetMode(ROLE_STA) != 0) return false;
sl_Stop(0);
sl_Start(NULL, NULL, NULL);
sl_WlanDisconnect();
sp.Key = (_i8 *) pass;
sp.KeyLen = strlen(pass);
sp.Type = sp.KeyLen ? SL_SEC_TYPE_WPA : SL_SEC_TYPE_OPEN;
if (sl_WlanConnect((const _i8 *) ssid, strlen(ssid), 0, &sp, 0) != 0) {
return false;
}
return true;
}
/*
* Copyright (c) 2014-2016 Cesanta Software Limited
* All rights reserved
*/
#ifndef CS_MONGOOSE_EXAMPLES_CC3200_WIFI_H_
#define CS_MONGOOSE_EXAMPLES_CC3200_WIFI_H_
#include <stdbool.h>
bool wifi_setup_ap(const char *ssid, const char *pass, int channel);
bool wifi_setup_sta(const char *ssid, const char *pass);
#endif /* CS_MONGOOSE_EXAMPLES_CC3200_WIFI_H_ */
clean:
rm -rf */Debug */Release */.config */.launches */.settings */.xdchelp */src
<?xml version="1.0" encoding="UTF-8" ?>
<?ccsproject version="1.0"?>
<projectOptions>
<deviceVariant value="MSP432P401R"/>
<deviceFamily value="MSP432"/>
<deviceEndianness value="little"/>
<codegenToolVersion value="5.2.7"/>
<isElfFormat value="true"/>
<connection value="common/targetdb/connections/TIXDS110_Connection.xml"/>
<createSlaveProjects value=""/>
<templateProperties value="id=org.eclipse.rtsc.project.templates.EmptyRtscApplication,buildProfile=release,isHybrid=true,"/>
<isTargetManual value="false"/>
</projectOptions>
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Mongoose</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
<triggers>full,incremental,</triggers>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.rtsc.xdctools.buildDefinitions.XDC.xdcNature</nature>
<nature>com.ti.ccstudio.core.ccsNature</nature>
<nature>org.eclipse.cdt.core.cnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
<nature>org.eclipse.cdt.core.ccnature</nature>
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
</natures>
<linkedResources>
<link>
<name>mongoose.c</name>
<type>1</type>
<locationURI>PARENT-4-PROJECT_LOC/mongoose.c</locationURI>
</link>
<link>
<name>mongoose.h</name>
<type>1</type>
<locationURI>PARENT-4-PROJECT_LOC/mongoose.h</locationURI>
</link>
</linkedResources>
</projectDescription>
var BIOS = xdc.useModule('ti.sysbios.BIOS');
......@@ -3,7 +3,7 @@
# `wildcard ./*/` works in both linux and linux/wine, while `wildcard */` enumerates nothing under wine
SUBDIRS = $(sort $(dir $(wildcard ./*/)))
SUBDIRS:=$(filter-out ./ ./CC3200/, $(SUBDIRS))
SUBDIRS:=$(filter-out ./ ./CC3200/ ./ESP8266_RTOS/ ./MSP432/, $(SUBDIRS))
ifeq ($(OS), Windows_NT)
SUBDIRS:=$(filter-out ./load_balancer/ ./netcat/ ./raspberry_pi_mjpeg_led/ ./captive_dns_server/, $(SUBDIRS))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment