Skip to content

"ninja flash" cannot be used with DFU-capable applications #6147

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

Closed
SebastianBoe opened this issue Feb 12, 2018 · 10 comments
Closed

"ninja flash" cannot be used with DFU-capable applications #6147

SebastianBoe opened this issue Feb 12, 2018 · 10 comments
Assignees
Labels
area: Flashing area: West West utility bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: low Low impact/importance bug

Comments

@SebastianBoe
Copy link
Collaborator

SebastianBoe commented Feb 12, 2018

Hi,

as a user, when I do

$ cd bootloader_build_dir
$ ninja flash

$ cd app_build_dir
$ ninja flash

The second flash command will erase the bootloader written during the first flash command.

This makes "ninja flash" useless for applications that use a bootloader.

"ninja flash" is a useful feature that should be preserved for DFU-able applications.

@SebastianBoe
Copy link
Collaborator Author

Perhaps this can be resolved by NOT erasing the entire flash when "ninja flash" is executed, but I don't understand why we are erasing it in the first place so I can't comment on if this is the correct approach ...

@SebastianBoe SebastianBoe added area: Flashing bug The issue is a bug, or the PR is fixing a bug and removed bug The issue is a bug, or the PR is fixing a bug labels Feb 12, 2018
@SebastianBoe
Copy link
Collaborator Author

@mbolivar : FYI

@mbolivar mbolivar self-assigned this Feb 12, 2018
@mbolivar
Copy link
Contributor

@SebastianBoe I've been out sick for a few days, but am working on these issues

@mbolivar
Copy link
Contributor

Perhaps this can be resolved by NOT erasing the entire flash when "ninja flash" is executed, but I don't understand why we are erasing it in the first place so I can't comment on if this is the correct approach ...

The entire flash is not erased by the application build system on the targets I use (pyOCD backend, but I've tested dfu-util in the past as well).

Could this be an artifact of your runner? I assume you are using nrfjprog.

@SebastianBoe
Copy link
Collaborator Author

@mbolivar : Yes, I believe this is nrfjprog-specific, I thought I saw a patch go in recently that modified the nrfjprog runner to do erase-all, but I can't see evidence of this in the git history.

If pyOCD does not do erase-all then I definitely think the nrfjprog runner should align to not doing erase-all.

Perhaps this would be as simple as removing this line:

+ ['nrfjprog', '--eraseall', '-f', self.family, '--snr', board_snr],

from nrfjprog.py

@mbolivar
Copy link
Contributor

Perhaps this would be as simple as removing this line:

OK! I can send a patch to make that optional (the way it is with e.g. jlink.py) if nrfjprog will still erase the sectors needed for the image it's flashing -- can you confirm that's the case?

@SebastianBoe
Copy link
Collaborator Author

Sorry, there was a miscommunication. In addition to removing "--erase-all", "--sectorerase" must be appended to the "--program" command. It will ensure just the necessary pages are erased.

@nashif nashif added bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug labels Feb 15, 2018
mbolivar pushed a commit to mbolivar/zephyr that referenced this issue Mar 27, 2018
By default, use a sector erase to flash boards with nrfjprog.py.

To allow getting the old behavior, add an --erase flag that works the
exact same way as the corresponding jlink.py argument: if present, a
full flash erase is done before programming. If absent, only a sector
erase is done.

Fixes zephyrproject-rtos#6147

Signed-off-by: Marti Bolivar <[email protected]>
Signed-off-by: Carles Cufi <[email protected]>
mbolivar pushed a commit to mbolivar/west that referenced this issue May 31, 2018
By default, use a sector erase to flash boards with nrfjprog.py.

To allow getting the old behavior, add an --erase flag that works the
exact same way as the corresponding jlink.py argument: if present, a
full flash erase is done before programming. If absent, only a sector
erase is done.

Fixes zephyrproject-rtos/zephyr#6147

Signed-off-by: Marti Bolivar <[email protected]>
Signed-off-by: Carles Cufi <[email protected]>
@mbolivar
Copy link
Contributor

mbolivar commented Jun 4, 2018

Reopening since the west change is not in zephyr's copy of west yet -- it's a new feature, so not eligible for merge now.

@mbolivar mbolivar reopened this Jun 4, 2018
@nashif
Copy link
Member

nashif commented Nov 5, 2018

@mbolivar still an issue?

@galak galak added platform: nRF Nordic nRFx area: West West utility labels Dec 6, 2018
@galak
Copy link
Collaborator

galak commented Dec 13, 2018

Not relevant anymore (comment from @carlescufi)

@galak galak closed this as completed Dec 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Flashing area: West West utility bug The issue is a bug, or the PR is fixing a bug platform: nRF Nordic nRFx priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants