Skip to content

llext samples fail with BUS ERROR (zephyr-3.7 stable) #77824

Closed
@pillo79

Description

@pillo79

Originally discussed in #77515

The LLEXT "modules" sample was designed to show how to compile the same code in two different ways - directly as part of one binary, or as a separate extension. As described in the related doc, this can achieved with proper west build -T ... commands defined in the sample's sample.yaml.

However, when the sample is compiled as a project (without -T), it almost certainly results in a non-working binary. This is due to the fact that the build mode defaults to "as a module", but the other options that are required for LLEXT to work are only defined in the sample.yaml. This is the output:

Originally posted by fulup-bzh August 24, 2024
In the process of trying LLEXT I check samples/subsys/llext/modules and fail to get it working.

  • zephyr 3.7 stable
  • Linux zephyr-sdk-0.16.8
  • board frdm_k64f

do_llext_load seams to work fine with all symbols are resolved. But when launching extension function, I get a bus fault.

Does anyone success in running LLEXT samples ?

thank you

[00:00:00.568,000] <dbg> llext: do_llext_load: Allocating memory for symbol table...
[00:00:00.576,000] <dbg> llext: do_llext_load: Copying symbols...
[00:00:00.583,000] <dbg> llext: llext_copy_symbols: function symbol 0 name hello_world addr 0x20002121
[00:00:00.592,000] <dbg> llext: do_llext_load: Linking ELF...
[00:00:00.599,000] <dbg> llext: llext_link: relocation section .rel.text (2) acting on section 1 has 2 relocations
[00:00:00.609,000] <dbg> llext: llext_link: relocation 2:0 info 0x202 (type 2, sym 2) offset 16 sym_name  sym_type 3 sym_bind 0 sym_ndx 3
[00:00:00.622,000] <inf> llext: writing relocation symbol  type 2 sym 2 at addr 0x20002130 addr 0x20002180
[00:00:00.632,000] <dbg> elf: arch_elf_relocate: 2 20002130 20002180 
[00:00:00.639,000] <dbg> llext: llext_link: relocation 2:1 info 0xe02 (type 2, sym 14) offset 20 sym_name printk sym_type 0 sym_bind 1 sym_ndx 0
[00:00:00.652,000] <inf> llext: found symbol printk at 0x65c9
[00:00:00.659,000] <inf> llext: writing relocation symbol printk type 2 sym 14 at addr 0x20002134 addr 0x65c9
[00:00:00.669,000] <dbg> elf: arch_elf_relocate: 2 20002134 65c9 printk
[00:00:00.676,000] <dbg> llext: llext_link: relocation section .rel.exported_sym (5) acting on section 4 has 2 relocations
[00:00:00.687,000] <dbg> llext: llext_link: relocation 5:0 info 0x202 (type 2, sym 2) offset 0 sym_name  sym_type 3 sym_bind 0 sym_ndx 3
[00:00:00.700,000] <inf> llext: writing relocation symbol  type 2 sym 2 at addr 0x200021e0 addr 0x20002180
[00:00:00.710,000] <dbg> elf: arch_elf_relocate: 2 200021e0 20002180 
[00:00:00.717,000] <dbg> llext: llext_link: relocation 5:1 info 0xf02 (type 2, sym 15) offset 4 sym_name hello_world sym_type 2 sym_bind 1 sym_ndx 1
[00:00:00.731,000] <inf> llext: writing relocation symbol hello_world type 2 sym 15 at addr 0x200021e4 addr 0x20002121
[00:00:00.742,000] <dbg> elf: arch_elf_relocate: 2 200021e4 20002121 hello_world
[00:00:00.750,000] <dbg> llext: llext_export_symbols: sym 0x20002121 name hello_world in 0x200021c4
[00:00:00.759,000] <dbg> llext: do_llext_load: loaded module, .text at 0x20002120, .rodata at 0x20002180
[00:00:00.769,000] <inf> llext: Loaded extension ext
[00:00:00.774,000] <err> os: ***** BUS FAULT *****
[00:00:00.780,000] <err> os:   Instruction bus error
[00:00:00.785,000] <err> os:   NXP MPU error, port 3
[00:00:00.791,000] <err> os:     Mode: Supervisor, Instruction Address: 0x20002120
[00:00:00.799,000] <err> os:     Type: Read, Master: 0, Regions: 0x8400
[00:00:00.807,000] <err> os: r0/a1:  0x20002121  r1/a2:  0x000086e6  r2/a3:  0x00000000
[00:00:00.815,000] <err> os: r3/a4:  0x00000000 r12/ip:  0x00002801 r14/lr:  0x000007ad
[00:00:00.824,000] <err> os:  xpsr:  0x61000000
[00:00:00.829,000] <err> os: Faulting instruction address (r15/pc): 0x20002120
[00:00:00.837,000] <err> os: >>> ZEPHYR FATAL ERROR 27: Unknown error on CPU 0
[00:00:00.845,000] <err> os: Current thread: 0x200005d0 (unknown)
[00:00:00.852,000] <err> os: Halting system

Metadata

Metadata

Assignees

Labels

area: llextLinkable Loadable Extensions

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions