Previously, even with the reset enabled, st-util would not connect
to a target if it was running. This change will reset the chip
when opening the connection, which allows st-util to connect
successfully.
Signed-off-by: Greg Meiste <w30289@motorola.com>
This patch handles the cache on the cortex-m7 stm32f7 cpu.
When gdb inserts a soft breakpoint (which is the default for
code in RAM), it replaces an instruction with a breakpoint
instruction. But if the caches are enabled, the replacement
may be made only in the D-cache. To reach the I-cache, the
D-cache must be flushed and the I-cache invalidated.
This implementation is coarse: it cleans the whole D-cache
and invalidate the whole I-cache. It is possible to
track which cache lines have to be cleaned and invalidated.
This adds a parameter to the function stlink_open_usb and to the binary
st-flash to specify one of multiple connected stlinks.
As the identifier the iSerial of the stlink is used.
If no serial is given the function and binary behave as before.
The previous memory map didn't allow to debug the whole flash
memory. A new configuration has been added and should be
used while working with the STM32F4Discovery.
Rather than putting debug printing in #ifdef blocks, use the same
uglylogging framework used by core stlink code.
To support this, the *LOG() macros are moved into the uglylogging.h
header file, and always use the filename as the logging tag.
The indentation of various st-link source files is highly inconsistent.
Reindent all source files to 4 space indentions for consistency.
I went with 4 space indentations, as it was the most common style.
Setting the STLINK device with -d hasn't worked for some time, but
the STLINK_DEVICE environment variable works instead. Remove the
option, update documentation and help text.
There were removed in my previous commit 5851dee due
to compilation errors. It actually appears these signals
are supported in MinGW but there was an include error for
MinGW, this commit fixes it.
Remove st-term from the list of the targets for MinGW.
st-term uses termios and would require a rewrite to have
it compile on MinGW. Also remove cleanup signal handlers
in gdb-server for MinGW to compile.
'-n' in st-util will cause it to skip the reset step, and thus allow you
to begin debugging at whatever point the code may currently be at.
Adding this feature required changing the stlink_open functions to
accept a reset flag that tells them whether or not to reset after
connecting. Skipping reset does not seem to have any adverse effects on
stlink usb devices. Unfortunately, I have to stlink v1 devices to test.
When stopping st-util under Eclipse as an external tool the st-util
receives a SIGTERM signal, and would not return the device to
usb mass storage mode. This change now calls cleanup in the SIGTERM handler too!!
SIGINT causes st-util to immediately exit, without closing the open
stlink. This leaves devices (at least the F4 Discovery) in a state
where they are unable to reset. st-util could still connect and control
them, but a power cycle was required before they could reset on their
own.
A signal handler is added for SIGINT, which performs cleanup and closing
of the open stlink device, allowing it to function normally on
disconnect.
When started with -m, or connected with 'target extended-remote', the
GDB server will not terminate upon disconnection from GDB, instead it
will begin listening for conenctions again.
Starting with extended-remote also has the advantage of allowing 'run'
to be used to reset the target and begin again. Unfortunately, 'start'
is not working properly, as it does not send a reset packet (R), so it
complains when it tries to access memory before it is connected to the
target.