Uwe Bonnes
92cdf49e28
Clip flash read request to maximum flash size
2011-12-18 19:03:58 +01:00
Uwe Bonnes
6ab0eb83be
While L1 has empty flash cell erased to zero, at least F1/F4 are erased to 0xff.
2011-12-18 18:47:21 +01:00
Uwe Bonnes
379fcb3c61
Also ignore ZEROs at end of file when writing
2011-12-18 16:53:16 +01:00
Uwe Bonnes
6f194ad388
Ignore NULL bytes at flash end when reading
2011-12-18 16:34:16 +01:00
Uwe Bonnes
7f0e9ada38
Replace remaining _mem32 single word accesses with _debug32
2011-12-18 15:40:09 +01:00
Uwe Bonnes
5652cee37d
Fix a wrong placed brace and and a not replaced stlink_write_mem32() that keep
...
STM32L from programming
2011-12-18 15:33:05 +01:00
Uwe Bonnes
fba79be3b4
Page erase for STM32L needs a real write to lowest address with 0. stink_write_mem(.., ..,0) is undedined
2011-12-18 15:30:45 +01:00
Uwe Bonnes
9953efb763
Use the single word accesses in the flash inner loop too. We first swap the data, then the access routine swaps the data again, but cycles are cheep and so don't need another access function
2011-12-13 20:35:32 +01:00
Uwe Bonnes
03e745140d
Use the single WORD memory access
2011-12-13 20:33:58 +01:00
Uwe Bonnes
9ef6d28cb5
Modify shutdown seqeunce. Now a F107 in sleep mode reacts on the reset pin after running stlink
2011-12-13 18:41:07 +01:00
Uwe Bonnes
5eda4566d6
Determine the device parameters explicit after running
...
stlink_reset(). Otherwise a sleeping device (WFI) doesn't return the
parameters.
2011-12-13 17:48:54 +01:00
Uwe Bonnes
3e72f0b1b3
Implement and expose single 32 memory read/write
2011-12-13 17:42:37 +01:00
Uwe Bonnes
28956cf2c9
Expose JTAG NRST
2011-12-12 15:22:19 +01:00
Uwe Bonnes
e82da443bf
Print undecode chip_id too
2011-12-10 19:01:52 +01:00
Uwe Bonnes
48b604040a
Fix leakage pathes for V1
2011-12-10 18:08:06 +01:00
Uwe Bonnes
c1130cc3a6
Fix memory leakage pathe with no V2 device found
2011-12-10 17:59:20 +01:00
le mentec fabien
592276c939
[update] apply patches from marpe@mimuw.edu.pl: stlink-sg.c unused/uninitialized variables
2011-11-22 10:04:36 -06:00
le mentec fabien
bd1249c224
[update] apply patches from marpe@mimuw.edu.pl: strict aliasing issues, busy bit waiting
2011-11-22 09:54:55 -06:00
Karl Palsson
fd332562a7
Fix merge problem with flash verify for F4
...
The F4 code had #ifdefd out the verification, as the page/sector size can be
too large to read in via a single transfer. Pull the verification out to a
separate function, the flash write was getting far too large anyway.
2011-11-15 19:56:14 +00:00
Karl Palsson
83a5eb2ed3
Merge branch 'tmaster' into future
...
This branch should work for F1 and F4 devices. It has currently been tested
with F1 value line, (a VL discovery board) programmed via gdb via both an
stlinkv1 and an stlinkv2.
F4 has _not_ yet been tested on this branch
Conflicts:
.gitignore
doc/tutorial/tutorial.pdf
example/blink/main.c
gdbserver/Makefile
gdbserver/gdb-server.c
src/stlink-common.c
src/stlink-common.h
src/stlink-usb.c
2011-11-15 00:57:09 +00:00
jnosky
768a70d321
Added code so gdbserver can fully support the STM32F4 variable page sizes
...
gdbserver can now upload up to 1MB projects to flash
2011-11-14 16:20:49 -05:00
Karl Palsson
9ac1f0d9d6
Fix memory leaks closing v1 hardware.
...
Thanks valgrind
2011-11-14 04:12:49 +00:00
Karl Palsson
dbe5391bd1
Remove dead code and unused variables
2011-11-14 04:12:29 +00:00
Karl Palsson
e509310406
Start up stlinkv1 faster.
...
Now that we're not using sg, and we've told the kernel to ignore the device in
usb-mass storage, we don't need to close and wait 5 seconds. We can just
immediately issue the command to switch modes.
2011-11-14 03:52:19 +00:00
Karl Palsson
a76c9ccfb3
Remove lots of dead code and superfluous trace
...
Lots of the debug code is far too verbose for anything but usb tracing.
Likewise, remove all the old scsi code that was simply ifdefd out.
2011-11-14 03:47:47 +00:00
Karl Palsson
b48420e394
Don't refetch the chip id on every single page erase.
...
And update some of the logging to be a bit tidier
2011-11-14 02:51:16 +00:00
Karl Palsson
77f2d8b76c
Don't try reading device params in bad USB modes.
...
You cannot read device params when we're not in debug mode and trying to will fill the USB buffer with garbage, and you will have to
unplug and replug and start again. (which will fail, because, you're in the
wrong mode... :)
2011-11-14 02:25:31 +00:00
Karl Palsson
3c6f2f5231
Fix flash writing for VL cores.
...
The change from run->step breaks the VL cores. Need to double check that this
still works for L cores. The whole flash writing needs to be better
abstracted.
Lots more informational debug.
2011-11-14 01:25:56 +00:00
Karl Palsson
0c587eedfd
Read chip and core id in device param loading.
...
Instead of expecting everyone to read it every time they need to check it.
Just assume it's always there.
2011-11-12 20:45:41 +00:00
Karl Palsson
5a5d36fdc3
Move all the flash size mapping from gdb server into core.
...
All the device params like flash size and page size should all be in the core open routines, not
_only_ in the gdbserver. (This should stop it from ending up duplicated in the core, and get rid of
some of the hacks that were turning up. All of this is chip specific!)
2011-11-12 20:36:43 +00:00
Fabien Le Mentec
0ff09f90ce
[merge] merge jnosky/master
2011-11-12 02:25:02 -06:00
Karl Palsson
6cc3375151
Merge branch 'master' of github.com:karlp/stlink
2011-11-11 22:59:44 +00:00
jnosky
b32eb29a80
Changed chip detection method
...
Future plan to detect chip ID rather than core ID
2011-11-10 20:15:06 -05:00
Petteri Aimonen
fb9d6399a7
Fixed a bug that caused gdb to display wrong registers when using stlink ver 1.
2011-11-10 21:38:16 +02:00
Karl Palsson
c98c487fa5
Merge branch 'master' of https://github.com/texane/stlink
...
Conflicts:
Makefile
doc/tutorial/tutorial.pdf
example/blink/Makefile
flash/main.c
src/stlink-common.c
src/stlink-usb.c
Mostly whitespace conflicts it seems.
2011-11-04 02:51:15 +00:00
Karl Palsson
b463d50c5b
Update documentation removing all sg-utils notes
...
Just libusb now. Verified the modprobe.conf on Ubuntu 10.04
2011-11-04 01:56:22 +00:00
Karl Palsson
a19abbb547
Writing registers works too
2011-11-04 00:56:50 +00:00
Karl Palsson
8c7b98a4cb
blinking LEDs via stlink also works
2011-11-04 00:54:01 +00:00
Karl Palsson
2dc7d9f4ec
write_mem8 works too.
...
I just misinterpreted the test results earlier.
2011-11-04 00:51:30 +00:00
Karl Palsson
8febc74cf1
Fix write_mem32.
...
Moved some of the static methods up to the top, so they can always be used, so the changes is
messier than it needs to be.
2011-11-04 00:44:18 +00:00
Karl Palsson
0f376a74a5
Remove device names, we now just find it via USB ids.
...
In the future, we might actually want device names back again, if you have multiple stlink's
connected. But that would be a new device name, not scanning for /dev/sgX looking for scsi
devices.
2011-11-03 23:40:27 +00:00
Karl Palsson
87490393e8
Duh, don't try and do a bulk read when we requested 0 bytes back.
2011-11-03 23:24:28 +00:00
Karl Palsson
22d0777df9
Properly use tags. Doesn't help though.
2011-11-03 23:16:30 +00:00
Karl Palsson
f587baa03a
Use the libusb based sense and status reading from afaerber
...
Before, I could a single operation (get version) after plugging in, now I can issue two at least
:) I suspect there are two problems still. 1, I'm not using tags properly, as the original
sg-utils code seemed to skip that. 2) I'm pretty sure I need to be sending variable lengths for
the cdb field.
2011-11-03 21:28:19 +00:00
Karl Palsson
3bf3bbef0b
Read stlink version info via libusb.
...
Hooray! Stage 1 complete. The stlink version can now be read by sending the scsi
commands via libusb directly, instead of using sg-utils. It's very very prototype code
however, but should come together from here.
Major bugs: Only works when the device has been first plugged in. I'm clearly not
resetting some usb state somewhere.
Now that libusb is being used directly, you can use linux usb-storage quirks to
completely IGNORE the device as mass storage. We'll just grab it via libusb when we
want it.
2011-11-03 03:45:23 +00:00
Karl Palsson
214ecc8622
Successfully locate and open stlinkv1 by usb
...
Very very raw, this just finds the device and opens the usb handle.
2011-11-03 01:07:15 +00:00
Karl Palsson
ed7464f235
Merge branch 'master' into killsg
...
Conflicts:
src/stlink-common.c
src/test_sg.c
Conflicts were only in changes to logging.
2011-11-03 00:47:28 +00:00
Karl Palsson
afb487cfb6
Remove -sg's private version decoding
...
Remove duplication of stlink version decoding, and put the decoded version information
into the stlink object itself.
2011-11-03 00:36:31 +00:00
Karl Palsson
66c50cec89
Remove sg-utils test output
...
More bulk cleanup on the path to removing sg-utils dependencies. Trying to make
test-sg as simple as possible so I can use it reliably to test on both master and my
killsg branch
2011-11-03 00:35:19 +00:00
jnosky
0fbdd62e61
Fixed flash utility for STM32F4
...
Can write entire 1MB of flash
2011-10-29 18:17:46 -04:00
Fabien Le Mentec
224966f637
[update] factorize flash writing code. use core_id to identify.
2011-10-23 03:12:23 -05:00
Fabien Le Mentec
2953d3a6e8
[update] disable flash write operation checking
2011-10-23 01:45:01 -05:00
Fabien Le Mentec
70f04de7fc
[update] retry write once on failure
2011-10-22 17:34:05 -05:00
Fabien Le Mentec
27448f5a6f
[fix] stm32l flash write
2011-10-22 16:07:13 -05:00
Karl Palsson
d7e37a684a
Replace all logging
...
I needed some sanity...
2011-10-22 20:32:02 +00:00
Karl Palsson
42d2da531f
flag out the only scsi specific code
...
Also flag out some places where code appears unused.
2011-10-22 19:09:31 +00:00
Fabien Le Mentec
165e5fd66c
[update, wip] stm32l flash write, to be tested
2011-10-22 13:06:28 -05:00
Karl Palsson
076f1086fa
Remove all #ifdefs for sg-utils.
...
We're starting on integration from github.com/afaerber
So, instead of scanning all the usb devices, just open what we want.
2011-10-22 18:05:24 +00:00
Karl Palsson
9bc72d4519
Merge upstream texane/master
2011-10-22 02:11:04 +00:00
Fabien Le Mentec
ebaf5ac5be
Merge branch 'master' into local/stm32l_flash
2011-10-21 04:23:50 -05:00
Ned Konz
105e266a05
Allowed CONFIG_USE_LIBSG=0 to suppress STLink/V1 compilation
...
This will let people with Macintosh OS/X computers compile and use stlink with STLink/V2 devices, as libsg3 is not available for that platform.
2011-10-20 19:21:43 -07:00
Fabien Le Mentec
56c4ba72c5
[merge] patches from uwe
2011-10-19 12:07:56 -05:00
Fabien Le Mentec
a34d563757
[merge] karl/uwe_usb branch
2011-10-18 16:35:24 -05:00
Fabien Le Mentec
4bb6ab6d9f
[merge] karl/uwe_usb branch
2011-10-18 16:27:36 -05:00
Fabien Le Mentec
d2b5373e30
[wip]
2011-10-18 00:41:26 -05:00
Fabien Le Mentec
2ec1e2b25d
[fix] read_mem32 needs to add +1 to len
2011-10-17 16:21:29 -05:00
Fabien Le Mentec
7b0136b10f
[fix] stlink_usb_read_mem32 len command field
2011-10-16 16:28:29 -05:00
Fabien Le Mentec
99f8e5e950
[fix] stlinkv2 missing initialisation
2011-10-16 16:13:58 -05:00
Karl Palsson
46f1a7f29a
Merge branch 'master' of https://github.com/texane/stlink
...
Conflicts:
src/stlink-usb.c
2011-10-16 20:54:06 +00:00
Fabien Le Mentec
27cbec5d27
[fix] missing stlink_fwrite_flash decl
2011-10-16 15:36:53 -05:00
Uwe Bonnes
7abc08eeef
Remove some debug output
...
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2011-10-16 20:25:42 +00:00
Uwe Bonnes
06a737c4cc
Assert size only if Q_BUF_LEN is smaller UINT16_MAX
...
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2011-10-16 20:25:27 +00:00
Uwe Bonnes
4aa64b2daa
Size all USB receive operations
...
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2011-10-16 20:25:14 +00:00
Fabien Le Mentec
840f5e4821
[update] unused stlinkv2 commands
2011-10-15 17:21:35 -05:00
Fabien Le Mentec
502a540519
[fix] remove invalid free
2011-10-14 15:47:08 -05:00
Fabien Le Mentec
8b86626c36
[fix] missing parse_version in sg transport layer
2011-10-14 15:38:54 -05:00
Fabien Le Mentec
902f3a7e70
[fix] warnings
2011-10-14 14:51:16 -05:00
Uwe Bonnes
0d390c9122
Fix a signedness warning
...
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2011-10-14 19:28:28 +00:00
Uwe Bonnes
dc71d50b2c
Add missing functionality stlinkv2
...
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2011-10-13 19:25:04 +00:00
Uwe Bonnes
37f3d97e05
Implement _stlink_usb_write_mem32|8
...
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2011-10-13 19:25:02 +00:00
Uwe Bonnes
173831d592
Add a buffer to hold the command
...
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2011-10-13 19:24:53 +00:00
Uwe Bonnes
011f4e3e83
Add a pointer how to wrap USB SG commands
...
Signed-off-by: Karl Palsson <karlp@tweak.net.au>
2011-10-13 18:54:17 +00:00
Karl Palsson
59162a0b5c
More debug in prepration for working out writemem32
2011-10-12 21:24:33 +00:00
Karl Palsson
8ff74b175e
Add commentary on test methods?
2011-10-12 21:05:44 +00:00
Karl Palsson
1135f17d28
Add comments on register magic numbers.
2011-10-12 20:54:03 +00:00
Karl Palsson
bd3472751b
Support arm core cpuid register decoding
2011-10-12 20:40:24 +00:00
Karl Palsson
f85a173c46
Make stlink_core_id return the core id.
...
Instead of requiring manual extraction from the q_buf
2011-10-12 20:36:43 +00:00
Karl Palsson
75e544a724
Fix compiler warnings from missing includes
2011-10-12 19:57:54 +00:00
Karl Palsson
921b32cf58
Support "force debug" command, required by gdb server
...
usb implementation provided by Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
Glued together again by me. With this change, gdbserver actually enters debug and gdbserver
stays open!
2011-10-12 19:56:19 +00:00
Karl Palsson
371b100cb0
Fix stm32l readmem32.
...
As noted, the usb transfer only has a 1 byte length, but it also has a different mode
to enter.
Tidied up and removed more duplicate and hard coded code, tried to add some notes on
where the magic came from.
No idea where the chip ids came from, I can't find them in the datasheets anywhere.
2011-10-12 01:45:28 +00:00
Karl Palsson
d12da44c74
Support version decoding on both platforms
2011-10-12 00:01:46 +00:00
Karl Palsson
c327578c7d
Use defined VID/PIDs instead of magic numbers
2011-10-11 23:41:49 +00:00
Karl Palsson
1b2e65ae06
remove the keypress to exit the app
2011-10-08 18:50:45 +00:00
Karl Palsson
4e95d10aa8
move debugging output to common code
2011-10-07 20:21:37 +00:00
Karl Palsson
8f4e7c64dc
build gdbserver with new library
...
Has a line hardcoding it to the the usb backend. I don't have a stm32vl board :(
2011-10-07 20:17:48 +00:00
Karl Palsson
baf9829fd2
Fix the missing mode calls.
...
Start cleaning up the debug output a little
2011-10-07 19:41:55 +00:00
Karl Palsson
d31396111d
Pluggable backends for libsg or libusb
...
Compiles, but not fully tested yet.
2011-10-07 19:41:18 +00:00
Karl Palsson
93ea941dff
Remove duplicate endianness
2011-10-07 02:17:36 +00:00
Karl Palsson
d060c3c040
Initial commit of workable stm32l debug
...
Move towards a standard libstlink, with backends for libusb (stm32l discovery) and scsi
passthrough (stm32vl discovery) and a common front end.
Verified that stm32l branch works much the same, but more to go for stm32vl.
2011-10-06 23:22:33 +00:00
Karl Palsson
c34ccc3e51
Tweak stm32l version to start using shared headers
2011-09-29 22:06:54 +00:00
texane
c2a0e91d47
Merge pull request #9 from whitequark/master
...
Support for data watchpoints and larger flashes
2011-07-15 06:58:05 -07:00
Peter Zotov
f31dae4f24
Allow for bigger flash block sizes (code by Geoffrey Brown).
2011-07-14 23:46:21 +04:00
Peter Zotov
bc9dc8ffa1
Implement data watchpoints (code by Geoffrey Brown).
2011-07-14 23:40:59 +04:00
Karl Palsson
c9ab9cb0c7
Build on amd64 architecture.
...
printf("%x") -> printf("%zx") when using size_t
2011-06-27 22:30:13 +00:00
Fabien Le Mentec
08a79ed0fe
[fix] make_memory_map should receive flash_size as uint32_t
2011-06-05 12:35:09 -05:00
Peter Zotov
a4126921f0
make_memory_map should receive flash_size as uint32_t.
2011-05-19 18:41:00 +04:00
texane
189d33c0db
[patch] bug fixes and documentation improvements by Greg Alexander
2011-04-18 13:29:24 -05:00
Peter Zotov
ad2470d0eb
Use real flash size from system ROM.
2011-04-08 19:08:15 +04:00
Peter Zotov
12e13cd08a
Compare chip IDs correctly.
2011-04-08 19:08:02 +04:00
Peter Zotov
7f58436b93
Updated memory maps.
2011-04-08 18:59:31 +04:00
Peter Zotov
aaf1a0cd84
Add real core identification. Now stlink may debug devices other than STM32F100RB on Discovery.
2011-04-04 20:20:18 +04:00
Peter Zotov
7c294cf6a1
Add support for remote reset commands.
2011-04-04 20:20:13 +04:00
Peter Zotov
a4ae2f66b6
Remove useless message.
2011-02-17 16:45:03 +03:00
Peter Zotov
955d5f26dd
Fix multi-page flash writing.
2011-02-17 16:44:20 +03:00
Peter Zotov
32045151e9
Reset CPU before and after flash writing.
2011-02-16 14:28:20 +03:00
Peter Zotov
d10edcd6c0
Reduce latency a bit.
2011-02-16 14:04:32 +03:00
Peter Zotov
870694cbc1
Write flash correctly.
2011-02-16 12:34:46 +03:00
Peter Zotov
36b8fe70f3
Implement hardware breakpoints.
2011-02-16 03:56:29 +03:00
Peter Zotov
9795b7e8cc
Update memory map.
2011-02-16 03:55:58 +03:00
Peter Zotov
441bffd8ed
Fix alignment when uploading data to flash.
2011-02-16 02:07:25 +03:00
Peter Zotov
13d7162b0e
Fix continue command.
2011-02-16 00:24:00 +03:00
Peter Zotov
47bb36079b
Implemented flash writing.
2011-02-16 00:01:12 +03:00
Peter Zotov
d4b435e7c0
Implement FlashErase GDB command.
2011-02-15 22:35:19 +03:00
Peter Zotov
eac53cf6d1
Implement query command and add memory map.
2011-02-15 21:50:34 +03:00
Peter Zotov
fc7b68944d
Add optional -DDEBUG to Makefile.
2011-02-15 19:48:36 +03:00
Peter Zotov
ca668a5a5f
Bind to localhost.
2011-02-15 19:47:57 +03:00
Peter Zotov
db0a8d3ddf
Use SO_REUSEADDR socket option to allow binding after ^C.
2011-02-15 19:47:45 +03:00
Peter Zotov
db2744519e
Don't exit after kill gdb command; re-listen instead.
2011-02-15 19:47:18 +03:00
Peter Zotov
a6c902d67b
Add working GDB remote debug server.
2011-02-15 05:15:28 +03:00
texane
1896ea7336
[fix] unknown bug, must use 0x40 instead of pgsize when writing flash
2011-01-14 10:49:59 -06:00
texane
8c938d019b
[update] stlink_{fread,fwrite}
2011-01-14 10:24:32 -06:00
texane
18daa64fb4
[fix] use xxx_mem8 to write buffer into sram.
2011-01-14 06:18:08 -06:00
texane
5f6a692e72
[update] write a file to flash. compile, not tested.
2011-01-14 04:45:43 -06:00
texane
27b50a3df8
[initial]
2011-01-14 02:54:52 -06:00