This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MQTT client sample with AWS

Other Parts Discussed in Thread: UNIFLASH, CC3200, SYSBIOS, CC3200MOD, CC3200SDK

Hi All,

I have tested AWS IoT sample.

It can successfully connect to AWS IoT server for MQTT function.

However, I found that sample is hard to use because it is not like TI's sample code format.

And I am trying to use TI's MQTT sample to connect to AWS IoT.

Here is my code for configuration:

/*Defining Broker IP address and port Number*/
#define SERVER_ADDRESS "XXXXXXXXXXXXX.iot.ap-northeast-1.amazonaws.com"
#define PORT_NUMBER 8883

char *security_file_list[] = {"/cert/private.key", "/cert/client.pem", "/cert/ca.pem"};

/* connection configuration */
connect_config usr_connect_config[] =
{
{
{
{
SL_MQTT_NETCONN_SEC, //SL_MQTT_NETCONN_URL, /**< Enumerate connection type */
SERVER_ADDRESS, /**< Server Address: URL or IP */
PORT_NUMBER, /**< Port number of MQTT server */
SL_SO_SEC_METHOD_TLSV1_2, //0 /**< Method to tcp secured socket */
SL_SEC_MASK_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, //0, /**< Cipher to tcp secured socket */
3, //0, /**< Number of files for secure transfer */
security_file_list, //NULL /* SL needs 4 files*/
},
SERVER_MODE,
true,
},
NULL,
(unsigned char*) CLIENT_ID,
NULL,
NULL,
true,
KEEP_ALIVE_TIMER,
{Mqtt_Recv, sl_MqttEvt, sl_MqttDisconnect},
TOPIC_COUNT,
{TOPIC1, TOPIC2}, //, TOPIC3},
{QOS2, QOS2}, //, QOS2},
{WILL_TOPIC,WILL_MSG,WILL_QOS,WILL_RETAIN},
false
}
};

Before connect to MQTT broker, I already set current time with

retVal = sl_DevSet(SL_DEVICE_GENERAL_CONFIGURATION,
SL_DEVICE_GENERAL_CONFIGURATION_DATE_TIME,
sizeof(SlDateTime_t),(unsigned char *)(&g_time));

The CA, Client, key files are flashed to CC3200 on Uniflash.

The CA, Client, Key files can be used on IoT sample successfully

but it seems cannot use same setting on MQTT demo code.

It cannot connect to server on MQTT sample code.

Does anyone have experience about this?

Thank you.

Best Regards,

