Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Add USB serial number string #7

Closed
flit opened this issue Mar 19, 2021 · 2 comments
Closed

Add USB serial number string #7

flit opened this issue Mar 19, 2021 · 2 comments

Comments

@flit
Copy link

flit commented Mar 19, 2021

Not having a serial number string makes it difficult to identify uniquely and support multiple connected probes.

A short manufacturer string would be nice, too.

I know they take up memory, but it's useful.

@majbthrd
Copy link
Owner

I have added a unique ID (using the SPI flash 0x4B command) that appears both in the USB descriptor and CMSIS-DAP’s DAP_Info command. I have also added a manufacturer string.

The size of the code to retrieve the unique ID from the SPI flash dwarfs the size of storing the string that ultimately contains the result.

The way to make things fit within the existing pico-debug footprint was to cheat somewhat. Since pico-debug loads as an SRAM .uf2, it has to load into SRAM for the Boot ROM to run. Upon initial execution, it briefly has access to the entire SRAM (and not just the portion of memory earmarked for pico-debug’s use). The code for retrieving the unique ID (as well as PLL initialization code previously resident in the app that I moved to free up string space) executes first, and once it has written the result into the string buffer used by pico-debug to store the unique ID, it has done its job. The .uf2 image is slightly larger, but only the existing smaller footprint is needed for debugger operation.

@flit
Copy link
Author

flit commented Mar 21, 2021

Great! Thanks for adding this. And I wouldn't call that cheating—it's a well-crafted hack. 😉

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants