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

Buffer handling issues in the SWO code #2050

Open
dragonmux opened this issue Jan 13, 2025 · 0 comments
Open

Buffer handling issues in the SWO code #2050

dragonmux opened this issue Jan 13, 2025 · 0 comments
Assignees
Labels
BMP Firmware Black Magic Probe Firmware (not PC hosted software) Bug Confirmed bug HwIssue Mitigation Solving or mitigating a Hardware issue in Software
Milestone

Comments

@dragonmux
Copy link
Member

Currently when the SWO buffer fills up, and swo_buffer_bytes_available reaches SWO_BUFFER_SIZE, the buffer management code will fail to cap the availability count. This results in the implementation sending the same buffer of data multiple times to the host till the transfer amount has been satisfied.

This is not correct, and requires the management code to detect this over-filling and advance the read index appropriately while capping the availability count. This will prevent us sending garbage.

Note that there are actually two approaches needed - if the data excess is from the Manchester decoder then the extra bytes should be thrown away and an artificial overflow inserted into the buffer, meanwhile if the extra bytes are from the UART decoder, then DMA requires we do the read index tracking change instead. In this latter case, we will get a glitch in SWO data output that we cannot prevent and we cannot easily mark the overflow. The only way to work around this would be to suspend DMA till the overflow condition is cleared, including setting up the extra overflow marker, before resuming DMA This is doable but more complicated.

@dragonmux dragonmux added this to the v2.1 release milestone Jan 13, 2025
@dragonmux dragonmux added Bug Confirmed bug HwIssue Mitigation Solving or mitigating a Hardware issue in Software BMP Firmware Black Magic Probe Firmware (not PC hosted software) labels Jan 13, 2025
@dragonmux dragonmux self-assigned this Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BMP Firmware Black Magic Probe Firmware (not PC hosted software) Bug Confirmed bug HwIssue Mitigation Solving or mitigating a Hardware issue in Software
Projects
None yet
Development

No branches or pull requests

1 participant