SAM-ICE / Linux with atmel cpu

I’m trying to get openocd working on Linux. I have the Atmel Sam-Ice, and I’ve build openocd 0.4.0 from source enabling the jlink during configuration. Since I don’t have a config script for the at91samg45-es, I’m using a modified at91samg20-es.cfg file. Here is what I get executing the openocd program. The bulk-read failures don’t look good, yet SOME data is being read from the jtag. Any ideas?

ken@PACALAdev ~ $ openocd -f ~/.openocd.d/interface/jlink.cfg -f .openocd.d/board/at91sam9g45-ek.cfg

Open On-Chip Debugger 0.4.0 (2010-11-29-15:42)

Licensed under GNU GPL v2

For bug reports, read

http://openocd.berlios.de/doc/doxygen/bugs.html

trst_and_srst separate srst_gates_jtag trst_push_pull srst_open_drain

jtag_nsrst_delay: 200

jtag_ntrst_delay: 200

RCLK - adaptive

TapName Enabled IdCode Expected IrLen IrCap IrMask


0 at91sam9g45.cpu Y 0x00000000 0x0792603f 4 0x01 0x0f

Info : J-Link initialization started / target CPU reset initiated

Info : J-Link ARM V8 compiled Sep 30 2010 13:08:47

Info : JLink caps 0xb9ff7bbf

Info : JLink hw version 80000

Info : JLink max mem block 8376

Info : Vref = 3.293 TCK = 1 TDI = 0 TDO = 0 TMS = 0 SRST = 0 TRST = 0

Info : J-Link JTAG Interface ready

Error: usb_bulk_read failed (requested=1, result=0)

Error: jlink_tap_execute, wrong result -107 (expected 1)

Info : RCLK (adaptive clock speed)

Error: usb_bulk_read failed (requested=1, result=-110)

Error: jlink_tap_execute, wrong result -107 (expected 1)

Error: usb_bulk_read failed (requested=1, result=0)

Error: jlink_tap_execute, wrong result -107 (expected 1)

Command handler execution failed

Warn : jtag initialization failed; try ‘jtag init’ again.

Hello,

Sorry to bring the subject up again after such a long time. But it seems I have the exact same problems as you have/had. Did you found a solution for it? It would throw a glance of light into my humble life 8) :wink:

I also work on OpenOCD 0.4.0, use a JLink as wel (also firmware V8)

I’m still experimenting but I’m thinking to put the firmware back to V6, because I have a small doubt if V8 is completely OK for openocd. On the internet I only see V3 – V7. Although I’m not sure that this is the solution for the problem.

I’ll keep you informed!

Best,

Hans

hi!

need change the jlink.c

if (jlink_caps & (1 << EMU_CAP_GET_HW_VERSION))

{

/* query hardware version */

jlink_simple_command(EMU_CMD_GET_HW_VERSION);

result = jlink_usb_read(jlink_handle, 4);

if (4 != result)

{

LOG_ERROR(“J-Link command EMU_CMD_GET_HW_VERSION failed (%d)”, result);

return ERROR_JTAG_DEVICE_ERROR;

}

uint32_t jlink_hw_version = buf_get_u32(usb_in_buffer, 0, 32);

uint32_t major_revision = (jlink_hw_version / 10000) % 100;

jlink_hw_type = (jlink_hw_version / 1000000) % 100;

if (major_revision >= 5)

jlink_hw_jtag_version = 3;

LOG_INFO(“J-Link hw version %i”, (int)jlink_hw_version);

if (jlink_hw_type >= JLINK_HW_TYPE_MAX)

LOG_INFO(“J-Link hw type uknown 0x%x”, jlink_hw_type);

else

LOG_INFO(“J-Link hw type %s”, jlink_hw_type_str[jlink_hw_type]);

}

// add this

if (jlink_caps & (1 << EMU_CAP_SELECT_IF))

{

/* Select a target interface */

usb_out_buffer[0] = EMU_CMD_SELECT_IF;

usb_out_buffer[1] = 0xff;

result = jlink_usb_write(jlink_handle, 2);

if (result != 2)

{

LOG_ERROR(“J-Link Select a target interface failed (%d)”, result);

return ERROR_JTAG_DEVICE_ERROR;

}

result = jlink_usb_read(jlink_handle, 4);

if (4 != result)

{

LOG_ERROR(“J-Link command EMU_CMD_SELECT_IF failed (%d)”, result);

return ERROR_JTAG_DEVICE_ERROR;

}

interface = buf_get_u32(usb_in_buffer, 0, 32);

LOG_INFO(“J-Link interface 0x%x”, (int)interface);

usb_out_buffer[0] = EMU_CMD_SELECT_IF;

usb_out_buffer[1] = 0x00;

result = jlink_usb_write(jlink_handle, 2);

if (result != 2)

{

LOG_ERROR(“J-Link Select a target interface failed (%d)”, result);

return ERROR_JTAG_DEVICE_ERROR;

}

result = jlink_usb_read(jlink_handle, 4);

if (4 != result)

{

LOG_ERROR(“J-Link command EMU_CMD_SELECT_IF failed (%d)”, result);

return ERROR_JTAG_DEVICE_ERROR;

}

interface = buf_get_u32(usb_in_buffer, 0, 32);

LOG_INFO(“J-Link interface 0x%x”, (int)interface);

}