Skip to content

Commit

Permalink
Merge branch 'feature/add_at_net_debug' into 'master'
Browse files Browse the repository at this point in the history
feat(debug): Added network debug feature to allow different kinds of network debug output

See merge request application/esp-at!1533
  • Loading branch information
xcguang committed Mar 15, 2024
2 parents 39fd304 + 6200c55 commit 993bf6d
Show file tree
Hide file tree
Showing 4 changed files with 416 additions and 0 deletions.
19 changes: 19 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,25 @@ if (CONFIG_BOOTLOADER_COMPRESSED_ENABLED)
add_dependencies(flash ota_image)
endif()

# Network Debug
add_custom_target(at_net_debug ALL)
if (CONFIG_AT_NET_DEBUG)
add_custom_command(TARGET at_net_debug
POST_BUILD
COMMAND ${PYTHON} $ENV{ESP_AT_PROJECT_PATH}/tools/at_net_debug.py --sdkconfig $ENV{ESP_AT_PROJECT_PATH}/sdkconfig
DEPENDS $ENV{ESP_AT_PROJECT_PATH}/sdkconfig
WORKING_DIRECTORY $ENV{ESP_AT_PROJECT_PATH}/esp-idf
COMMENT "Enabling Network Debug...")
else()
add_custom_command(TARGET at_net_debug
POST_BUILD
COMMAND ${PYTHON} $ENV{ESP_AT_PROJECT_PATH}/tools/at_net_debug.py --restore
WORKING_DIRECTORY $ENV{ESP_AT_PROJECT_PATH}/esp-idf
COMMENT "Disabling Network Debug...")
endif()
add_dependencies(gen_project_binary at_net_debug)
add_dependencies(flash at_net_debug)

# Create factory bin
file(MAKE_DIRECTORY $ENV{ESP_AT_PROJECT_PATH}/build/factory)
add_custom_command(TARGET factory_bin
Expand Down
54 changes: 54 additions & 0 deletions main/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -397,4 +397,58 @@ menuconfig AT_DEBUG
depends on AT_WIFI_DUMP_STATIS_DEBUG
default 3000

config AT_NET_DEBUG
bool "Enable Network Debug"
depends on AT_DEBUG && (LOG_DEFAULT_LEVEL_INFO || LOG_DEFAULT_LEVEL_DEBUG || LOG_DEFAULT_LEVEL_VERBOSE)
default n
help
Enabling this option allows different kinds of network debug output, and these debug outputs will be sent to the AT log port.
Attention: this network debug feature does not support IP fragment and IPv6 till now.

config AT_NET_TCP_DEBUG
bool "Enable the TCP packet debug messages"
depends on AT_NET_DEBUG
default y
help
Enabling this option to monitor the outgoing (TX) and incoming (RX) packets of TCP or protocol based on TCP (SSL/HTTP/MQTT/WebSocket/etc).
It will print TCP packets information, which includes ip total len, tcp data len, tcp seq, tcp ack, src port, dest port, and tcp flags. TCP flags is the accumulation of CWR:128, ECN:64, Urgent:32, Ack:16, Push:8, Reset:4, SYN:2, FIN:1.

config AT_NET_TCP_DEBUG_PORT_LIST
string "Specify the list of TCP port numbers to monitor"
depends on AT_NET_TCP_DEBUG
default "0"
help
0 means all ports, and the port numbers should be separated by commas if monitor multiple ports.

config AT_NET_UDP_DEBUG
bool "Enable the UDP packet debug messages"
depends on AT_NET_DEBUG
default y
help
Enabling this option to monitor the outgoing (TX) and incoming (RX) packets of UDP or protocol based on UDP (DHCP/DNS/SNTP/mDNS/etc).
It will print UDP packets information, which includes ip total len, src port, dest port, and udp data len.

config AT_NET_UDP_DEBUG_TX_PORT_LIST
string "Specify the list of outgoing UDP (UDP TX) port numbers to monitor"
depends on AT_NET_UDP_DEBUG
default "0"
help
0 means all ports, and the port numbers should be separated by commas if monitor multiple ports.

config AT_NET_UDP_DEBUG_RX_PORT_LIST
string "Specify the list of incoming UDP (UDP RX) port numbers to monitor"
depends on AT_NET_UDP_DEBUG
default "53, 67, 68, 123"
help
The port number should be separated by commas if monitor multiple ports.
You should not set the port number to 0 to prevent UDP RX flooding.

config AT_NET_ICMP_DEBUG
bool "Enable the ICMP packet debug messages"
depends on AT_NET_DEBUG
default y
help
Enabling this option to monitor the outgoing (TX) and incoming (RX) packets of ICMP.
It will print ICMP packets information, which includes ip total len, icmp type, id, seq, and icmp data len.

endmenu
Loading

0 comments on commit 993bf6d

Please sign in to comment.