Creating projects for Cypress PSoC 6 with the WICED SDK with Visual Studio

This tutorial shows how to create, build and debug a basic project using the Cypress WICED SDK for the PSoC6 WiFi-BT Pioneer Pioneer Kit board. We will create a basic Wi-Fi HTTP Server application and will show how to build it, program the FLASH memory and debug it with VisualGDB.

Before you begin, install VisualGDB 5.5 or later and WICED Studio that includes the WICED SDK.

  1. Start Visual Studio and locate the VisualGDB WICED Project Wizard:
  2. Enter the name and location for the project. Note that in order to use the WICED SDK build system, the actual source code of the project needs to be located inside the WICED SDK directory. However, you can place the Visual Studio project file in any location of your choice:
  3. On the first page of the WICED project wizard, select the location of the WICED SDK (including the 43xxx_Wi-Fi subfolder) and choose the target device:
  4. When you proceed to the next page, VisualGDB will automatically scan the projects in the apps subdirectory of the SDK and show the ones compatible with the selected device. In this tutorial we will use the https_server project:
  5. Connect your PSoC6 board via the USB as shown below:
  6. Locate the CMSIS-DAP item in the “Debug using” box. As the PSoC6 device requires a very specific debugging setup, make sure you select the settings described below:
    1. Select Cortex-M4 as the debugged core, since the application logic of the WICED projects runs there.
    2. As the FLASH memory cannot be programmed using the Cortex-M4 core, select “Program FLASH memory using WICED SDK“. This will also make sure that all additional resources (e.g. file system and device configuration tables) get programmed.
    3. Resetting PSoC6 and halting it before it reaches the start of the application requires yet another workaround. Enable it by adding the following line to the end of the Startup GDB commands in the Advanced Settings:
      mon psoc6 reset_to_entry $$DEBUG:ENTRY_POINT$$

      Once you configure the debug settings, press Finish to create the project.

  7. If this is the first project created with theĀ  WICED SDK, VisualGDB may be able to load its structure until you build it. If this happens, build the solution normally:
  8. Then reload the project by right-clicking in Solution Explorer:
  9. Now VisualGDB will load the exact project structure from the WICED build logic and will display it in Solution Explorer:
  10. Try setting a breakpoint at the wiced_network_up() call and press F5 to begin debugging. VisualGDB will automatically launch the WICED FLASH programming tools, loading both the application and the auxiliary files:
  11. Once the FLASH memory is programmed, the debug session will begin. If the SDK triggers a watchdog reset warning, simply press F5 again to ignore it:
  12. Now the breakpoint we set on the wiced_network_up() function will trigger:
  13. Try stepping into wiced_network_up() to find out the SSID and password used by the sample:
  14. In this example, the Wi-Fi parameters are read from the DCT (device configuration table) that is loaded into the FLASH memory separately. Locate DCT under Special Targets in Solution Explorer and go to definition of CLIENT_AP_SSID:
  15. This will open the default_wifi_config_dct.h file that defines the default Wi-Fi configuration for WICED projects that don’t have it explicitly specified:
  16. We will now replace the file with a project-specific definition. Right-click on the Source Files (or Header Files) in Solution Explorer and select “Add->New Item”:
  17. Then choose to create a header file called wifi_config_dct.h:
  18. Copy the entire contents of the default DCT configuration file into wifi_config_dct.h and replace CLIENT_AP_SSID and CLIENT_AP_PASSPHRASE with the parameters that match your Wi-FI network. Then right-click on the project in Solution Explorer and select “Open component Makefile”:
  19. Add the following line to the make file:
    WIFI_CONFIG_DCT_H  := wifi_config_dct.h

  20. Now you can rebuild the project and run it again. It will now connect to your Wi-Fi network and obtain an IP address from the DHCP server. You can find out the IP address by examining the ipv4 variable in application_start(). E.g. 0xc0a800a7 corresponds to
  21. Open the IP address assigned to the board in your browser. You will see a basic page produced by the demonstration project:
  22. VisualGDB will automatically determine the precise structure of the project and the SDK from the WICED build command lines, so you can use various code navigation features (e.g. CodeJumps) to understand the relations between different components of the project:When you add source files to Solution Explorer, VisualGDB will automatically update the $(NAME_SOURCES) assignment in the .mk file, so you won’t need to edit it manually.