SPARC-RTEMS5-GDB and RTEMS Fatal error !
Joel Sherrill
joel at rtems.org
Tue Apr 16 15:26:15 UTC 2019
On Mon, Apr 15, 2019 at 2:25 PM Michel Macena <mmacena.eng at gmail.com> wrote:
> Hi, I have compiled a code for an ERC32 target board and loaded it using
> gdb,
> the code:
>
> #include <bsp.h>
>> #include <stdlib.h>
>> #include <stdio.h>
>>
>>
>> rtems_task Init(
>> rtems_task_argument ignored
>> )
>> {
>>
>> printf( "Hello World Michel\n" );
>> printf( "Hello World Michel\n" );
>> printf( "Hello World Michel\n" );
>> printf( "Hello World Michel\n" );
>> printf( "Hello World Michel\n" );
>> printf( "Hello World Michel\n" );
>> printf( "Hello World Michel\n" );
>> printf( "Hello World Michel\n" );
>> printf( "Hello World Michel\n" );
>> printf( "Hello World Michel\n" );
>>
>> }
>>
>> /* configuration information */
>>
>> /* NOTICE: the clock driver is explicitly disabled */
>> #define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
>> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
>>
>> #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
>> #define CONFIGURE_MAXIMUM_TASKS 1
>>
>> #define CONFIGURE_INIT
>>
>> #include <rtems/confdefs.h>
>>
>
> the gdb commands:
>
> sparc-rtems5-gdb
>> /home/inpe/rtems_exemplos/compile_test/hello_test/hello_exp.exe
>> set serial baud 19200
>> target extended-remote /dev/ttyS0
>> load
>> run
>>
>
> It loads the program perfectly, but I try the command "run" it says
> that the program is already running. So I closed the session
> and started a new one. The session:
>
> sparc-rtems5-gdb
>> /home/inpe/rtems_exemplos/compile_test/hello_test/hello_exp.exe
>> GNU gdb (GDB) 8.2.1
>> Copyright (C) 2018 Free Software Foundation, Inc.
>> License GPLv3+: GNU GPL version 3 or later <
>> http://gnu.org/licenses/gpl.html>
>> This is free software: you are free to change and redistribute it.
>> There is NO WARRANTY, to the extent permitted by law.
>> Type "show copying" and "show warranty" for details.
>> This GDB was configured as "--host=i686-linux-gnu --target=sparc-rtems5".
>> Type "show configuration" for configuration details.
>> For bug reporting instructions, please see:
>> <http://www.gnu.org/software/gdb/bugs/>.
>> Find the GDB manual and other documentation resources online at:
>> <http://www.gnu.org/software/gdb/documentation/>.
>>
>> For help, type "help".
>> Type "apropos word" to search for commands related to "word"...
>> Reading symbols from
>> /home/inpe/rtems_exemplos/compile_test/hello_test/hello_exp.exe...done.
>> (gdb) set serial baud 19200
>> (gdb) target extended-remote /dev/ttyS0
>> Remote debugging using /dev/ttyS0
>> trap_table ()
>> at
>> /home/inpe/masters_project/src/rtems/c/src/lib/libbsp/sparc/erc32/../../../../../../bsps/sparc/shared/start/start.S:107
>> 107 RTRAP( 0, SYM(hard_reset) ); ! 00 reset trap
>> (gdb) cont
>> Continuing.
>> [Inferior 1 (Remote target) exited normally]
>> ../../gdb-8.2.1/gdb/thread.c:93: internal-error: thread_info*
>> inferior_thread(): Assertion `tp' failed.
>> A problem internal to GDB has been detected,
>> further debugging may prove unreliable.
>> Quit this debugging session? (y or n) y
>>
>> This is a bug, please report it. For instructions, see:
>> <http://www.gnu.org/software/gdb/bugs/>.
>>
>> ../../gdb-8.2.1/gdb/thread.c:93: internal-error: thread_info*
>> inferior_thread(): Assertion `tp' failed.
>>
>
> When I use the command "cont" the program ran, but his was the ERC32 board
> console output:
>
> Hello World Michel
>> Hello World Michel
>> Hello World Michel
>> Hello World Michel
>> Hello World Michel
>> Hello World Michel
>> Hello World Michel
>> Hello World Michel
>> Hello World Michel
>> Hello World Michel
>>
>> *** FATAL ***
>> fatal source: 0 (INTERNAL_ERROR_CORE)
>> fatal code: 5 (INTERNAL_ERROR_THREAD_EXITTED)
>> RTEMS version: 5.0.0.0a9b45132c0144c1dc4b6b828a68608c21397ca4
>> RTEMS tools: 7.4.0 20181206 (RTEMS 5, RSB
>> 9a3e12e5820918057633798c3fe2a1f952fb4e56, Newlib 1d35a003f)
>> executing thread ID: 0x08a010001
>> executing thread name: UI1
>>
>
> It seems that that the code works but I don't get why the "FATAL" and also
> the "tp" error in GDB.
> Do you know what may be happening ?
>
Chris explained the gdb startup very well. The issue on the FATAL message is
an interesting aspect of embedded programming. What happens when a
task/thread
falls off the bottom of its function body?
For POSIX, the thread is implicitly deleted.
In the Classic API, it is considered a fatal error.
Since you didn't call rtems_task_delete(RTEMS_SELF) to delete the calling
task or exit() to shutdown the application, you fell into the fatal error
case.
If you had deleted the Init task, the application would have switched to the
IDLE thread and run forever.
--joel
>
> Thanks !
> _______________________________________________
> 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/20190416/1d41fbd9/attachment-0002.html>
More information about the users
mailing list