BK7258 AP log is forwarded to CP serial port DL_UART0 output through mailbox (default baud rate is 115200)
By macro CONFIG_SYS_PRINT_DEV_MAILBOX=n,CONFIG_SYS_PRINT_DEV_UART=y,CONFIG_UART_PRINT_PORT=0
you can change the output mode of the log of AP (the above setting is that the log of AP is output through UART0)
note CPU0 is the main core, and there is no MailBox channel between CPU0 and CPU2, so only CPU1 is supported
AP log has cpu1 label (except exception log)
Enter the log command through the serial port to view the current log configuration
The macro CONFIG_UART_ATE_PORT indicates which pin to use for detecting the ATE (Automated Test Equipment) mode; the macro CONFIG_UART_PRINT_PORT represents the default UART port for initializing the LOG; CONFIG_UART_ATE_PRINT_PORT signifies that during ATE detection, the LOG UART port should be switched once (but at this point, the LOG port has not been initialized yet; during initialization, the choice for the LOG port is made based on CONFIG_UART_ATE_PRINT_PORT).
Example: For ATE identification, use UART1’s TX pin, and for normal application logs, use UART1. After entering the ATE mode, the log and command line should use UART0. Configuration is as follows: CONFIG_UART_ATE_PORT=1, CONFIG_UART_PRINT_PORT=1, and CONFIG_UART_ATE_PRINT_PORT=0.
Enter the help command through the serial port to view the currently supported debugging commands:
Eclipse version
eclipse-embedcpp-2020-12-R-win32-x86_64.zip
Eclipse project configuration
The default swd is connected to CP, and BK7258 has two swd ports (grou1/group2)
You can set swd connection CP through the setjtagmode cpu0 group1 command
You can set swd to connect AP through setjtagmode cpu1 group1
You can view the current jtag status through the jtagmode command
Note
To establish a SWD debugging connection using Jlink, a DEBUG version of the code must be compiled.
If the system is not booting normally, attempting to connect to Jlink via serial input commands may not be possible.
In this case, you can manually call the following functions in driver_init after bk_gpio_driver_init():
bk_set_jtag_mode(0,0); // The first parameter 0 indicates debugging cpu0, and the second parameter 0 indicates
using the first set of SWD gpio pins while(g_test_mode); // Define a volatile global variable to prevent the compiler from optimizing away the following code
Then, after connecting to Jlink, modify the g_test_mode variable value and continue debugging.
Due to GPIO pin multiplexing, the default version requires entering debug commands or setting debug mode in the code when connecting to Jlink for debugging:
The dump function of Release version is turned off by default and can be turned on through CONFIG_DUMP_ENABLE configuration
The current architecture uses the cp+ap mode, and the dump function can be enabled by modifying the config files of both.
The principle of the Dump tool to restore the scene is that the script analyzes the log, parses out the contents of regs, itcm, dtcm, and sram, and then restores these contents to the qemu virtual machine through gdb
Log file suffix supports txt, log, DAT
Log file encoding currently only supports utf-8, other encoding formats can be manually converted to utf-8 encoding format through notepad++
If there are multiple Logs in the tool directory, or there are multiple Dumps in the Log, the tool will analyze the last Dump. You need to ensure that there is only one Log in the tool directory, and there is only one dump in the Log.
The Dump tool can automatically remove regular timestamps in the log: [2024-02-03 14:35:13.375193]. If you encounter irregular timestamps, you need to remove them manually.
If two exceptions occur during the dump process, a common example is when detecting memory out of bounds and encountering Assert, the register will be printed one more time. The second register printing needs to be deleted during parsing.
BK7258 Any CPU Dump will dump all the registers of the current CPU, itcm, dtcm, and 640k sram.
By default, the Log and Dump of BK7258 CP are output through UART0
By default, the Log and Dump of AP are sent to CP through MAILBOX and then output through UART0
If you encounter multiple CPUs dumping at the same time during the Dump process, you need to split the Log into two dump files, and use the elf of CP and AP to restore the scene.
Each CPU needs the registers of the current CPU, itcm, dtcm, sram plus elf to restore the scene
>>>>stack mem dump begin, stack_top=20000000, stack end=20004000<<<<stack mem dump end. stack_top=20000000, stack end=20004000
itcm format:
>>>>stack mem dump begin, stack_top=00000020, stack end=00004000<<<<stack mem dump end. stack_top=00000020, stack end=00004000
sram format:
>>>>stack mem dump begin, stack_top=28040000, stack end=28060000<<<<stack mem dump end. stack_top=28040000, stack end=28060000>>>>stack mem dump begin, stack_top=28060000, stack end=280a0000<<<<stack mem dump end. stack_top=28060000, stack end=280a0000>>>>stack mem dump begin, stack_top=28000000, stack end=28010000<<<<stack mem dump end. stack_top=28000000, stack end=28010000>>>>stack mem dump begin, stack_top=28010000, stack end=28020000<<<<stack mem dump end. stack_top=28010000, stack end=28020000>>>>stack mem dump begin, stack_top=28020000, stack end=28040000<<<<stack mem dump end. stack_top=28020000, stack end=28040000
When the system turns on CONFIG_MEM_DEBUG, the Dump process will print out all the Heap memory currently used by the system and check whether there is any memory out of bounds:
Under normal circumstances, task-related information will also be dumped to the log for reference during problem analysis.
analysis of stability issues of Armino platform BK7258 system
Embedded stability problems are a common but difficult to locate problem,
which have the following characteristics:
Unpredictability:The time point of system failure is not fixed and difficult to predict.
It may occur suddenly after a long period of operation.
Diversity:problems can appear in many forms such as crashes,freezes,lags or erroneous behavior.
Cumulative effect:The longer the system runs,problems such as resource leakage or data corruption
may accumulate,eventually leading to a crash.
Environmental dependence:stability may also be affected by environmental factors such as temperature,
humidity and power supply ripple.
In order to help users better locate stability problems,the following linked documents provide common analysis methods.
Note
This document only addresses stability issues caused by the software. It is recommended that users refer to
this document first when encountering stability issues.