Skip to content

Commit

Permalink
Add documentation of --freq and --opt
Browse files Browse the repository at this point in the history
  • Loading branch information
chenguokai committed May 8, 2020
1 parent 9311418 commit 07d097c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 4 deletions.
11 changes: 11 additions & 0 deletions doc/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ The size may be followed by an optional "k" or "m" to multiply the given value b
When flashing a file, a checksum is calculated for the binary file, both in md5 and the sum algorithm.
The latter is also used by the official ST-Link utility tool from STMicroelectronics as described in the document: [`UM0892 - User manual - STM32 ST-LINK utility software description`](https://www.st.com/resource/en/user_manual/cd00262073-stm32-stlink-utility-software-description-stmicroelectronics.pdf).

#### --freq=n[k][m]

(since v1.6.1)

You can specify the frequency of SWD/JTAG interface, to override the default 1800KHz configuration. This option accpets decimal only (5K or 1.8M). `Hz` is left out in this option. Valid frequencies are `5K, 15K, 25K, 50K, 100K, 125K, 240K, 480K, 950K, 1200K(1.2M), 1800K(1.8M), 4000K(4M)`

#### --opt

(since v1.6.1, optional; enabled by default from v1.0.0 to v1.6.0)

You can enable the optimization to skip flashing empty (0x00 or 0xff) bytes at the end of binary file. May cause some garbage data left after a flash.

## Solutions to common problems
### a) STLINK/v1 driver: Issue with Kernel Extension (kext) (macOS 10.11 and later only)
Expand Down
2 changes: 1 addition & 1 deletion include/stlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ typedef struct flash_loader {

// transport layer verboseness: 0 for no debug info, 10 for lots
int verbose;
int opt;
int opt; // set by main() in tools/flash.c, empty tail bytes drop optimization
uint32_t core_id; // set by stlink_core_id(), result from STLINK_DEBUGREADCOREID
uint32_t chip_id; // set by stlink_load_device_params(), used to identify flash and sram
int core_stat; // set by stlink_status(), values STLINK_CORE_xxxxx
Expand Down
4 changes: 2 additions & 2 deletions include/stlink/tools/flash.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ struct flash_opts
enum flash_area area;
uint32_t val;
size_t flash_size; /* --flash=n[k][m] */
int opt;
int freq;
int opt; /* enable empty tail data drop optimization */
int freq; /* frequency of JTAG/SWD */
};

#define FLASH_OPTS_INITIALIZER {0, { 0 }, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
Expand Down
2 changes: 1 addition & 1 deletion src/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,7 +1042,7 @@ stlink_t *stlink_open_usb(enum ugly_loglevel verbose, bool reset, char serial[ST
}


sl->opt = freq;
sl->freq = freq;
// set the speed before entering the mode
// as the chip discovery phase should be done at this speed too
// Set the stlink clock speed (default is 1800kHz)
Expand Down

0 comments on commit 07d097c

Please sign in to comment.