-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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: linkserver: Add ELF file support to flash command #75276
west: linkserver: Add ELF file support to flash command #75276
Conversation
# Use .elf, .hex or .bin, preferring .elf over .hex over .bin | ||
if self.elf_name is not None and os.path.isfile(self.elf_name): | ||
flash_cmd = (["load", self.elf_name]) | ||
elif self.supports_hex and self.hex_name is not None and os.path.isfile(self.hex_name): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To have the same behavior as for all other runners, could you give the highest priority to .hex ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put hex back to default, thanks for the remark.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put hex back to default, thanks for the remark.
Thanks.
I have reviewed all runners, and .elf is used only for debugging.
For flashing are used .hex and .bin.
Only one OpenOCD runner is able to flash .elf, BUT only if the "use_elf" parameter is set intentionally.
Are you sure that you cannot use .hex for flashing instead?
Afraid, that can be some examples that require flashing of shifted .bin files, and flashing of .elf can brake them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal flash on a MCXN is on address 0x0000 0000
the external flash is on 0x8000 0000
when using both regions in your program results in a a generated hex file of around ~3GB. When using west flash
it simply fails because I think it's actually trying to write the whole region.
ELF pretty much solves this because it contains a list of sections that need to be programmed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The internal flash on a MCXN is on address
0x0000 0000
the external flash is on0x8000 0000
when using both regions in your program results in a a generated hex file of around ~3GB. When usingwest flash
it simply fails because I think it's actually trying to write the whole region.ELF pretty much solves this because it contains a list of sections that need to be programmed.
Hi @PetervdPerk-NXP,
could you point to the example, to test it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a new commit it seemed that Linkserver version detect never worked as intended thus faulting when flashing ihex files.
The internal flash on a MCXN is on address 0x0000 0000 the external flash is on 0x8000 0000 when using both regions in your program results in a a generated hex file of around 3GB. When using west flash it simply fails because I think it's actually trying to write the whole region.
Okay it turns you've to set CONFIG_BUILD_NO_GAP_FILL=y
to avoid generating big hex files.
Only one OpenOCD runner is able to flash .elf, BUT only if the "use_elf" parameter is set intentionally.
Sure it seems that the other runners haven't implemented it yet, however the API exposes self.elf_name
and when CONFIG_BUILD_OUTPUT_HEX=n
and CONFIG_BUILD_OUTPUT_BIN=n
the build system only outputs an elf file. Hence I believe we should support ELF files for our runner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added the DNM label.
As we have discussed off-line with @PetervdPerk-NXP
- it will break MCUBoot examples by flashing .elf instead of signed.bin.
- the huge .hex/bin issue can be solved by
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_BUILD_NO_GAP_FILL=y
CONFIG_BUILD_OUTPUT_BIN=n
My proposal:
The ,hex and .bin generation is optional.
As compromise, we can decrease .elf flashing priority.
So the flashing priority can be hex>bin>elf.
As the result, no existing example is broken and the .elf flashing can be supported.
4aed664
to
a489b90
Compare
53dce3c
For files with multiple regions use ELF file instead so that all regions get flashed Signed-off-by: Peter van der Perk <[email protected]>
version detect never occured correctly and always yielded true Signed-off-by: Peter van der Perk <[email protected]>
53dce3c
to
567afc2
Compare
Apparently MCUboot makes supporting ELF in |
The MCX N SoC has an internal flash but also supports external flash.
For builds with multiple regions use ELF file instead so that all regions get flashed.