Porównaj commity

...

9 Commity

Autor SHA1 Wiadomość Data
nightwalker-87 40ee5f4bd1
Merge pull request #1371 from ii8/newline
[stlink-lib] Clarified warning message for data alignment
2024-02-20 18:12:52 +01:00
nightwalker-87 1ee7f6b6c0 Restored previous cmake policy (regression)
(Closes #1374) (Closes #1375)
2024-02-20 18:10:46 +01:00
nightwalker-87 4f3761b6bc
Merge branch 'testing' into newline 2024-02-18 21:22:37 +01:00
nightwalker-87 95862cc687
Merge pull request #1372 from ii8/usage
Rewrite commandline usage text for st-flash tool
2024-02-18 21:21:56 +01:00
nightwalker-87 710e1d3c3b
Merge pull request #1370 from ii8/pollh
Fixed include path for header file `poll.h`.
2024-02-18 19:21:24 +01:00
nightwalker-87 a1fc8b70b1
Merge branch 'testing' into pollh 2024-02-18 19:12:55 +01:00
murray 2d483db866 Rewrite usage text 2024-02-15 15:05:42 +00:00
murray 7a93f7a24d Add missing newline to log message 2024-02-15 10:48:37 +00:00
murray 9f84dcdef8 Fix poll.h include path
The correct include path for poll(2) is poll.h not sys/poll.h.
sys/poll.h may not be available on some libcs or may issue a
warning. In particular this fixes a warning on musl systems.
2024-02-15 10:33:25 +00:00
5 zmienionych plików z 45 dodań i 24 usunięć

Wyświetl plik

@ -3,7 +3,7 @@
###
cmake_minimum_required(VERSION 3.10.2)
cmake_policy(SET CMP0153 NEW)
cmake_policy(SET CMP0042 NEW)
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)

Wyświetl plik

