Skip to content

Conversation

@feilongfl
Copy link
Contributor

@feilongfl feilongfl commented Dec 4, 2022

Add pack option support to support device with custom pyocd packages.

pyocd have an option for specific pack when run command.
But our project not support it.

Some vendor provide pack without upload to official CMSIS-Pack list
Use pack option we can specific the pack file like this:

board_runner_args(pyocd "--target=gd32a503vd" "--pack=${ZEPHYR_HAL_GIGADEVICE_MODULE_DIR}/${CONFIG_SOC_SERIES}/support/GigaDevice.GD32A50x_DFP.1.0.0.pack")

add `pack` option support to support device with custom pyocd packages.

Signed-off-by: YuLong Yao <[email protected]>
@zephyrbot zephyrbot added the area: West West utility label Dec 4, 2022
@feilongfl feilongfl changed the title scripts: pyocd: Add pack option support to support device with custom pyocd packages. scripts: pyocd: Add pack option to support device with custom pyocd packages. Dec 4, 2022
@feilongfl feilongfl changed the title scripts: pyocd: Add pack option to support device with custom pyocd packages. scripts: pyocd: Add pack option to support device custom pyocd packages. Dec 4, 2022
Copy link
Member

@gmarull gmarull left a comment

Choose a reason for hiding this comment

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

Why is this required? Once a pack is installed, there's no need to specify it every time. Also, why do we need to host packs when there's a repo?

@feilongfl
Copy link
Contributor Author

feilongfl commented Dec 6, 2022

Why is this required? Once a pack is installed, there's no need to specify it every time.

I refer to pyocd document: Manual pack usage and did not find a way to install pack method except config pack path in pyocd.yml file.
I think only Managed packs can install directly, not all packages are in the CMSIS-pack list.

In addition to Gigadevice's gd32a503, there are other vendors who also provide pack files only on their official websites, without uploading to CMSIS-pack. (e.g. artery, etc.)
The same problem occurs when maintaining the out-of-tree devices from these vendors.

I believe adding the pack option to pyocd would be the good way to solve this problem.


why do we need to host packs when there's a repo?

I think this question is not directly related to this PR. About host pack file or not in hal repo, I suggest discussing it at zephyrproject-rtos/hal_gigadevice#30.

gigadevice provide GD32A50x_DFP on their website but they don't upload it to CMSIS-pack list,
so it can't install directly.
Each user can flash and debug their devices only after downloading the pack file from the gigadevice website and configuring their `pyocd.yml'.

@cameled
Copy link
Contributor

cameled commented Dec 11, 2022

The GD32A503 series release at September 2022 release CN, release EN. I think this just about the cooperate, there have a publish time dely for new pack list on Keil.

I recommand use others to instead, like jlink, and wait it sync at Keil.

If we add the --pack, we need to maintain it. The better choise to add it is, there should have enough case need this feature. Also, there have --config option to do the same thing.

@feilongfl @gmarull What did you think?

@feilongfl
Copy link
Contributor Author

feilongfl commented Dec 11, 2022

I think --pack should be added for the following reasons.

  1. This is an option supported by the pyocd program that is not available in the zephyr project due to argument checking.
    To be honest, when I first met the problem runner pyocd received unknown arguments, it took me some time to notice that pyocd in zephyr and the debugger program pyocd were two different programs with similar arguments. This inconsistent behavior can be confusing to the user.
  2. Not only for in-tree devices, but when maintaining out-of-tree devices, you may encounter cases where the vendor does not upload the package to the CMSIS-pack list.
    Maybe for Gigadevice this is a publishe delay, but for some vendors it may never be published.
  3. You can set the pack option to be correct via the pyocd configuration file. But currently only absolute path references are supported, no environment variables are allowed. So I think the --config option is not enough.
  4. I think adding the --pack option is easy, just pass it to the pyocd program and that's enough.

@cameled
Copy link
Contributor

cameled commented Dec 11, 2022

  1. This is an option supported by the pyocd program that is not available in the zephyr project due to argument checking.
    To be honest, when I first met the problem runner pyocd received unknown arguments, it took me some time to notice
    that pyocd in zephyr and the debugger program pyocd were two different programs with similar arguments. This
    inconsistent behavior can be confusing to the user.

To get runners description of current build board, use below command.
west flash --context

Also, update the test case in zephyr/scripts/west_commands/tests/test_pyocd.py

@MaureenHelm
Copy link
Member

Have you looked into using --tool-opt for this instead?

@feilongfl
Copy link
Contributor Author

feilongfl commented Dec 12, 2022

Have you looked into using --tool-opt for this instead?

You are right, --tool-opt works well.
I missed this option before.


board_runner_args(pyocd "--target=gd32a503vd" "--tool-opt=--pack=${ZEPHYR_HAL_GIGADEVICE_MODULE_DIR}/${CONFIG_SOC_SERIES}/support/GigaDevice.GD32A50x_DFP.1.0.0.pack")

@feilongfl feilongfl closed this Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: West West utility

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants