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.
- Start Visual Studio and locate the VisualGDB WICED Project Wizard:
- 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:
- 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:
- 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:
- Connect your PSoC6 board via the USB as shown below:
- 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:
- Select Cortex-M4 as the debugged core, since the application logic of the WICED projects runs there.
- 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.
- 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:
1mon psoc6 reset_to_entry $$DEBUG:ENTRY_POINT$$
Once you configure the debug settings, press Finish to create the project.
- 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:
- Then reload the project by right-clicking in Solution Explorer:
- Now VisualGDB will load the exact project structure from the WICED build logic and will display it in Solution Explorer:
- 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:
- 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:
- Now the breakpoint we set on the wiced_network_up() function will trigger:
- Try stepping into wiced_network_up() to find out the SSID and password used by the sample:
- 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:
- 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:
- 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”:
- Then choose to create a header file called wifi_config_dct.h:
- 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”:
- Add the following line to the make file:
1WIFI_CONFIG_DCT_H := wifi_config_dct.h
- 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 192.168.0.167:
- Open the IP address assigned to the board in your browser. You will see a basic page produced by the demonstration project:
- 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.