@ -44,25 +44,39 @@ static void cleanup(int32_t signum) {
}
static void usage(void) {
puts("command line: ./st-flash [--debug] [--reset] [--connect-under-reset] [--hot-plug] [--opt] [--serial <serial>] [--format <format>] [--flash=<fsize>] [--freq=<kHz>] [--area=<area>] {read|write} [path] [addr] [size]");
puts("command line: ./st-flash [--debug] [--connect-under-reset] [--hot-plug] [--freq=<kHz>] [--serial <serial>] erase [addr] [size]");
puts("command line: ./st-flash [--debug] [--freq=<kHz>] [--serial <serial>] reset");
puts(" <addr>, <serial> and <size>: Use hex format.");
puts(" <fsize>: Use decimal, octal or hex (prefix 0xXXX) format, optionally followed by k=KB, or m=MB (eg. --flash=128k)");
puts(" <format>: Can be 'binary' (default) or 'ihex', although <addr> must be specified for binary format only.");
puts(" <area>: Can be 'main' (default), 'system', 'otp', 'optcr', 'optcr1', 'option' or 'option_boot_add'");
puts("print tool version info: ./st-flash [--version]");
puts("example read option byte: ./st-flash --area=option read [path] [size]");
puts("example write option byte: ./st-flash --area=option write 0xXXXXXXXX");
puts("On selected targets:");
puts("example read boot_add option byte: ./st-flash --area=option_boot_add read");
puts("example write boot_add option byte: ./st-flash --area=option_boot_add write 0xXXXXXXXX");
puts("example read option control register byte: ./st-flash --area=optcr read");
puts("example write option control register1 byte: ./st-flash --area=optcr write 0xXXXXXXXX");
puts("example read option control register1 byte: ./st-flash --area=optcr1 read");
puts("example write option control register1 byte: ./st-flash --area=optcr1 write 0xXXXXXXXX");
puts("example read OTP area: ./st-flash --area=otp read [path]");
puts("example write OTP area: ./st-flash --area=otp write [path] 0xXXXXXXXX");
puts("usage: st-flash [options] read [file] [addr] [size]");
puts(" st-flash [options] write <file> [addr] [size]");
puts(" st-flash [options] write <value>");
puts(" st-flash [options] erase <addr> <size>");
puts(" st-flash [options] reset");
puts("");
puts("options:");
puts(" --freq <kHz> Frequency of JTAG/SWD, default 1800kHz.");
puts(" --serial <serial> STLink device to use.");
puts(" --connect-under-reset Pull reset low while connecting.");
puts(" --hot-plug Connect without reset.");
puts(" --reset Reset after writing.");
puts(" --format {binary|ihex} Format of file to read or write. When writing");
puts(" with ihex specifying addr is not needed.");
puts(" --flash <size> Specify size of flash, e.g. 128k, 1M.");
puts(" --area <area> Area to access, one of: main(default), system,");
puts(" otp, option, option_boot_add, optcr, optcr1.");
puts(" --opt Skip writing empty bytes at the tail end.");
puts(" --debug Output extra debug information.");
puts(" --version Print version information.");
puts(" --help Show this help.");
puts("");
puts("examples:");
puts(" st-flash --area=option read [file] [size]");
puts(" st-flash --area=option write 0xXXXXXXXX");
puts(" st-flash --area=option_boot_add read");
puts(" st-flash --area=option_boot_add write 0xXXXXXXXX");
puts(" st-flash --area=optcr read");
puts(" st-flash --area=optcr write 0xXXXXXXXX");
puts(" st-flash --area=optcr1 read");
puts(" st-flash --area=optcr1 write 0xXXXXXXXX");
puts(" st-flash --area=otp read <file>");
puts(" st-flash --area=otp write <file> 0xXXXXXXXX");
}
int32_t main(int32_t ac, char** av) {
@ -70,14 +84,19 @@ int32_t main(int32_t ac, char** av) {
struct flash_opts o;
int32_t err = -1;
uint8_t * mem = NULL;
int32_t getopt_ret;
o.size = 0;
o.connect = CONNECT_NORMAL;
if (flash_get_opts(&o, ac - 1, av + 1) == -1) {
getopt_ret = flash_get_opts(&o, ac - 1, av + 1);
if (getopt_ret == -1) {
printf("invalid command line\n");
usage();
return (-1);
} else if (getopt_ret == 1) {
usage();
return 0;
}
printf("st-flash %s\n", STLINK_VERSION);

Wyświetl plik

@ -98,6 +98,8 @@ int32_t flash_get_opts(struct flash_opts* o, int32_t ac, char** av) {
if (strcmp(av[0], "--version") == 0) {
printf("v%s\n", STLINK_VERSION);
exit(EXIT_SUCCESS);
} else if (strcmp(av[0], "--help") == 0 || strcmp(av[0], "-h") == 0) {
return 1;
} else if (strcmp(av[0], "--debug") == 0) {
o->log_level = DEBUG_LOG_LEVEL;
} else if (strcmp(av[0], "--opt") == 0) {

Wyświetl plik

@ -12,7 +12,7 @@
#include <win32_socket.h>
#else
#include <unistd.h>
#include <sys/poll.h>
#include <poll.h>
#endif
#include "gdb-remote.h"

Wyświetl plik

@ -750,8 +750,8 @@ int32_t stlink_flashloader_write(stlink_t *sl, flash_loader_t *fl, stm32_addr_t
sl->flash_type == STM32_FLASH_TYPE_C0) {
if (sl->flash_type == STM32_FLASH_TYPE_L5_U5_H5 && (len % 16)) {
WLOG("Data size is aligned to 16 byte");
len += 16 - len%16;
WLOG("Aligning data size to 16 bytes\n");
len += 16 - len % 16;
}
DLOG("Starting %3u page write\n", len / sl->flash_pgsz);
for (off = 0; off < len; off += sizeof(uint32_t)) {