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

Detect iMX RT variant to support more than 1060 #1599

Merged
merged 6 commits into from
Sep 23, 2023

Conversation

tannewt
Copy link
Contributor

@tannewt tannewt commented Aug 10, 2023

Detailed description

This uses a word of the ROM to distinguish different chips. Once distinguished, we can use the correct FLEXSPI base address. Specifically, the 1011 has the FLEXSPI at a different address. Tested on the 1011, 1015, 1020, 1040, 1050 and 1060 EVK boards.

This change also checks the length of the SFDP basic parameters table to ensure it is long enough to include page size. The 1011 and 1015 EVKs use the AT25SF128A which has an old SFDP table that is only 9 DWORDS long. Page size is in DWORD 11.

The 1176 is detected but the flash SFDP doesn't work still. So, it doesn't fully work.

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

@dragonmux
Copy link
Member

Please update your commit message to conform to the contribution guidelines and split the SPI and SFDP changes out into their own commits. They are not directly related to the i.MXRT support improvements and so don't belong in the same commit.

@dragonmux dragonmux added HwIssue Mitigation Solving or mitigating a Hardware issue in Software New Target New debug target labels Aug 10, 2023
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.

Thank you for the contribution! This is an initial review and complements the items given in the lint pass from CI. This is looking good, but could do with a little more work before we can merge it.

src/target/imxrt.c Outdated Show resolved Hide resolved
src/target/imxrt.c Outdated Show resolved Hide resolved
src/target/imxrt.c Outdated Show resolved Hide resolved
@tannewt tannewt force-pushed the support_other_imx branch 2 times, most recently from 73331d9 to 2ca5952 Compare August 10, 2023 20:56
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.

Thank you for splitting the contribution into commits. We have now given the code a more proper review, see below. It looks like a lot of items, for which apologies, but most of them should be fairly trivial to address and are quite mechanical in nature.

We look forward to testing this on our i.MXRT1060 board and getting this merged soon!

src/target/imxrt.c Outdated Show resolved Hide resolved
src/target/imxrt.c Outdated Show resolved Hide resolved
src/target/imxrt.c Outdated Show resolved Hide resolved
src/target/imxrt.c Outdated Show resolved Hide resolved
src/target/imxrt.c Show resolved Hide resolved
src/target/sfdp.c Outdated Show resolved Hide resolved
src/target/imxrt.c Outdated Show resolved Hide resolved
src/target/imxrt.c Outdated Show resolved Hide resolved
src/target/imxrt.c Outdated Show resolved Hide resolved
src/target/imxrt.c Show resolved Hide resolved
@dragonmux dragonmux added this to the v1.10 milestone Aug 10, 2023
@dragonmux
Copy link
Member

There's a small additional change we'd like to request based on some research @mubes has been doing - it turns out that allowing the Cortex-M probe routine to poke for Kinetis parts before iMXRT parts puts certain iMXRT parts in a bad state when we arrive, so please apply this patch in a new commit as part of this PR:

diff --git a/src/target/cortexm.c b/src/target/cortexm.c
index 6d80f4f8..28bdc5d9 100644
--- a/src/target/cortexm.c
+++ b/src/target/cortexm.c
@@ -686,8 +686,8 @@ bool cortexm_probe(adiv5_access_port_s *ap)
 
 	switch (t->designer_code) {
 	case JEP106_MANUFACTURER_FREESCALE:
-		PROBE(kinetis_probe);
 		PROBE(imxrt_probe);
+		PROBE(kinetis_probe);
 		break;
 	case JEP106_MANUFACTURER_GIGADEVICE:
 		PROBE(gd32f1_probe);

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.

There are only two items we saw doing a further review. With these taken care of we think this is ready to be merged. Please rebase this on main (git rebase -i main), which will eliminate that merge commit, and then squish fixes such as the spi.c print removal into the original commit for that - we are happy to provide help with this if you would like.

Thank you for your hard work with this and persevering!

src/target/imxrt.c Outdated Show resolved Hide resolved
src/target/sfdp.c Outdated Show resolved Hide resolved
@tannewt
Copy link
Contributor Author

tannewt commented Sep 22, 2023

we are happy to provide help with this if you would like.

Please feel free to finish this. I've lost the context for it (not working with imx currently.)

@dragonmux
Copy link
Member

Thank you - we'll get on that in the next day or two then.

@dragonmux dragonmux force-pushed the support_other_imx branch 2 times, most recently from 86616a0 to cc4d5f6 Compare September 23, 2023 15:32
@dragonmux dragonmux dismissed their stale review September 23, 2023 15:33

We have now touched the files, needs Esden's review.

Copy link
Member

@esden esden left a comment

Choose a reason for hiding this comment

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

LGTM

@esden esden merged commit 49b7231 into blackmagic-debug:main Sep 23, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HwIssue Mitigation Solving or mitigating a Hardware issue in Software New Target New debug target
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants