Skip to content

Commit

Permalink
at32f43x: Add UID command
Browse files Browse the repository at this point in the history
stm32_common: Provide as a meson dep to at32f43x
  • Loading branch information
ALTracer committed Nov 10, 2024
1 parent bcdaa30 commit 95e537c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions src/target/at32f43x.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@
#include "target.h"
#include "target_internal.h"
#include "cortexm.h"
#include "stm32_common.h"

static bool at32f43_cmd_option(target_s *target, int argc, const char **argv);
static bool at32f43_cmd_uid(target_s *target, int argc, const char **argv);

const command_s at32f43_cmd_list[] = {
{"option", at32f43_cmd_option, "Manipulate option bytes"},
{"uid", at32f43_cmd_uid, "Print unique device ID"},
{NULL, NULL, NULL},
};

Expand Down Expand Up @@ -126,8 +129,10 @@ static bool at32f43_mass_erase(target_s *target);
#define AT32F423_SERIES_256KB 0x700a3000U
#define AT32F423_SERIES_128KB 0x700a2000U
#define AT32F423_SERIES_64KB 0x70032000U
#define AT32F4x_PROJECT_ID 0x1ffff7f3U
#define AT32F4x_FLASHSIZE 0x1ffff7e0U

#define AT32F4x_UID_BASE 0x1ffff7e8U
#define AT32F4x_PROJECT_ID 0x1ffff7f3U
#define AT32F4x_FLASHSIZE 0x1ffff7e0U

typedef struct at32f43_flash {
target_flash_s target_flash;
Expand Down Expand Up @@ -708,3 +713,10 @@ static bool at32f43_cmd_option(target_s *target, int argc, const char **argv)

return true;
}

static bool at32f43_cmd_uid(target_s *target, int argc, const char **argv)
{
(void)argc;
(void)argv;
return stm32_uid(target, AT32F4x_UID_BASE);
}
2 changes: 1 addition & 1 deletion src/target/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ target_at32f4 = declare_dependency(
sources: files(
'at32f43x.c',
),
dependencies: target_cortexm,
dependencies: [target_cortexm, target_stm_common]
)

target_ti = declare_dependency(
Expand Down

0 comments on commit 95e537c

Please sign in to comment.