At the FreeRTOS SDK,there are some debug methods supported.You could to use them to debug your program and find out the problem's root cause helpful.
void __attribute__((no_instrument_function))__cyg_profile_func_enter(void *this, void *call) { printf("enter func:0x%x, caller:0x%x\n", this, call); } void __attribute__((no_instrument_function))__cyg_profile_func_exit(void *this, void *call) { printf("exit func:0x%x, caller:0x%x\n", this, call); }
enable the CLI support
type task-stats command:return the content of bellow title:
name number state priority stack_depth stack_watermark run(ms) run(percent)
name:task of name
number:task id
state:task status;X(running),B(blocked),R(ready to schedule),D(deleted)S(suspend)
priority:priority of task
stack_depth:stack depth of task
stack_watermark:the watermark of task stack;
run(ms):running time of this task;
run(percent) :running percent time of this task;
If you already know the ARCH, SOC, BOARD and PRODUCT,
you could specify them by the command line parameters.
source scripts/env.sh [ARCH] [SOC] [BOARD] [PRODUCT]
For ARCH arm64, SOC a1, BOARD ad401_a113l, PRODUCT speaker, you could type the following command.
source scripts/env.sh arm64 a1 ad401_a113l speaker
Otherwise, you can choose the project interactively by the following command.
source scripts/env.sh
make menuconfig
steps following: Libs Options -> Backtrace Support
If you use the following command:
make
When an exception occurs, the output format is as follows:
ESR: 96000007 SPSR: 20000004 ELR: 13cb4 LR: 13cb4 ========== Call stack ========== [<0000000000013cb4>] N/A [<000000000001b094>] N/A [<000000000001c194>] N/A [<fffffffffffffffc>] N/A ========== End ==========
If you use the following command:
make backtrace
When an exception occurs, the output format is as follows:
ESR: 96000007 SPSR: 20000004 ELR: 13cb4 LR: 13cb4 ========== Call stack ========== [<0000000000013cb4>] cmd_read32+0x154/0x250 [<000000000001b094>] FreeRTOS_CLIProcessCommand+0xa4/0x3b0 [<000000000001c194>] FreeRTOS_CLIEnterConsoleLoop+0x294/0x740 [<fffffffffffffffc>] N/A ========== End ==========
Backtrace default used when program crash (Asynchronous exception)) .
Also you can use to other place like this:
print current context stack when dump_stack() called by assertion.
when you compile your project complete,RTOS SDK will collect git information and general a report sheet in a output file.
The file's path is output/project_fullname/freertos/sdk_ver.h.You can use them to trace your source code version.The sheet is follow:
[cm_hash remote_name branch ] [f7e725c boar riscv amlogic-dev ] [c9d7923 arch riscv (HEAD ] [db5a75b soc riscv (HEAD ] [cfc1e49 scripts (HEAD ] [a341cbe libc (HEAD ] [e72fb29 freertos (HEAD ] [601c9d0 prod aocpu (HEAD ] [c6e9858 build (HEAD ] [46573f9 drivers_aocp (HEAD ]
For binary file,it will enable the switch to output version message
when you compile your project complete,it will calculate the module size and report them in a output file.