|
35 | 35 | #include "target.h" |
36 | 36 | #include "target_internal.h" |
37 | 37 | #include "cortexm.h" |
| 38 | +#include "stm32_common.h" |
38 | 39 |
|
39 | 40 | static bool at32f43_cmd_option(target_s *target, int argc, const char **argv); |
| 41 | +static bool at32f43_cmd_uid(target_s *target, int argc, const char **argv); |
40 | 42 |
|
41 | 43 | const command_s at32f43_cmd_list[] = { |
42 | 44 | {"option", at32f43_cmd_option, "Manipulate option bytes"}, |
| 45 | + {"uid", at32f43_cmd_uid, "Print unique device ID"}, |
43 | 46 | {NULL, NULL, NULL}, |
44 | 47 | }; |
45 | 48 |
|
@@ -126,8 +129,10 @@ static bool at32f43_mass_erase(target_s *target); |
126 | 129 | #define AT32F423_SERIES_256KB 0x700a3000U |
127 | 130 | #define AT32F423_SERIES_128KB 0x700a2000U |
128 | 131 | #define AT32F423_SERIES_64KB 0x70032000U |
129 | | -#define AT32F4x_PROJECT_ID 0x1ffff7f3U |
130 | | -#define AT32F4x_FLASHSIZE 0x1ffff7e0U |
| 132 | + |
| 133 | +#define AT32F4x_UID_BASE 0x1ffff7e8U |
| 134 | +#define AT32F4x_PROJECT_ID 0x1ffff7f3U |
| 135 | +#define AT32F4x_FLASHSIZE 0x1ffff7e0U |
131 | 136 |
|
132 | 137 | typedef struct at32f43_flash { |
133 | 138 | target_flash_s target_flash; |
@@ -708,3 +713,10 @@ static bool at32f43_cmd_option(target_s *target, int argc, const char **argv) |
708 | 713 |
|
709 | 714 | return true; |
710 | 715 | } |
| 716 | + |
| 717 | +static bool at32f43_cmd_uid(target_s *target, int argc, const char **argv) |
| 718 | +{ |
| 719 | + (void)argc; |
| 720 | + (void)argv; |
| 721 | + return stm32_uid(target, AT32F4x_UID_BASE); |
| 722 | +} |
0 commit comments