Bryan

  • Moving to TI-RTOS forum

    Regards,
    Gigi Joseph.
  • Hi Joseph,

    I dun think it is a problem on TI-RTOS.
    I am trying to use the MQTT sample on IAR.
    It is using FreeRTOS.
    I think it is a problem on CC3200 forum.

    Thank you.
  • Hi Bryan,
    What TI software products are you using? I don't know where the MQTT you are referring to is coming from.
    Best regards,
    Janet
  • Hi Bryan,

    It looks like you are using the SimpleLink MQTT APIs directly, while you may eventually get this approach to work, you should use the pre-ported AWS IoT Agents that enable easy connection to AWS IoT. The source code and build instructions for the AWS IoT agent port for CC3200 Launchpad usinc C SDK at:

    git.ti.com/.../aws-iot-device-sdk-embedded-c

    and check out the info at:
    www.ti.com/.../IoT-Amazon-Web-Services-for-SimpleLink-Wi-Fi.html

    Murat

     

  • Hi Murat,

    I tried that SDK.
    I can successfully connect to AWS but I found that SDK is hard to use
    and it is not like the standard SimpleLink APIs.
    For example, it is hard to import OTA to that AWS SDK.
    Therefore, I want to use the SimpleLink MQTT APIs to access AWS.
    But it seems not work with correct certs.
    Do you have any idea how to import it?

    Thank you.
    Bryan
  • Hi Janet,

    I am using CC3200.

    Thank you.
    Bryan
  • Hi Murat,

    For the AWS SDK, is there any way to build on IAR or CCS?

    Thank you.
    Bryan
  • Ok, thanks. BTW, there is no current support for IAR or CCS builds.

  • Bryan/Murat,

    Have you come to a resolution on this question? I am also interested in merging the AWS sample with example projects in the CC3200 SDK (specifically OTA, provisioning using TI Smartlink, and wlan_station/WiFi direct mode).

    I'm interested in starting off in the right direction. Would it be recommended to start from the aws-iot-device-sdk-embedded-c project or from one of the TI example projects (ie mqtt_client)?
  • Hi,

    I think starting out with the TI AWS-IoT SDK might be the better starting point if you will do development on a CC32xx device.
    I think this thread is closed, but if you have specific questions you might want to post it on a new thread in this forum.

    Best wishes,

    Murat

  • Team,

    I want to ensure you are using the latest supported AWS SDK. We are currently supporting AWS SDK 1.1.1. Follow this link to our gitorious server and clone the aws-iot-devices-sdk-embedded-c.git repository to your computer.

    https://git.ti.com/iotdev/aws-iot-device-sdk-embedded-c

    As you have discovered, the examples in this SDK are hard to integrate into a CCS environment. Here is what I did.

    1. Create a CCS project which references the AWS SDK.
    2. Modify the build command to only build the AWS library
    3. Create my own CCS project and reference the AWS project.

    Here are some of the CCS details.

    1. Create a project

        File > New > Project...
        C/C++ > Makefile Project with Existing Code
        Next

        Project Name: AWS
        Existing Code Location: .../aws/sample_apps/subscribe_publish_sample/platlform_tirtos/cc3200
        Languages > C > Select
        Languages > C++ > Select
        Toolchain for Indexer Settings > TI Build Tools > Select
        Finish

    2. Customize the build command

        Project Explorer > AWS > Select
        Project > Properties
        C/C++ Build > Builder Settings (tab)
        Use default build command > Unselect
        Build command: ${XDCROOT}/gmake -e
        Generate Makefile automatically > Unselect
        Build directory: ${workspace_loc:/AWS/}/

        Behavior (tab)
        Stop on first build error > Select
        Build on resource save > Unselect
        Build (Incremental build): aws_iot_sl.aem4
        Clean: clean

        C/C++ Build > Environment
        <add the following variables>
        TIRTOS_INSTALL_DIR ${COM_TI_RTSC_TIRTOS_CC32XX_INSTALL_DIR}
        TI_ARM_CODEGEN_INSTALL_DIR ${ccs_install_root}/tools/compiler/ti-cgt-arm_5.2.6
        XDC_INSTALL_DIR ${XDCROOT}

    When you build this project, it will build the aws library using the makefile in the AWS SDK. The environment variables will be used by the AWS makefile, so you don't need to make any changes in the AWS SDK.

    In your own CCS project, be sure to link in the aws library and set the include path as needed. For example, here are my settings.

    Include path includes the following (aws-1.1.1 is my git repository I cloned from gitorious):

    "C:\Projects\SensorTag\aws-1.1.1\aws_iot_src\utils"
    "C:\Projects\SensorTag\aws-1.1.1\aws_iot_src\protocol\mqtt"

    Library path includes the following:

    "${workspace_loc:/AWS/aws_iot_sl.aem4}"

    Good luck.

    ~Ramsey

  • Bryan,

    Just to be clear, did you clone the TI AWS IoT repository and follow the instructions in the Readme_CC3200.md file? You do need to make some modifications to the demo code. For example, you must provide your own certificates. You will also need an Amazon IoT account. The readme file gives all the details.

    Here is another getting started page.

    http://processors.wiki.ti.com/index.php/AWS_IoT_Development

    ~Ramsey

  • Ramsey,

    Thank you for writing up how to bring the AWS IoT library into CCS. I've followed your instruction and have the AWS project building successfully in CCS. However, as I'm not able to directly debug this project, I'm not sure where this leaves me or what my next step is.

    Did following these steps just bring AWS IoT as a library into CCS? I was hoping we'd be able to run the subscribe_publish_sample example application. I'm new to CCS so am very weary of trying to create a project from scratch and would much prefer to have a starting point. Can you briefly explain how to actually use the files that we imported (or point me towards some documentation/training to help me learn)?

    Thank you,
    -Jon
  • Jon,

    Look in the CCS Help menu for tutorials on how to use CCS Projects.

    I had created a new project for my application and then written in from scratch. My project linked to the AWS library project I explained above. But this is just one way to put together an application. There are other alternatives.

    At any rate, you should be able to debug the library in CCS. As long as you build the library with debug symbols, it does not matter if you build it outside of CCS or as a project. If CCS cannot file the source file for the library, use the Path Mapping dialog in CCS Preferences to teach CCS how to find the source files.

    If you load and run your program without CCS, you can still use CCS for debugging. Load the program symbols into CCS and then attach to the device.

    ~Ramsey

  • Ramsey,


    I should clarify that I'm not concerned about making a new project, I'm concerned with how to use the AWS library without examples.  I created a project and added the includes as you mentioned.  It builds fine, but when I try adding any logic from subscribe_publish_sample.c I get lots of build errors.


    When you created your project from scratch, what did you test?  Is there a specific header file(s) from the AWS library that outlines what the API's are?  Also, what needs to be done with the license/key files?

  • Jon,

    Are you getting linker errors? Did you add the aws library to your link command? Here is what I added to my linker file search path:

    "${workspace_loc:/AWS/aws_iot_sl.aem4}"

    In my test program, I called the same set of mqtt API functions as the example did. Here are some of the functions I used:

    aws_iot_mqtt_connect
    aws_iot_mqtt_subscribe
    aws_iot_mqtt_yield

    The certificates are the same as in the example programs. I use the certificate filename in my connection parameters, just like in the example.

    ~Ramsey

  • I believe the errors are linker errors, but am not sure.

    I did add "${workspace_loc:/AWS/aws_iot_sl.aem4}" to linker. At least I think I did. I went into Project properties->build->ARM linker->file search path. I believe it belongs in the top box ("Include library file"), but also tried it in the bottom box ("Add <dir> to library search path").

    I also added the two folders you mentioned into the include search path, which I'm pretty sure is correct as they show up in my project's Includes folder. (I used project properties->Build->ARM Compiler->Include Options, bottom box "Add dir to #include search path").

    It seems like trying to copy and paste from this subscribe_publish_sample program is a bit of a rabbit hole. This is why I was preferring to find another route, but I'll go ahead and give you dead ends I've been finding. I've tried bringing it in piece wise to show some of the variety of error messages.

    1. First issue is with some #includes.
    unistd.h - don't know what this file is or where it would be located.
    memory.h - found a similar file, "memory" without the '.h in the 'ti-cgt-arm_5.2.6' folder, but don't think this is the same. When I try to include "memory", it causes a slew of errors with files in the path tools/compiler/ti-cgt-arm_5.2.6
    sys/time.h. I've found a time.h (no sys/) in the 'ti-cgt-arm_5.2.6' folder. Not sure if this is the same file, but I've gone ahead and included this.

    2. It doesn't seem to find function getcwd. (simply says it's an unresolved symbol and stops the build). Note that when I only included library file in the top box (not placing it in the "Add <dir> to library search path", hovering over it showed warning message "<a href="file:/c:/ti/ccsv6/tools/compiler/dmed/HTML/225.html">#225-D</a> function "getcwd" declared implicitly".

    3. When I try to use aws functions like "aws_iot_mqtt_connect" it gets really angry and brings up lots of unresolved symbols such as "NetWiFi_isConnected" and "ti_sysbios_knl_Clock_getTicks_E" (among 16 others). I can't find use of any of these, so I'd assume it's finding issues with some include paths.

    As for certificates, can you clarify a bit more? Are you saying you left them in the original /certs path, and then kept the line "char certDirectory[PATH_MAX + 1] = "../../certs";"?


    Sorry for the lengthy questions here, I really appreciate your help in getting me to the starting line.
  • Here is the error output when I attempt to use aws_iot_mqtt_connect:

    From this, it seems like it's not finding the aem4 library.  The following is my linker settings where I try to add the aem4 library:

    Am I not correctly adding the library?  Note that I can actually see the aem4 file when I click add...->workspace...->AWS.

  • Jon,

    I'm sorry about all the problems. I'll try to answer your questions, but unfortunately I have limit time.

    The header file unistd.h provides access to the POSIX API. I don't use it, so I did not include this header file in my project. Here is a link to Wikipedia in case our want to learn more about it.

    https://en.wikipedia.org/wiki/Unistd.h

    I suggest that you build up your CCS project by adding only the functions you need. As you add the AWS calls, bring in the header file for that function. But don't try to include everything from the example.

    If your intent is simply to replicate the AWS example, then just build it in the AWS SDK. There is no need to recreate it in CCS.

    I did not use getcwd. There is no concept of a current working directory when using SYS/BIOS.

    The function NetWiFi_isConnected is defined in the example file netwifi.c. I copied this file into my CCS project and then modified as needed.

    You get your certificates from Amazon. Then you must flash them onto your device. This is detailed in the file README_CC3200.md in the aws repository. This is a one-time operation. After that, your application simply references the certificates in the connection parameters when you call aws_iot_mqtt_connect. You application will specify the certificate location, but in reality the TLS layer looks for them at a given location. So, you cannot use a different directory path. Just use the same settings as in the AWS certs example.

    Here is a code fragment form my application:

    #define AWS_IOT_MY_THING_NAME           "rvh-cc3200stk"
    #define AWS_IOT_ROOT_CA_FILENAME        "ca.der"
    #define AWS_IOT_CERTIFICATE_FILENAME    "cert.der"
    #define AWS_IOT_PRIVATE_KEY_FILENAME    "key.der"
    
    connectParams.pRootCALocation = "/cert";
    connectParams.pDeviceCertLocation = AWS_IOT_CERTIFICATE_FILENAME;
    connectParams.pDevicePrivateKeyLocation = AWS_IOT_PRIVATE_KEY_FILENAME;
    
    rc = aws_iot_mqtt_connect(&connectParams);

    Looking at your screen shot, it seems you are still missing some libraries from your linker command. You need to add the CC3200 driverlib library as follows:

    "${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/CC3200_driverlib_1.1.0/driverlib/ccs/Release/driverlib.a"

    There are other libraries which are added by the generated linker command file produced during the configuration phase. For these, you need to add the necessary xdc.useModule calls in your application configuration script. Use script from the AWS example as a reference:

    aws/sample_apps/subscribe_publish_sample/platform_tirtos/cc3200/subscribe_publish_sample.cfg

    I'm guessing you need to add the following (and probably some more):

    var Drivers = xdc.useModule('ti.drivers.Config');
    var Config = xdc.useModule('ti.mw.Config');
    var Network = xdc.useModule('ti.net.Network');
    Network.networkStack = Network.SimpleLink;
    var Sntp = xdc.useModule('ti.net.sntp.Sntp');
    Sntp.networkStack = Sntp.SimpleLink;

    I hope this helps.

    ~Ramsey

  • Thanks for the response Ramsey.

    I was only bringing in the sample code as I wasn't sure what was needed. At this point I've stripped the code down to just setup connectParams and call aws_iot_mqtt_connect.

    I've got three followup questions:
    1a. When you say to add netwifi.c, is there any steps outside of just the "add file" command inside CCS? Is there a header file I'd include in my main.c or is CCS doing something special to automatically link functions inside netwifi.c?
    1b. Once I add netwifi.c, I'll have three files in my project (main.c, aws_iot_config.h, and netwifi.c). Are there any other files I need to add?
    2. To clarify the certificates, I understand they get copied into my device (via the certflasher.out built during the AWS IoT readme). I can see them when listing files using uniflash; the show up as /cert/ca.der, /cert/cert.der, and /cert/key.der. But I don't understand how you've setup the connectParams. Should these include the "/cert" path or not? You have used the path (but no file name) for connectParams.pRootCALocation, but for the other two you used the file name (but no path).
    3. I'm not aware of the application configuration script, I've never seen or used something like this before. I have found the .cfg file inside the AWS SDK, but can't find anything inside of CCS. Is this something that exists within my project settings or as an actual file? Please clarify how this file would be setup and linked (or direct me towards the appropriate help topic).

    Thank you,
    -Jon
  • I've found some information on the XDC tools, rtsc.eclipse.org/.../XDCtools_Getting_Started_Guide.pdf and http://www.ti.com.cn/cn/lit/ug/spruex4/spruex4.pdf.  From these, I've created a .cfg file with your XDC.useModule calls (nothing else in this file).


    But there seems to be an issue when I go to build. I've got all the AWS calls cleared out, just trying to build with the .cfg file.  I found the issue is with the call “var Drivers = xdc.useModule('ti.drivers.Config');”)  See screenshot:

    Note that in addition to adding netwifi.c, I've also added board.h and CC3200_LAUNCHXL.h.  I've also added #include <xdc/std.h> to my main.c file.


    I am still worried about how messy the project is becoming with the numerous include paths and additional files I'm adding to my project.  Can you post your simple project that is able to call aws_iot_mqtt_connect()?  If you cannot post the full project, perhaps you can just post some screenshots of your include paths, linker/library search paths, and and main.c #includes. 

  • Hi Jon Schweiger,

    Are you successfully integrated AWS on CCS?

    When I am building source code, I have got error which are posted on bellow link.

    Please go this link e2e.ti.com/.../518986

    Regards,
    Rajneesh
  • I am still not able to build my custom project linking in the AWS aem4 file.  I'm still trying to figure out what I need to do with the .cfg file.  Not sure if there are other issues as well. 

    It looks like you're having trouble building the AWS aem4 library file though.  When I build the imported AWS project, it starts with "C:\\TI\\xdctools_3_32_00_06_core\\gmake" -e aws_iot_sl.aem4 ", so I'm wondering if you've got the project settings correct.  Double check Ramsey's suggested modifications to the AWS project.  Better yet, just remove the project and re-import following his direction line by line.

  • Hi Jon,

    I worked with Ramsey to get a project file cooked up for you.  Please find the attached zip file of a CCS project that builds the subscribe_publish example.

    Note you should follow these steps to properly build this project:

    1. use git clone to get a fresh copy of the AWS C SDK (you could actually use your existing repository, but starting fresh may be a good idea given the issues you've run into thus far)

    2. unzip the attached into the following folder of your AWS repo: <path to AWS C SDK repo>\sample_apps\subscribe_publish_sample\platform_tirtos\cc3200

    3. Open CCS and select File -> Import ...

    4. Choose to import an existing CCS project:

    5. Click next

    6. On the next screen, choose "Select root directory" and then browse to the location of your subscribe/publish example (where you extracted the zip file) and you should see the project appear.

    7. Be sure to uncheck the option to copy the project into your local workspace, then hit finish

    8. Click Finish

    9. Next you need to update the project to point to your XDC tools, TI-RTOS and Code Generation tools locations.

    10. Right click on the project and select "Show Build Settings ..."

    11. Navigate down to the "Environment" settings.  You need to modify the values of the variable (highlighted in the screen shot) to have the full path to your XDC tools, TI-RTOS, and Code Generation tools.  (The screen shot shows paths as they exist on my PC):

    12. Note that these variables have the same names as those found in the products.mak file of the AWS SDK repo.  The "-e" option passed to gmake causes these variables to override those found in products.mak

    13. Click OK


    14. Build the project

    You should be able to build and then you can load and run the subscribe/publish example.

    One caveat is that you would also need to update the example with your AWS info, as described in the README_CC3200.md file.

    Steve

    1856.aws_v1.1.1_subscribe_publish_ccs_project.zip

  • Thank you for following up Steve/Ramsey. 

    I've followed your instructions and have one clarification.  The .zip file you attached has an "AWS" folder inside, which contains the ".settings" folder along with files  ".cproject" and ".project".  If I try putting this "AWS" folder into the instructed location, when I try to build I get the error "gmake: *** No rule to make target `all'.".  If I try instead to copy the contents of folder AWS directly into the cc3200 folder (and re-import the project), the build is successful and I can see new generated files (lots of .o files, an AEM4 file, a MAP file, and an OUT file).  But I cannot enter into debug mode with this project.

    Are your directions here just to allow me to execute the gmake command inside of CCS rather than having to use command prompt?  Then, I would have to load and run the .out file as described in the README_CC3200 file? 

    I was hoping to be able to load/debug just as I can do with the CCS sample projects.  I thought Ramsey was leading me in the right direction with bringing the  AEM4 library file into my project, but there just seemed to be problems with my include paths, linker paths, and xdc configuration.  I was hoping Ramsey could upload the CCS project he had that referenced the AWS AEM4 file.

  • Hi Jon,

    Jon Schweiger said:
    've followed your instructions and have one clarification.  The .zip file you attached has an "AWS" folder inside, which contains the ".settings" folder along with files  ".cproject" and ".project".  If I try putting this "AWS" folder into the instructed location, when I try to build I get the error "gmake: *** No rule to make target `all'.".  If I try instead to copy the contents of folder AWS directly into the cc3200 folder (and re-import the project), the build is successful and I can see new generated files (lots of .o files, an AEM4 file, a MAP file, and an OUT file)

    Yes, good catch.  I should have said to extract the zip file into a temporary location, and then copy the contents into the example.

    Jon Schweiger said:
    Are your directions here just to allow me to execute the gmake command inside of CCS rather than having to use command prompt?  Then, I would have to load and run the .out file as described in the README_CC3200 file? 

    Yes, this project essentially calls the makefile.  It seemed like that's what you wanted based on the previous posts.

    Jon Schweiger said:
    I was hoping to be able to load/debug just as I can do with the CCS sample projects.  I thought Ramsey was leading me in the right direction with bringing the  AEM4 library file into my project, but there just seemed to be problems with my include paths, linker paths, and xdc configuration.  I was hoping Ramsey could upload the CCS project he had that referenced the AWS AEM4 file.

    Note that Ramsey's steps were also for creating a project that calls the makefile, too.

    Jon Schweiger said:
    But I cannot enter into debug mode with this project.

    Isn't the -g (debug) flag being thrown?  This should build for debug.  Are you unable to single step through the project sources?

    Steve

  • Hi Steve,

    I am not sure what you mean with the -g flag.  The build command is "${XDC_INSTALL_DIR}/gmake -e".  gmake does not have a -g parameter (It gives error "invalid command" if I try to add it. 

    My concern is this doesn't seem like a normal project.  It never shows "[Active - Debug]" next to it like when I clikc on any of the other CCS example projects.  When I right click on it->Debug As->Code Composer Debug Session, the debugger launches with whatever program was last selected.  It seems like this is not a real project due to this.

    Also note this project does not show up like a normal project with a General tab.  I will attach screenshots of your project and a normal project (showing the test project I had that tried to link in the AEM4 library file based on Ramsey's earlier post). Note there is no general tab in your project ("AWS") like there is in my custom CCS project ("Test_AWS").

  • Normal project:

  • Jon,

    I went through some experimenting and I have been able to create a CCS project in the form that you're used to.  I'll post the steps on how to do this in a follow up post.

    Jon Schweiger said:
    I am not sure what you mean with the -g flag.

    The -g option is an option for the compiler.  It's used to build in debug mode, as opposed to release mode.

    Jon Schweiger said:
    It never shows "[Active - Debug]" next to it like when I clikc on any of the other CCS example projects.  When I right click on it->Debug As->Code Composer Debug Session, the debugger launches with whatever program was last selected.  It seems like this is not a real project due to this.

    Hmm.  I was able to do this, once I created a new target configuration for the project.

    Note that you can work around this very easily.  Once you have built the project, you can open your target configuration like this:

    1. CCS -> View menu -> Target Configurations
    2. This will open up a window with the list of your target configurations
    3. In the target configuration window, find the target configuration you made for the project
    4. Right click on it and choose "Launch Selected Configuration"
    5. This should take you to the Debug view in CCS
    6. In the Debug window (within the Debug view), right click on "Stellaris in circuit debug interface ..." and choose "connect target"
    7. Run (menu item) -> Reset
    8. Choose Run -> Load -> Load Program
    9. In the window that appears, choose "browse project"
    10. Find and choose the executable under the AWS project and click ok
    11. The program should load and you can run it from here

    Steve

  • Try these steps to create a new project that will build both the AWS framework and the subscribe publish example in a CCS project.  Note that this should be done in a fresh workspace, with TI-RTOS for the 3200 and XDC tools already installed properly:

    1. Create a new project in CCS: Project -> New CCS Project.  Choose the following settings from the New Project window:

    • Target: CC3200 (right most drop down box)
    • You can also choose your connection type here.  I don't show this in the screen shot.
    • Choose a project name
    • Uncheck "use default location."  You want to save this project in the location of the subscribe_publish example (in the cc3200 sub folder)
    • Choose your compiler (you may have to browse to find the version you want)
    • Little Endian
    • "Empty RTSC Project"
    • Click Next

    2. In the second screen of the New CCS Project window:

    • XDC 3.32.0.06_core
    • In products and repositories, unselect all and then choose only TI-RTOS for the 3200
    • Select the platform
    • Choose debug profile
    • Finish

    3. Note that the subscribe publish (example specific) source files (that exist in the cc3200 folder) are automatically added to the project.  Note also that this project has the "[Active - Debug]" next to its name.  It is still necessary to add the AWS framework files to the project, though (done in step 4).

    Before moving on, a couple of files must be removed from the project:

    • Two files were added automatically that we don't want in the project
    • Select the following two files in the project view and hit the delete key to remove them from the project:
      • makedefs
      • makefile

    4. Add the AWS framework sources to the project as links (not copies).

    • Use Windows Explorer to navigate to the following locations and then drag and drop the source files into the project.  Make sure to choose the "link option" NOT the option to copy sources into the project
    • Navigate to the folder aws-iot-device-sdk-embedded-c\aws_iot_src\protocol\mqtt\aws_iot_embedded_client_wrapper
      • drag and drop the following file into the project:
      • aws_iot_mqtt_embedded_client_wrapper.c

    • Folder: aws-iot-device-sdk-embedded-c\aws_iot_src\protocol\mqtt\aws_iot_embedded_client_wrapper\platform_tirtos
      • network_sl.c
      • timer.c
    • Folder: aws-iot-device-sdk-embedded-c\aws_iot_src\shadow
      • aws_iot_shadow.c
      • aws_iot_shadow_actions.c
      • aws_iot_shadow_json.c
      • aws_iot_shadow_records.c
    • Folder: aws-iot-device-sdk-embedded-c/aws_iot_src/utils/aws_iot_json_utils.c

      • aws_iot_json_utils.c

      • jsmn.c
    • Folder: aws-iot-device-sdk-embedded-c/aws_mqtt_embedded_client_lib/MQTTClient-C/src
      • MQTTClient.c
    • Folder: aws-iot-device-sdk-embedded-c/aws_mqtt_embedded_client_lib/MQTTPacket/src
      • MQTTConnectClient.c
        MQTTDeserializePublish.c
        MQTTPacket.c
        MQTTSerializePublish.c
        MQTTSubscribeClient.c
        MQTTUnsubscribeClient.c

    5. Define a project variable to store the location of the AWS repository within the project

    • Right click on the project and select "Show Build Settings"
    • Under Build -> Variables, select "Add" to add a new variable

    • Name the variable AWS_SDK_INSTALL and set it to the full path of your AWS repository folder
    • Click OK

    6. Update the compiler settings to add all paths for all AWS header files included and define symbols needed by the program

    This could be a tedious step, but hopefully I've done most of the work for you here.  You should only need to copy/paste these paths and defines into the compiler options.

    • Right click on the project and select "Show Build Settings"
    • Under Build -> ARM Compiler, choose "Edit Flags"
    • <insert compopts01>
    • A new window "Edit Build Flags" will appear that allows text input
    • Append the following include paths and symbol defines to the existing compiler options:
    --include_path="${AWS_SDK_INSTALL}/aws_iot_src/protocol/mqtt"
    --include_path="${AWS_SDK_INSTALL}/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper"
    --include_path="${AWS_SDK_INSTALL}/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/platform_tirtos"
    --include_path="${AWS_SDK_INSTALL}/aws_iot_src/shadow"
    --include_path="${AWS_SDK_INSTALL}/aws_iot_src/utils"
    --include_path="${AWS_SDK_INSTALL}/aws_mqtt_embedded_client_lib/MQTTClient-C/src"
    --include_path="${AWS_SDK_INSTALL}/aws_mqtt_embedded_client_lib/MQTTPacket/src"
    --include_path="${AWS_SDK_INSTALL}/sample_apps/subscribe_publish_sample"
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/CC3200_driverlib_1.1.0/inc" 
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/tidrivers_cc32xx_2_16_00_08/packages/ti/mw/wifi/cc3x00/simplelink/include" 
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/CC3200_driverlib_1.1.0" 
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/CC3200_driverlib_1.1.0/driverlib" 
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/tidrivers_cc32xx_2_16_00_08/packages/ti/mw/wifi/cc3x00/oslib" 
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/tidrivers_cc32xx_2_16_00_08/packages/ti/mw/wifi/cc3x00/simplelink/include" 
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/ns_1_11_00_10/packages" 
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/bios_6_45_01_29/packages" 
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/packages" 
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/uia_2_00_05_50/packages" 
    --include_path="${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/tidrivers_cc32xx_2_16_00_08/packages"
    -DNET_SL -DIOT_INFO -DIOT_ERROR -DIOT_WARN -DIOT_DEBUG
    
    • Click OK to accept the options you added.
    • Click OK to save the project's build settings.

    7. Add the driverlib library to the proeject:

    • Right click on the project and select "Show Build Settings"
    • Under Build -> ARM Linker -> File Search Path, click the "+" sign next to "Inlcude library file... as input"
    • A file path window will appear.  Paste the following path to the library into the text box and click OK:
      • ${COM_TI_RTSC_TIRTOSCC32XX_INSTALL_DIR}/products/CC3200_driverlib_1.1.0/driverlib/ccs/Release/driverlib.a"
    • Click OK to save the project's build settings.

    8. Build the project

    • Right click on the project and select "build project"

    The project should build and you should be able to auto load your program with the "Debug" button if you've configured a target configuration for the it.

  • Steve,  thank you for laying this out.  I have followed your direction and now have the subscribe_publish_sample project building and able to enter debug mode!  A quick note to other readers, I did have to make some modifications on some of the include paths as folder names are based on versions.  Just check the warning output and it will tell you if any of the include paths are not found.

    Unfortunately, the program is not fully executing for me.  I do see LED0 turn on (occurs right after all the board inits in main() function) so I know the code is actually running.  But the code gets stuck at the end of slTask, within the function NetWiFi_Init().  (I can see breakpoint hit UARTUtils_systemInit(0), but it never reaches runAWSClient() ).  When I pause the debugger, I can see the place it's stuck is driver.c, SlDrvRxHdrRead() at VERIFY_PROTOCOL(SyncCnt < SL_SYNC_SCAN_THRESHOLD);  SyncCnt is set to 2000, same as the define SL_SYNC_SCAN_THRESHOLD which looks like it turns this statement into a while(1).

    I have tried to debug this over the last two days, but do not seem to be getting anywhere.  I see there was another thread written about this issue (https://e2e.ti.com/support/wireless_connectivity/simplelink_wifi_cc31xx_cc32xx/f/968/t/443450, but no resolution was found there (it was for a non_os build, so not sure how relevant it is to us).  I tried re-formatting the CC3200MOD Launchpad board using uniflash, reloading the service pack (version 1.0.1.6-2.6.0.5), and reloading the cert files (using the cert.out built when following the README_CC3200 file in the AWS).  But I find the code executes exactly the same.


    Can you give me some insight on what this issue could be stemming from (ie RTOS, XDC tools, service pack, simplelink, AWS library, etc)?  From reading through that other thread, it seems to be related to the simplelink library (which tells me it's not the XDC tools or AWS library).  But I see we didn't even link in any library file for simplelink (just the include paths used).  I'd be interested to hear if the project is fully running on your launchpad and what I can do to debug this issue.

    Thanks again for your support,
    -Jon 

  • I now have the application running!!!!!!!!!!!!!!!!!!!!!!!!!


    I am not sure exactly what fixed it, but will list my steps that lead to execution.  First, I switched back to the original workspace to work on the custom application I have been building.  I went to run one of the TI CC3200 SDK example programs, wlan_station, and found it was also getting stuck at the VERIFY_PROTOCOL statement.  I decided to rebuild all the projects as suggested in the CC3200-Getting_Started_guide (I brought all these projects in a few months ago when first setting up the environment, so I just rebuilt them in order based on Section 3.1.3, steps 5,6,7,8,and 12 ). After rebuilding all these projects, I ran the wlan_station project again and it worked.  I went back to the new workspace created for the AWS project as Steve described, cleaned&rebuilt, and ran and it executed with console outputs showing proper execution.  Verified topics showed up on my AWS console.

    I did not make any changes to any of the project files I had to rebuild, and I don't understand what would be linked to my new workspace so I do not understand why this worked, but hopefully it will keep working.

    Thank you for all of your help and I hope this thread helps others as well!

    -Jon 

  • Jon,


    Glad those steps worked for you and you got past your issues!


    FYI, the problem you describe above was most likely solved by power cycling your 3200 board.  The board can get into a bad state and what you describe above is the symptom of that.

    Please see this thread for details.

    Steve

  • Hi Ramsey,

    I was successfully able to  create aws library from your instructions thanks for step by step instructions . Then i created a new project in  code composer where I linked "aws_iot_sl.aem4" in linker file search file. But now I am getting the following compile errors I dont why I am getting these errors any idea why?? 

    "C:\\ti\\xdctools_3_32_00_06_core\\gmake" -e -k all
    'Building file: ../subscribe_publish_sample.c'
    'Invoking: ARM Compiler'
    "C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=vfplib -me --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-arm_15.12.1.LTS/include" --include_path="C:/aws-iot-device-sdk-embedded-c/aws-iot-device-sdk-embedded-c/include/" --include_path="C:/ti/xdctools_3_32_00_06_core/packages/xdc/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/example/mqtt_client/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/example/common/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/inc" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/simplelink/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/simplelink/include/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/simplelink/source/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/driverlib/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/oslib/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/third_party/FreeRTOS/source/include/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/third_party/FreeRTOS/source/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/third_party/FreeRTOS/source/portable/CCS/ARM_CM3" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/netapps/mqtt/client/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/netapps/mqtt/common/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/netapps/mqtt/include/" --include_path="C:/ti/CC3200SDK_1.2.0/cc3200-sdk/simplelink_extlib/provisioninglib" -g --gcc --define=ccs --define=SL_PLATFORM_MULTI_THREADED --define=cc3200 --define=ti_net_Socket__include --define=USE_TIRTOS --diag_warning=225 --diag_wrap=off --display_error_number --abi=eabi --preproc_with_compile --preproc_dependency="subscribe_publish_sample.d" --cmd_file="configPkg/compiler.opt" "../subscribe_publish_sample.c"

    >> Compilation failure
    "C:/ti/tirtos_cc32xx_2_16_01_14/products/ns_1_11_00_10/packages/ti/net/ssock.h", line 52: error #80: expected a type specifier
    "C:/ti/tirtos_cc32xx_2_16_01_14/products/ns_1_11_00_10/packages/ti/net/ssock.h", line 52: error #91: function returning function is not allowed
    "C:/ti/tirtos_cc32xx_2_16_01_14/products/ns_1_11_00_10/packages/ti/net/ssock.h", line 55: error #91: function returning function is not allowed
    "C:/ti/tirtos_cc32xx_2_16_01_14/products/ns_1_11_00_10/packages/ti/net/ssock.h", line 58: error #91: function returning function is not allowed
    "C:/ti/tirtos_cc32xx_2_16_01_14/products/ns_1_11_00_10/packages/ti/net/ssock.h", line 61: error #91: function returning function is not allowed
    "C:/ti/tirtos_cc32xx_2_16_01_14/products/ns_1_11_00_10/packages/ti/net/ssock.h", line 67: error #20: identifier "Ssock_EncryptFxn" is undefined
    "C:/ti/tirtos_cc32xx_2_16_01_14/products/ns_1_11_00_10/packages/ti/net/ssock.h", line 93: error #91: function returning function is not allowed
    "C:/ti/tirtos_cc32xx_2_16_01_14/products/ns_1_11_00_10/packages/ti/net/ssock.h", line 95: error #91: function returning function is not allowed
    "C:/ti/tirtos_cc32xx_2_16_01_14/products/ns_1_11_00_10/packages/ti/net/ssock.h", line 98: error #91: function returning function is not allowed
    9 errors detected in the compilation of "../subscribe_publish_sample.c".
    gmake: *** [subscribe_publish_sample.obj] Error 1
    gmake: Target `all' not remade because of errors.

    **** Build Finished ****

    Please Help.

  • Hi Kaiser,
    We generally discourage posting a new question to an old closed thread because the person who answered before may no longer be available, and also it will allow whomever is currently assigned to monitor the forum to respond to you more quickly. For these reasons, I suggest you start a new thread with your question and reference this thread.

    Thank you
  • Hi Steven,

    I'm working on a sniffer application based project on cc3200 and now I need to send some data to cloud using cc3200.I am new to AWS IOT services, I have downloaded  the AWS SDK for embedded C from this link  

    I tried to build the AWS publish subscribe example as explained by you in the thread above.

    Steven Connell said:
    Note that these variables have the same names as those found in the products.mak file of the AWS SDK repo.  The "-e" option passed to gmake causes these variables to override those found in products.mak
    But I can't find the products.mak file of AWS SDK repo. Will I have to make changes in the products.mak file again when I complete the steps explained by you given above?

    And are there any tutorials and sample example related to how to connect, send, retrieve data from AWS cloud using cc3200 Launchpad. Any information in this context will be helpful to me.

    Thanks ahead in time.

    Best Regards,

    Techinspired

  • Hi Steven,

    I have downloaded the zip file of 'publish /subscribe' example given above by you. I changed environment variable as per my path and tried building the project but I've got error . I'm attaching snippet of the same error

    what I am missing out here? How to eliminate the error and do I need to make changes in the products.mak file also even after changing the variables in environment?

    Thanks.

    Best Regards,

    Techinspired