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

Supporting cores with private flash partitions #1616

Closed
maxd-nordic opened this issue Aug 25, 2023 · 4 comments
Closed

Supporting cores with private flash partitions #1616

maxd-nordic opened this issue Aug 25, 2023 · 4 comments

Comments

@maxd-nordic
Copy link
Contributor

Hi! I'm looking into supporting the nRF5340 in pyocd.
Although it seems easy enough to have multiple flasher algos for different memory partitions, I couldn't find a way to specify on which core the algo needs to run. We would usually have a merged HEX file containing all the partitions that is supplied to the flasher tool. It would be great if someone could help me out here. :)

@flit
Copy link
Member

flit commented Aug 29, 2023

Unfortunately… pyocd currently can only run the flash algo on the main core. ☹️ It's definitely a serious deficiency for certain devices!

@flit
Copy link
Member

flit commented Aug 29, 2023

It looks like it wouldn't be too hard to implement. The pyocd.flash.flash.Flash class that's responsible for running the flash algo already takes a Target class used to access the core. If the target instance for a core (rather than SoC) is passed in, the algo would be run on that core.

The main changes would be

  • Tracking the core the algo needs to on. Using a FlashRegion attribute with the core name (or number) would be fine. (Default of None needs to be added to FlashRegion.DEFAULT_ATTRS dict.)
  • Update CoreSightTarget.create_flash() to look up the core and pass it to the Flash class constructor, or use the primary core if not specified.
  • Update pyocd.target.pack.cmsis_pack.CmsisPackDevice to set the flash algo core name attribute.

@maxd-nordic
Copy link
Contributor Author

Thanks for the insight! I'm currently tinkering with this on my develop branch.
Do you have an idea why

  • the second core is not automatically generated
  • only the first flash region is actually saved as a flash regions, while the others are ROM regions?

@maxd-nordic
Copy link
Contributor Author

Got some more progress, here's a PR: #1656

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants