How to make a debug build for hello?

yanghb sprhawk at gmail.com
Sun Sep 29 22:39:59 UTC 2019


Hi Joel, thanks for reply.

I understand executable is built with "-g", but I think the outputs from
optimize and debug are different instructions, and what built by debug is
more straightforward for debugging purposes.

I want to know whether you just use optimized output for development /
debugging, or use another debug output for this purpose?

On Sun, Sep 29, 2019 at 11:51 PM Joel Sherrill <joel at rtems.org> wrote:

> On Sat, Sep 28, 2019 at 9:28 PM yanghb <sprhawk at gmail.com> wrote:
> >
> > Hi everyone!
> >
> > I'm new to RTEMS, and having this question.
> >
> > For short, how could I build application with DEBUG enabled?
> >
> > What I have done:
> >
> > 1. Building RTEMS kernel with stm32f4 bsp with following options:
> > ../rtems/configure --prefix=`pwd`/../../4.11.3 --target=arm-rtems4.11
> --disable-networking --enable-rtemsbsp=stm32f4 --enable-tests
> >
> > 2. Preparing my own hello application:
> >     mkdir myhello; cd myhello
> >     cp $RTEMS_KERNEL_ROOT/rtems/testsuites/samples/hello/init.c  hello.c
> >     cp $RTEMS_BUILD_ROOT/share/rtems4.11/make/Templates/Makefile.leaf
> Makefile
> >     edit Makefile according to its README under Templates
> > 3. Building myhello
> >     export
> RTEMS_MAKEFILE_PATH="/home/xxxx/yyyy/RTEMS/prjs/myhello/../../4.11.3/arm-rtems4.11/stm32f4"
> >     make
> >     Output:
> >>
> >> test -d o-optimize || mkdir o-optimize
> >> arm-rtems4.11-gcc --pipe
> -B/home/xxxx/yyyyy/RTEMS/kernel/stm32f4/../../4.11.3/arm-rtems4.11/stm32f4/lib/
> -specs bsp_specs -qrtems   -Wall  -O2 -g     -march=armv7-m -mthumb
> -c   -o o-optimize/hello.o hello.c
> >> arm-rtems4.11-gcc --pipe
> -B/home/xxxx/yyyyyy/RTEMS/kernel/stm32f4/../../4.11.3/arm-rtems4.11/stm32f4/lib/
> -specs bsp_specs -qrtems   -Wall  -O2 -g     -march=armv7-m -mthumb
>    -march=armv7-m -mthumb   -o o-optimize/hello.exe  o-optimize/hello.o
> >> arm-rtems4.11-nm -g -n o-optimize/hello.exe > o-optimize/hello.num
> >> arm-rtems4.11-size o-optimize/hello.exe
> >>    text    data     bss     dec     hex filename
> >>   69572    1660  129416  200648   30fc8 o-optimize/hello.exe
> >> cp o-optimize/hello.exe o-optimize/hello.ralf
> >
> >
> > however if I build with debug it failed:
> >>
> >> make clean; make debug
> >> make -f Makefile MAKEFILE=Makefile VARIANT=DEBUG
> >> make[1]: Entering directory '/home/xxxx/yyyyyy/RTEMS/prjs/myhello'
> >> test -d o-debug || mkdir o-debug
> >> arm-rtems4.11-gcc --pipe
> -B/home/xxxx/yyyyyy/RTEMS/kernel/stm32f4/../../4.11.3/arm-rtems4.11/stm32f4/lib/
> -specs bsp_specs -qrtems   -Wall   -O0 -g    -march=armv7-m -mthumb
> -c   -o o-debug/hello.o hello.c
> >> make[1]: *** No rule to make target
> '/home/xxxx/yyyyyy/RTEMS/kernel/stm32f4/../../4.11.3/arm-rtems4.11/stm32f4/lib/librtemsbsp_g.a',
> needed by 'o-debug/hello.exe'.  Stop.
> >> make[1]: Leaving directory '/home/xxxx/yyyyy/RTEMS/prjs/myhello'
> >> make: ***
> [/home/xxxx/yyyyyy/RTEMS/kernel/stm32f4/../../4.11.3/make/leaf.cfg:31:
> debug] Error 2
> >
> >
> >  I try to rebuild BSP with --enable-rtems-debug flag, it also didn't
> generate *_g.a files.
> >
> > So how could I build BSP with debug enabled?
>
> --enable-debug enables internal consistency checks.
>
> Every BSP and executable should be built by default with "-g" so
> symbols are already included.
>
> --joel
> >
> > _______________________________________________
> > users mailing list
> > users at rtems.org
> > http://lists.rtems.org/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20190930/29bd9784/attachment.html>


More information about the users mailing list