From: texane Date: Mon, 18 Apr 2011 18:29:24 +0000 (-0500) Subject: [patch] bug fixes and documentation improvements by Greg Alexander X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=189d33c0db8e4a8e22e52af2d150936600148256;p=fw%2Fstlink [patch] bug fixes and documentation improvements by Greg Alexander --- diff --git a/10-stlink.rules b/10-stlink.rules index a47b2f9..2413acd 100644 --- a/10-stlink.rules +++ b/10-stlink.rules @@ -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 b7fbf6a..8335e9b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -2,3 +2,4 @@ Martin Capitanio Spencer Oliver Le Mentec Fabien Peter Zotov +Greg Alexander diff --git a/README b/README index 58bd3ca..c251be1 100644 --- 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 ========================== diff --git a/src/gdb-remote.c b/src/gdb-remote.c index 474af9d..f6bf02d 100644 --- a/src/gdb-remote.c +++ b/src/gdb-remote.c @@ -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. diff --git a/src/gdb-server.c b/src/gdb-server.c index 6b57e78..cc2b527 100644 --- a/src/gdb-server.c +++ b/src/gdb-server.c @@ -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 = " " // option byte area ""; -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';