[patch] bug fixes and documentation improvements by Greg Alexander
authortexane <texane@dell.fbx.proxad.net>
Mon, 18 Apr 2011 18:29:24 +0000 (13:29 -0500)
committertexane <texane@dell.fbx.proxad.net>
Mon, 18 Apr 2011 18:29:24 +0000 (13:29 -0500)
10-stlink.rules
AUTHORS
README
src/gdb-remote.c
src/gdb-server.c

index a47b2f9de30d33ba519e72fdf331ad4f4eb4864f..2413acd8eaeb26093dae7d81a1ddf6a8caafd03b 100644 (file)
@@ -32,7 +32,7 @@ SUBSYSTEMS=="usb", ATTR{idVendor}=="0483", ATTR{idProduct}=="3744", \
 # Other possible settings:
 # OPTIONS="last_rule", ATTRS{vendor}=="STM32"
 
-KERNEL=="sg[0-9]*", STLINK=="1", MODE="0664", GROUP:="tape", \
+KERNEL=="sg[0-9]*", MODE="0664", GROUP:="tape", \
   NAME+="stlink-sg%n", SYMLINK+="stlink", \
   ENV{UDISKS_PRESENTATION_HIDE}:="1", \
   ENV{UDISKS_PRESENTATION_NOPOLICY}:="1", \
diff --git a/AUTHORS b/AUTHORS
index b7fbf6a401cfe7919f3ee6970a2c0454d994aecc..8335e9b49b920dc08e95de07f041dc470290ef99 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -2,3 +2,4 @@ Martin Capitanio <m@capitanio.org>
 Spencer Oliver <spen@spen-soft.co.uk>
 Le Mentec Fabien <fabien.lementec@gmail.com>
 Peter Zotov <whitequark@whitequark.org>
+Greg Alexander <grestm@galexander.org>
diff --git a/README b/README
index 58bd3ca2ae26236cd83c28fd9a38b13e19c93d26..c251be1616580d0064391b9d6c3c65df43616b78 100644 (file)
--- a/README
+++ b/README
@@ -40,6 +40,17 @@ $ udevadm control --reload-rules
 Udev will now create a /dev/stlink file, which will point at appropriate
 /dev/sgX device. Good to not accidentally start debugging your flash drive.
 
+Setting up modprobe rules
+=========================
+
+You may install a modprobe rules file, stlink.modprobe.conf, located in
+the root of the repository.  You will need to copy it to /etc/modprobe.d
+and then 
+  $ rmmod usb-storage
+If you have usb-storage built as a module, then this will cause it to be
+loaded with a "quirks" parameter that will cause it to ignore the STLink,
+rather than causing repeated errors and resets.
+
 Running programs from SRAM
 ==========================
 
index 474af9dcc46f9c04d1f799331466722194f8e1c1..f6bf02d26a82c0faaaa45196e885fe8d8eeddc25 100644 (file)
@@ -130,7 +130,7 @@ start:
        packet_buffer[packet_idx] = 0;
        *buffer = packet_buffer;
 
-       return packet_size;
+       return packet_idx;
 }
 
 // Here we skip any characters which are not \x03, GDB interrupt.
index 6b57e78dac40c67a3d60e2060b1ac7e5833bf6d3..cc2b527d0149904639d47fd038f93487c1f261d7 100644 (file)
@@ -46,7 +46,7 @@ struct chip_params {
 };
 
 int serve(struct stlink* sl, int port);
-char* make_memory_map(const struct chip_params *params, uint16_t flash_size);
+static char* make_memory_map(const struct chip_params *params, uint32_t flash_size);
 
 int main(int argc, char** argv) {
        if(argc != 3) {
@@ -87,7 +87,7 @@ int main(int argc, char** argv) {
        printf("Device parameters: SRAM: 0x%x bytes, Flash: up to 0x%x bytes in pages of 0x%x bytes\n",
                params->sram_size, params->max_flash_size, params->flash_pagesize);
 
-       uint16_t flash_size;
+       uint32_t flash_size;
 
        stlink_read_mem32(sl, 0x1FFFF7E0, 4);
        flash_size = sl->q_buf[0] | (sl->q_buf[1] << 8);
@@ -121,7 +121,8 @@ static const char* const memory_map_template =
   "  <memory type=\"rom\" start=\"0x1ffff800\" length=\"0x8\"/>"        // option byte area
   "</memory-map>";
 
-char* make_memory_map(const struct chip_params *params, uint16_t flash_size) {
+static char*
+make_memory_map(const struct chip_params *params, uint32_t flash_size) {
        /* This will be freed in serve() */
        char* map = malloc(4096);
        map[0] = '\0';