ADuC7000 Introduction

Introduction

I had a chance to work a bit with ADuC7000 microcontrollers. I worked mainly
on a ADUC7024, rev. B1 evaluation board:
http://www.analog.com/static/imported-files/application_notes/AN-719.pdf
with evaluation version of KEIL uVision, available for educational purposes
(with limitations) on http://www.keil.com

KEIL software is a very powerful debugging platform that supports ulink
debugger (JTAG by KEIL). You can find more details about it on the
manufacturer's website: http://www.keil.com/arm/ulink/. Ulink allows for
easy debugging and view everything that happens of the memory of the
microcontroller.

Working with KEIL uVision

A particularly important feature of KEIL uVision's is the option of accessing
microcontroller's peripherals using ULINK. The KEIL environment supports GPIO,
interrupts, oscillators, timers, interrupts, etc. It is possible to quickly
see what are the interrupt status flags, browse through registers statuses of
peripherals and see what is happening in the microcontroller.

When it is not clear where the execution of microcontroller's code fails
(or hangs) - it is possible to set a breakpoint and halt execution of core
when Program Counter reaches place indicated by breakpoint. This allows for
easy checking with ULINK all registers, variables, interrupts to verify
correctness of code. Additionally when core exuctution is halted - KEIL allows
to change values of registers and resume operation of the microcontroller.
Below are example screen shots of the service peripherals.

Viewing values of microcontroller interrupt registers (left) and GPIO registers (right), with option of chaning repsective values.

Below is shown ULINK connection to the eval board.

Installing and running a first example

In short - it can be broken down into the following steps:

  1. Installing the software (download from KEIL, including installation of USB operation of ulink)
  2. Verification of evaluation platform
  3. Create an simple project and run it

1. Installation

Download software evaluation version from: https://www.keil.com/demo/eval/arm.htm
Install it.

2. Validation of eval board

If ULINK is desired - connect ULINK to the eval board and verify
whether everything works correctly. Open the sample project provided
with KEIL IDE (sample location):
C:\Keil\ARM\Boards\ADI\ADuC702X\Blinky\Blinky.Uv2
or C:\Keil\ARM\Boards\ADI\ADuC712x\CBlinky\CBlinky.Uv2 - if an ADuC712x

Configure to work with ULINK:
Menu> Flash> Flash Tools Configure as shown below:

In the Utilities tab, select "Use Target Driver for Flash Programming":

Click "Settings" and make sure that a correct type of memory if selected. In case of ADuC702x it should be: "ADuC702X Flash", 62kB, 0080000H - 008F7FFH, as shown below. In case of other microcontroller - select appropriate memory by using the "Add" / "Remove".

After accepting the check - click to Rebuild All Target Files and then Download to Flash Memory

"If the code is loaded properly - it means that drivers are installed properly
and we have nothing to worry about; you may still need to press a RESET button
on the evaluation board to run the code. If KEIL can not run properly ULINK - read
help first, and reinstall files and drivers again. In my case I had to install
drivers using the second link, and overwrite the existing drivers.

Ulink: REINSTALLING USB DRIVER (http://www.keil.com/support/docs/2418.htm)
Ulink: DRIVER PROBLEM GIVES NO USB DEVICE FOUND (http://www.keil.com/support/docs/2937.htm)

3. Create an simple project and run it

In my case - I had a problem with the creating a new project properly.
The problem I have encountered was an incorrect Start-up.s file. From what I
know the problem does not exist on latest verison of KEIL uVision. Anyway - below
is shown a workaround that should help you out.

Menu> Project> New Project ... uVision

Choose a project name (eg test.uv2), we accept.
Select the microcontroller (eg ADuC7024):

Accept the question, "Copy Start Up Code"? :: Yes.

Create a new file: Menu> File> New
Save it as test.c, and fill in the following code:

#include <aduc7024.h>
 
int main (void)
{
    while (1);
}

Right click on Source Group (on the left side of the screen and add the newly created file test.c - "Add Files to Group Source Group 1") to the project:

Remember the whole project (Menu> File> Save All).
Compile the project: (Menu> Project> Rebuild All Target Files).
If the design build work - this means that everything is OK.

On the older version on KEIL you might receive the following messages:

test.axf: Error: L6218E: Undefined symbol DAbt_Handler (reffered from aduc702x.o).
test.axf: Error: L6218E: Undefined symbol FIQ_Handler (reffered from aduc702x.o).
test.axf: Error: L6218E: Undefined symbol IRQ_Handler (reffered from aduc702x.o).
test.axf: Error: L6218E: Undefined symbol PAbt_Handler (reffered from aduc702x.o).
test.axf: Error: L6218E: Undefined symbol SWI_Handler (reffered from aduc702x.o).
test.axf: Error: L6218E: Undefined symbol Undef_Handler (reffered from aduc702x.o).

This problem is related to the lack of symbols DAbt_Handler, FIQ_Handler, etc. .. In other words - the linker requires declared in C FIQ handlers, DAbt, IRQ, and others. Personally, I tried the following files startup.s asnd main.c. You can download below.

What is the difference? - Solution to the problem of interruptions:

Boot file (Assembler) - defines the unused symbols (like DAbt_Handler), and used the symbols (eg IRQ - are transferred to C). For example - if you want to allow, eg interrupt IRQ is:

1) in the C source code to declare them:

__irq IRQ_Handler void (void)
{
}

2) remove the label Startup.s IRQ_Handler IRQ_Handler and import the symbol, using the IMPORT command, as shown below:

Compilation should go smoothly.