42 Commits

Author SHA1 Message Date
Gareth McMullin
aeaca988c3 target: Use new target_addr type consistently in external interface.
Flash routines still use uint32_t internally.
2016-07-13 08:31:09 +12:00
Gareth McMullin
b644724520 Overhaul of semihosting. Remove dependence of target on gdb_packet. 2016-07-13 08:31:09 +12:00
Gareth McMullin
b03cc59bea target: Add target controller structure for indirect calls back to host. 2016-07-13 08:31:09 +12:00
Gareth McMullin
4e04c1dded Split out non-public target stuff into new header.
Wrap target methods with functions instead of macros.
2016-07-13 08:31:09 +12:00
Gareth McMullin
67bd1530b7 Remove some unused includes. 2016-07-13 08:31:09 +12:00
Gareth McMullin
60f3be501e Pass breakpoint length to target. 2016-04-19 13:24:05 -07:00
Laurent Bonnans
c9d3cf71dd gdb_main.c: fix buffer overflow on large reads
When gdb issues a `m xx,200` command, the probe should respond with a
packet of size 2*0x200=1024 which is the size of the packet buffer.

However, the `hexify()` procedures writes 1025 bytes in the buffer.

During my tests, it caused the probe to hang when issuing a `dump`
command. Presumably by overwritting the `cur_target` variable.
2015-12-14 11:28:28 +01:00
Gareth McMullin
21d464293c gdb: don't access target fields directly. 2015-03-29 18:06:13 -07:00
Gareth McMullin
4313b64bbe Add a flash_done target method. 2015-03-26 20:47:57 -07:00
Gareth McMullin
5ab8564ff6 Clean up handling of lost targets using new exceptions mechanism. 2015-03-22 14:05:12 -07:00
Gareth McMullin
ee3af96a73 Consolidate target_mem_read* and target_mem_write* methods.
There are now only mem_read and mem_write, that must
handle all alignments.  These methods return void, errors must be
checked with target_check_error.
2015-03-15 14:31:57 -07:00
Gareth McMullin
f5c856af3b Fix pointer sign warnings and remove -Wno-pointer-sign. 2015-03-13 20:35:39 -07:00
Gareth McMullin
3d28c1418c Cleaned up printf/scanf for C99 integer types. 2015-03-11 20:47:42 -07:00
Gareth McMullin
4d4813de87 Clean up includes everywhere.
All source files include general.h first and before anything else.
This inlcludes platform.h and platform_support.h
No header file needs to include to include any of these, but should include
any others needed for it's own declarations.
2015-03-01 22:16:04 -08:00
Richard Meadows
9072faf6ca Fixed spaces / tabs from last commit 2015-01-17 18:35:36 +00:00
Richard Meadows
c12002b636 Check target_attach succeeded in vRun command, and return error if not 2015-01-17 18:30:58 +00:00
Vegard Storheil Eriksen
9434299613 Add support for halfword memory accesses. 2014-10-21 00:12:50 +02:00
Gareth McMullin
a5549d630c Whitespace cleanup. 2014-10-16 13:50:56 -07:00
Gareth McMullin
2d63dd4b5b Fix register array sizes. 2013-06-17 15:52:15 +12:00
Gareth McMullin
5020d1f05d Move semihosting support to cortexm.c.
Try to implement more syscalls.
2013-05-18 15:33:58 +12:00
Paul Fertser
aca421d0bb Basic semihosting support
Implement bare minimum necessary to support console IO.

This works with standard newlib builds and is based on the reference
documentation:
http://infocenter.arm.com/help/topic/com.arm.doc.dui0471c/CHDJHHDI.html

Tested using gcc-arm-none-eabi-4_7-2013q1-20130313 for both
stm32f1-based BMP and stm32f0 target.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2013-05-18 15:33:58 +12:00
Paul Fertser
9c95f039cf Make code compatible with newlib-nano and use it for stlink
With gcc-arm-none-eabi-4_7-2013q1-20130313 and -O2 I get
   text    data     bss     dec     hex filename
  45744     304    2376   48424    bd28 blackmagic

