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

mcuboot: enable use on RISC-V with ram load mode #81276

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

maass-hamburg
Copy link
Collaborator

this enables the use of mcuboot on riscv with ram load mode.

for that a function to get the flash_img_get_upload_slot() is needed.

Copy link
Collaborator

@nordicjm nordicjm left a comment

Choose a reason for hiding this comment

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

Changes look OK, one nit.

subsys/dfu/boot/mcuboot.c Outdated Show resolved Hide resolved
nordicjm
nordicjm previously approved these changes Nov 12, 2024
@maass-hamburg
Copy link
Collaborator Author

We have some problems in ci, now that CONFIG_ROM_START_OFFSET isn't ignored anymore on RISCV platforms and actually used.

@d3zd3z d3zd3z changed the title mcuboot: enable use on RICSV with ram load mode mcuboot: enable use on RISC-V with ram load mode Nov 13, 2024
@d3zd3z
Copy link
Collaborator

d3zd3z commented Nov 18, 2024

The CI issues will have to be addressed.

if (DEFINED CONFIG_ARM OR DEFINED CONFIG_X86 OR DEFINED CONFIG_ARM64
OR DEFINED CONFIG_SOC_OPENISA_RV32M1)
OR (DEFINED CONFIG_RISCV AND CONFIG_ROM_START_OFFSET GREATER 0))
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is CONFIG_ROM_START_OFFSET > 0 needed here but only for risc?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • I don't wanted to change it for the other archs
  • there are some riscv soc, that don't work, so the part to add a offset is only used, if that offset is needed

Copy link
Collaborator

@nordicjm nordicjm Nov 25, 2024

Choose a reason for hiding this comment

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

If the others are failing, they should be fixed, this is adding a hack (would suggest getting build logs from CI then pinging the maintainers of those platforms since they would be broken)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the problem was mainly opentitan, which needs to put a other rom header in front. maybe @snematbakhsh can help

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@nordicjm the opentitan one is not compatible with having a CONFIG_ROM_START_OFFSET, because it has to put something soc specific in front in the linker.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

for the opentitan soc the offset is now forced to be 0x0.

Copy link
Collaborator

Choose a reason for hiding this comment

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

for the opentitan soc the offset is now forced to be 0x0.

so can the CONFIG_ROM_START_OFFSET GREATER 0 be removed then ?
I agree with @nordicjm that this is not a nice adjustment.

Or can you elaborate so much on the issue that we might find another way to handle this ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no CONFIG_ROM_START_OFFSET GREATER 0 is necessary , so that

  zephyr_linker_sources(ROM_START SORT_KEY ! rom_start_address.ld)
  # Some linkers fill unspecified region with pattern other than 0x00. Include
  # fill_with_zeros.ld file which forces the linker to use 0x00 pattern. Please
  # note that the pattern will affect empty spaces created after FILL(0x00).
  zephyr_linker_sources(ROM_START SORT_KEY $ fill_with_zeros.ld)
 zephyr_linker_sources(ROM_START SORT_KEY 0x0 rom_start_offset.ld)

is not used on the opentitan soc

add flash_img_get_upload_slot() to get current
upload slot.
when CONFIG_MCUBOOT_BOOTLOADER_MODE_RAM_LOAD
is enabled, it is not based on the DT.

Signed-off-by: Fin Maaß <[email protected]>
don't assume, that the slot to upload is the second.

Signed-off-by: Fin Maaß <[email protected]>
don't assume, that the slot to upload is the second.

Signed-off-by: Fin Maaß <[email protected]>
don't select USE_DT_CODE_PARTITION,
when MCUBOOT_BOOTLOADER_MODE_RAM_LOAD

Signed-off-by: Fin Maaß <[email protected]>
be able to use ROM_START_OFFSET on RISCV.

Signed-off-by: Fin Maaß <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants