rtems dynamic loading with waf

Chris Johns chrisj at rtems.org
Fri Jan 6 02:38:50 UTC 2017


On 29/12/2016 20:25, xuelin.tian at qkmtech.com wrote:
> Dear Chris,
> For now, I use rtems-ld to generate my application. I have my base
> kernel, bkv01.elf, and my application, dl-01.c.
>
> First, I compiled my application without linking:
> # arm-rtems4.11-gcc ${CFLAGS1} -o dl-01.o -c dl-01.c
> Then, I used rtems-ld to generate my loadable RAP: (something like
> below, please ignore the libs I added)
> #
> rtems-ld -v --base bkv01.elf -e hello_world dl-01.o  -o app01.rap -L /opt/rtems-4.11.1-release/4.11-bsp/arm-rtems4.11/xilinx_zynq_zedboard/lib/ -lbsd -lrtemsbsp -lrtemscpu -ljffs2 -lrtems++ -lz
>
> base-image: bkv01.elf
> cache:load-sym: object files: 1
> cache:load-sym: symbols: 10688
> Finding libraries:
>   found: ./libbsd.a
>   found: /opt/rtems-4.11.1-release/4.11-bsp/arm-rtems4.11/xilinx_zynq_zedboard/lib/librtemsbsp.a
>   found: /opt/rtems-4.11.1-release/4.11-bsp/arm-rtems4.11/xilinx_zynq_zedboard/lib/librtemscpu.a
>   found: /opt/rtems-4.11.1-release/4.11-bsp/arm-rtems4.11/xilinx_zynq_zedboard/lib/libjffs2.a
>   found: /opt/rtems-4.11.1-release/4.11-bsp/arm-rtems4.11/xilinx_zynq_zedboard/lib/librtems++.a
>   found: /opt/rtems-4.11.1-release/4.11-bsp/arm-rtems4.11/xilinx_zynq_zedboard/lib/libz.a
> cc::stdlib: libgcc.a
> cc::stdlib: libssp.a
> cc::stdlib: libc.a
> cache:load-sym: object files: 4513
> cache:load-sym: symbols: 12987
> resolver:resolving:  undefines, unresolved: 1
> resolver:resolve  :    |- hello_world
> resolver:resolved :    |   `--> dl-01.o (unresolved: 1)
> resolver:resolved :    +-- referenced objects: 1
> resolver:resolving:  ] undefines ==> dl-01.o
> resolver:resolving:  dl-01.o, unresolved: 7
> resolver:resolve  :     |- __getreent
> resolver:resolved :     |   `--> bkv01.elf (base)
> resolver:resolve  :     |- fprintf
> resolver:resolved :     |   `--> bkv01.elf (base)
> resolver:resolve  :     |- puts
> resolver:resolved :     |   `--> bkv01.elf (base)

This indicates `puts` is in the base image.

> resolver:resolve  :     |- rtems_status_text
> resolver:resolved :     |   `--> bkv01.elf (base)
> resolver:resolve  :     |- rtems_task_create
> resolver:resolved :     |   `--> bkv01.elf (base)
> resolver:resolve  :     |- rtems_task_delete
> resolver:resolved :     |   `--> bkv01.elf (base)
> resolver:resolve  :     |- rtems_task_start
> resolver:resolved :     |   `--> bkv01.elf (base)
> resolver:resolved :     +-- referenced objects: 0
> resolver:resolving: top: dl-01.o
> resolver:resolving:  dl-01.o is resolved or resolving
> resolver:resolving: dependents: 1
>    1: dl-01.o
> outputter:application: app01.rap
> rap::layout: total:654 text:380 const:178 ctor:0 dtor:0 data:0 bss:0 symbols:12 (1) strings:26 relocs:59
> rap:output: machine=0
> rap:output: header=12
> rap:output: .text: offset=177 size=380
> rap:output: .const: offset=557 size=178
> rap:output: .ctor: offset=735 size=0
> rap:output: .dtor: offset=735 size=0
> rap:output: .data: offset=735 size=0
> rap:output: strtab=735
> rap:output: symbols=761
> rap:output: relocs=773
> rap: objects: 1, size: 881, compression: 54.7%
>
> And, I got the RAP format file I want. This RAP would be downloaded into
> my system filesystem via FTP (just make rtems as server, and my host as
> client).
> Finally, I loaded this RAP file with dlopen, then an error came up:
>      dlopen failed: global symbol not found: puts
>
> Is there something wrong with my attempt? If so, please give my some
> advise, thanks a lot.
>

Did you generate a symbol table and load it before loading app01.rap?

Chris


More information about the users mailing list