Commit Graph

2157 Commits

Author SHA1 Message Date
Mathias K
54f820e8d8 Make cortex_m3 functions public accessible.
Change this functions to make it accessible for other
target implementations.

Change-Id: Ib41fc793cfb4de5439af026c2e8b52e7a9507c85
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/278
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2012-01-03 21:11:51 +00:00
Øyvind Harboe
115f5380ff jtag: stop using sharp corner of JTAG API
this particular edge case of the JTAG API will no
longer be supported.

the in_value buffer must be provided by the caller when
the callback needs the buffer.

Change-Id: I552c72a64af6875f4aa4fa9b923194dcf3b57b64
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/265
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-12-20 16:57:58 +00:00
Øyvind Harboe
991ed5a2b6 jtag: retire jtag_alloc_in_value32 API
not needed, reduce area of interface and sharp edges to
API.

Change-Id: I5347352e7595686634bd0de13fcf6de6e55027b0
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/262
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-12-20 16:56:16 +00:00
rodrigo_l_rosa
3d0e2547fe dsp5680xx - indent fix
no logic changes, only coding style (spaces to tabs, etc)

Change-Id: I5933447c633990e103bc62d088ca2e12f11f031d
Signed-off-by: rodrigo_l_rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/253
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-12-11 18:40:01 +00:00
Mathias K
ea54ea5364 target init sanity check
Add a test if the pointer to the target_init function in the target struct
is set before the function pointer is used.

Change-Id: Ie4ea542f64f35efce8c5bce2ced9b881bf283ec1
Signed-off-by: Mathias K <kesmtp@freenet.de>
Reviewed-on: http://openocd.zylin.com/241
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-29 14:35:24 +00:00
rodrigo_l_rosa
83be6cfc16 dsp5680xx - flash module clk to freescale cfg value
the flash module clock was set according to a spreadsheet from freescale, now it's set according to the configuration file used by the Freescale Flash Programmer.
both work, but i think it's better to use the one used by a software that's made by Freescale (should be correct...)

Change-Id: I382197a3eb43dd47ff4b9b83d5e05008d5613fc6
Signed-off-by: Rodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/223
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-24 23:26:15 +00:00
rodrigo_l_rosa
c725167ba8 dsp5680xx - mark erase after unlocking flash
the unlocking procedure erases the flash mem (even if it wasn't locked), so it should be marked as erased after unlocking.

Change-Id: I5cc6a1e1d6cf4e1f243de532eff54111ffd66187
Signed-off-by: Rodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/222
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-24 23:25:57 +00:00
rodrigo_l_rosa
e0c0810a8e dsp5680xx - fix jtag debug request failure handling
if JTAG debug request fails then halting with a reset should be attempted.
the failure was ignored previously.

Change-Id: Ibec08e2e97f962d164a110c21aaa80bfc17b7f1a
Signed-off-by: Rodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/221
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-24 23:25:25 +00:00
rodrigo_l_rosa
e2fdb1c864 dsp5680xx - separate debug from halt
i had assumed two possible halt/debug states:
  - halted + debug mode
  - running + not debug mode
turns out this one also exists
  - halted + NOT in debug mode
added code to handle this in an appropiate way.

Change-Id: Ia0ddcd55d1890c90d100a9e6f5e84ed8dda812a3
Signed-off-by: Rodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/220
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-24 23:25:09 +00:00
rodrigo_l_rosa
6461f7669a dsp5680xx - fix - flashing algorithm check
now the flash algorithm running on the 568013 checks the buffer_empty bit (instead of the command_finished bit) before trying to write a new word to the flash mem.
this should speed up the flashing procedure. since it is open loop, this change may reduce the risk of failure. flashing will fail if JTAG speed is such that the flash module cannot keep up.

also, the USTAT register is only read once, as suggested in the flow chart provided by freescale (per. ref. manual @ 6-11)

the last step of the flow chart, exiting after commands are complete, is not implemented.
the algorithm will stay waiting for more data. it is up to the PC side to *not* send more data.

Change-Id: I47fe4b50de7da85f80868f5986a89a7e2152616c
Signed-off-by: Rodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/219
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-24 23:24:28 +00:00
rodrigo_l_rosa
c460697b62 dsp5680xx - added more error codes
Change-Id: I36962a0ab0cc9d1eb6a29d7e577c24c38cab946b
Signed-off-by: Rodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/218
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-24 23:24:04 +00:00
rodrigo_l_rosa
ea16bc578f dsp5680xx - fix jtag status mask
Change-Id: I17a0f22cbeb20e4f6ea4065236243f93d826ccf0
Signed-off-by: Rodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/217
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-24 23:23:36 +00:00
rodrigo_l_rosa
e6c3ab9df3 dsp5680xx - relocating code
moved reset_jtag to the top, since it will be needed in future changes.
also send a define to the .h

Change-Id: I53ef9c02ffa70e7d0416364525a6fbfef855e222
Signed-off-by: Rodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/216
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-24 23:22:34 +00:00
rodrigo_l_rosa
b9346fbd64 dsp5680xx - error codes
added logging of target error codes to enable automatic error handling from tcl.
the plan is to use a computer to execute a series of tcl commands, the changes allow simple parsing of return messages to detect errors.

Change-Id: Ia98d3bd036e1b6065b475ffff6c1d30baeaf7417
Signed-off-by: Rodrigo L. Rosa <rodrigorosa.lg@gmail.com>
Reviewed-on: http://openocd.zylin.com/215
Tested-by: jenkins
Tested-by: Øyvind Harboe <oyvindharboe@gmail.com>
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-24 23:21:58 +00:00
Spencer Oliver
b462316699 target: fix init_targets script handling
This fixes an issue when init is called before init_targets has been
executed.

Make sure init_targets is called before init.

Change-Id: Icd5bd4c2a8eea2e399d9de4e331a77560e9672ac
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/235
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2011-11-23 23:51:36 +00:00
Øyvind Harboe
a943ec1ca9 target: make it absolutely clear that no null pointers are accepted
there are no comments about what the rules w.r.t. null pointers
are and it is inconsistent.

It's simply a bug in the app if we ask about the properties of a null
pointer w.r.t. what kind of target it is. It's equally wrong to say
that it is an arm target as that it isn't an arm target.

Change-Id: I0925a6a5c8b38e594ffa7c3ca4390487b5e9b718
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/168
Tested-by: jenkins
Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-11-14 23:39:20 +00:00
Øyvind Harboe
9e1a16690e image: remove assignments to local variables that is never read
Change-Id: I1a5e968f165e060fd4aa7c023ad870a9e21bb5dd
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/191
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-10 21:30:15 +00:00
Øyvind Harboe
3558721df7 arm7_9: remove warnings by reducing scope of variables
Change-Id: Idc384b733056a72108680b073da7c327a8eeedc3
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/179
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-08 08:09:15 +00:00
Øyvind Harboe
6fa4c5a456 disassembly: fix access to undefined memory pointer upon unknown instruction
return error message instead. Found by clang.

Change-Id: Ica109d077206236a12d007e77cc78061ffd05834
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/169
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-07 20:37:11 +00:00
Øyvind Harboe
0552c05ee8 dsp5680xx: fix warnings
- propagate error
- remove dead assignment

Change-Id: I0d7078f531d96e421e95f08bfd908e818500d74c
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/170
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-07 20:34:41 +00:00
Øyvind Harboe
6be4646d17 xscale: cleanup
- fix error propagation
- add some debug output for "unused" variables
- reduce scope of variable to avoid "unread" variables.

Change-Id: I136995f2a043102e64b8fff3017502fae564013b
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/175
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-07 16:13:08 +00:00
Øyvind Harboe
482e8a2b55 etm: fix warning by removing assignment that is immediately overwritten
Change-Id: Ia3a83d3c1fc3a1707d69017fce6cf142a81babc4
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/165
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-04 09:15:14 +00:00
Øyvind Harboe
ed028542ed cortex_m: initialize unused CPU variables to 0 for poll info output
fixes warnings.

Change-Id: I1a9ec09083d4e6269889fb79e6121f25e83eb396
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/163
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-04 09:13:14 +00:00
Øyvind Harboe
5bdd2111d0 dsp5680xx: add missing and broken error propagation
found by clang.

Change-Id: Ie7e2ecad71bf0838ece93727e4778ad368b890ef
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/156
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-04 09:06:50 +00:00
Øyvind Harboe
cb38df20dc avr32_regs: add missing error propagation
Change-Id: Ie8b141dd534d73eccfc045069d5f628bd1eea88e
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/166
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-04 09:05:15 +00:00
Øyvind Harboe
2c906384c3 cortex_a: add missing error propagation
found by clang.

Change-Id: I50eac219d7540fd48d3285f3f213cb659492d0c0
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/153
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-02 09:43:04 +00:00
Øyvind Harboe
566faa17de arm11: print next address to debug
fixes clang warning. Basically the next address pointer is not
used for anything in the fn, except to be examined in debug.

Change-Id: I253519b8e49e54490bbe7da8ec3d2dd31f49052a
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/155
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-02 09:41:40 +00:00
Øyvind Harboe
2ea7a42e22 cortex_m: add missing error checking
found by clang.

Change-Id: I099c6fe6b044dba36c20221cb439bdcba5a6bb6f
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/152
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2011-11-01 22:12:59 +00:00
Øyvind Harboe
06216744ed target: fix null pointer exception
check if no target is selected and return error.

Change-Id: Ie8abb63c708d09572b45e88fc6766af108715077
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/148
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-11-01 21:20:19 +00:00
Spencer Oliver
3f8f583964 target: rename cortex_m3.[ch] to cortex_m.[ch]
This rename is in preparation for cortex_m4 support.

Change-Id: Ic08c298ec6ed2aabc2c39db67191f68b3a51f550
Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/147
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-11-01 14:23:08 +00:00
Øyvind Harboe
01f461b20a warning fix: remove senseless assignment before bailing out of fn w/error
Change-Id: I822f3adce0eccb880007673d60c7eccf7d36b398
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/144
Tested-by: jenkins
Reviewed-by: Peter Stuge <peter@stuge.se>
2011-10-31 21:12:30 +00:00
Øyvind Harboe
9b9092b7fa warnings: null pointer check fix
rewrite broken null pointer check code by reducing scope
of variable.

Change-Id: I8254f6849b187e5c9cd083053cdc11973c6fe339
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/142
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-31 20:43:36 +00:00
Øyvind Harboe
08815946f6 bugfixes: tinker a bit with the targets command
return error when target can not be found instead of ERROR_OK,
split fn.

Change-Id: Iba5232d3862a490d0995c3bfece23685bd6856e3
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/131
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-31 17:41:44 +00:00
Øyvind Harboe
fc553327c0 dsp563xxx: fix missing error propagation found by clang
Change-Id: I7380ce145b4942e21b174f2a810928a877c32bc7
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/140
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-31 11:04:42 +00:00
Øyvind Harboe
97806831e2 bugfixes: numerous bugs in error propagation found by clang
Change-Id: I784068325b422d1918e28c08544bc5a1332d712f
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/130
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-27 22:08:35 +00:00
Øyvind Harboe
e6d979eefc clang: fix warning about use of unitialized variable
this was a false positive, silence it.

Change-Id: I432e0c466c94cf8fd6bbf0ea153c8501a8a261eb
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/126
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-26 20:36:04 +00:00
Andreas Fritiofson
8f76ca05d9 armv7a: fix scan-build warnings
"Value stored to 'retval' is never read": Check and propagate error
"Dereference of null pointer": Probably bogus, maybe triggered by the null
check on armv7a, so remove the check since it can't be null anyway.

Change-Id: I3bc44e52af1589ff40e6a42deda0ce7f3a25e397
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/119
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-25 05:16:50 +00:00
Andreas Fritiofson
f80ec2aa37 armv7a: make local functions static
Also fix a spelling error and remove the declaration for a non-existent
function from the header.

Change-Id: I13177e2d81aa167c05c1cc766f06924211e6d735
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/118
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-25 05:16:04 +00:00
Andreas Fritiofson
8c6b95ed16 armv7m: improve error handling
Propagate errors unchanged.
Free allocated working area in the error return path.
Remove duplicated cleanup code by rewriting the logic.
As a side-effect, fixes a scan-build warning.

Change-Id: I80e3c0015be672778f916e998c8c2e4f23d7588c
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
Reviewed-on: http://openocd.zylin.com/117
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-25 05:14:11 +00:00
Øyvind Harboe
e5fd6131fe warning: silence gcc by initializing local variables
GCC doesn't understand that these are in fact initialized if they are
used.

Change-Id: I01988adb0547f785b48d869ddbe44cc17dca4739
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/116
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-24 17:10:40 +00:00
Øyvind Harboe
c9f51acdc3 clang: fix warning w/assert so that clang knows that there will be no division by zero
Change-Id: I98ac62a22f21043bb535a667a4f1f1537ccde2a4
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/42
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-23 11:57:34 +00:00
Øyvind Harboe
4e079d18bf clang: fix malloc() warning with assert
Change-Id: I989d2655622a9f11f4a0a2994014e42822587ecd
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/41
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-23 11:55:02 +00:00
Freddie Chopin
1c1771ef6c Unused variables
Fix a few errors with set and unused variables detected by GCC 4.7.0

Change-Id: I59b748e18e514ee9f0cde7883b4ed5116198bd4a
Signed-off-by: Freddie Chopin <freddie.chopin@gmail.com>
Reviewed-on: http://openocd.zylin.com/36
Tested-by: jenkins
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-19 19:53:00 +00:00
Matt Reimer
4eca579a6e xscale: fix bug in xscale_receive()
The code in xscale_receive() that tries to skip invalid reads (i.e.
reads that don't have the DBG_SR[0] 'valid' bit set) seems to be
wrong, as it only looks at the first word's valid flag rather than
each word's own valid flag. Am I reading the code correctly? If so,
the attached patch should fix it.

If this looks correct, I'll generate a proper patch and commit message.

Matt

Change-Id: I74ebe2ad7a36d340a9dd3b8487578b6ea7f3cf1e
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/32
Tested-by: jenkins
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-18 20:32:36 +00:00
Øyvind Harboe
80c20a186b target_request: add target_got_message() that can be used to improve DCC performance
API change to allow implementing a back-off algorithm for
polling hardware.

Change-Id: I6cbe8b4534c8dfeb8442305171ea96b5481c1f17
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/26
Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Tested-by: Øyvind Harboe <oyvindharboe@gmail.com>
2011-10-17 12:32:38 +00:00
Spencer Oliver
8cd3832e2b target: whitespace cleanup
Change-Id: I1453f4f3dc0add529da20577e38b8b82d7d00366
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
Reviewed-on: http://openocd.zylin.com/18
Reviewed-by: Alex Austin <alex.austin@spectrumdsi.com>
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-13 20:18:43 +00:00
Michel Jaouen
5a7cff26a5 breakpoint : smp software breakpoint issue
Change-Id: Iefe78bad71d4fdb38ae412ab8fe2f6282836c22e
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
Reviewed-on: http://openocd.zylin.com/14
Tested-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2011-10-13 18:54:04 +00:00
Michel Jaouen
3ab7855d1a breakpoint : indentation
Change-Id: Icdb8f72dbb516cd0dfc612c3d61b6801f6382be6
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-10-11 22:04:24 +02:00
Andreas Fritiofson
1163435e19 cortex_m3: use armv7m's async algorithm implementation
Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-10-09 00:00:52 +02:00
Andreas Fritiofson
9d4c466c21 armv7m: implement async algorithm functions
Split armv7m_run_algorithm into two pieces and use them to reimplement it.
The arch_info parameter is used to keep context between the two calls, so
both calls must refer to the same armv7m_algorithm struct. Ugly but works
for a proof-of-concept.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-10-09 00:00:52 +02:00
Andreas Fritiofson
3f6ef7a40b target: add async algorithm entries to the target type
On supported targets, this may be used to start a long running algorithm in
the background so the target may be interacted with during execution and
later wait for its completion.

The most obvious use case is a double buffered flash algorithm that can
upload the next block of data while the algorithm is flashing the current.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2011-10-09 00:00:52 +02:00
Michel Jaouen
00ded4eb01 armv7a ,cortex a : add L1, L2 cache support, va to pa support 2011-09-30 09:45:26 +02:00
Mathias K
daa41473ab add target events, run algorithm and default r/w buffer api
Target events are added to get better gdb support. The run
algorithm functionality are implemented to support feature
fast flash write functionality. The new r/w buffer api is now
used to support the special memory address handling. The output
of the md command was fixed.
2011-09-23 15:32:49 +02:00
Michel Jaouen
508bc7ca36 kinetis : fix deadlock on device having hasidcode false. 2011-09-23 15:31:39 +02:00
Mathias K
5c91551ea7 kinetis auto mass erase on secured devices
This is a proof of concept to get access to the debug port of a
secured kinetis cpu. On full flash erase the cpu is automatically
secured and the debug port is not accessible.
To get this to work the srst line is needed and the necessary
configuration should be added to the configuration file.
2011-09-16 09:51:35 +02:00
Rodrigo L. Rosa
355f183adb usleep to jtag_sleep
this will help avoid platform specific timing issues
2011-08-31 15:46:05 -07:00
Rodrigo L. Rosa
c4a1728a2d static for some functions
made two functions into static, since they are not required by anything external
2011-08-31 15:45:55 -07:00
Rodrigo L. Rosa
fb164bca55 speed up, relocate function
added an attempt to use the non-reseting halting sequence. if it fails, then the full sequence will be attempted. this makes things a bit faster most of the time.
changed the location of a function, avoiding a forward def
2011-08-31 15:45:45 -07:00
Rodrigo L. Rosa
42300c98ab removed trailing whitespaces
emacs is awesome.
replace-regexp RET [ ]+$ RET RET
and it's done
2011-08-30 21:16:46 -07:00
Rodrigo L. Rosa
be568d37c0 fix enter debug mode for locking
added an alternative way to enter debug mode, which does not require restarting the chip.
this will not always work, but in general it will (failure 0.3%), and failure is not a dramatic issue, simply have to use the full sequence.
the user can only access "halt", which uses the full sequence, so the user should not have any problems.
restarting the chip requires reconfiguring the flash module. the doc is very poor, so i'd rather have the two methods, and live with the 0.3%.
2011-08-30 21:16:34 -07:00
Rodrigo L. Rosa
573cbeac1e fix irlen handling
sometimes the master tap will be enabled, since tap switching is required during halt/lock/unlocking procedures.
now irscan handles this, avoiding unnecessary warnings and preventing errors.
2011-08-30 15:17:00 -07:00
Rodrigo L. Rosa
eb0734de19 fix debug mode,lock,unlock
got new info regarding setting the chip to debug mode, and locking/unlocking flash memory.
the newer implementation is a bit slower, but always works.
the previous implementation would randomly (as once every 25k-70k times) get the chip into a state where the freescale tool would be necessary. this is fixed now.

added functions to play around with the jtag state machine. they are not the happiest, but are necessary to be able to execute the halting/locking/unlocking sequences.

Conflicts:

	src/target/dsp5680xx.c
2011-08-30 15:13:49 -07:00
Rodrigo L. Rosa
1d4f294c3c fix error handling during halt
the user can execute halt, but no enter_debug_mode. modified the error handling to suite this.
the new implementation of unlocking will use enter_debug_mode, and should not get the same errors as the user would, because not being able to enter debug mode is actually success when checking for locked flash.
2011-08-30 15:09:44 -07:00
Rodrigo L. Rosa
e1a2d7255e optional crc for flash writing
crc check was always performed on newly flashed data, now it is optional
flash mem can be locked by writing a specific word to a specific address in flash.
to verify flash, target must be halted, and this will (when the new halt sequence is implemented) require reseting the chip. if the target is reset after writing the lock words, then it will lock, hence the CRC will fail because it is not possible to read stuff from the target.

also added a function that resets the jtag state machine.
this is not used yet, but will be soon.
it is implemented to allow strict control over JTAG state machine, necessary to implement to halt and unlocking sequences.
2011-08-30 15:09:34 -07:00
Rodrigo L. Rosa
2aa14db677 def syntax to match tap irlen
the master tap has a 4 bit irlen
changed the instructions to be 4 bit, ie, removed the zeros.
it makes it clearer to interpret.
2011-08-30 15:09:23 -07:00
Heythem Bouhaja
c8926d1457 cortex_a hybrid & context breakpoints 2011-08-30 18:27:52 +02:00
Jie Zhang
8d7ddde5f1 remove target argument from gdb packet handling functions 2011-08-24 17:41:35 +02:00
Jie Zhang
40ac04ca7a remove white space before TAB 2011-08-17 17:28:24 +02:00
Stefan Mahr
45b5c838a6 mips: fix potential alignment error 2011-08-12 12:00:51 +02:00
Stefan Mahr
85f1963d52 mips: fix reading uint32 and uint16 when running on big endian host 2011-08-12 12:00:46 +02:00
Stefan Mahr
28f088dc66 target: add helper functions to get/set u16 or u32 array from/to buffer 2011-08-12 12:00:42 +02:00
Rodrigo L. Rosa
7675db7e92 fix return code from dsp5680xx_read
it returned ERROR_OK even though it actually failed.
this made the Tcl interface report success, though it had not succeeded.
2011-08-10 13:08:14 -07:00
Rodrigo L. Rosa
67f1f0c7b5 renamed for clarity
i had started my code from dsp5683xx, i renamed a bunch of stuff to names i consider to be better.
i believe no one is using this code, so nobody should be affected. (it's not too late to do this change)
2011-08-10 13:07:31 -07:00
Drasko DRASKOVIC
827057f560 mips32 : Fixed memory byte access
Function mips_m4k_write_memory() does endianess byte swap,
but this procedure break one byte access (temporary array
overwrites content in buffer).
As a fix, this endianess swap and buffer affecting
is preformed only on hword and word accesses (not on byte access).
2011-08-09 23:17:28 +02:00
Drasko DRASKOVIC
c18e02387b mips32: Sync Caches to Make Instr Writes Effective
Pprogram that loads another program into memory is actually writing the
D- side cache.
The instructions it has loaded can't be executed until they reach the
I-cache.

After the instructions have been written, the loader should arrange to
write back any containing D-cache line and invalidate any locations
already in the I-cache.

For the MIPS Architecture Release2 cores, we can use synci command
that does this job.
For Release1 we must use "cache" instruction.
2011-08-09 23:17:28 +02:00
Drasko DRASKOVIC
1be7163408 mips32: Added CP0 coprocessor R/W routines
This patch adds MIPS32 CP0 coprocessor R/W routines,
as well as adequate commands to use these routines via
telnet interface.

Now is becomes possible to affect CP0 internal registers
and configure CPU directly from OpenOCD.
2011-08-09 23:17:28 +02:00
Drasko DRASKOVIC
800bc9308d mips_m4k: common_magic should be unsigned
For all architectures we use distinct common magic number,
and this should be a uint32_t type.
Otherwise, comparison with macros will yield compilation
warning.
2011-08-09 23:17:28 +02:00
Drasko DRASKOVIC
e1466df54d mips32: Removed Unnecessary JTAG Queue Flush
jtag_execute_queue() is executed as a part of mips_ejtag_drscan_32().
No need for this to be done before - removed for optimisation.
2011-08-09 23:17:28 +02:00
Øyvind Harboe
7d2bf8805d Revert "dsp5680xx: disable for now, it generates warnings"
This reverts commit d567df02b9.
2011-08-09 20:15:21 +02:00
Rodrigo L. Rosa
c2c19c5018 dsp5680xx fix constante ref
a counter was incorrectly set
when i added the macros i incorrectly called them.
fixed that.
2011-08-09 20:07:49 +02:00
Rodrigo L. Rosa
e8543de820 dsp5680xx fix FM clk
before doing anything with the flash module (FM) the clock divider must be set.
if erase_check was the first thing done with the FM after reset then an error would be generated because the clk divider was not set.
now erase_check sets the clk divider.
2011-08-09 20:07:46 +02:00
Rodrigo L. Rosa
ba68ae8bd5 dps5680xx fix warnings
reorganized code to get rid of compiler warnings
the warning were related to allignment, i do not get these warning on my build system (i've tried setting the compiler flag but it doesn't work, still working on why) so i cannot detect them (yet.)
2011-08-09 20:07:28 +02:00
Øyvind Harboe
bbd84417f6 arm11: disable broken optimization for setting current scan chain 2011-08-08 22:33:41 +02:00
Jie Zhang
d02dfff48b etb: fix incorrect previous patchset
This corrects two issues found with openocd.
d7f71e7fe9 removed some code that was
being used.

The above then caused even more code to get removed by commit 1cfb2287a6.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-08-01 17:16:10 +01:00
Drasko DRASKOVIC
ac43d7a69f mips_m4k and arm7_9 : Fix soft bkpt endianess for 16-bit instructions
The patch fix comparison of target data on the host by using
target_buffer_get_u16() to transform current_instr to
_host_ endianess before comparison.
2011-07-04 18:15:18 +02:00
Peter Horn
d4cd6f0320 cortex_m3: add auto maskisr
This patch extends the cortex_m3 maskisr command by a new option 'auto'.
The 'auto' option handles interrupts during stepping in a way they are
processed but don't disturb the program flow during debugging.

Before one had to choose to either enable or disable interrupts. The former
steps into interrupt handlers when they trigger. This disturbs the flow during
debugging, making it hard to follow some piece of code when interrupts occur
often.

When interrupts are disabled, the flow isn't disturbed but code relying on
interrupt handlers to be processed will stop working. For example a delay
function counting the number of timer interrupts will never complete, RTOS
task switching will not occur and output I/O queues of interrupt driven
I/O will stall or overflow.

Using the 'maskisr' command also typically requires gdb hooks to be supplied
by the user to switch interrupts off during the step and to enable them again
afterward.

The new 'auto' option of the 'maskisr' command solves the above problems. When
set, the step command allows pending interrupt handlers to be executed before
the step, then the step is taken with interrupts disabled and finally interrupts
are enabled again. This way interrupt processing stays in the background without
disturbing the flow of debugging. No gdb hooks are required. The 'auto'
option is the default, since it's believed that handling interrupts in this
way is suitable for most users.

The principle used for interrupt handling could probably be used for other
targets too.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-07-04 11:31:52 +01:00
Spencer Oliver
89fa8ce2d8 Revert "cortex_m3: add auto maskisr"
This reverts commit ff640f197a.

Original patch reverted as Author's name was incorrectly set.
2011-07-04 11:31:52 +01:00
Drasko DRASKOVIC
bad3ee87ac mips_m4k : Fix soft breakpoint endianess handling
In order to compare data read from the target with some marcros or data
defined on the host, we must transform this read data from target
endianess to host endianess.
target_read_memory() gets bytes from target to the host, but keeps them in _target_
endianess. This is OK if we just want to temporary keep this data on the
host, like keeping breakpoint->orig_instr. But if we want to use this
data for any ispections and comparisons on the host side, we must
transform it to _host_ endianess, by using target_buffer_get_u32()
function.
Currently this transformation is missing, and check current_instr ==
MIPS32_SDBBP will never pass if target and host endianess differ,
because current_instr will be kept in _target_ endianess and
MIPS32_SDBBP will be kept in _host_ endianess,

The patch fix this issue by using target_buffer_get_u32() to transform current_instr to
_host_ endianess before comparison.
2011-07-01 21:31:08 +02:00
Øyvind Harboe
d567df02b9 dsp5680xx: disable for now, it generates warnings
Use "git revert <commit>" to revert this commit, then build and
repair and post patch to the mailing list.

Warnings generated with:

nios2-elf-gcc (GCC) 3.4.6 (Altera Nios II 9.1 b222)

openocd/src/target/dsp5680xx.c: In function 'eonce_rx_upper_data':
openocd/src/target/dsp5680xx.c:252: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'eonce_rx_lower_data':
openocd/src/target/dsp5680xx.c:268: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'eonce_pc_store':
openocd/src/target/dsp5680xx.c:508: warning: dereferencing type-punned
pointer will break strict-aliasing rules
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_read':
openocd/src/target/dsp5680xx.c:736: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c:737: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_write_8':
openocd/src/target/dsp5680xx.c:823: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_write':
openocd/src/target/dsp5680xx.c:938: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c:941: warning: cast increases required
alignment of target type
openocd/src/target/dsp5680xx.c: In function 'dsp5680xx_f_wr':
openocd/src/target/dsp5680xx.c:1355: warning: cast increases required
alignment of target type
2011-06-28 18:39:01 +02:00
Øyvind Harboe
2482244b07 mips4k: fix big-endian hosts and host alignment problems
the code was making assumptions about the endianness of the host.
2011-06-28 18:22:32 +02:00
Øyvind Harboe
e4c054cada dsp5680xx: fix compilation problems
use a more specific global variable name than "context", which
can easily conflict with other things.
2011-06-28 18:09:48 +02:00
Spencer Oliver
ff640f197a cortex_m3: add auto maskisr
This patch extends the cortex_m3 maskisr command by a new option 'auto'.
The 'auto' option handles interrupts during stepping in a way they are
processed but don't disturb the program flow during debugging.

Before one had to choose to either enable or disable interrupts. The former
steps into interrupt handlers when they trigger. This disturbs the flow during
debugging, making it hard to follow some piece of code when interrupts occur
often.

When interrupts are disabled, the flow isn't disturbed but code relying on
interrupt handlers to be processed will stop working. For example a delay
function counting the number of timer interrupts will never complete, RTOS
task switching will not occur and output I/O queues of interrupt driven
I/O will stall or overflow.

Using the 'maskisr' command also typically requires gdb hooks to be supplied
by the user to switch interrupts off during the step and to enable them again
afterward.

The new 'auto' option of the 'maskisr' command solves the above problems. When
set, the step command allows pending interrupt handlers to be executed before
the step, then the step is taken with interrupts disabled and finally interrupts
are enabled again. This way interrupt processing stays in the background without
disturbing the flow of debugging. No gdb hooks are required. The 'auto'
option is the default, since it's believed that handling interrupts in this
way is suitable for most users.

The principle used for interrupt handling could probably be used for other
targets too.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-06-28 14:16:48 +01:00
Peter Horn
e53f7e5fc0 cortex_m3: add BKPT_TYPE_BY_ADDR define
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-06-28 14:12:00 +01:00
Drasko DRASKOVIC
37aaa28292 Fix load_image for ELF with all p_paddr set to zero
So far image_load command tries to load ELF binaries to address
discovered by reading p_paddr member of a Program header of an ELF
segment.

However, ELF specifications says for p_paddr : ...Because System V
ignores physical addressing for application programs, this member has
unspecified contents for executable files and shared objects.

ARM ELF specifiaction goes even further, demanding that this member
be set to zero, using the p_vaddr as a segment load address.

To avoid the cases to wrong addr where p_paddr is zero,
we are now using p_vaddr to as a load destination in case that *all*
p_paddr == 0. Basically, this patch re-implements the approach present in
BDF's elf.c, which is used by GDB also (so that we can be consistent).
2011-06-24 11:00:35 +02:00
Spencer Oliver
16cbe1216a build: add missing files to make dist
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-06-17 12:21:01 +01:00
Spencer Oliver
3428035a7e build: add missing files from dist release
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-06-17 09:31:13 +01:00
Øyvind Harboe
c8b5719802 transport: move files over to transport folder
as we introduce swd and jtag as two transports, we want
to start up with a new transport folder to organize the
code a bit.
2011-06-13 15:51:04 +02:00
Rodrigo L. Rosa
47aa65b3e8 doxy more 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
d343941386 doxy & cleanup 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
7b0ead520d cleanup trailing whitespaces 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
f4b9a2fc8b flash speed improved 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
ca76e4a423 removed unnecessary actions/controls 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
c4bcb0b95a cleanup flash module command 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
d539fc856f fix read for verify_image 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
f42353d821 fix read speed improved by queueing commands 2011-06-12 11:18:27 +02:00
Rodrigo L. Rosa
f4a3db0d4a fix flash driver size, sector erase 2011-06-12 11:18:27 +02:00
Freddie Chopin
1cfb2287a6 Fix "unused variable" warnings (errors) detected with GCC 4.7.0 - leftover changes 2011-06-07 17:53:33 +02:00
Stefan Mahr
5d9b7cdd2b mips: add nor flash write from memory block 2011-06-05 22:45:21 +02:00
Rodrigo L. Rosa
c989de0cea crc check on flashed data 2011-06-04 09:52:14 +02:00
Rodrigo L. Rosa
d09bef2622 code cleanup 2011-06-04 09:52:14 +02:00
Freddie Chopin
f499bab698 Fix "unused variable" warnings (errors) detected with GCC 4.7.0 - dubious fixes 2011-06-04 09:46:48 +02:00
Freddie Chopin
f6315d5e5b Fix "unused variable" warnings (errors) detected with GCC 4.7.0 - trivial fixes 2011-06-04 09:35:13 +02:00
Stefan Mahr
796086cd49 mips: fixup fastdata
fixup fastdata
2011-06-01 07:23:42 +02:00
Stefan Mahr
524d79ebe7 mips: fix some more endian madness 2011-06-01 07:23:35 +02:00
Stefan Mahr
875298bc53 mips: fix swapping if running on big endian host 2011-05-29 23:21:23 +02:00
Stefan Mahr
73988aea1f mips: fix swapping if openocd is running on big endian host 2011-05-28 14:25:06 +02:00
Spencer Oliver
5d7d08a1f0 dsp5680xx: whitespace cleanup
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-05-23 10:23:34 +01:00
Spencer Oliver
d16b0ea6d4 Fix build issue under cygwin
cygwin does not define sleep, so use our internal win32 version.
caused by commit 9d4aec6bda

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-05-23 10:22:12 +01:00
Rodrigo L. Rosa
ef599aebfd flashing speed improved using queued jtag. error propagation improved. 2011-05-19 07:27:02 +02:00
Rodrigo L. Rosa
9d4aec6bda partial support for 568013 and 568037, target integration. 2011-05-18 18:47:50 +02:00
Jie Zhang
7d8053e93f Remove useless MIPS code in avr32_ap7k.c. 2011-05-03 21:59:08 +02:00
Michel Jaouen
5578935eff cortex_a : smp support
Conflicts:

	src/target/cortex_a.c
2011-04-28 12:22:29 +02:00
Michel Jaouen
b778b36f29 smp : infra for smp minimum support 2011-04-28 12:22:10 +02:00
Broadcom Corporation (Evan Hunter)
b69119668e RTOS Thread awareness support wip
- works on Cortex-M3 with ThreadX and FreeRTOS

Compared to original patch a few nits were fixed:

- remove stricmp usage
- unsigned compare fix
- printf formatting fixes
- fixed a bug with overrunning a memory buffer allocated with malloc.
2011-04-15 08:24:18 +02:00
Luca Ellero
ecd5e5de7f Replace byte-access to memory with faster word-access
Freescale iMX53 doesn't seem to like unaligned accesses to his memory
mapped registers.
Anyway this patch makes dump_image/load_image 4X faster for every
access through APB.

Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-04-13 21:33:11 +02:00
Luca Ellero
81f238f522 Add opcodes for load/store registers words immediate post-indexed
Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-04-13 21:32:24 +02:00
Michel JAOUEN
08303f10aa cortex_a :apb mem read/write working with mmu_on
Conflicts:

	src/target/cortex_a.c
2011-04-13 10:57:02 +02:00
Michel JAOUEN
28ddd16ddc cortex_a : multiple target on the same dap 2011-04-13 10:56:52 +02:00
Michel JAOUEN
a7844aa4e8 cortex_a : use dap ref from armv4_5common 2011-04-13 10:56:42 +02:00
Michel JAOUEN
5e86c5173c cortex_a : implement jtag console for cortex_a 2011-04-06 06:45:39 +02:00
Drasko DRASKOVIC
719f9ecde3 Added mips_ejtag_drscan_32_out() for optimization. 2011-04-05 08:21:29 +02:00
Drasko DRASKOVIC
bc9afcd4d1 Corrected waiting on PrAcc in wait_for_pracc_rw(). Added necessary check that PrAcc is "1" before FASTDATA access. 2011-04-05 08:21:25 +02:00
Drasko DRASKOVIC
b125689459 Added correct endianess treatment for big endian targets. Now it is possible to use mips_m4k_write_memory() and mips_m4k_read_memory() to correctly set-up SDRAM, as well as bulk data write, which already handled endianess well. Also added correct endianess manipulation in case of fallback from erroneus bulk write to simple write (to avoid byte swapping two times). 2011-04-05 08:21:17 +02:00
Øyvind Harboe
a1d9f16320 cortex_a: delete dbgbase hack vestiges
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-04-01 21:00:44 +02:00
Michel JAOUEN
930d70f1a3 cortex_a: fix gaffe in first implementation of -dbgbase 2011-04-01 18:59:02 +02:00
Øyvind Harboe
3b7c9585db Merge remote branch 'origin/master' into HEAD 2011-04-01 13:02:24 +02:00
Øyvind Harboe
a0b83e82f7 mips: fix gaffe in previous commit
accidentally invoked return jtag_execute_queue() in the
middle of a fn. Hmm.... I would have expected gcc or
at least lint to catch this.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-04-01 12:32:41 +02:00
Øyvind Harboe
977df18f50 cortex_a: remove broken dbgbase patchup code
the patchup code would get false positives when checking
whether a dbgbase had to be corrected.

The solution is to have autodetect default, with manual override
in scripts.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-04-01 10:00:41 +02:00
Øyvind Harboe
378567da4e mips: illustrates how to improve performance
Do not require unecessary roundtrips for clocking out
data.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-04-01 08:59:11 +02:00
Øyvind Harboe
2615bf4398 types: write memory now uses const
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-04-01 08:59:07 +02:00
Øyvind Harboe
d76fd2aac7 mips: delete kludgy code that modifies data sent to write_memory()
Could this cause confusion as data sent to write would be flipped
and then if the caller subsequently used the data, e.g. a
compare mismatch might happen?

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-31 23:46:56 +02:00
Øyvind Harboe
0c1ebf2673 mips: mips32_pracc_exec error propagation fixes
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-31 23:46:56 +02:00
Øyvind Harboe
83ab5ad240 mips: mips_ejtag_get_impcode error propagation added
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-31 23:46:56 +02:00
Øyvind Harboe
667c65552e mips: fix mips_ejtag_set_instr error handling
this fn does not fail, it queues data.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-31 23:36:45 +02:00
Øyvind Harboe
e1f5055bb0 mips: fix error handling for jtag_execute_queue()
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-31 23:08:53 +02:00
Øyvind Harboe
f169f86bd1 xscale: fix gaffe in phys write
it would *read* instead of *write* to memory
when the MMU was disabled.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-31 18:46:14 +02:00
Øyvind Harboe
8d338f3296 cortex-a: use -dbgbase option
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-31 09:30:48 +02:00
Øyvind Harboe
b75bdb7b04 target: add -dbgbase option to target configuration
Really a Cortex-A specific option, but there is no
system in place to support target specific options
currently and there has been no need for such a system
until now.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-31 09:30:48 +02:00
Andrew Lyon
be14e8cbb0 bugfix for step <address> mips_m4k
The patch below fixes step <address> on mips_m4k.

Spencer Oliver <spen@spen-soft.co.uk>:

The current code is used on all other arch's - is
there a underlying issue with those aswell ?
2011-03-29 12:50:54 +02:00
Øyvind Harboe
dec80e1cff cortex_a: rename cortex_a8.c/h to cortex_a.c/h
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-22 11:29:10 +01:00
Øyvind Harboe
a843789ede omap4430: tried to add in workaround for broken dbgbase query
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-22 09:21:16 +01:00
Øyvind Harboe
fc574c64bb cortex a9: merge cortex a9 and a8 code
better to keep this in a single file.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-22 09:10:21 +01:00
Øyvind Harboe
17201b5847 dsp563xx_once: fix warning and potential bug
I don't think dsp563xx_once_read_register() would ever
be called with len==0, but it would have been broken in
that case.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-20 19:47:58 +01:00
Mathias K
4332bc32e4 target: allow targets to override memory alignment
Targets can implement read/write_buffer to handle
alignment.
2011-03-17 14:18:16 +01:00
John and Tina Peterson
9f17b30f88 SYS_WRITE0 fix
Problem is, trying to print "Hello, world!\n" just prints endless H's, because r1 is never incremented.

One way to fix it would be to add a "++" after "r1".
2011-03-17 07:34:44 +01:00
Uwe Hermann
33a17fd359 Fix a bunch of typos.
Fix a bunch of typos.

Most are in code comments, so nothing should break. UNKOWN_COMMAND and
CMD_UNKOWN are not used elsewhere, so correcting the spelling should
also not break anything.
2011-03-17 07:25:25 +01:00
Øyvind Harboe
582b4195a9 dsp563xx: fix alignment warnings
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-15 16:30:44 +01:00
Øyvind Harboe
9b1d38707c dsp563xx: fix bug in x buffer handling
found by inspection.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-03-15 16:29:52 +01:00
Luca Ellero
47b5829db4 cortex_a8: remove dap_ap_sel calls
add new mem_ap_sel_* functions (as was made for cortex_a9)
see commit: 779005f43d

Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-23 08:14:41 +01:00
Mathias K
403e239960 dsp563xx: rudimentary gdb support
This patch add rudimentary gdb support. The gdb register list
order is corrected. All registers are now 32bit width. Events are
send to signalize gdb the current target status. Resume and step
function was corrected to consider a modified pc register. Read/write
memory now support L memory type, this means a memory with alternating
y/x memory words. The memspace variable, used by gdb, is now observed
before a default memory access is initiated. Dummy functions for breakpoint
and watchpoint are added.
2011-02-21 21:30:47 +01:00
Luca Ellero
fa93174a56 arm_adi_v5: add/move apsel member in struct adiv5_dap
This patch tries to make some order in "apsel" mess.
"dap apsel" command was quite useless (and broken) by itself.
With this patch we can use it to select between AHB or APB memory access
(previous patch 05ab8bdb81 was somehow broken).

- moves member apsel (in struct adiv5_dap) to ap_current
- adds apsel member

this strange choice is made trying to keep coherence in "dap apsel" command
 and to keep compatibility with other code (for example cortex_a8).

Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-17 09:28:07 +01:00
Mathias K
01edbc2c3f dsp563xx: minor fixes, code cleanup
This patch move the dsp563xx_target_create function to the
related code block. Also the target examine function was added
and the register cache is initialized in a separate function. The
missing functionality to invalidate the x memory context on memory
writes was also added.
2011-02-17 09:22:21 +01:00
Mathias K
b7163f534a dsp563xx_once: Correct wrong return value on jtag communication errors
This patch change the return value on a jtag communication error
to TARGET_UNKNOWN because this function should return the current
target status and not a error code from the underlying api call.
Also the validity of the jtag_status is extended to all static
bits in this value.
2011-02-17 09:22:17 +01:00
Mathias K
0f863ecb01 - remove pipeline context, use once register instead - fix wrong register write in resume and step function - add more conditional branch handling 2011-02-17 08:24:17 +01:00
Mathias K
fe0894015f - add parameter flush to the once api to signalize if the jtag queue need to be flushed after the command 2011-02-15 20:20:00 +01:00
Mathias K
aa9baf11a8 - add bulk memory write function - execute jtag queue at the end of the memory transfer 2011-02-15 20:19:55 +01:00
Phil Fong
17a6ffa0c7 dsp563xx_once: Correct definition of JTAG_INSTR_CLAMP
I've been working on Rodrigo on adding support to flash
Freescale dsp56800e devices and have been looking at the
dsp563xx code.  I think the define for the JTAG CLAMP
instruction in dsp563xx_once.c is incorrect.  It should
be 0x05 according the Freescale AN2074 (and is also
0x05 in the dsp568xx according to AN1935).  It won't
actually change anything in OpenOCD since this define
is not used anywhere (as far as I can tell).
2011-02-15 20:17:33 +01:00
Luca Ellero
779005f43d cortex_a9: move dap_ap_select to arm_avi_v5
dap_ap_select was used in the code at various points, but that can lead to
confusion, without any knowledge of what AP is really selected at some
points.
Some bugs derive from this (for example md/mw doesn't work well after
issueing "dap apsel" command).
Moving it to arm_adi_v5.c (using  mem_ap_sel* functions instead of mem_ap_*)
make the code more clear and more easier to maintain.
In the future it should be made "static" to avoid its use outside arm_adi_v5

One further benefit is the various goto has been removed as well

Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-14 15:29:25 +01:00
Luca Ellero
bc404041c0 arm_adi_v5: add wrapping transfer functions with selection of ap
Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-14 15:29:25 +01:00
Luca Ellero
dcc9624b98 arm_adi_v5: add transfer functions prototypes with selection of ap
Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-14 15:29:25 +01:00
Luca Ellero
aaa52e16ce cortex_a9: check if MMU is enabled on APB read/write memory
Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-14 15:29:25 +01:00
Luca Ellero
f609d03f1f cortex_a9: check target halted on APB read/write memory
Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-14 15:29:25 +01:00
Luca Ellero
28b953d0bd cortex_a9: trivial fixes
Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-14 15:29:25 +01:00
Spencer Oliver
177fe9d762 buikd: fix cygwin -mno-cygwin build error
Remove duplicate inline that causes certain versions of gcc to choke.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-02-10 13:57:30 +00:00
Luca Ellero
05ab8bdb81 cortex_a9: implement read/write memory through APB-AP
This patch adds read/write capability to memory addresses not
accessible through AHB-AP (for example "boot ROM code").

To select AHB or APB, a "dap apsel" command must be issued:
dap apsel 0 -> following memory accesses are through AHB
dap apsel 1 -> following memory accesses are through APB

NOTE: at the moment APB memory accesses are very slow, compared
      to AHB accesses. Work has to be done to get it faster (for
      example LDR/STR instead od LDRB/STRB)

Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-10 10:07:56 +01:00
Aaron Carroll
94e90cbf16 cortex_a9: fix dap_ap_select() usage
Save, select and restore AP in cortex_a9_step and cortex_a9_init_debug_access.
Fixes a bug where the wrong AP is selected after a reset.

Signed-off-by: Aaron Carroll <aaronc@cse.unsw.edu.au>
2011-02-10 09:57:17 +01:00
Mathias K
08bf273def dsp563xx: add x, y and p memory access
Hello,

this patch add commands to access to x,y and p memory. For run time optimization some local jtag
function was changed to static inline.

Regards,

Mathias
2011-02-08 09:45:01 +01:00
Luca Ellero
d51b561b10 cortex_a8/a9: fix some comments
Signed-off-by: Luca Ellero <lroluk@gmail.com>
2011-02-08 09:42:43 +01:00
Mathias K
75cdbff5aa more changes to dsp563xx code
Hello,

this patch adds the missing cpu registers and the correct read/write register functions and fixed
most of the halt/step/resume issues. The complete missing error propagation was added.

+ fix tab/spaces

Regards,

Mathias
2011-02-03 12:28:17 +01:00
Mathias K
b0bdc4e2f2 24bit buffer support
Hello,

this patch add 24bit support to the target buffer functions and little/big endian functions.

Regards,

Mathias
2011-02-03 12:23:55 +01:00
Aaron Carroll
efcea8306a cortex_m3: allow scripts to override reset
If a handler for the reset-assert event it present, skip the usual reset
handling.  This is needed, for example, for board-level resets.

Signed-off-by: Aaron Carroll <aaronc@cse.unsw.edu.au>
2011-02-02 08:32:10 +01:00
Aaron Carroll
c34e69cb10 cortex_a9: add source files for Cortex A9 support.
add target and build support for A9

Signed-off-by: Aaron Carroll <aaronc@cse.unsw.edu.au>
2011-01-31 08:57:38 +01:00
Aaron Carroll
8e60d4955f arm_dpm: add some SCR/RCR macros
Signed-off-by: Aaron Carroll <aaronc@cse.unsw.edu.au>
2011-01-31 08:53:53 +01:00
Aaron Carroll
aea22bdbd1 Add '-coreid' target option to support multiple cores per TAP.
ARM Cortex-A9 multi-core chips expose a single TAP/DAP which connects
to both cores.  The '-coreid' option selects which core the target
should connect to.

Note that at present, OpenOCD can connect to either core, but not both
simulatenously, until ADI contexts can be shared.

Signed-off-by: Aaron Carroll <aaronc@cse.unsw.edu.au>
2011-01-31 08:53:21 +01:00
Mathias K
e26bda10bc add cortex-r4 etm id to dap info
Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-27 10:33:20 +00:00
Andreas Fritiofson
5b34018ccd fix segfault from stack corruption in ahbap_debugport_init
ahbap_debugport_init was queueing reads to a local stack variable but
didn't execute the queue before returning. Since the result of the reads
are not used anyway, it's better to pass NULL as the destination instead of
a dummy variable. I changed this throughout the function, even for the
reads that were actually executed.

Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-26 12:14:51 +00:00
Eric Wetzel
0535531d27 nit: more LOG_* \n fixes
Remove extra \n from LOG_DEBUG, LOG_INFO, and LOG_WARNING messages

Remove LOG_INFO_N
LOG_INFO_N was only used once and had a \n at the end

Change LOG_USER_N calls that end with \n to LOG_USER
2011-01-09 21:35:23 +01:00
Eric Wetzel
a665ef716a nit: do not add \n at end of LOG_ERROR
Fixed in many other places, and submitted in response to Øyvind's invitation.
2011-01-05 21:46:12 +01:00
Spencer Oliver
0cd84000da mips32: add fastdata loader working area
Add a working area that is preserved between calls to
mips_m4k_bulk_write_memory - this gives us a speed increase
of approx 3kb/sec during flash writes to the pic32mx.

This area is released during a resume/reset.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-04 12:29:49 +00:00
Spencer Oliver
dc1c5a7500 target: change working area free data type
We only use the struct working_area member 'free' as a
true/false type so might as well use a bool data type.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2011-01-04 09:52:20 +00:00
Øyvind Harboe
c69553cbc5 error handling: the error number is not part of the user interface
Do not propagate error number to user. This is for internal
programming purposes only. Error messages to the user is
reported as text via LOG_ERROR().

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2011-01-03 13:33:27 +01:00
Marek Vasut
0136977c40 CORTEX A8: Fix broken CPU identification
This patch fixes the issue where the OMAP CPU (and possibly others) was mistaken
for iMX51 and therefore had misadjusted debug base.

Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
2010-12-30 08:19:47 +01:00
Andrew MacIsaac
50e79d60ce Compilation Warnings on OS X 10.5
I received a number of "-Wshadow" related warnings (treated as errors) while
trying to build on OS X Leopard.  In addition, there were two miscellaneous
other warnings in the flash drivers.  Attached are two patches which correct
these issues and the commit messages to accompany them.

My system has the following configuration (taken from uname -a):

Darwin 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009;
root:xnu-1228.15.4~1/RELEASE_I386 i386

=== Werror_patch.txt Commit Message ===
compilation: fixes for -Wshadow warnings on OS X

These changes fix -Wshadow compilation warnings on OS X 10.5.8

Compiled with the following configure command:

../configure --prefix=/usr/local --enable-maintainer-mode --enable-jlink
--enable-ft2232_libftdi

=== flash_patch.txt Commit Message ===
compilation: fixes for flash driver warnings on OS X

These changes fix two compilation warnings on OS X 10.5.8:

../../../../src/flash/nor/at91sam3.c:2767: warning: redundant redeclaration
of 'at91sam3_flash'
../../../../src/flash/nor/at91sam3.c:101: warning: previous declaration of
'at91sam3_flash' was here

and

../../../../src/flash/nor/stmsmi.c:205: warning: format not a string literal
and no format arguments

Compiled with the following configure command:

../configure --prefix=/usr/local --enable-maintainer-mode --enable-jlink
--enable-ft2232_libftdi
===

Andrew
2010-12-29 22:16:28 +01:00
Øyvind Harboe
4f9a9b8eba warnings: use more 'const' for char *
Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-29 22:07:39 +01:00
Øyvind Harboe
8f93c0a3fe target: do not expose error numbers to users
error numbers are only reported at DEBUG log levels and
used internally, they are not part of the user interface.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-29 20:59:30 +01:00
David Brownell
7cd2617384 initial SWD transport (SWD infrastructure #2)
This piggy backs on JTAG so it's not yet pretty, but that
seems unavoidable so far given today's OpenOCD internals.

SWD init and data transfer  are unfinished and untested, but
that should cause no regressions, and will be addressed by
the time drivers start using this infrastructure.  Checking
in whould get the code working better sooner, and turn up any
structural/architectural issues while they're easier to fix.

The debug adapter drivers will provide simple SWD driver
structs with methods that kick in as needed (instead of JTAG).
So far just one adapter driver has been updated (not yet
ready to use or circulate).

The biggest issues are probably
  - fault handling, where the ARM Debug Interface V5 pipelining
    needs work in both JTAG and SWD modes and
  - missing  rewrite of block I/O code to work on both of our
Cortex-ready transports (Current code is  hard-wired to JTAG);
relates also to the pipelining issue.
  - omitted support to activate/deactivate SWO/SWV trace (this is
    technically trivial, but configuring what to trace is NOT.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
----

 doc/openocd.texi        |   17 ++
 src/jtag/core.c         |    3
 src/jtag/interface.h    |    4
 src/jtag/jtag.h         |    2
 src/jtag/swd.h          |  114 +++++++++++++++++++
 src/jtag/tcl.c          |    2
 src/target/adi_v5_swd.c |  281 ++++++++++++++++++++++++++++++++++++++++++++++--
 src/target/arm_adi_v5.c |    8 +
 src/target/arm_adi_v5.h |    3
 9 files changed, 425 insertions(+), 9 deletions(-)
2010-12-24 18:50:41 -08:00
Øyvind Harboe
e03f45f699 config: add init_targets proc that is executed just before init
this allows configuration scripts to export a init_targets proc
rather than setting up the target directly.

This allows for new conventions in how to set up target vs. board
script and how to transfer default settings between board and
target scripts.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-22 17:44:22 +01:00
Mike Dunn
2e7d51c96a xscale: trace buffer remains enabled until explicitly disabled
Hi everyone,

Since a call went out for patches... been sitting on this for months.  For some
reason, the xscale trace buffer is automatically disabled as soon as a break
occurs and the trace data is collected.  This patch was a result of the
frustration of always re-enabling it, or else hitting a breakpoint and checking
the trace data, only to discover that I forgot to re-enable it before resuming.
Don't see why it should work this way.  There is no run-time penalty, AFAIK.

Along the way, I also cleaned up a little by removing the ugly practice of
recording wrap mode by setting the fill count variable to "-1", replacing it
with an enum that records the trace mode.

I've been using this for months.  Comments, criticisms gratefully received.

Mike

Signed-off-by: Mike Dunn <mikedunn@newsguy.com>
2010-12-04 09:40:15 +01:00
Spencer Oliver
f0fac8a2cd cortex_m3: change cortec_m3 reset_config behaviour
Currently the cmd 'cortex_m3 reset_config' will overide the default
target's 'reset_config'.
Chnage the behaviour to use the target 'reset_config' if configured and
fallback if not.

Signed-off-by: Spencer Oliver <ntfreak@users.sourceforge.net>
2010-12-03 09:02:07 +00:00
Øyvind Harboe
778b789c8e profile: use 100Hz as a default sampling frequency
it's a lie that is somewhere in the vicinity of the
truth. Certainly 64MHz confuses gprof and produces
zero output and no error messages.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
2010-12-01 15:28:56 +01:00