Skip to content

Commit

Permalink
Refactoring for tool "st-info"
Browse files Browse the repository at this point in the history
- Resorted cmds to the order they appear.
  • Loading branch information
Nightwalker-87 committed Mar 24, 2020
1 parent c3f2b6b commit c783d0e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
30 changes: 15 additions & 15 deletions doc/man/st-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ st-info - Provides information about connected STLink and STM32 devices

# DESCRIPTION
Provides information about connected STLink programmers and STM32 devices:
Serial code, openocd, flash, sram, page size, chipid, description.
Serial code, OpenOCD hla-serial, flash, page size, sram, chipid, description.


# OPTIONS

\--version
: Print version information

\--flash
: Display amount of flash memory available in the device
\--probe
: Display the summarized information of the connected programmers and devices

\--sram
: Display amount of sram memory available in device
\--serial
: Display the serial code of the device

\--descr
: Display textual description of the device
\--hla-serial
: Display the hex escaped serial code of the device

\--flash
: Display amount of flash memory available in the device

\--pagesize
: Display the page size of the device

\--sram
: Display amount of sram memory available in device

\--chipid
: Display the chip ID of the device

\--serial
: Display the serial code of the device

\--hla-serial
: Display the hex escaped serial code of the device

\--probe
: Display the summarized information of the connected programmers and devices
\--descr
: Display textual description of the device


# EXAMPLES
Expand Down
38 changes: 19 additions & 19 deletions src/tools/info.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
static void usage(void)
{
puts("st-info --version");
puts("st-info --probe");
puts("st-info --serial");
puts("st-info --hla-serial");
puts("st-info --flash");
puts("st-info --sram");
puts("st-info --descr");
puts("st-info --pagesize");
puts("st-info --sram");
puts("st-info --chipid");
puts("st-info --serial");
puts("st-info --hla-serial");
puts("st-info --probe");
puts("st-info --descr");
}

/* Print normal or OpenOCD hla_serial with newline */
Expand Down Expand Up @@ -45,20 +45,20 @@ static void stlink_print_info(stlink_t *sl)
if (!sl)
return;

printf(" serial: ");
printf(" serial: ");
stlink_print_serial(sl, false);
printf("openocd: ");
printf(" hla-serial: ");
stlink_print_serial(sl, true);

printf(" flash: %u (pagesize: %u)\n",
(unsigned int)sl->flash_size, (unsigned int)sl->flash_pgsz);
printf(" flash: %u (pagesize: %u)\n",
(unsigned int)sl->flash_size, (unsigned int)sl->flash_pgsz);

printf(" sram: %u\n", (unsigned int)sl->sram_size);
printf(" chipid: 0x%.4x\n", sl->chip_id);
printf(" sram: %u\n", (unsigned int)sl->sram_size);
printf(" chipid: 0x%.4x\n", sl->chip_id);

params = stlink_chipid_get_params(sl->chip_id);
if (params)
printf(" descr: %s\n", params->description);
printf(" descr: %s\n", params->description);
}

static void stlink_probe(void)
Expand Down Expand Up @@ -113,18 +113,18 @@ static int print_data(char **av)
if (stlink_current_mode(sl) != STLINK_DEV_DEBUG_MODE)
stlink_enter_swd_mode(sl);

if (strcmp(av[1], "--flash") == 0)
if (strcmp(av[1], "--serial") == 0)
stlink_print_serial(sl, false);
else if (strcmp(av[1], "--hla-serial") == 0)
stlink_print_serial(sl, true);
else if (strcmp(av[1], "--flash") == 0)
printf("0x%x\n", (unsigned int)sl->flash_size);
else if (strcmp(av[1], "--sram") == 0)
printf("0x%x\n", (unsigned int)sl->sram_size);
else if (strcmp(av[1], "--pagesize") == 0)
printf("0x%x\n", (unsigned int)sl->flash_pgsz);
else if (strcmp(av[1], "--sram") == 0)
printf("0x%x\n", (unsigned int)sl->sram_size);
else if (strcmp(av[1], "--chipid") == 0)
printf("0x%.4x\n", sl->chip_id);
else if (strcmp(av[1], "--serial") == 0)
stlink_print_serial(sl, false);
else if (strcmp(av[1], "--hla-serial") == 0)
stlink_print_serial(sl, true);
else if (strcmp(av[1], "--descr") == 0) {
const struct stlink_chipid_params *params = stlink_chipid_get_params(sl->chip_id);
if (params == NULL)
Expand Down

0 comments on commit c783d0e

Please sign in to comment.