connect the eval-adicup3029 / ev-cog-ad3029 board with the ... · unzip the provided...

29
This is a non-official quick tutorial on How-To use a EVAL-ADICUP3029 / EV-COG-AD3029 board with an simple, free and easy to use unlimited tool “emIDE”. emIDE is based on Code Blocks and the GNU Arm Embedded Toolchain http://www.emide.org/ https://developer.arm.com/open-source/gnu-toolchain/gnu-rm The official support for ADuCM3029 with Cross-Core-Embedded-Studio – based on Eclipse – is working well. http://www.analog.com/en/design-center/processors-and-dsp/evaluation-and- development-software/adswt-cces.html But I‘m personally appreciate this simpler approach for small and quick Bare-Metal Projects It is assumed you have basic knowledge of programming ARM Cortex M3 embedded micros in C and have access to the Hardware Reference Manual for the ADuCM3029 http://www.analog.com/media/en/dsp-documentation/processor- manuals/ADuCM302x-mixed-signal-control-processor-hardware-reference.pdf This Tutorial has been put together based on an system running Windows 7 Pro 64- bit – but it should also work on newer versions of Windows (tested on Win 8.1 and Win 10) 1

Upload: others

Post on 10-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� This is a non-official quick tutorial on How-To use a EVAL-ADICUP3029 / EV-COG-AD3029 board with an simple, free and easy to use unlimited tool “emIDE”.

� emIDE is based on Code Blocks and the GNU Arm Embedded Toolchain http://www.emide.org/https://developer.arm.com/open-source/gnu-toolchain/gnu-rm

� The official support for ADuCM3029 with Cross-Core-Embedded-Studio – based on Eclipse – is working well.http://www.analog.com/en/design-center/processors-and-dsp/evaluation-and-development-software/adswt-cces.html

� But I‘m personally appreciate this simpler approach for small and quick Bare-Metal Projects

� It is assumed you have basic knowledge of programming ARM Cortex M3 embedded micros in C and have access to the Hardware Reference Manual for the ADuCM3029 http://www.analog.com/media/en/dsp-documentation/processor-manuals/ADuCM302x-mixed-signal-control-processor-hardware-reference.pdf

� This Tutorial has been put together based on an system running Windows 7 Pro 64-bit – but it should also work on newer versions of Windows (tested on Win 8.1 and Win 10)

1

Page 2: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Download all attached files from the Engineer Zone post and from the links

above.

� Download and Install the J-Link-Driver and PuTTY.

� J-Link Drivers are usually used with the emIDE. The user will be prompted

for it at first startup if it is not found. It may also be used with this board if

you own a J-Link Debug Probe. But here we focus on the onboard

OpenOCD Debug Probe

� PuTTY is recommended as the Terminal Emulator and in one step of that

tutorial it is used to check communication with the connected board via

Telnet – but this step can be skipped and is not absolute necessary.

� Follow step-by-step this tutorial to get the basic examples up and running and

start debugging on the EVAL-ADICUP3029 / EV-COG-AD3029 board and

easily use the provided projects as a starting point for your own projects.

2

Page 3: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the micro USB

cable to a Windows PC (or Windows Virtual Machine)

� Wait until Windows has tried to install the driver for the new USB devices and

complains about it.

3

Page 4: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Start the installation of the mbed Windows serial port driver .

� In my case “mbedWinSerial_16466.exe”

4

Page 5: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Success: all USB devices are correctly installed

� Click Finish

5

Page 6: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder

called C:\openocd.

If you change the C:\openocd folder name, you also need to adjust the

startOpenOCDserver.bat file.

� This OpenOCD server is a simplified, stripped-down version of the official one

provided with Cross-Core-Embedded-Studio

http://openocd.org

� Start by double-clicking on the batch file

6

Page 7: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Assuming the EVAL-ADICUP3029 / EV-COG-AD3029 board is still connected

to your Windows machine.

� A cmd window pops up and you should get the shown Info‘s about the

connected device.

7

Page 8: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� For the first start up of the OpenOCD server you will be asked to allow

OpenOCD to access communication networks – this is required as the server

uses virtual network communication on your Windows machine

� Click Allow access

� All Ok

� Leave the OpenOCD cmd-Window open

8

Page 9: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Now , as an optional step, we can check the communication with the

EVAL-ADICUP3029 / EV-COG-AD3029 board.

� Start PuTTY and open a Telnet connection with localhost port 4444.

9

Page 10: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� With PuTTY connected via Telent with localhost port 4444

� Check the basic functionality of the OpenOCD server quickly with the following

