Alios-things supports several debugging methods, specific functions and the use of reference link to address
Https://github.com/alibaba/AliOS-Things/wiki/Debugging-Overview.zh
Today we focus primarily on the opening of CLI debugging and the addition of CLI functions.
1, modify the ENTRY.C code in the kinit variable cli_ebable value is 1
Static kinit_t kinit = {
. argc = 0,
. argv = NULL,
. cli_enable = 1
};
The "entry.c" file is located in "xxx\alios-things\platform\mcu\esp8266\bsp".
2. Adding CLI functions to the project
Here, I use example's Netmgrapp for this project code as an example.
Open the NCMDS structure array for the "netmgrapp.c" file and add the code as shown below
static void Handle_jack_cmd (char *pwbuf, int blen, int argc, char **argv)
{
aos_cli_printf ("Call me jack,please\r \ n ");
}
static struct Cli_command ncmds[] = {
{
. Name = ' Test ',
. Help = ' Test ',
. function = Handle_test_cmd
} ,
{
. Name = "Jack",
. Help = "Jack",
. function = Handle_jack_cmd
},
#ifdef Test_wifi_hal_ Only
{
. Name = ' Test_wifi_hal ',
. Help = "Test_wifi_hal [Start|scan|scan_adv|monitor [mngt]|80211send| Get_mac|ip_info|all] ",
. function = Handle_test_wifi_cmd
}
#endif
};
After saving, execute the following instructions in the Docker compilation environment
AOS make netmgrapp@esp8266
Burn the generated Netmgrapp@esp8266-0x1000.bin files to the Development Board.
3, the use of serial tools to run CLI command
Send help instructions to the MCU in the serial tool to enter the CLI. From the parameters returned from the CLI, we can see that we have just added an instruction "Jack".
Then we send the Jack command to the MCU via the serial tool, and we can see the print information we added: "Call me Jack,please"
The results of the operation are shown in the following figure
Since then, you can add your own CLI functions to debug the development of product features.