Detailed description
In this PR we address a hang/crash we spotted that happens under certain circumstances with JTAG scans where the chain doesn't have a target on it, but reads back all-highs in the right way to make the JTAG machinery try to validate the chain length. This would trip on a call to the JTAG cycle running machinery with 0 cycles to run and that would then cause the firmware to appear to hang owing to it now trying to run UINT32_MAX cycles due to how cycle was implemented in the firmware.
This is fixed by adding guards to both BMDA and the firmware to avoid calling cycle or doing anything in cycle when this condition is met.
Your checklist for this pull request
Closing issues
<!-- Filling this template is mandatory -->
## Detailed description
In this PR we address a hang/crash we spotted that happens under certain circumstances with JTAG scans where the chain doesn't have a target on it, but reads back all-highs in the right way to make the JTAG machinery try to validate the chain length. This would trip on a call to the JTAG cycle running machinery with 0 cycles to run and that would then cause the firmware to appear to hang owing to it now trying to run UINT32_MAX cycles due to how cycle was implemented in the firmware.
This is fixed by adding guards to both BMDA and the firmware to avoid calling cycle or doing anything in cycle when this condition is met.
## Your checklist for this pull request
* [x] I've read the [Code of Conduct](https://codeberg.org/blackmagic-debug/blackmagic/src/CODE_OF_CONDUCT.md)
* [x] I've read the [guidelines for contributing](https://codeberg.org/blackmagic-debug/blackmagic/src/CONTRIBUTING.md) to this repository
* [x] It builds for hardware native (see [Building the firmware](https://codeberg.org/blackmagic-debug/blackmagic?tab=readme-ov-file#building-the-firmware))
* [x] It builds as BMDA (see [Building the BMDA](https://codeberg.org/blackmagic-debug/blackmagic?tab=readme-ov-file#building-black-magic-debug-app))
* [x] I've tested it to the best of my ability
* [x] My commit messages provide a useful short description of what the commits do
## Closing issues
<!-- put "fixes #XXXX" here to auto-close the issue(s) that your PR fixes (if any). -->