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