Morse Micro IoT SDK  2.10.4
Debugging with GDB

Launching OpenOCD with MM_PROGRAM=0

In Launching OpenOCD we launched OpenOCD with the CONNECT_ASSERT_SRST flag set to 1. This causes OpenOCD to reset the application on attaching to the target. The GNU Debugger (GDB) is used for debugging, with OpenOCD providing the interface between the GDB and the hardware, as shown in the diagram below. The ST-link is on board the Nucleo, or on the Morse Micro evaluation kit for standalone Platforms. See Morse Micro IoT Reference Platforms for which USB port to connect to.

Block diagram of debugging hardware/software stack

By launching without this flag, we can attach to a running program without restarting:

openocd -f src/platforms/mm-mm6108-ekh05/openocd.cfg

Note that GDB requires OpenOCD open for the duration of debugging.

Launching GDB

The GNU Project debugger (GDB) is an application allows us to program and debug an application. We will just be using it to program and run the application.

To verify that the correct ARM toolchain is in the path, execute the following command:

which arm-none-eabi-gdb

We should expect:

/opt/morse/gcc-arm-none-eabi-10.3-2021.07/bin/arm-none-eabi-gdb

Once OpenOCD and Miniterm are running, as described in the previous sections, it is possible to then launch GDB to program the device.

Navigate to the example directory (where we ran the make command) and run gdb on the built '.elf' file:

cd mm-iot-sdk-2.10.4/examples/ping/targets/mm-mm6108-ekh05
arm-none-eabi-gdb build/ping.elf -ex 'target extended-remote :3333'

This will start GDB and connect to the local OpenOCD instance started above.

From the GDB terminal first reset and halt the device by executing:

monitor reset halt

Then download firmware by executing:

load

Once the firmware download has completed, the processor can be started by executing:

continue

As the firmware runs, it will boot the Morse Micro transceiver and attempt to connect to the AP and ping it. A successful result will output something like the following in Miniterm:

Note: This firmware has been built with debug in stop mode enabled. This will impact power consumption and should be disabled for production firmware.

Morse Ping Demo (Built Sep 19 2025 10:51:20)

-----------------------------------
BCF API version:         12.1.0
BCF build version:       4cdf808 07f9d31
BCF board description:   mf08551
Morselib version:        2.6.1
Morse firmware version:  2.8.2
Morse chip ID:           0x0306
Morse chip name:         MM6108A1
-----------------------------------
Initialize IPv4 with static IP: 192.168.1.2...
Initialize IPv6 using Autoconfig...
Morse LwIP interface initialised. MAC address 0c:bf:74:00:01:2b
Attempting to connect to MorseMicro with passphrase 12345678
This may take some time (~30 seconds)
WLAN STA connecting
WLAN STA connected
Link is up. Time: 8294 ms, IP: 192.168.1.2, Netmask: 255.255.255.0, Gateway: 192.168.1.1

Ping 192.168.1.1 56(64) bytes of data.
(192.168.1.1) packets transmitted/received = 1/1, round-trip min/avg/max = 34/34/34 ms
(192.168.1.1) packets transmitted/received = 2/2, round-trip min/avg/max = 4/19/34 ms
(192.168.1.1) packets transmitted/received = 3/2, round-trip min/avg/max = 4/19/34 ms
(192.168.1.1) packets transmitted/received = 3/3, round-trip min/avg/max = 4/17/34 ms
(192.168.1.1) packets transmitted/received = 4/3, round-trip min/avg/max = 4/17/34 ms
(192.168.1.1) packets transmitted/received = 4/4, round-trip min/avg/max = 4/15/34 ms
(192.168.1.1) packets transmitted/received = 5/5, round-trip min/avg/max = 1/12/34 ms
(192.168.1.1) packets transmitted/received = 6/6, round-trip min/avg/max = 1/11/34 ms
(192.168.1.1) packets transmitted/received = 7/6, round-trip min/avg/max = 1/11/34 ms
(192.168.1.1) packets transmitted/received = 7/7, round-trip min/avg/max = 1/11/34 ms
(192.168.1.1) packets transmitted/received = 8/7, round-trip min/avg/max = 1/11/34 ms
(192.168.1.1) packets transmitted/received = 8/8, round-trip min/avg/max = 1/11/34 ms
(192.168.1.1) packets transmitted/received = 9/8, round-trip min/avg/max = 1/11/34 ms
(192.168.1.1) packets transmitted/received = 9/9, round-trip min/avg/max = 1/11/34 ms
(192.168.1.1) packets transmitted/received = 10/9, round-trip min/avg/max = 1/11/34 ms
(192.168.1.1) packets transmitted/received = 10/10, round-trip min/avg/max = 1/12/34 ms

--- 192.168.1.1 ping statistics ---
10 packets transmitted, 10 packets received, 0.000% packet loss
round-trip min/avg/max = 1/12/34 ms
WLAN STA disabled
Link is down. Time: 28727 ms

To halt the firmware press CTRL-C and to exit GDB from there press CTRL-D and enter y when prompted.