With -Os the results are even more impressive:
   text    data     bss     dec     hex filename
  37900     304    2376   40580    9e84 blackmagic

Since -Os might lower the debugging speed, do not enable it yet in the
absence of real measurements.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
2013-04-14 11:48:59 -07:00
Gareth McMullin
f526a82773 Move breakpoint packet handler out of main gdb loop.
Use gdb_putpacketz for constant strings.
2012-11-03 20:38:27 +13:00
Gareth McMullin
538f4d41b6 Clean up whitespace. 2012-11-03 19:59:01 +13:00
Gareth McMullin
dac1f60dc2 Clean up ancient bad typing and malloc madness. 2012-11-03 19:52:09 +13:00
Gareth McMullin
50b6c623d6 Check for null pointer before decalaring register array. 2012-11-03 19:04:27 +13:00
Gareth McMullin
0990c2224c Allow target attachment to timeout and report failure.
This is needed for if the target device is held in reset.
2012-11-03 16:42:46 +13:00
Gareth McMullin
d64cec686a Signal on halt is now returned by target_halt_wait().
Fault unwinding is now handled internally in target implementation.
GDB server doesn't need to know about it.
2012-06-30 20:29:08 +12:00
Gareth McMullin
466bb66424 Made cur_target, last_target static in gdb_main.c.
Added target destroy notify mechanism.
2012-06-27 21:26:08 +12:00
Gareth McMullin
03fdd23e9c Added mechanism for target driver to add new monitor commands. 2012-06-24 21:41:32 +12:00
Gareth McMullin
6089a66dce Renamed target_flash_write_words to target_flash_write.
Buffer from GDB may not be aligned or integer number of words.
Corrected alignment in in STM32F1 driver.
2012-06-18 20:53:06 +12:00
Gareth McMullin
a73f06c147 Cleaned up debug output on linux build. 2011-12-18 17:01:10 +13:00
Gareth McMullin
c7c31d2502 Implement gdb 'qCRC' packet to support 'compare-sections' command. 2011-12-17 21:46:22 +13:00
Gareth McMullin
540573bc18 Fixed qSupported resonse. 2011-11-26 17:04:48 +13:00
Mike Smith
ffda30f393 Add support for a more comprehensive target description, including the additional v7m registers.
This doesn't work with vanilla gdb, as for reasons unknown said vanilla gdb doesn't support XML target descriptions queried from the remote.

Add code to the fault unwinder to deal with the stack alignment fixup and FP registers.  Avoid saving/restoring registers that don't get trashed.
2011-11-25 17:07:46 -08:00
Gareth McMullin
d73ac40ef1 Added preliminary support for the STM32F4. 2011-11-12 19:15:52 +13:00
Gareth McMullin
adabaa7592 Halt and detach target if host releases DTR.
Port reads 0x04 (EOF) when DTR is released.  GDB loop detaches from
target if EOF is read.
Fixes bug 3307433.
2011-07-02 20:47:39 +12:00
Gareth McMullin
be91386c0a Minor changes to allow a build for Windows hosts with libftdi. 2011-03-29 20:01:15 +13:00
Gareth McMullin
32cabac0f3 Stack is now unwound on hardfault. 2011-02-21 20:57:56 +13:00
Gareth McMullin
981a906898 Changed some uint32_t to unsigned long to remove warnings. 2011-02-07 08:32:33 +13:00
Gareth McMullin
5788445ab2 Changed to use sprintf/sscanf by default.
Overridden by STM32 platform.h to use newling siprintf/siscanf.
2011-02-06 19:36:01 +13:00
Gareth McMullin
406617a2a4 Import of working source tree. 2011-02-04 20:23:52 +13:00