Performance Optimization
Better Performance
Change the default compilation optimization level to -O2 or -O3. Note that increasing the compiler optimization level may increase firmware size and expose previously undetected errors.
Move frequently executed code to SRAM to reduce XIP execution loading wait time. Use
ATTRIBUTE_IRAM
to modify a single function, or specify it for an entire file incomponents\wm_system\ld\code_in_ram.ld.h
.Reduce logging overhead by setting the default log level to ERROR or below.
Disable heap memory and FreeRTOS debug statistics features.
Adjust FreeRTOS task priorities reasonably.
Improve interrupt performance by minimizing the use of interrupt enable/disable for critical section protection.
Increase network speed by referring to the iperf example and maximizing available cache and configuration in the WiFi driver and TCP/IP stack.
Re-enable jump table optimization to improve hot path performance in large switch cases. Add the compilation parameters
-fjump-tables -ftree-switch-conversion
during compilation.Avoid using floating-point operations (float and double) in the program, as floating-point calculations are always slower than integer operations.
Additionally, there may be more ways to improve application performance based on usage scenarios, which users should choose flexibly.
Better Size
Disable unused features in various components by menuconfig.
Choose the -Os optimization level during compilation, which is the default selection.
Analyze the size occupancy by viewing the
map
file after compilation. The map file is located in the projectbuild
folder.