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

Add debug and flash support for S32K344 #1652

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

via
Copy link
Contributor

@via via commented Oct 21, 2023

Detailed description

This adds the ability to attach to an NXP S32K344 and basic erase/flash support. The bulk of the changes are in two parts:

  • First, adiv5.c is updated with an explicit overriden discovery sequence for APs. This chip will hard fault if we probe for one that does not exist, and there is an additional step to enable debug access.
  • Second, implement a s32k3xx skeleton, and add probe and flash support for the s32k344

I have mostly tested this by some regular use as a debugger, and to test the flash I generated a 4MB (-48KB to avoid the protected region at the end) random binary file, converted to an elf, and repeatedly erased, flashed, and compare-section-ed.

Your checklist for this pull request

  • I've read the Code of Conduct
  • I've read the guidelines for contributing to this repository
  • It builds for hardware native (make PROBE_HOST=native)
  • It builds as BMDA (make PROBE_HOST=hosted)
  • I've tested it to the best of my ability
  • My commit messages provide a useful short description of what the commits do

Closing issues

@dragonmux dragonmux added this to the v2.0 release milestone Oct 21, 2023
@dragonmux dragonmux added the New Target New debug target label Oct 21, 2023
@via via force-pushed the feature/s32k344 branch from 374498e to 6166485 Compare October 21, 2023 00:43
Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing a review, we've only spotted two small mistakes that are easily fixed.

This looks great, thank you for the contribution and your hard work implementing this! (We've been talking on Discord chatting back and forth on approaches and how best to support this part.)

We know that this is overflowing Flash right now which is why the firmware builds are failing, and that's well noted as a problem to solve for v2.0 via the new build system.

src/target/adiv5.c Outdated Show resolved Hide resolved
src/target/s32k3xx.c Outdated Show resolved Hide resolved
@via via force-pushed the feature/s32k344 branch 2 times, most recently from 6c347f3 to 0e76aa4 Compare October 21, 2023 01:03
dragonmux
dragonmux previously approved these changes Oct 21, 2023
src/target/s32k3xx.c Outdated Show resolved Hide resolved
dragonmux
dragonmux previously approved these changes Oct 21, 2023
@dragonmux
Copy link
Member

We know we approved this PR but now the Meson build system has landed, this needs some updating.

If you're able to do the necessary changes to add an enable macro to the Makefile and Meson build systems and gate this properly then please do so, if not we'll be happy to do the necessary changes ourself with your permission. Just let us know what path you'd like to pursue here.

via added 3 commits February 2, 2024 08:39
These chips will hard fault if we probe for APs that are not present.  Instead,
lets detect the specific chip and explicitly initialize the APs we know it has.

Additionally, the S32K3 requires specific bits to be set in the SDA_AP registers
to allow debug access, so we explicitly initialize that as well.
Copy link
Member

@dragonmux dragonmux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All builds are passing, and the Meson build system change looks good 👍🏼 LGTM, merging after a little light testing as you've said this works on BMDA to us.

@dragonmux dragonmux merged commit 1b532ac into blackmagic-debug:main Feb 5, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New Target New debug target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants