aboutsummaryrefslogtreecommitdiff
path: root/src/target
AgeCommit message (Collapse)Author
2014-01-11cortex_m: Fix possible endianness problem in emulated DCC channelAndreas Fritiofson
Change-Id: If7104464a8c65085f3ceac445e9c9be8446f2da9 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1846 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-01-11target: Add test bench for memory access functionsAndreas Fritiofson
Change-Id: I86e6fe4d0b4d580389ae5e1d3f4813d1e25b2613 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1629 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2014-01-09cmsis-dap: add initial cmsis-dap supportSpencer Oliver
This is based on work from: https://github.com/TheShed/OpenOCD-CMSIS-DAP/tree/cmsis-dap Main changes include moving over to using HIDAPI rather than libusb-1.0 and cleaning up to merge into master. Support for reset using srst has also been added. It has been tested on all the mbed boards as well as the Freedom board from Freescale. These boards only implement SWD mode, however JTAG mode has been tested with a Keil ULINK2 and a stm32 target - but requires a lot more work. Change-Id: I96d5ee1993bc9c0526219ab754c5aad3b55d812d Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Signed-off-by: Andrey Yurovsky <yurovsky@gmail.com> Reviewed-on: http://openocd.zylin.com/1542 Tested-by: jenkins
2013-12-30target/image: allow for comments in IHEX filesFranck Jullien
This is not in the Intel hex file format specification but some hex files may include comments (i.e. Altera USB-Blaster II firmware) starting with '#'. This patch makes image_ihex_buffer_complete_inner to skip comment lines. Change-Id: Id1f57d84d75da45e592f1c72b2b8c29193bc14e3 Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Reviewed-on: http://openocd.zylin.com/1842 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-12-22kinetis : Add timeouts to flash status checking in dap_syssec_kinetis_mdmap().Per Ekman
Change-Id: Ifc8fe7aa4c2a40a78fa0655435e82418f549bad3 Signed-off-by: Per Ekman <pekenator@gmail.com> Reviewed-on: http://openocd.zylin.com/1819 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-12-14topic: Support for the Xilinx BSCAN_* Virtual JTAG in OpenriscSergio Chico
This add support to the Xilinx BSCAN_* virtual JTAG interface. This is the Xilinx equivalent of the Altera sld_virtual_jtag interface, it allows a user to connect to the debug unit through the main FPGA JTAG connection. Change-Id: Ia438e910650cff9cbc8f810b719fc1d5de5a8188 Signed-off-by: Sergio Chico <sergio.chico@gmail.com> Reviewed-on: http://openocd.zylin.com/1806 Tested-by: jenkins Reviewed-by: Franck Jullien <franck.jullien@gmail.com> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-12-01[PATCH 1/2]support64: Add functions into types and targetDongxue Zhang
Add functions into types.h, target.c, target.h to operate 64bits data. Prepare for 64bits mips target. Change-Id: I668a8a5ac12ba754ae310fa6e92cfc91af850b1c Signed-off-by: Dongxue Zhang <elta.era@gmail.com> Reviewed-on: http://openocd.zylin.com/1700 Tested-by: jenkins Reviewed-by: Mathias Küster <kesmtp@freenet.de> Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-11-08kinetis : Fix broken check for mass erase.Per Ekman
If the flash is not ready (MDM_STAT_FREADY is 0) then dap_syssec_kinetis_mdmap() would act as if the MDM_STAT_SYSSEC bit was set and erase the flash. Wait until MDM_STAT_FREADY is set before checking the MDM_STAT_SYSSEC bit. Change-Id: I5c3352f625599016625ed9be8787033f49bfacea Signed-off-by: Per Ekman <pekenator@gmail.com> Reviewed-on: http://openocd.zylin.com/1762 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-11-07hla: Make consistent parameter namingMathias K
Rename fd to handle. Change-Id: I98615aed1546976d00b0f20856d4e8e75f83c575 Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/1761 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-11-07target: use target_buffer_set_u32_arraySpencer Oliver
Attempt to use target_buffer_set_u32_array to convert to target endian arrays rather reimplementing code. This also removed cfi_fix_code_endian as its functionality is also repeated. Change-Id: I7c359dbe46ea791cd5f6fb18d8b0fb6895c599d3 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1783 Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-10-31target: fix mem2array/array2memMathias K
if data size is bigger than transfer buffer, all portions are transferred from/to the same target address - address advance after successful transmission missed. Change-Id: I79a6c388af197ac062d2807e397a2d7947400520 Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net> Signed-off-by: Mathias K <kesmtp@freenet.de> Reviewed-on: http://openocd.zylin.com/1679 Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk> Tested-by: jenkins
2013-10-31smp: Fix byte order bugAndreas Fritiofson
Found by grepping for pointer casts. Also rewrite to reduce scope and allocate the few bytes needed on stack instead of on heap. Change-Id: Ia2a369fb612e807b981ee60ebcfd9c09c2fbdf4c Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1779 Tested-by: jenkins Reviewed-by: Mathias Küster <kesmtp@freenet.de> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31Remove unnecessary (void *)Andreas Fritiofson
When pointer casts are needed, cast directly to the correct type, instead of going via void*. Don't explicitly cast to void* if it would have been done implicitly. Change-Id: I4093209200051c5eb62847d00a4b9c8567480068 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1669 Tested-by: jenkins Reviewed-by: Mathias Küster <kesmtp@freenet.de> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31Clean up const usage to avoid excessive castingAndreas Fritiofson
Don't use const on pointers that hold heap allocated data, because that means functions that free them must cast away the const. Do use const on pointer parameters or fields that needn't be modified. Remove pointer casts that are no longer needed after fixing the constness. Change-Id: I5d206f5019982fd1950bc6d6d07b6062dc24e886 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1668 Tested-by: jenkins Reviewed-by: Mathias Küster <kesmtp@freenet.de> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-31Clean up many C99 integer types format specifiersPaul Fertser
This eliminates most of the warnings reported when building for arm-none-eabi (newlib). Hsiangkai, there're many similar warnings left in your nds32 files, I didn't have the nerve to clean them all, probably you could pick it up. Change-Id: Id3bbe2ed2e3f1396290e55bea4c45068165a4810 Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/1674 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-29cortex_m: set fpb_enabled on enabling fpbSpencer Oliver
If the fpb_enabled is not set then as part of cortex_m3_set_breakpoint we enable the fpb, however we do not signal the fpb as being enabled. This issue only effects the hla target as the current cortex_m code enables the fpb during cortex_m3_endreset_event. Change-Id: I44d3fc65916c131b7a226869dd16aed5afb441b4 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1634 Tested-by: jenkins
2013-10-15nds32: Remove unused declarationAndreas Fritiofson
Change-Id: Ie0df720b2adacc8f10474f88f15142fa94c388b8 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1686 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-15 hla_target: Update target state when pollingSergey A. Borshch
Polling target does not change stste information except if new state is TARGET_HALTED. Connecting to the runing target result in target->state not updated with retrieved value and remains "UNKNOWN" until 'halt' command issued. Change-Id: I803d6c0207f7f8699e648779d1df342c9ee7315a Signed-off-by: Sergey A. Borshch <sb-sf@users.sourceforge.net> Reviewed-on: http://openocd.zylin.com/1680 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-15arm7_9: Avoid infinite loops in bulk write dispatchingAndreas Fritiofson
Add a mandatory field in struct arm7_9_common for regular, non-optimized memory writes. Together with the existing bulk_memory_write field, this allows variants to select any combination of implementations for regular and bulk writes, without risking infinite loops from accidentally using bulk writes for implementing bulk writes. ARM 7/9 targets may now select arm7_9_memory_write_opt as their target.write_memory implementation, which will dispatch to arm7_9_common.bulk_write_memory if possible, or fallback to arm7_9_common.write_memory otherwise. To avoid loops, bulk write implementations mustn't call any other functions than arm7_9_write_memory_no_opt() to write memory; it will unconditionally call arm7_9_common.write_memory. If they fail, they should simply return error to allow the caller to fallback to regular writes. Tested on a regular ARM7TDMI only. Change-Id: Iae42a6e093e2df68c4823c927d757ae8f42ef388 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1685 Tested-by: jenkins Reviewed-by: Sergey A. Borshch <sb-sf@users.sourceforge.net> Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-15openrisc/tap_vjtag: fix IR settingFranck Jullien
Change-Id: I2b1f057dc9777ff263d6cefa4ff5958e85607a22 Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Reviewed-on: http://openocd.zylin.com/1694 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-15openrisc/du_adv: check or1k_adv_jtag_init return valueFranck Jullien
Change-Id: I784c16b8137b4269254c86007e6766b1a2297aa2 Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Reviewed-on: http://openocd.zylin.com/1693 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-10cortex_m: target implementation renames cortex_m3 to cortex_mSpencer Oliver
We changed the actual target name quite a while ago. This changes the actual target function names/defines to also match this change. Change-Id: I4f22fb107636db2279865b45350c9c776e608a75 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1626 Tested-by: jenkins
2013-10-02cortex_m: Call mem_ap_read/write directlyAndreas Fritiofson
Change-Id: I52e1d8babf7bf9fcde4094046d29b817c15c0562 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1659 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-02arm_adi_v5: Rewrite MEM-AP transfer implementationAndreas Fritiofson
Create a single pair of relatively simple functions to handle all variants of MEM-AP transfers. This replaces the many separate functions that handled different access sizes and packed or non-packed transfers, which were all implemented rather differently. With this single implementation, performance should be more consistent, regardless of transfer type. Change-Id: I89960e437fc6ba68a389c074fab8eac91abcf844 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1658 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-02cortex_m: mem_ap access functions take number of bytes, not wordsAndreas Fritiofson
Accessing one byte of memory using a 16-bit access is not well defined. The current implementation is forgiving and rounds up, but it should not be relied upon. Also, I suspect this code might fail if the byte order differs between target and host, but I have no way of verifying it so I left it as it is. Change-Id: I8d6a511151a194ed419f141703201f0632d84fc8 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1657 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-02arm_adi_v5: Fix packed transfers crossing TAR auto-increment blockAndreas Fritiofson
The word count returned from max_tar_block_size() was compared with the count of half-word/bytes in the u16 and u8 packed access functions, causing an infinite loop if the access actually crossed the boundary. Change max_tar_block_size() to return a byte count, and scale at the call site. Change-Id: I2fe9b5941eb485f3d8219cfdd29fb71e02006de4 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1649 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-10-02arm_adi_v5: Fix packed and unaligned memory writesAndreas Fritiofson
For packed and/or unaligned accesses, the write functions reordered the source buffer in place. Causing in the best case a segfault, in the worst case silent data corruption. Rewrite the data fetching to directly match the byte lane mapping according to IHI0031C, without destroying the buffer. Also slightly clean up variable usage and harmonize all the write functions. Change-Id: I9a01cfc5578653f9ec02043ff6b61a7a20f90d67 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1646 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-26Add new target type: OpenRISCFranck Jullien
Add support for OpenRISC target. This implementation supports the adv_debug_sys debug unit core. The mohor dbg_if is not supported. Support for mohor TAP core and Altera Virtual JTAG core are also provided. Change-Id: I3b1cfab1bbb28e497c4fca6ed1bd3a4362609b72 Signed-off-by: Franck Jullien <franck.jullien@gmail.com> Reviewed-on: http://openocd.zylin.com/1547 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-09-25target: Fix strange ordering in target_read_u8Andreas Fritiofson
It's been like this since the check was added, in 5aa93a5e. Change-Id: Iaa0586e0cd1ce57ad92735dcc3e51108a133fe96 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1640 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-25hla: move memory read/write functionality to driverSpencer Oliver
Due to issues reported when using the jtag mode of the stlink (see Trac #61), the functionality/checking has been moved to the driver. This change also fixes unaligned 32bit memory read/write for the stlink. From testing this change also brings a 3KiB/s speed increase, this is due to the larger read/write packets. Change-Id: I8234110e7e49a683f4dadd54c442ecdc3c47b320 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1632 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-09-25hla: cleanup read/write apiSpencer Oliver
This is the first part in moving the adapter specific api back into the driver. The next task is to also move the hla read/write buffer size handling. Change-Id: I86a19144b50b6de18659bfcd05b3729b2cafc051 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1621 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-09-21armv7m: add gdb target description supportSpencer Oliver
Change-Id: I7c01109c0b85d208fb04a7ae1185fab4b2ab96b8 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1620 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-09-21armv7m: remove gdb register hacksSpencer Oliver
Now that we support the target description format we do not need these hacks anymore, we can now tell gdb what registers we support. Change-Id: Ie774231d296420b35efcf708bc4435475c87ff5e Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1617 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-09-21gdb: add default description reg typesSpencer Oliver
Add support for the default gdb register description type "int" and "float". When this is given to gdb it will use the bitsize to determine the reg size. Change-Id: Iaeed594d1feece54044128eae1baff9858bdcae0 Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1622 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-09-21Restore mwh/mwb functionality.Andreas Fritiofson
Half-word and byte writes using mwh/mwb has been completely broken since bf71e34cbf, because it dispatched all writes, regardless of access size, to target_write_buffer(), which uses as large accesses as possible. Partially revert the commit by changing back to the correct write method. Change-Id: I60731fc576bf4a076a7da02bee7879e121c21d17 Signed-off-by: Andreas Fritiofson <andreas.fritiofson@gmail.com> Reviewed-on: http://openocd.zylin.com/1628 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-20adiv5: check packed transfers are supportedSpencer Oliver
Currently we try and use MEM-AP packed transfers as much as possible for 8/16bit transfers. However not all targets support packed transfers, so check before using. Change-Id: I66256007f25ccd0c583f23db5acf6d1aa8b5e57d Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1602 Tested-by: jenkins Reviewed-by: Andreas Fritiofson <andreas.fritiofson@gmail.com>
2013-09-13nds32: remove .soft_reset_halt dependencyHsiangkai Wang
.soft_reset_halt is not necessary for nds32 target. Remove the dependency. Change-Id: Ic3b126d6c7eb995583a661b762627e736222fcaa Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1612 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13aice: add target name to nds command messagesHsiangkai Wang
Change-Id: Ie6c786c6880fb554af54ed27f1c159326f60a701 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1583 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13nds32: support multi-target debuggingHsiangkai Wang
Change-Id: If767f646b234dbcdb01946e5d13a3a6a29df2d78 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1581 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13nds32: Use DMA to access memory as no DCacheHsiangkai Wang
As GDB uses file-I/O protocol to access memory, use DMA to access if no DCache. This commit improves the performance of Andes Virtual Hosting. Change-Id: I36bb2154b9f497fc4237625836cf8c7115330a60 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1580 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13nds32: modify nds commands implementationHsiangkai Wang
Modify handle_nds32_memory_access_command: do not use DCache setting to block user's setting. Change-Id: I2d33f893773e2a2e3e2f26edde5938ef5902609d Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1579 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13nds32: report any one of hit read watchpointsHsiangkai Wang
If multiple read watchpoints are hit at the same time, report any one of these hit watchpoints. Change-Id: I8d4439aa80e4b62bb7d48bbdc0450920e2008a2e Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1576 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13nds32: change default valueHsiangkai Wang
Change-Id: I0505bdc0e75543a3b205981339c5b9fa78a080ca Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1575 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13nds32: always polling after gdb attachedHsiangkai Wang
Do not turn on/off polling as leave/enter debug mode. Enable polling after gdb attached, and disable polling after gdb detached. Change-Id: Id64459b86f44937af7ea5ccfe2cd13e31732eecf Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1574 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13nds32: support Andes profiling functionHsiangkai Wang
Change-Id: Ibc45ec5777d6841956c02de6b4ae8e74c2a6de37 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1585 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13target: enhance target profilingHsiangkai Wang
1. gprof uses 2-bytes as minimum bucket size. 2. As user wants to use gprof --sum to summarize multiple profiling data files, the range MUST be the same. Add new arguments to specify profiling range. Change-Id: Ie7e6afa6a4d82250e2d194a0eed2b428c1479ea1 Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1572 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13target: add profiling interfaceHsiangkai Wang
Profiling could be target-specific. Add .profiling interface to target_type. Change-Id: Ic0eea9db742971db1350a474fbbb5ed24565922b Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1571 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13target: increase the maximum number of bucketsHsiangkai Wang
I do not know what is the reasonable number of buckets. If there are enough buckets, the result will be accurate. I propose increase the maximum number of buckets to 128K. If the size of program text section is less than 256KB, every two bytes will be occupied by one buckets. (The minimum size of one buckets is 2 bytes in gprof implementation.) Change-Id: If9147743cefdc36f40f21e6dc73b9b28f28c9e1e Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1608 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13target: Correct profiling calculationHsiangkai Wang
1. high_pc should be (maximum sample + 1) (Refer to gprof source code) 2. bucket index should be sample offset --------------- x (number of bucket) sample range For example, if minimum sample is 0 and maximum sample is 5 and the number of bucket is 3. a = sampled_address - 0 b = 3 c = 6 (a, b, c refer to source code variables) sampled_address = 0, => a = 0, => bucket_index = 0 sampled_address = 1, => a = 1, => bucket_index = 0 sampled_address = 2, => a = 2, => bucket_index = 1 sampled_address = 3, => a = 3, => bucket_index = 1 sampled_address = 4, => a = 4, => bucket_index = 2 sampled_address = 5, => a = 5, => bucket_index = 2 Change-Id: Ia9fa0e4d9c7183e3e9d7ceaf73e63729f07aa2ce Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1607 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
2013-09-13target: Make profiling function more readableHsiangkai Wang
Change variable name 'length' to 'numBuckets'. It is more readable. Change-Id: I913cba0746f887adf6da401a46cd5e9ea88d2c6d Signed-off-by: Hsiangkai Wang <hsiangkai@gmail.com> Reviewed-on: http://openocd.zylin.com/1606 Tested-by: jenkins Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>