Skip to content

lopper:assists: Add RV32E (embedded) compiler/ABI support for MicroBlaze-V.#786

Open
sushil-dev-amd wants to merge 1 commit into
devicetree-org:masterfrom
sushil-dev-amd:rv32e-pr
Open

lopper:assists: Add RV32E (embedded) compiler/ABI support for MicroBlaze-V.#786
sushil-dev-amd wants to merge 1 commit into
devicetree-org:masterfrom
sushil-dev-amd:rv32e-pr

Conversation

@sushil-dev-amd

Copy link
Copy Markdown
Contributor

Propagate the xlnx,use-embedded CPU property (set by SDTGen for MicroBlaze-V cores with C_USE_EMBEDDED) through to the generated build flags:

  • lop-microblaze-riscv.dts: emit rv32e/-mabi=ilp32e in cflags.yaml instead of rv32i/ilp32 when the core is configured as embedded, and apply the ABI flag to linkflags as well as cflags so BSP link-time multilib selection matches. Guard against the invalid use-embedded + hardware-FPU combination (RV32E has no standard hard-float ABI) and warn if use-embedded is set alongside a 64-bit data size (RV32E is 32-bit only).
  • gen_domain_dts.py: select RISCV_ISA_RV32E instead of RISCV_ISA_RV32I in the generated Zephyr SoC and board Kconfig when the parsed ISA string indicates an embedded (rv32e) core.

Signed-off-by: sushilkumar.singh@amd.com

…aze-V.

Propagate the xlnx,use-embedded CPU property (set by SDTGen for MicroBlaze-V
cores with C_USE_EMBEDDED) through to the generated build flags:

- lop-microblaze-riscv.dts: emit rv32e/-mabi=ilp32e in cflags.yaml instead of
  rv32i/ilp32 when the core is configured as embedded, and apply the ABI flag
  to linkflags as well as cflags so BSP link-time multilib selection matches.
  Guard against the invalid use-embedded + hardware-FPU combination (RV32E
  has no standard hard-float ABI) and warn if use-embedded is set alongside
  a 64-bit data size (RV32E is 32-bit only).
- gen_domain_dts.py: select RISCV_ISA_RV32E instead of RISCV_ISA_RV32I in the
  generated Zephyr SoC and board Kconfig when the parsed ISA string indicates
  an embedded (rv32e) core.

Signed-off-by: Sushil Singh <sushilkumar.singh@amd.com>
@sushil-dev-amd

Copy link
Copy Markdown
Contributor Author

@sathishkumar-amd, @sivadur and @kedareswararao, please review the downstream compilation flags support to enable rv32e compilation for 32-bit arch using use_embedded flag (C_HAS_EMBEDDED parameter) from the DT.
Note: use_embedded and use_fpu cannot be 1 at the same time, since there exists no fpu for rv32e support.

content += "config RISCV_ISA_RV32I\n"
# Base ISA configuration - RV32E for embedded (reduced register set) MB-V
# cores (xlnx,use-embedded), RV32I otherwise.
isa_base_check = isa_string.split('_')[0] if isa_string else ''

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can you add check to make sure isa_string variable is not empty like if isa_string: and keep your code inside it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

okay will add it inside the if block below.

is_embedded = use_embedded != [''] and use_embedded[0] == 1 and n['xlnx,data-size'].value[0] != 64

if is_embedded and n['xlnx,use-fpu'].value[0] != 0:
raise Exception('Invalid MicroBlaze-V configuration at {}: xlnx,use-embedded=1 (RV32E/ilp32e) is not compatible with a hardware FPU (xlnx,use-fpu={}). The RV32E ABI has no standard hard-float variant; disable the FPU or the embedded (RV32E) option.'.format(n.abs_path, n['xlnx,use-fpu'].value[0]))

@kedareswararao kedareswararao Jul 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

so this configuration is allowed at Vivado level and not valid? should we be asking the IP owner to update it such away that vivado GUI to not to allow this configuration?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes ideally, it should be blocked at hardware IP design level, and lopper layer should not decide on this. But not sure who to reach out for implementing this configuration logic in hardware level.

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

Successfully merging this pull request may close these issues.

2 participants