zephyr: stm32: Linkable loadable extensions test fails

Describe the bug Running the tests/subsys/llext on the nucleo_h743zi fails when CONFIG_ARM_MPU=n

$ west build -p auto -b nucleo_h743zi tests/subsys/llext – -DCONFIG_ARM_MPU=n

To Reproduce Steps to reproduce the behavior:

  1. west build -p auto -b nucleo_h753zi tests/subsys/llext – -DCONFIG_ARM_MPU=n
  2. west flash
  3. See error

Expected behavior Test Passed Impact stm32 CI failure

Logs and console output

Running TESTSUITE llext
===================================================================
START - test_llext_simple
[00:00:00.016,000] <dbg> llext: llext_load: Loading relocatable or shared elf
[00:00:00.023,000] <dbg> llext: do_llext_load: Finding ELF tables...
[00:00:00.030,000] <dbg> llext: llext_find_tables: section 0 at 268: name 0, type 0, flags 0, addr 0, size 0
[00:00:00.040,000] <dbg> llext: llext_find_tables: section 1 at 290: name 31, type 1, flags 6, addr 0, size 56
[00:00:00.051,000] <dbg> llext: llext_find_tables: section 2 at 2b8: name 27, type 9, flags 40, addr 0, size 24
[00:00:00.061,000] <dbg> llext: llext_find_tables: section 3 at 2e0: name 37, type 1, flags 3, addr 0, size 0
[00:00:00.071,000] <dbg> llext: llext_find_tables: section 4 at 308: name 43, type 8, flags 3, addr 0, size 0
[00:00:00.082,000] <dbg> llext: llext_find_tables: section 5 at 330: name 48, type 1, flags 2, addr 0, size 37
[00:00:00.092,000] <dbg> llext: llext_find_tables: section 6 at 358: name 56, type 1, flags 30, addr 0, size 33
[00:00:00.103,000] <dbg> llext: llext_find_tables: section 7 at 380: name 65, type 1879048195, flags 0, addr 0, s2
[00:00:00.114,000] <dbg> llext: llext_find_tables: section 8 at 3a8: name 1, type 2, flags 0, addr 0, size 240
[00:00:00.124,000] <dbg> llext: llext_find_tables: symtab at 8
[00:00:00.130,000] <dbg> llext: llext_find_tables: section 9 at 3d0: name 9, type 3, flags 0, addr 0, size 47
[00:00:00.141,000] <dbg> llext: llext_find_tables: strtab at 9
[00:00:00.147,000] <dbg> llext: llext_find_tables: section 10 at 3f8: name 17, type 3, flags 0, addr 0, size 81
[00:00:00.158,000] <dbg> llext: llext_find_tables: shstrtab at 10
[00:00:00.164,000] <dbg> llext: do_llext_load: Allocate and copy strings...
[00:00:00.171,000] <dbg> llext: do_llext_load: Mapping ELF sections...
[00:00:00.178,000] <dbg> llext: llext_map_sections: section 0 name 
[00:00:00.185,000] <dbg> llext: llext_map_sections: Not copied section 
[00:00:00.192,000] <dbg> llext: llext_map_sections: section 1 name .text
[00:00:00.199,000] <dbg> llext: llext_map_sections: section 2 name .rel.text
[00:00:00.207,000] <dbg> llext: llext_map_sections: Not copied section .rel.text
[00:00:00.214,000] <dbg> llext: llext_map_sections: section 3 name .data
[00:00:00.222,000] <dbg> llext: llext_map_sections: section 4 name .bss
[00:00:00.229,000] <dbg> llext: llext_map_sections: section 5 name .rodata
[00:00:00.236,000] <dbg> llext: llext_map_sections: section 6 name .comment
[00:00:00.243,000] <dbg> llext: llext_map_sections: Not copied section .comment
[00:00:00.251,000] <dbg> llext: llext_map_sections: section 7 name .ARM.attributes
[00:00:00.259,000] <dbg> llext: llext_map_sections: Not copied section .ARM.attributes
[00:00:00.267,000] <dbg> llext: llext_map_sections: section 8 name .symtab
[00:00:00.275,000] <dbg> llext: llext_map_sections: Not copied section .symtab
[00:00:00.282,000] <dbg> llext: llext_map_sections: section 9 name .strtab
[00:00:00.290,000] <dbg> llext: llext_map_sections: Not copied section .strtab
[00:00:00.297,000] <dbg> llext: llext_map_sections: section 10 name .shstrtab
[00:00:00.305,000] <dbg> llext: llext_map_sections: Not copied section .shstrtab
[00:00:00.312,000] <dbg> llext: do_llext_load: Allocate and copy sections...
[00:00:00.320,000] <dbg> llext: do_llext_load: Counting exported symbols...
[00:00:00.327,000] <dbg> llext: llext_count_export_syms: symbol count 15
[00:00:00.334,000] <dbg> llext: llext_count_export_syms: unhandled symbol 0, name , type tag 0, bind 0, sect 0
[00:00:00.345,000] <dbg> llext: llext_count_export_syms: unhandled symbol 1, name hello_world.c, type tag 4, bind1
[00:00:00.357,000] <dbg> llext: llext_count_export_syms: unhandled symbol 2, name , type tag 3, bind 0, sect 1
[00:00:00.367,000] <dbg> llext: llext_count_export_syms: unhandled symbol 3, name , type tag 3, bind 0, sect 3
[00:00:00.378,000] <dbg> llext: llext_count_export_syms: unhandled symbol 4, name , type tag 3, bind 0, sect 4
[00:00:00.388,000] <dbg> llext: llext_count_export_syms: unhandled symbol 5, name , type tag 3, bind 0, sect 5
[00:00:00.398,000] <dbg> llext: llext_count_export_syms: unhandled symbol 6, name $d, type tag 0, bind 0, sect 5
[00:00:00.409,000] <dbg> llext: llext_count_export_syms: unhandled symbol 7, name number, type tag 1, bind 0, sec5
[00:00:00.420,000] <dbg> llext: llext_count_export_syms: unhandled symbol 8, name $t, type tag 0, bind 0, sect 1
[00:00:00.431,000] <dbg> llext: llext_count_export_syms: unhandled symbol 9, name $d, type tag 0, bind 0, sect 1
[00:00:00.441,000] <dbg> llext: llext_count_export_syms: unhandled symbol 10, name $t, type tag 0, bind 0, sect 1
[00:00:00.452,000] <dbg> llext: llext_count_export_syms: unhandled symbol 11, name , type tag 3, bind 0, sect 6
[00:00:00.462,000] <dbg> llext: llext_count_export_syms: unhandled symbol 12, name , type tag 3, bind 0, sect 7
[00:00:00.473,000] <dbg> llext: llext_count_export_syms: function symbol 13, name hello_world, type tag 2, bind 11
[00:00:00.484,000] <dbg> llext: llext_count_export_syms: unhandled symbol 14, name printk, type tag 0, bind 1, se0
[00:00:00.495,000] <dbg> llext: do_llext_load: Allocating memory for symbol table...
[00:00:00.503,000] <dbg> llext: do_llext_load: Copying symbols...
[00:00:00.510,000] <dbg> llext: llext_copy_symbols: function symbol 0 name hello_world addr 0x240025cd
[00:00:00.520,000] <dbg> llext: do_llext_load: Linking ELF...
[00:00:00.526,000] <dbg> llext: llext_link: relocation section .rel.text (2) linked to section 8 has 3 relocations
[00:00:00.536,000] <dbg> llext: llext_link: relocation 2:0 info 502 (type 2, sym 5) offset 40 sym_name  sym_type 5
[00:00:00.549,000] <inf> llext: found section symbol  addr 0x24002610
[00:00:00.556,000] <inf> llext: relocating (linking) symbol  type 3 binding 0 ndx 5 offset 40 link section 8
[00:00:00.566,000] <inf> llext: writing relocation symbol  type 2 sym 5 at addr 0x240025f4 addr 0x24002610
[00:00:00.576,000] <dbg> llext: llext_link: relocation 2:1 info e02 (type 2, sym 14) offset 44 sym_name printk sy0
[00:00:00.589,000] <inf> llext: found symbol printk at 0x8006b55, updating op code 0x240025f8
[00:00:00.598,000] <inf> llext: relocating (linking) symbol printk type 0 binding 1 ndx 0 offset 44 link section 8
[00:00:00.609,000] <inf> llext: writing relocation symbol printk type 2 sym 14 at addr 0x240025f8 addr 0x8006b55
[00:00:00.620,000] <dbg> llext: llext_link: relocation 2:2 info 502 (type 2, sym 5) offset 48 sym_name  sym_type 5
[00:00:00.632,000] <inf> llext: found section symbol  addr 0x24002620
[00:00:00.639,000] <inf> llext: relocating (linking) symbol  type 3 binding 0 ndx 5 offset 48 link section 8
[00:00:00.649,000] <inf> llext: writing relocation symbol  type 2 sym 5 at addr 0x240025fc addr 0x24002620
[00:00:00.659,000] <dbg> llext: do_llext_load: loaded module, .text at 0x240025cc, .rodata at 0x2400260c
[00:00:00.669,000] <inf> llext: Loaded extension hello
[00:00:00.675,000] <err> os: ***** USAGE FAULT *****
[00:00:00.681,000] <err> os:   No coprocessor instructions
[00:00:00.687,000] <err> os: r0/a1:  0x00000024  r1/a2:  0x00000024  r2/a3:  0x00000029
[00:00:00.696,000] <err> os: r3/a4:  0xa6044730 r12/ip:  0x080021d1 r14/lr:  0x240025db
[00:00:00.704,000] <err> os:  xpsr:  0x01000000
[00:00:00.709,000] <err> os: Faulting instruction address (r15/pc): 0x24012a64
[00:00:00.717,000] <err> os: >>> ZEPHYR FATAL ERROR 0: CPU exception on CPU 0
[00:00:00.725,000] <err> os: Current thread: 0x240000b0 (test_llext_simple)
[00:00:00.733,000] <err> os: Halting system

Environment (please complete the following information):

  • OS Ubuntu
  • Toolchain Zephyr SDK,0.16.1
  • Commit SHA bc43e890fd7a6035438a47b8853b6fe652472da2

Additional context

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Comments: 17 (1 by maintainers)

Most upvoted comments

@FRASTM thanks for testing! I’ve now put that fix with a bit more flexibility as https://github.com/zephyrproject-rtos/zephyr/pull/62433/commits/94e5a1a97506996ed33bbc95a4d133dc146525a5 . ATM it’s a part of #62433 but if we want to have it quickly, I can also push it as a stand-alone fix. With that commit both options - setting CONFIG_LLEXT_STORAGE_WRITABLE to “y” or to “n” should work for systems like yours, one of them will effectively make that test image writable, the other one will avoid writing to it and allocate a copy instead.