当前位置:网站首页>Easy entry haas100 diagnostic debugging system

Easy entry haas100 diagnostic debugging system

2020-12-07 09:56:32 osc_ ybv4169f

1、AliOS Things CLI Component is introduced

In daily embedded development , Users often implement a set similar to Linux Shell Through the serial port command to control the device into a specific state , Or perform a specific operation . Such as system self-test , Simulation run , Or enter the manual mode to jog the device .AliOS-Things Native implementation of a set called CLI(command-line interface) Command line interaction tool for , On the basis of providing basic system interaction commands , It also supports user-defined commands .

 

2、CLI How to use components

Users only need to be in aos.mk It contains CLI Components , Such as

$(NAME)_COMPONENTS += cli

Then recompile, burn and power on , After system startup , Operation method and other commonly used shell similar , Press enter to have # Symbol printing , Input help You can check several of the system's own cli command :
image

 

3、 How to add custom CLI command

Include header file

#include "aos/cli.h"
API Enter the reference Return value
aos_cli_register_command cli_command* 0 Successful implementation ; other : Failure

 

Invoke the sample :

/* Reference code */
const struct cli_command command = { "debug", "show debug info", debug_cmd };
ret = aos_cli_register_command(&command);
if (ret) {
/* Error handling */
}

void debug_cmd(char *buf, int32_t len, int32_t argc, char **argv)
{ /*cli  Command implementation */ }

4、 common cli Command Introduction

4.1、 Memory status statistics

This function depends on debug Components , That is to say aos.mk Add... Below

$(NAME)_COMPONENTS += cli debug

Recompile power on , Carry out orders

dumpsys mm

image

The fields in the above screenshot are interpreted as :
HEAP The meaning of the content in :
• TotalSz: System available malloc Total dynamic memory size of ;
• FreeSz: The current free memory size of the system ;
• UsedSz: The amount of memory currently allocated by the system , namely UsedSz = TotalSz – FreeSz;
• MinFreeSz: The historical minimum of free memory in the system , namely TotalSz – MinFreeSz It's the peak of memory history usage ;
• MaxFreeBlkSz: System maximum free block Size, Indicates the maximum amount of memory that the system can allocate at this time .





dumpsys mm_info

This command can display all the current dynamic memory applications of the system , This function is useful for diagnosing system memory leaks , It prints out the address of the dynamic memory that the system is using at this time address、 size size、 applicant caller And other useful information .
image

 

Be careful : This function depends on k_config.h Li Hong's opening

#ifndef RHINO_CONFIG_MM_DEBUG
#define RHINO_CONFIG_MM_DEBUG                1
#endif

4.2、 Task information statistics tasklist

image

 

You can see the current OS Several background tasks are started by default . About AliOS Things Of OS Use , Follow up .

4.3、 Task load statistics cpuusage

Carry out orders

cpuusage

We can use 1s Of the current task of the periodic printing system cpuusage, Press ctrl c Stop printing
image

 

4.4、 Show / Modify memory data p/m command

Illustrate with examples : Need to get HaaS100 Priority of system peripheral interrupt , We found out in the data book that 0xE000E400 Register address of interrupt priority for system peripheral , Can pass p Commands access system registers or memory :

p 0xE000E400

image

When we need to modify a memory value ( Or the value of a register ), Can pass m command , Such as : Here's a demonstration of what will be in
0x34027770 The value of the address of , from 0x12345678 It is amended as follows 0xffffffff The process of
image

 

4.5、 System reset command reboot

reboot It's a system hot reset command , The command is called at the board level reboot Interface to implement .

 

5、 summary

HaaS100 The diagnosis and debugging system of is more than the one described above cli Components and common commands , The follow-up will bring you more based on AliOS Things Diagnostic debugging method of . You are welcome to continue to pay attention HaaS!

 

6、 Developer technical support

For more technical support , You can join the nail developer group

Introduction to more technologies and solutions , Please visit alicloud AIoT home page https://iot.aliyun.com/

版权声明
本文为[osc_ ybv4169f]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/20201207095123786a.html