Commit Graph

59 Commits

Author SHA1 Message Date
Uwe Bonnes 554e34517e Better reporting when monitor command fails. 2021-09-22 21:41:43 +02:00
Uwe Bonnes e58b7d623b crc32: Abort generic_crc32 with error from target_mem_read
Use larger chunks for hosted to speed up. Send pure NULL as line keep-alive.
2021-09-07 10:57:17 +02:00
Thiadmer Riemersma be534a9c5e Turn error LED off after successful attach to target (error LED blinks on 'target lost'). 2021-08-13 16:10:37 +02:00
Björn Mellström 711a87f7ba Fix some warnings when compiling with -Wshadow
There are still a few more places that would need to be corrected
before -Wshadow could be added by default.
2021-06-03 12:55:28 +02:00
Uwe Bonnes 8289862b55 gdb: Reset flash_mode with when erase or flash fails.
Thanks to Dave Marples <dave@marples.net>, extracted from  #607
2020-09-04 15:17:29 +02:00
Uwe Bonnes dc3fd2eb06 Classify debug messages
Firmware BMP with ENABLE_DEBUG=1 will print WARN and INFO as before.
PC-Hosted BMPwill alway print to stderr. Warn is printed unconditional,
INFO, GDB, TARGET, DONGLE and WIRE will print if their appropriate bit in
cl_debuglevel is set via the -v verbose command line argument.
INFO will go to stdout with -t or -l.
2020-06-05 14:59:30 +02:00
Koen De Vleeschauwer 8851504a41 new semihosting commands 2020-04-23 09:43:46 +02:00
Gareth McMullin 19a8078f99 gdb: Implement 'p' and 'P' register access 2019-09-01 20:38:38 +02:00
Uwe Bonnes 703f88a969 gdb_main: Always release CPU when detaching.
Fixes Issue #413 and released as PR #477.
2019-05-23 13:17:54 +02:00
Uwe Bonnes 5f404cdbc0 Construct memory map on the stack
The memory map uses 1k of SRAM and is only needed during attach. Release
after use lowers pressure on SRAM.
2018-04-23 10:51:04 +12:00
Gareth McMullin 9a5b31c37b Fix fallthrough warnings on gcc 7 2017-10-09 11:07:29 +13:00
Gareth McMullin bd2cfe72f0 Add range checking on mem access packets. 2017-04-18 11:41:11 +12:00
Chuck McManis a3c2592e44 Review feedback 2016-12-04 13:15:45 -08:00
Chuck McManis 0aef6c6774 SAM4L: Add extended reset to target interface
This adds a new function to the internal target interface
to allow the target to get control before reset is complete
so that it can do any additional work. On this target there
is a proprietary internal bit that has to be reset in some
cases to allow the core to continue operating.
2016-12-02 00:08:21 -08:00
Gareth McMullin 40f960db4d Restore LED behaviour. 2016-09-28 22:15:15 -07:00
Gareth McMullin 9a45d89b4a target: Remove target_check_error from external interface. 2016-07-13 08:31:09 +12:00
Gareth McMullin 9136cf4c98 target: target_halt_wait and target_check_hw_wp replaced with target_halt_poll.
The new function returns a stop reason which must be translated in gdb server.
In the case of a watchpoint hit, the address is returned by a pointer parameter.
Simplify the extenal interface for set/clear breaki-/watchpoints.
2016-07-13 08:31:09 +12:00
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