Here are some of my notes for getting Mynewt to work with eclipse.  I
wrote these a while back, so there may be a few inaccuracies.  Also,
these notes assume you are building bletiny for the nRF52dk BSP, so you
may need to adjust accordingly.

Thanks,
Chris

*** Setup

1. Download Eclipse Neon (https://www.eclipse.org/downloads/).

2. Start Eclipse.

3. Eclipse -> Preferences -> C/C++ -> Environment; Add a "PATH" Variable
   with the value "/usr/local/bin" (or wherever arm-none-eabi-gdb is
   located on your machine).

4. In your newt project directory, overwrite
   repos/apache-mynewt-core/hw/bsp/nrf52dk/nrf52dk_debug.sh with the
   attached version.

*** New project

5. File -> New -> New Project -> C/C++ -> C Project ->
   Makefile project -> Empty Project

6. Select "-- Other Toolchain --" in the Toolchains panel.

7. Type your project's name in the "Project name" field.

8. Select your newt project directory in the "Location" field.

(see "new-project.png").

9. Click Finish.

*** Debug configuration

10. Right-click your project and select "Debug As..." ->
    "Debug Configurations".

11. Double click "C/C++ Remote Application" to create a new debug
    configuration.  The new configuration should now be selected.

12. At the bottom of the window, you should see: "Using GDB (DSF)
    Automatic Remote Debugging Launcher - Select other...".  Click the
    "Select other..." link.

13. Check "Use configuration specific settings"

14. Select "GDB (DSF) Manual Remote Debugging Launcher"

(see "select-launcher.png").

15. Click OK.

16. (Main tab) In the "C/C++ Application" field, select the .elf file
    corresponding to your newt target.

17. (Main tab) Check "Disable auto build"

(see "debug-main.png").

18. (Debugger, Main tab) In the "GDB debugger" field, type:
    arm-none-eabi-gdb

(see "debug-debugger-main.png").

19. (Debugger, Connection tab) In the "Port number" field, type: 3333

(see "debug-debugger-connection.png").

20. Click Apply and Close.

*** Debugging

21. In a shell, run "newt run <target-name> 0".  JLinkGDBServer should
    start up and listen for a connection from gdb.

21. Select your project in the Project Explorer.

22. Click the icon with a picture of a bug.  The debugger should start.

23. The board will be in a bad state and requires a reset.  Type
    "monitor reset" in the Console pane

(see "monitor-reset.png")

24. Click the Resume button (play button with a yellow rectangle on its
    left).  The program should now halt at the start of main().

Attachment: nrf52dk_debug.sh
Description: Bourne shell script

Reply via email to