Using Visual Studio to debug applications on Digi Connect ME9210

This quickstart guide shows how to build and debug a simple application on a Digi Connect module using VisualGDB.

Before you begin, please download and install the following:

  • VisualGDB
  • Digi development kit on a Linux virtual machine
  • Make sure the GPIOs are set up and the GPIO kernel module included
  • Set up the board to load the root filesystem from the default NFS directory

1. First create a sample project in Digi ESP, select File->New->Digi EL Application/Library C Project


01-wizard

2. Then select the sample GPIO project and press “Finish”.


02-sample

3. Next build the project Debug version and ensure that it runs.


03-built

4. Run the debug version.


04a-eclipse

5. Go to Debug Configurations and make the debugger output verbose.


04b-verbose

6. Run the debug version again and observe the flags Digi ESP uses for gdb. We will need these flags later to manually set up gdb.


04c-console

7. Now we are ready to make a VisualGDB project.


04-wizard

8. Choose a full custom project.


05-wizard1

9. Choose the vm as the build server.


06-wizard2

10. Add copying the files as a build command.


07-wizard3

11. Add a make all build command.


08-wizard4

12. Add a make all build command.


09-wizard5

13. Add a make clean command.


10-wizard6

14. The build and clean commands look now like this.


11-wizard7

15. Now we set up path mapping.


12-wizard8

16. We use a script to start the gdbserver on the device and load the gpio kernel module before starting GDB.

#!/usr/bin/expect
spawn telnet 192.168.0.77
expect {/ # }
send "modprobe gpio &\r"
expect {/ # }
send "gdbserver 192.168.0.78:8086 /bin/GPIOTest &\r"
expect {/ # }


13-wizard9

17. We use the arm-linux-gdb provided by Digi.


14-wizard10

18. We use another script to kill the gdbserver after debugging.

#!/usr/bin/expect
spawn telnet 192.168.0.77
expect {/ # }
send "killall gdbserver\r"
expect {/ # }


15-wizard11

19. We need to specify the flags for gdb.

target remote 192.168.0.77:8086
-gdb-set architecture armv4
-gdb-set solib-absolute-prefix /home/user/DigiEL-5.2/


17-wizard13

20. Now our debugging settings look as follows. Press “Finish”.


16-wizard12

21. Let’s go to Project->VisualGDB Project Properties and then method of breaking.

#!/usr/bin/expect
spawn telnet 192.168.0.77
expect {/ # }
send "killall -s INT GPIOTest\r"
expect {/ # }


18-interrupt

22. Now everything has been set up and we are ready to debug. Set a breakpoint just inside the main function and go to Debug->Start Debugging with GDB


19-debug

23. Set a breakpoint as shown, then press the user button 2 on the development board. Observer how the breakpoint is reached.


20-debug2

24. Press the button more times, observe how the Led 3 turns on and off.


21-board_on


21-board_off