JTAG Connection

Why am I getting a "Cannot identify target" error message when I connect to the target?

This error message could be caused by the following:

  • The JTAG interface is not correctly connected to the target.
  • The target is not powered.
  • The target is being held in reset.
  • The wrong JTAG target interface type has been selected.
Why am I getting a "Target not responding" error message when I connect to the target?

This error message could be caused by the following:

  • Incorrect ARM Debug Interface Type - Check that the Target | ARM Debug Interface project property matches the type of target you are trying to connect to.
  • Unreliable JTAG Connection - Try reducing the JTAG clock frequency or reducing the target interface's cable lengths as much as possible.
Why am I getting a "Cannot stop CPU" error message?

This error message could be caused by the following:

  • Unreliable JTAG Connection - Try reducing the JTAG clock frequency or reducing the target interface's cable lengths as much as possible.
  • Invalid code has been executed - This may be caused by your program not being loaded correctly, a problem with the target's memory or a bug in your program. You can check the download and memory by verifying the download.
How do I reduce the JTAG clock frequency?

If you are using an ARM CrossConnect or a Wiggler you can alter the clock frequency by setting the JTAG Clock Divider target property (the default setting is 1).

If you are using an ARM CrossConnect you can also enable adaptive clocking by setting the Adaptive Clocking target property to Yes. This mode uses the RTCK signal to dynamically control the JTAG clock frequency

If you are using a J-Link you can alter the clock frequency by setting the Speed target property (the default setting is 4000).

How should the JTAG connector signals nSRST and nTRST be used?

See the "Reset Signals" section in "Chapter 6, System Design Guidelines" of the Multi-ICE User Guide for a description of the correct reset circuit design.

For reliable debugging over JTAG, the JTAG connector's nSRST signal should only reset the ARM core and not the JTAG state machine / EmbeddedICE logic. If this is not the case, the debugger will be unable to reset and stop the processor without allowing the program currently in memory to execute for a period of time. This may cause unreliability because the processor and peripherals may not be in their reset state or invalid code may have been executed before a new program can be downloaded or run.

CrossStudio does not use the nTRST signal.

Program Loading

How can I check that my program has been downloaded correctly?

You can verify that your program has been downloaded after every load by enabling load verification. To do this check the Tools | Options | Target | Enable load verification option.

Alternatively, you can carry out a program verification at any time by selection the Debug | Verify menu option. This will verify that your current active project is correctly loaded onto the target.

Is it possible to reduce the time it takes to download a program?

Download speeds can be increased when using a program loader on some some targets by changing the Target | Loader File Type from Comms Channel Loader to Fast Comms Channel Loader.

The Fast Comms Channel loader option may not work or be may be unreliable on certain ARM targets, so revert to the Comms Channel Loader option if you experience any unreliability.

Memory Placement

How do I put code and data into different sections?

There are two ways to put code and data into different named sections:

  1. Use gcc's section attribute. For example, the following declaration will place the function foobar into the section named .foo section:

    void foobar(void) __attribute__ ((section(".foo")));

  2. Change a section's name for an entire module using the Section Name project properties. For example to put all code from a particular module into the section ".foo":

    • Select project element in project window.
    • Open the element's Properties window.
    • Select the Section tab.
    • Change the Code Section Name from ".text" to ".foo".

How do I place program sections at a particular position in memory?

The memory map file specified by a project's Memory Map File property is used to place sections in memory. A program section's Input Sections property is used to specify which input sections will be placed in a program section.

For example, to put the contents of the ".foo" section at a particular location in memory:

  • Open the project's memory map by selecting the project in the project explorer and selecting View Memory Map from the context menu.
  • Create a new program section called ".foo" at the required position in the memory map.
  • Select the ".foo" program section and modify it's Input Section property to be *(.foo)
  • Re-build the project.

C Runtime

How do I change the stack sizes?

The ARM maintains six separate stacks:

  • System/User mode stack.
  • Supervisor mode stack
  • IRQ mode stack
  • FIQ mode stack
  • Abort mode stack.
  • Undefined mode stack.

To change the size of a stack section:

  • Select your application project in the Project Explorer window.
  • Right click to bring up the Project Explorer context menu and select Properties to open the Project Options dialog.
  • Select the configuration(s) you wish the change to apply to using the Configuration drop down.
  • Select the Linker tab to bring forward the linker options.
  • You should see six Stack Size properties, one for each stack, set the property for the stack you wish to change to be the required maximum stack size in bytes.
How do I change the heap size?

To change the size of the heap section:

  • Select your application project in the Project Explorer window.
  • Right click to bring up the Project Explorer context menu and select Properties to open the Project Options dialog.
  • Select the configuration(s) you wish the change to apply to using the Configuration drop down.
  • Select the Linker tab to bring forward the linker options.
  • Set the Heap Size property to be the required heap size in bytes.

C Library

Why don't floating point numbers work with the printf and scanf functions?

In order to minimize size, versions of the printf and scanf functions without floating point support are linked by default. To enable floating point printf and scanf support, set the Floating Point I/O Supported property of your project to Yes

Projects

How do I compile or assemble Thumb code?

The Instruction Set compiler project property controls the type of code generated by both compiler and assembler, it can be set to ARM or Thumb.

The ARM/Thumb Interworking compiler project property instructs the compiler whether to produce code that supports calling between ARM and Thumb instruction sets.

How do I link a Thumb version of the standard C library?

The Library Instruction Set linker project property controls the version of the standard C library to use. If ARM is selected, the ARM version of the standard C library will be linked. If Thumb is selected, the Thumb version of the standard C library will be linked.

Memory Usage

How can I find out how big my program is?

You can use the symbol browser window to find out the size of your program:

  • Open up the Symbol Browser using View | Symbol Browser or typing Ctrl+Alt+Y.
  • Click the arrow on the first button on the symbol browser's toolbar.
  • Select Group By Section from the menu.

You will now see the sections that comprise your program together with their addresses and sizes. You can use the symbol browser to view the range of data items and see how much code each individual function takes up.

How can I find out where functions or variables have been placed in memory by the linker?

You can use the symbol browser window to find out where symbols are placed in memory:

  • Open up the Symbol Browser using View | Symbol Browser or typing Ctrl+Alt+Y.
  • Click the arrow on the first button on the symbol browser's toolbar.
  • Select Group By Type from the menu.

You will see a list of groups each containing symbols of a particular type, such as functions, variables and labels. Within each of these groups will be listed each symbol and the address range it occupies in memory.