# 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", \
Spencer Oliver <spen@spen-soft.co.uk>
Le Mentec Fabien <fabien.lementec@gmail.com>
Peter Zotov <whitequark@whitequark.org>
+Greg Alexander <grestm@galexander.org>
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
==========================
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.
};
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) {
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);
" <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';