commands:

� reg – to list the core registers

� resume – to let the core run code possibly already programmed into the

Flash

� halt – to hold the core

� step – to execute a single instruction on the core

� arm disassamble 0x800 16 – to disassemble 16 instructions starting at

address 0x800

Assuming that works as expected - you‘re basically ready to do any kind of

Bare-Metal-Development with this boards

10

Page 11: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Download the emIDE from emIDE.org

� The Portable Package is my preferred option.

� You only need to unzip it with 7-zip into a new folder: C:\emIDE

11

Page 12: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Now check that the arm version of gdb is working with the

EVAL-ADICUP3029 / EV-COG-AD3029 board

� Open a cmd-window

� cd into C:\emIDE\arm\bin(assumed you have unzipped the emIDE file into C:\emIDE as suggested)

� Run arm-none-eabi-gdb

� Connect to target with target remote localhost:3333

� Read out core registers with “info registers“

� Run the program possibly already in the Flash with “c” – like continue

� If that all works as expected close the cmd-window and we are ready to work

with projects in emIDE.

12

Page 13: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Unzip the simple project attached to the EngineerZone post for the board you

are using – either EVAL-ADICUP3029 or EV-COG-AD3029 – in a folder of

your choice.

� Open the file-explorer at C:\emIDE and double click emIDE.exe to start

13

Page 14: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� For the first start emIDE is checking available compilers and at least will find

the GNU ARM GCC Compiler which comes with it.

14

Page 15: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Open an existing project

15

Page 16: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Open an existing project in the folder where we unzipped the project attached

to the Engineer Zone post with the file extension .emP.

16

Page 17: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Check the Global Compiler Settings for the Toolchain executables.

� The compilers installation directory should be C:\emIDE\arm.

17

Page 18: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Check the Debugger Settings for the GDB debugger : ARM.

� The Executable path should be C:\emIDE\arm\bin\arm-none-eabi-gdb.exe.

18

Page 19: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� In the project window right click the project name and click Properties.

19

Page 20: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� In the Debugger tab the default setting is J-Link. We need to use OpenOCD

for the EVAL-ADICUP3029 / EV-COG-AD3029 board.

� In the GDB tab

� Remote connection settings� IP Address: localhost

� Port: 3333� Remote server: Other(External tool)

� Select Run and break at function: Main

20

Page 21: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Now we can Build or Rebuild (Build All) using one of the two marked icons on

the toolbar.

� The result in the Build Log should show 0 errors and 0 warnings

21

Page 22: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Here is a list of commands, the command shortcuts and the corresponding

toolbar icon for debugging.

Note: The Reset the target command is not correct implemented with

OpenOCD and the ADuCM3029 – but there is a workaround. This is explained

later.

� It is assumed the OpenOCD cmd-window is still open in the background at this

point.

� <F5> or Start Debugging has two functions:

� Start debugging and download the code to the target board

and

� Start/run the code in the debugger

22

Page 23: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� After starting debugging the execution already starts, but breaks/halts at the

entry of the main function

� Other windows around the source code show the core registers, disassembly,

locals, individual watches, breakpoint locations and the Debugger Log.

� With OpenOCD the feature to use predefined Peripheral Registes does not

work now, but for this you can use the watches to monitor the MMR of interest

– i.e. TMR0_CURCNT – Timer 0 Current Count – as defined in the used

ADuCM3029 header-file for the project.

23

Page 24: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� To set a Breakpoint click to the right of the line number .

� It is possible to set a breakpoint while the core is running.

� If the project provided has not been modified till now – the execution will not hit

the breakpoint, as the timer has not been enable.

24

Page 25: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Exit the Debugger

� Remove the comment (//) in line 26 to enable the code generation for Timer 0

Init

� Build the project and start debugging again

25

Page 26: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Now the Timer generates an interrupt and the Debugger will halt at the

Breakpoint in the Timer 0 Interrupt Handler.

26

Page 27: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� Workaround for the missing Reset the target functionality

� Simply type into the Debugger Command frame mon reset halt <Enter>

� Put your cursor i.e. on line 39 – the first Instruction in the main function and

use Run to cursor.

27

Page 28: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

� You can also select the C-startup file and set your cursor there and use Run to cursor.

� This way you can also debug the low level entry if required.

28

Page 29: Connect the EVAL-ADICUP3029 / EV-COG-AD3029 board with the ... · Unzip the provided OpenOCD-Win-ADuCM3029.zip file into a new folder called C:\openocd. If you change the C:\openocd

29