<div dir="ltr">Hi Joel, thanks for reply.<div><br></div><div>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.</div><div><br></div><div>I want to know whether you just use optimized output for development / debugging, or use another debug output for this purpose?</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Sep 29, 2019 at 11:51 PM Joel Sherrill <<a href="mailto:joel@rtems.org">joel@rtems.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">On Sat, Sep 28, 2019 at 9:28 PM yanghb <<a href="mailto:sprhawk@gmail.com" target="_blank">sprhawk@gmail.com</a>> wrote:<br>
><br>
> Hi everyone!<br>
><br>
> I'm new to RTEMS, and having this question.<br>
><br>
> For short, how could I build application with DEBUG enabled?<br>
><br>
> What I have done:<br>
><br>
> 1. Building RTEMS kernel with stm32f4 bsp with following options:<br>
> ../rtems/configure --prefix=`pwd`/../../4.11.3 --target=arm-rtems4.11 --disable-networking --enable-rtemsbsp=stm32f4 --enable-tests<br>
><br>
> 2. Preparing my own hello application:<br>
> mkdir myhello; cd myhello<br>
> cp $RTEMS_KERNEL_ROOT/rtems/testsuites/samples/hello/init.c hello.c<br>
> cp $RTEMS_BUILD_ROOT/share/rtems4.11/make/Templates/Makefile.leaf Makefile<br>
> edit Makefile according to its README under Templates<br>
> 3. Building myhello<br>
> export RTEMS_MAKEFILE_PATH="/home/xxxx/yyyy/RTEMS/prjs/myhello/../../4.11.3/arm-rtems4.11/stm32f4"<br>
> make<br>
> Output:<br>
>><br>
>> test -d o-optimize || mkdir o-optimize<br>
>> 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<br>
>> 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<br>
>> arm-rtems4.11-nm -g -n o-optimize/hello.exe > o-optimize/hello.num<br>
>> arm-rtems4.11-size o-optimize/hello.exe<br>
>> text data bss dec hex filename<br>
>> 69572 1660 129416 200648 30fc8 o-optimize/hello.exe<br>
>> cp o-optimize/hello.exe o-optimize/hello.ralf<br>
><br>
><br>
> however if I build with debug it failed:<br>
>><br>
>> make clean; make debug<br>
>> make -f Makefile MAKEFILE=Makefile VARIANT=DEBUG<br>
>> make[1]: Entering directory '/home/xxxx/yyyyyy/RTEMS/prjs/myhello'<br>
>> test -d o-debug || mkdir o-debug<br>
>> 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<br>
>> 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.<br>
>> make[1]: Leaving directory '/home/xxxx/yyyyy/RTEMS/prjs/myhello'<br>
>> make: *** [/home/xxxx/yyyyyy/RTEMS/kernel/stm32f4/../../4.11.3/make/leaf.cfg:31: debug] Error 2<br>
><br>
><br>
> I try to rebuild BSP with --enable-rtems-debug flag, it also didn't generate *_g.a files.<br>
><br>
> So how could I build BSP with debug enabled?<br>
<br>
--enable-debug enables internal consistency checks.<br>
<br>
Every BSP and executable should be built by default with "-g" so<br>
symbols are already included.<br>
<br>
--joel<br>
><br>
> _______________________________________________<br>
> users mailing list<br>
> <a href="mailto:users@rtems.org" target="_blank">users@rtems.org</a><br>
> <a href="http://lists.rtems.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.rtems.org/mailman/listinfo/users</a><br>
</blockquote></div>