Chris Johns created an issue: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5163
The following discussion from !312 should be addressed: - [ ] @ppisa started a [discussion](https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/312#note_115090 "Add RISCV libdl support"): (+5 comments) >>> I have applied your changes and tried to call `dlopen` on BeaglV-Fire from my test application https://github.com/ppisa/rtems-devel/tree/master/rtems-omk-template/appdl which calls `shell_dlopen` and tries to load simple ELF file build from https://github.com/ppisa/rtems-devel/blob/master/rtems-omk-template/appdl/examples/appdl_print.c And the result is exception ``` SHLL [/] # dlopen bin/appdl_print-riscv64.o *** FATAL *** fatal source: 9 (RTEMS_FATAL_SOURCE_EXCEPTION) CPU: 0 mstatus 0x8000000a00007880 mcause 0x0000000000000004 mepc 0x00000010000271a8 ra 0x000000100002949c sp 0x00000010000d9ef0 gp 0x0000001000093800 tp 0x00000010000dabc8 t0 0x0000000000000000 t1 0x0000000000000001 t2 0xffffffffffffffff s0 0x00000010001b97e6 s1 0x00000010001b8660 a0 0xffffffffffe986c2 a1 0x0000001000089e48 a2 0x00000010001b8940 a3 0x0000006000000013 a4 0x00000010000271a8 a5 0x0000000000051ea8 a6 0x00000010001a67a6 a7 0x0000000000051ea8 s2 0x0000000000051ea8 s3 0x00000010000da008 s4 0x00000010001a67a6 s5 0x00000010001b88e0 s6 0x00000010001b0ea0 s7 0x0000000000000018 s8 0x0000000000000060 s9 0x0000000000000004 s10 0x0000000000000001 s11 0x00000010001b8d60 t3 0x0000000000000038 t4 0x0000000000000000 t5 0x000000580000003c t6 0x0000000000000038 fcsr 0x00000000 RTEMS version: 6.0.0.e049757c58-modified RTEMS tools: 13.3.0 20240521 (RTEMS 6, RSB e52d2288c8a0df64466010839ca1eb40c6d243ed, Newlib 1b3dcfd) executing thread ID: 0x0a010004 executing thread name: SHLL ``` I do not have JTAG cable with special connector yet. So I have trued to decode problem from the reported mepc. GDB decodes location as ``` 0x10000271a8 <rtems_rtl_elf_relocate_rela+270>: lw a4,0(s0) ``` If I try to decode to line `l * 0x10000271a8` then it points to the function `rtems_rtl_elf_relocate_rela` ``` 0x10000271a8 is in rtems_rtl_elf_relocate_rela (../../../../../git/rtems/cpukit/libdl/rtl-mdreloc-riscv.c:128). ``` But if I try next location then it points to ``` 0x10000271aa is in rtems_rtl_elf_relocate_rela (../../../../../git/rtems/cpukit/libdl/rtl-mdreloc-riscv.c:364). ``` ``` 359 case R_TYPE(CALL): { 360 int64_t hi = SignExtend64(pcrel_val + 0x800, bits); 361 write32le(where, (read32le(where) & 0xFFF) | (hi & 0xFFFFF000)); 362 int64_t hi20 = SignExtend64(pcrel_val + 0x800, bits); 363 int64_t lo = pcrel_val - (hi20 << 12); 364 write32le(((char *) where) + 4, (read32le(((char *) where) + 4) & 0xFFFFF) | ((lo & 0xFFF) << 20)); 365 } 366 break; ``` I have found way how to convert RTEMS generate ELF to HSS payload relatively easily by direct call of `hss-payload-generator`. I use `rtems-config.yaml`: ``` set-name: 'PolarFire-SoC-HSS::RTEMSImage' hart-entry-points: {u54_1: '0x1000000000', u54_2: '0x1000000000', u54_3: '0x1000000000', u54_4: '0x1000000000'} payloads: rtems-app.elf: {exec-addr: '0x1000000000', owner-hart: u54_1, secondary-hart: u54_2, secondary-hart: u54_3, secondary-hart: u54_4, priv-mode: prv_m, skip-opensbi: true, payload-name: "rtems-app"} ``` and then run in terminal ``` hss-payload-generator -c rtems-config.yaml rtems-payload.bin ``` >>> -- View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/issues/5163 You're receiving this email because of your account on gitlab.rtems.org.
_______________________________________________ bugs mailing list [email protected] http://lists.rtems.org/mailman/listinfo/bugs
