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

West runner jlink add optional loader details to address the CLI requirements of JLink v7.70d and later #50393

Merged
merged 2 commits into from
Sep 21, 2022
Merged

West runner jlink add optional loader details to address the CLI requirements of JLink v7.70d and later #50393

merged 2 commits into from
Sep 21, 2022

Conversation

yvanderv
Copy link
Contributor

@yvanderv yvanderv commented Sep 19, 2022

For some boards, the jlink '-device' switch requires more information to flash a binary, e.g. the type of device (qspi, etc), the base address, etc. For example, the change is needed for NXP's boards mimxrt1060_evk(b)* and mimxrt1050_evk_qspi.

The approach taken is to add an optional argument the the jlink runner, i.e. '--loader' to specify the required information.
The code is backward compatible with versions of jlink older than v7.70d.

This PR:

  • adds code to West's jlink runner
  • updates the relevant board cmake files for the NXP boards mentioned above.

For more details from Segger on the new flashloader parameters, see
https://wiki.segger.com/J-Link_Multiple_Flashloader#Command_line_parameter
https://wiki.segger.com/i.MXRT1060#Available_flash_loaders

fixes #50327

@dleach02 dleach02 added this to the v3.2.0 milestone Sep 19, 2022
@mmahadevan108 mmahadevan108 added the bug The issue is a bug, or the PR is fixing a bug label Sep 19, 2022
scripts/west_commands/runners/jlink.py Outdated Show resolved Hide resolved
scripts/west_commands/runners/jlink.py Outdated Show resolved Hide resolved
scripts/west_commands/runners/jlink.py Outdated Show resolved Hide resolved
scripts/west_commands/runners/jlink.py Outdated Show resolved Hide resolved
@@ -7,5 +7,9 @@
board_runner_args(pyocd "--target=mimxrt1050_hyperflash")
board_runner_args(jlink "--device=MCIMXRT1052")

if(${CONFIG_BOARD_MIMXRT1050_EVK_QSPI})
board_runner_args(jlink "--loader=BankAddr=0x60000000&Loader=QSPI")
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense to use ${FLASH_BASE_ADDRESS} instead of the constant address here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There might be an offset to take into account as well. I have ideas to make this submission generic. However, this implementation addresses the bug. I am working on an improvement that can be thoroughly looked at after the release deadline.
How does this sound?

Copy link
Contributor

Choose a reason for hiding this comment

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

@mmahadevan108 asked that I share these test results, testing this PR on all the NXP i.MX RT boards supported in Zephyr.

This PR was prompted by Segger making a change, and we want to ensure this is backwards compatible. So I tested with both JLink versions 7.80a after Segger’s change, and 7.70c before the change. Everything looks good to me.

With the latest v7.80a, the following boards flash and work great for me:
mimxrt1050_evk
mimxrt1050_evk_qspi
mimxrt1060_evk

Note that I also built apps using board mimxrt1060_evk_hyperflash, and flashed to the mimxrt1050_evkb board using the same hyperflash memory. The flash was programmed and verified successfully, but the Zephyr apps didn’t boot. But this is good enough for me for this, because it does program correctly, so the booting may be related to using the wrong board. But I do not have a mimxrt1060_evk modified for HyperFlash.

I also reverted JLink to v7.70c and tested with these default boards:
mimxrt1050_evk
mimxrt1060_evk

I also tested all these boards work with JLink 7.80a without needing any changes to Zephyr tree:
mimxrt595_evk_cm33
mimxrt685_evk_cm33
mimxrt1010_evk
mimxrt1015_evk
mimxrt1020_evk
mimxrt1024_evk
mimxrt1064_evk
mimxrt1160_evk_cm4
mimxrt1160_evk_cm7
mimxrt1170_evk_cm4
mimxrt1170_evk_cm7

So this PR looks great to me. Thank you, Yves!

mmahadevan108
mmahadevan108 previously approved these changes Sep 20, 2022
fabiobaltieri
fabiobaltieri previously approved these changes Sep 20, 2022
@fabiobaltieri
Copy link
Member

fabiobaltieri commented Sep 20, 2022

Can you drop the merge commit? We don't use those.

With revision 7.70d, Segger changed the command line interface of the
jlink client, requiring some flash specific information, such as
the base address and the type of memory, e.g. QSPI.

This commit adds an optional argument to the West jlink runner,
'--loader' which passes the information to the jlink client.
This change is backward compatible with versions of jlink older
than v7.70d which introduces the CLI change.

Fixes: #50327

Signed-off-by: Yves Vandervennet <[email protected]>
This commit updates the board cmake files for the following
NXP boards:
 - mimxrt1060_evk and mimxrt1060_evkb
 - mimxrt1050_evk_qspi

The change adds the loader information for these boards

Signed-off-by: Yves Vandervennet <[email protected]>
@mmahadevan108 mmahadevan108 merged commit bf93255 into zephyrproject-rtos:main Sep 21, 2022
@mmahadevan108 mmahadevan108 added the backport v2.7-branch Request backport to the v2.7-branch label Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: West West utility backport v2.7-branch Request backport to the v2.7-branch bug The issue is a bug, or the PR is fixing a bug platform: NXP NXP
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JLink needs flashloader for MIMXRT1060-EVK
6 participants