This blog post discusses how to run a restricted set of WL commands along with iperf for limited memory platforms like BCM943438WCD1, CYW94343WWCD1_EVB, CY8CKIT-062 (A typical use-case would be something like adaptivity testing)

  1. If you are running the test.console example with CONSOLE_ENABLE_WL set to 1 and getting the APP_CODE overflow error, please follow the steps mentioned below to enable the particular set of WL commands your application requires.
  2. In console.mk file, please mark CONSOLE_ENABLE_WL :=  0. Along with that, you can make use of certain macros listed below to save some further memory.

CONSOLE_NO_P2P :=1

CONSOLE_DISABLE_WPS_COMMANDS := 1

CONSOLE_DISABLE_TRACEX_COMMANDS := 1

 

GLOBAL_DEFINES     += CONSOLE_DISABLE_ENTERPRISE_COMMANDS

$(NAME)_DEFINES    += CONSOLE_DISABLE_WPS_COMMANDS

$(NAME)_DEFINES    += CONSOLE_DISABLE_TRACEX_COMMANDS

$(NAME)_DEFINES    += CONSOLE_DISABLE_MALLINFO_COMMANDS

       GLOBAL_DEFINES += DISABLE_WIFI_AP_INTERFACE \

                       WICED_CONFIG_DISABLE_SSL_SERVER \

                       WICED_CONFIG_DISABLE_DTLS \

                       WICED_CONFIG_DISABLE_ENTERPRISE_SECURITY \

                       WICED_CONFIG_DISABLE_DES \

                       WICED_CONFIG_DISABLE_ADVANCED_SECURITY_CURVES \

                       WICED_DISABLE_WATCHDOG

      3. Now, you can use one more macro to enable a limited set of WL commands for your application.

$(NAME)_DEFINES    += CONSOLE_INCLUDE_WIFI_LIMITED_SET_COMMANDS

          This enables some fixed wifi related commands defined inside 43xxx_Wi-Fi/libraries/utilities/command_console/wifi/command_console_wifi.h

 

     4. The idea is now to keep adding the application specific WL commands to the WIF_LIMITED_SET_COMMANDS by modifying the existing code in 43xxx_Wi-Fi/libraries/utilities/command_console/wifi/command_console_wifi.h and 43xxx_Wi-Fi/libraries/utilities/command_console/wifi/command_console_wifi.c

 

     5. I am going to take up a sample WL command like wl down for which the sequence is mentioned below (modified command is wl_down):

 

    1. Add

{ (char*) "wl_down", wl_down, 0, NULL, NULL, (char*) "", (char*) "Getting the driver down"}, \

under the #define WIFI_COMMANDS_LIMITED_SET \

           b. Time to declare the wl_down function inside command_console_wifi.h

      int wl_down                (int argc, char* argv[] );

           c. The function may be defined in the following manner inside command_console_wifi.c

int wl_down(int argc, char* argv[])

{

wwd_result_t result = wwd_wifi_set_down();

 

if (result != WWD_SUCCESS)

{

        WPRINT_APP_INFO(("WLAN Driver down failed with result %d\n,result"));

}

 

    return result;

}

 

     6. Let’s try to take one more WL command like wl bi and follow almost the same steps as mentioned in 5a, 5b. But the function definition inside command_console_wifi.c will use some ioctl/iovar to set the parameter.

int wl_bi(int argc, char* argv[])

{

wwd_result_t result;

uint32_t bi = atoi(argv[1]);

 

result = wwd_wifi_set_ioctl_value(WLC_SET_BCNPRD, bi, WWD_STA_INTERFACE);

 

if(result != WWD_SUCCESS)

{

        WPRINT_APP_INFO(("Setting beacon interval failed with %d\n", result));

}

 

          return result;

 

}

More details on how to use the ioctl/iovars from application, you can go through  How to use IOCTL commands in CYW43907

 

To add any other WL command, you can first look for WWD APIs which can serve the same purpose inside 43xxx_Wi-Fi/WICED/WWD/include/wwd_wifi.h. If there is no such API available, you can look for the list of IOCTLs inside 43xxx_Wi-Fi/libraries/test/wl_tool/<chip_name>/common/include/devctrl.h and use the IOCTL GET/SET APIs to define the particular WL command.

 

An example screenshot for the above mentioned wl_down command can be found below.