Useful Features

  1. Enabling parallel builds
  2. Debugging
    1. Error code interpretation
    2. Opening declarations
    3. Using console output in code
  3. Showing line numbers
  4. Enabling autosave before building a project
  5. Adding a new Interface
  6. Rename a Project in the XDK Workbench

Enabling parallel builds

This section describes how to enable the parallel build of the binary files, which greatly increases build speed and is highly recommended. Sadly this is not a default as of yet and has to be set manually for each project.

Step 1: Right-click onto your project in XDK Workbench’s Project Explorer and select Properties.

Image

Step 2: Click on the tab Behavior and Enable parallel Build

Image

Debugging

Error code interpretation

This section describes how to read and find declarations and interpret error codes in the various modules.

In general, an error message is split in 4 parts:

Image

Package ID - The software of the XDK is split in different packages for modularity. The overview of all packages and their respective ID are listed at line 165 in the implementation file SDK/xdk110/Common/source/SystemStartup.c. In our example this is “WLAN”.

More common errors from workbench version 3.4 upwards can be represented by the Package ID 153 - XDK110 Application and can traced further inside SDK/xdk110/Common/include/XdkCommonInfo.h where it will list the corresponding Module ID and Error ID under enum XDK_Common_ModuleID_E and enum XDK_Common_Retcode_E

The Package ID then leads you to the Module ID where the error occurred which is listed inside the header at SDK/xdk110/Platform/packageName/BCDS_packageName.h, in our example case the header file is SDK/xdk110/Platform/Wlan/BCDS_Wlan.h listing the Module ID under enum BCDS_Wlan_ModuleID_E and the Error ID under enum Retcode_Wlan_E. Module ID 2 is BCDS_WLAN_MODULE_ID_WLAN_CONNECT and Error ID 67 RETCODE_WLANDRIVER_SPI_DATALOSS. Further tracking of the Error ID 67 can be done in the SDK/xdk110/Platform/Wlan/BCDS_WlanConnect.h

Optionally further assessment of the error can be done inside the package source code but this may not always be available. Source files are located inside the SDK/xdk110/Common/source/ in our case the Wlan source code is accessible in the file SDK/xdk110/Common/source/connectivity/WLAN.c where we see when the WLANPersonalWPA2Connect : Error from the function WlanConnect_WPA() gets printed.

Opening declarations

Another aid in finding errors in the code is the opening of declarations of functions or variables. This can be done by marking an occurrence and right-clicking on it, followed by a click on Open Declaration. This will lead to you to the place where it has been defined first.

Image

Using console output in code

This section describes how to use console printouts and what to consider when using them.

Printing a console output can be done via regular C print commands, but a few things need to be considered. Firstly the output requires \r\n at the end of the string, otherwise it will not be printed in the XDK-Workbench console. Another consideration is the USB connectivity behavior, as the XDK is a slave to the connected PC and will therefor not resend packets. The prints typically will only be displayed after the initializations are done unless delayed.

Note: It is not recommended to print to the console for a prolonged time at intervals of 10ms or less. This may result into overflows and cause crashes

As an alternative, or in case you deal with long term or remote analysis, you can use the SD card for logging after it has been initialized. For a detailed explanation on SD card operations please refer to the SD card article in the C section in Data Storage.

Showing line numbers

This section describes how to set useful configurations in the XDK Workbench. First, you should enable autosaving before building. The following screenshot shows where the configuration can be found in Window > Preferences and which checkbox has to be selected.

Image

Enabling autosave before building a project

Another useful setting is autosaving before flashing. This feature is especially helpful if there are small changes in the code done and not saved before the project was flashed to the XDK. Sometimes it can happen that code that was not saved is flashed to the XDK and it runs for example a non-functional application on the XDK besides working code. The following screenshot describes where autosaving can be enabled. This menu can be found in Window > Preferences.

Image

Adding a new Interface

This section describes how to add new interfaces to an existing application in the XdkApplicationTemplate or in other projects.

There are two ways to add new source and header files to an existing project. Import existing files into the project or create a new one. Existing files can be placed in the project folder and simply imported in the XDK Workbench by refreshing the project. The following Screenshot shows how to create both, an implementation file and a header file.

Image

Note: Both files need to have the correct ending tag, for example the implementation file .c

Image

The header file only has to be included in the .c implementation file. Therefore the implementation file has to be additionally added to the makefile of the project. The following screenshot shows where in the makefile the include has to be done. Both works similar for new files and for imported files.

Image

Note: Adding files to the project makefile are only necessary for XDK-Workbench versions below 3.4.0

Rename a Project in the XDK Workbench

This section describes how to rename a project folder

Step 1: Within the XDK-Workbench’s Project Explorer right-click your project and select Properties.

Image

Step 2: Select Rename and enter the new project name.

Image

Note: For the XDK-Workbench version 3.0 and earlier the project configuration as well as the makefile has to be modified. The additional steps are as follows.

Step 3: Go into the C/C++ Build tab and update the BuildDirectory. To do this, click on Workspace and select the “make” folder inside your renamed application.

Image

Step 4: Open up the makefile in your renamed application. You may want to modify the BCDS_APP_NAME, as it defines the name of your executable file afterwards. Furthermore, you may want to add and/or change the files listed in BCDS_XDK_APP_SOURCE_FILES.

Image