OpenOCD and multiple LPC chips in JTAG chain

Dominic,

Just wanted to give you my feedback regarding multiple targets in the jtag chain. As you’ve said, this is a part of the program that has received very little testing, and I’m afraid it still has a little way to go before being perfect.

I’ve spent some time looking through your code and have gained some understanding of how your code hangs together, however, it is probably more time efficient to feedback my experiences and have you work out a fix rather than me diving in.

I have a development board with three LPC2103s on it, as discussed in another thread. Thanks to your help, I figured out which chip corresponded to which target, and I can address all the chips with the ‘targets’ command from the telnet command line.

When trying to erase and program flash, I noticed that I would only ever get the flash in the 0th target erased/programmed. Sequence of events:

targets 0

mdw 0 => returned some value A from location zero

targets 1

mdw 0 => returned a different value B

erase 0 0 7

mdw 0 => still returned value B

targets 0

mdw 0 => returned 0xffffffff instead of A, i.e. erased.

Seems it is only talking to target 0. But no. Having looked at the code, I programmed something into flash in target 0 and tried again to confirm a suspicion.

This time I changed the erase command to say

erase 1 0 7

and hey presto, target 1 was erased instead of target 0.

Turns out all the flash commands use the “bank” parameter as their “target” number. I’m sure this is not what was intended, but alas this is what happens.

There is another issue that is a bit niggling. target_script looks like you should be able to do something like…

target_script 0 reset oocd_run_2xxx.script

target_script 1 reset oocd_run_2xxx.script

target_script 2 reset oocd_run_2xxx.script

which should run the oocd_run_2xxx.script on each target. Instead, it runs it three times on target 0. I can correct this by copying the contents of the script three times interspersed with ‘targets’ commands but it’s a bit of a pain.

Anyway, apart from that it does actually seem to work.

  • Niels

Hello Niels,

the flash behaviour is intended. There are flashes with JTAG ports of their own, (e.g. Xilinx configuration PROM), which wouldn’t have an associated target, and I wanted the OpenOCD to be able to handle these, too. Also, one target might have multiple flash banks, like the Olimex LPC-H2294 I have, with the internal flash of the LPC2294 and an external CFI compatible flash. That’s why flashes that belong to a target (currently all) take the number of that target as an argument in their configuration, and are then accessed by their ordinal number. The “flash banks” command lists all configured flash banks. This is also documented in the OpenOCD wiki at http://openfacts.berlios.de/index-en.ph … D_commands

I’ll look into the target_script issue, quite possible that there’s a bug left, thanks for reporting this.

Best regards,

Dominic