Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed old DFU serial number for STLINK programmers #1106

Merged
merged 1 commit into from
Mar 20, 2021

Conversation

tarek-bochkati
Copy link
Collaborator

@tarek-bochkati tarek-bochkati commented Mar 16, 2021

Signed-off-by: Tarek BOCHKATI tarek.bouchkati@gmail.com

(Closes #417, Closes #494, Closes #1121)

src/stlink-lib/usb.c Outdated Show resolved Hide resolved
src/stlink-lib/usb.c Show resolved Hide resolved
@Ant-ON
Copy link
Collaborator

Ant-ON commented Mar 17, 2021

For the "--- serial" parameter work correctly is necessary to rewrite the parsing of the serial number. See:

int j = (int)strlen(optarg);
int length = j / 2; // the length of the destination-array
if (j % 2 != 0) { return(-1); }
for (size_t k = 0; j >= 0 && k < sizeof(serialnumber); ++k, j -= 2) {
char buffer[3] = {0};
memcpy(buffer, optarg + j, 2);
serialnumber[length - k] = (uint8_t)strtol(buffer, NULL, 16);
}

int j = (int)strlen(serial);
int length = j / 2; // the length of the destination-array
if (j % 2 != 0) { return(-1); }
for (size_t k = 0; j >= 0 && k < sizeof(o->serial); ++k, j -= 2) {
char buffer[3] = {0};
memcpy(buffer, serial + j, 2);
o->serial[length - k] = (uint8_t)strtol(buffer, NULL, 16);
}

@Nightwalker-87
Copy link
Member

There also is a build fail on macOS, but it looks as if this is related to the current CI config for macOS
I'll fix that soon, and we'll have a look at it again afterwards, so don't bother too much about it right now. 😉

@tarek-bochkati
Copy link
Collaborator Author

There also is a build fail on macOS, but it looks as if this is related to the current CI config for macOS
I'll fix that soon, and we'll have a look at it again afterwards, so don't bother too much about it right now. 😉

I have seen the failure log, so I already ignored it ...

@tarek-bochkati
Copy link
Collaborator Author

tarek-bochkati commented Mar 17, 2021

For the "--- serial" parameter work correctly is necessary to rewrite the parsing of the serial number.
shit! this should be handled in one place ...

I will check it tonight

@Nightwalker-87
Copy link
Member

I've updated the Travis CI settings for macOS.
However there are still problems with the build on 10.14 and it still seems to be a lousy Xcode related issue. 🤮

@tarek-bochkati
Copy link
Collaborator Author

another Patch-Set is pushed, please let me know if this is OK.

omit the hla serial aka 'openocd serial'
Only one valid serial is used which matches the serial as displayed
in STM32CubeProgrammer and official ST tools.

Signed-off-by: Tarek BOCHKATI <tarek.bouchkati@gmail.com>
@tarek-bochkati
Copy link
Collaborator Author

I've updated the Travis CI settings for macOS.
However there are still problems with the build on 10.14 and it still seems to be a lousy Xcode related issue. 🤮

still failing on macos :/

@Nightwalker-87
Copy link
Member

Yeah, I'm still trying to solve it. It's not specifically related to this PR, but also other commits / PRs.

@tarek-bochkati
Copy link
Collaborator Author

happy to see this approved and solved your issue.
and good luck with STM32U5 support 😨

@Nightwalker-87
Copy link
Member

@tarek-bochkati: I'll merge this as soon as possible.
Thank you so much for contributing. May I add you to our list of project contributors?
Looking forward to stay in touch.

@tarek-bochkati
Copy link
Collaborator Author

@tarek-bochkati: I'll merge this as soon as possible.
Thank you so much for contributing. May I add you to our list of project contributors?
Looking forward to stay in touch.

honestly I don't plan to be an active contributor in this project.
but I'm watching the evolution here and I can contribute time to time (my main focus is contributing to OpenOCD as part of my job)

@Nightwalker-87
Copy link
Member

That's absolutely fine - there are no expectations associated with this.
For explanation: Our list of contributors is part of the project source code and aims to cover people who have brought notable improvements to the project pointing out the character of a community based project.

@tarek-bochkati
Copy link
Collaborator Author

Then we agree on this ;)

@Nightwalker-87 Nightwalker-87 changed the title fix for stlink old DFU serial number Fixed old DFU serial number for STLINK programmers Mar 20, 2021
@Nightwalker-87 Nightwalker-87 merged commit 4f7deea into stlink-org:develop Mar 20, 2021
@tarek-bochkati tarek-bochkati deleted the stlink_serial_fix branch March 20, 2021 12:51
@stlink-org stlink-org locked as resolved and limited conversation to collaborators Mar 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Status: Done
3 participants