Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions src/flash/flashTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,28 @@ export class FlashTask {
this.model.flashSections &&
this.model.flashSections.length === encryptedFlashSections.length
) {
// If all files need encryption, then use --encrypt flag
flasherArgs.push("--encrypt");
// Add all files
for (const flashFile of this.model.flashSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
: flashFile.binFilePath;
flasherArgs.push(flashFile.address, binPath);
}
} else {
// If only some files need encryption, handle them separately
// First add all unencrypted files normally
const unencryptedSections = this.model.flashSections.filter(
(section) => !section.encrypted
);
for (const flashFile of unencryptedSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
: flashFile.binFilePath;
flasherArgs.push(flashFile.address, binPath);
}
// Then add encrypted files after the --encrypt-files flag
flasherArgs.push("--encrypt-files");
for (const flashFile of encryptedFlashSections) {
let binPath = replacePathSep
Expand All @@ -220,12 +240,14 @@ export class FlashTask {
flasherArgs.push(flashFile.address, binPath);
}
}
}
for (const flashFile of this.model.flashSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
: flashFile.binFilePath;
flasherArgs.push(flashFile.address, binPath);
} else {
// No encryption needed, just add all files
for (const flashFile of this.model.flashSections) {
let binPath = replacePathSep
? flashFile.binFilePath.replace(/\//g, "\\")
: flashFile.binFilePath;
flasherArgs.push(flashFile.address, binPath);
}
}

return flasherArgs;
Expand Down
Loading