Skip to content

Commit

Permalink
Add tcp-serial-redirect target and add WSL notes on debugging
Browse files Browse the repository at this point in the history
Don't kill terminal when running gdb, it'll kill tcp redirector
  • Loading branch information
mikee47 committed Feb 26, 2021
1 parent db691f9 commit 09c2325
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Sming/project.mk
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ cs-dev: ##Apply coding style to all files changed from current upstream develop
$(SMING_MAKE) $@

.PHONY: gdb
gdb: kill_term ##Run the debugger console
gdb: ##Run the debugger console
$(GDB_CMDLINE)

.PHONY: fetch
Expand Down Expand Up @@ -544,6 +544,18 @@ otaserver: all ##Launch a simple python HTTP server for testing OTA updates
$(info Starting OTA server for TESTING)
$(Q) cd $(FW_BASE) && $(PYTHON) -m SimpleHTTPServer $(SERVER_OTA_PORT)


#
.PHONY: tcp-serial-redirect
tcp-serial-redirect: ##Redirect COM port to TCP port
$(info Starting serial redirector)
ifdef WSL_ROOT
$(Q) cmd.exe /c start /MIN python3 $(WSL_ROOT)/$(SMING_HOME)/../Tools/tcp_serial_redirect.py $(COM_PORT) $(COM_SPEED_SERIAL)
else
$(Q) gnome-terminal -- bash -c "$(PYTHON) $(SMING_HOME)/../Tools/tcp_serial_redirect.py $(COM_PORT) $(COM_SPEED_SERIAL)"
endif


##@Help

.PHONY: list-config
Expand Down
24 changes: 24 additions & 0 deletions docs/source/getting-started/windows/wsl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,30 @@ For example::
make flash COM_PORT=COM4


Serial debugging
----------------

Again, as we have no direct access to USB COM ports a workaround is required.
A small python application can be run on Windows to act as a simple bridge between the serial port and a TCP port.
See ``Tools/tcp_serial_redirect.py`` - run without arguments to see available options.

You can start the server like this::

make tcp-serial-redirect

A new console will be created (minimised) showing something like this::

--- TCP/IP to Serial redirect on COM4 115200,8,N,1 ---
--- type Ctrl-C / BREAK to quit
Waiting for connection on 192.168.1.101:7780...

This uses the current :envvar:`COM_PORT` and :envvar:`COM_SPEED_SERIAL` settings.

Now we can start the debugger::

make gdb COM_PORT_GDB=192.168.1.101:7780


Valgrind
--------

Expand Down

0 comments on commit 09c2325

Please sign in to comment.