Skip to content

SJTAG Unlock Updates#21

Open
Parithi098 wants to merge 4 commits intomainfrom
bugfix/build-warnings
Open

SJTAG Unlock Updates#21
Parithi098 wants to merge 4 commits intomainfrom
bugfix/build-warnings

Conversation

@Parithi098
Copy link
Collaborator

@Parithi098 Parithi098 commented Oct 17, 2025

  1. Configurable HSM Server IP and Port via cmd argument and environment variable (HSM_SERVER_IP and HSM_SERVER_PORT)

Usage: switchtec mfg sjtag-unlock [-s/--sjtag_server_ip] [-p/--sjtag_server_port]
Adding environment variable:
export HSM_SERVER_IP="121.25.12.04"
export HSM_SERVER_PORT="3001"

  1. Updated -i/o arguments:

-i : Use existing debug token file (HSM server not used for unlocking)
-o : Output filename for HSM server generated debug token (default: sjtag_debug_token.bin)
Note: When both are provided, -i overrides -o

  1. used to write() API to generate bin to avoid build warnings

cli/mfg.c Outdated
.cfg_type=CFG_FILE_R,
.value_addr=&cfg.sjtag_debug_token,
.argument_type=required_argument,
.help="Optional Argument. If not provided, the Debug Token will be generated\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it like if not provided, debug token will not be generated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rarun-mchp both arguments 'i'(debug_token_input_file) and 'o'(debug_token_output_file) are optional.

'o' is for SJTAG unlocking with HSM
'i' is for SJTAG unlocking without HSM

'o' with file name - sjtag_debug_token.bin is the default
i.e., switchtec mfg sjtag-unlock

So, to answer your question, even if no arguments are provided, debug token bin will still be generated.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expand the help statement.

cli/mfg.c Outdated
fclose(debug_token_bin_file);
getcwd(dir_path, sizeof(dir_path));
printf("Generated SJTAG Debug Token Path: %s/sjtag_debug_token.bin\n", dir_path);
switchtec_perror("Error saving the Debug token");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test this path by providing the invalid absolute path.

cli/mfg.c Outdated
.cfg_type=CFG_FILE_R,
.value_addr=&cfg.sjtag_debug_token,
.argument_type=required_argument,
.help="Optional Argument. If not provided, the Debug Token will be generated\n"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expand the help statement.

@Parithi098 Parithi098 changed the title Build Warning: Avoid using getcwd SJTAG Unlock Feb 17, 2026
@Parithi098 Parithi098 changed the title SJTAG Unlock SJTAG Unlock Updates Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants