Welcome, Guest
Username: Password: Remember me

TOPIC: compile for Raspberry Pi

Re: compile for Raspberry Pi 11 years 8 months ago #4036

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3178
  • Thank you received: 502
  • Karma: 133
Hi Martin,

I don't see any log messages, and I suspect the kernel is built without POSIX Message Queue. If you add this in the kernel config and rebuild the kernel, troubleshooting will be much easier.

If you copy the source code to the directory where gdb is started, you will be able to see it in the debuger, examine variables, step in the code etc. The source you need in this case is src/exe/rt_ini/src/*.c and src/lib/rt/src/*.c. It would be interesting to also see the traceback (gdb command 'bt'). It seems as some pointer is corrupt (qdb or qdb->g ?) and it's hard to say why and where this happend.

/Claes
The administrator has disabled public write access.

Re: compile for Raspberry Pi 11 years 8 months ago #4037

  • siamect
  • siamect's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 116
  • Thank you received: 1
  • Karma: 1
Hi Claes
Thanks for helping me on a Sunday an' all...

I checked the old .config shipped with the Raspbian distro and it seemed to have Posix MQ enabled:
pwrp@martin-laptop:~/raspberrypi/linux$ zcat config.gz |grep QUE
CONFIG_POSIX_MQUEUE=y
CONFIG_POSIX_MQUEUE_SYSCTL=y
CONFIG_NETFILTER_NETLINK_QUEUE=m
CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
# CONFIG_IP_NF_QUEUE is not set
CONFIG_IP_NF_TARGET_MASQUERADE=m
# CONFIG_IP6_NF_QUEUE is not set
CONFIG_SND_SEQUENCER=m
CONFIG_SND_SEQUENCER_OSS=y
CONFIG_CRYPTO_WORKQUEUE=y
pwrp@martin-laptop:~/raspberrypi/linux$ 

Screenshotfrom2012-07-29180603.png


But just to be sure I rebuilt the kernel image anyway and installed it but I get the same problem:
pi@raspberrypi ~/src $ pwr kill
Remove all processes and resources for Proview Storage Environment
/tmp/pwr_killer: line 4: kill: (1831) - No such process
/tmp/pwr_killer: line 5: kill: (1835) - No such process
/tmp/pwr_killer: line 6: kill: (1839) - No such process
/tmp/pwr_killer: line 7: kill: (1843) - No such process
/tmp/pwr_killer: line 8: kill: (1847) - No such process
rm: cannot remove `/tmp/pwr*1': No such file or directory
Done.
pi@raspberrypi ~/src $ gdb rt_ini
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 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 "arm-linux-gnueabihf".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/pwrrt/exe/rt_ini...done.
(gdb) r
Starting program: /usr/pwrrt/exe/rt_ini 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x000596ea in qdb_RemoveQue (
    status=<error reading variable: Cannot access memory at address 0x4>, 
    qp=<error reading variable: Cannot access memory at address 0x0>)
    at ../../rt_qdb.c:1379
warning: Source file is more recent than executable.
1379	  qdb_AssumeLocked;
(gdb) bt
#0  0x000596ea in qdb_RemoveQue (
    status=<error reading variable: Cannot access memory at address 0x4>, 
    qp=<error reading variable: Cannot access memory at address 0x0>)
    at ../../rt_qdb.c:1379
Cannot access memory at address 0x2c
(gdb) q
A debugging session is active.

	Inferior 1 [process 1889] will be killed.

Quit anyway? (y or n) y
pi@raspberrypi ~/src $ 
Last Edit: 11 years 8 months ago by siamect.
The administrator has disabled public write access.

Re: compile for Raspberry Pi 11 years 8 months ago #4039

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3178
  • Thank you received: 502
  • Karma: 133
Hi Martin,

About the logging you can set breakpoints in errl_Init and openLog, step through these functions and see what mq_open returns.

I expected to see all the function calls on the stack with the bt command, but it seems as if the stack is corrupt. I think the call to qdb_RemoveQueue is made from qdb_RemoveAppl, so you could set a breakpoint there and step through the code. You could also try setting norun on all servers that are not used in the $pwrp_load/ld_appl... file, thus preventing qdb_RemoveQueue to be called.

/Claes
The administrator has disabled public write access.

Re: compile for Raspberry Pi 11 years 8 months ago #4045

  • siamect
  • siamect's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 116
  • Thank you received: 1
  • Karma: 1
Thanks again Claes

I cannot get gdb to stop at my break points. I start GDB from Emacs and when I type break something it marks the row in the source files correctly but when I run the program it just run as if there were no breakpoints and segfaults. Emacs brings up the right file and marks the row where it segfaults.

I have the source files that you mentioned in /home/pi/scr and I load the folder from Emacs and start GDB.

I will continue tomorrow.
I have to get some sleep.
Last Edit: 11 years 8 months ago by siamect.
The administrator has disabled public write access.

Re: compile for Raspberry Pi 11 years 8 months ago #4099

  • siamect
  • siamect's Avatar
  • OFFLINE
  • Expert Boarder
  • Posts: 116
  • Thank you received: 1
  • Karma: 1
Hi again...

This segfault problem seems to be just a toolchain thing... When I use the toolchain from github.com/raspberrypi/tools at least the rt_ini doesn't segfault anymore.

But when I compile projects I get some problem with a missing lrpcsvc.
-- Build node rasptest
-- Creating bootfile for node rasptest
-- Plc thread generated priority 22, scantime   0.10000 s, 1 plcpgm's 
Setting base /home/martin/pwrsrc_git/rls_dbg
-- Cross compilation ARM_LINUX
-- Plc process compiled for arm_linux optimized -O3 Dummy
Setting base /home/martin/pwrsrc_git/rls_dbg
-- Cross compilation ARM_LINUX
/opt/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi/bin/../lib/gcc/arm-bcm2708hardfp-linux-gnueabi/4.7.1/../../../../arm-bcm2708hardfp-linux-gnueabi/bin/ld: cannot find -lrpcsvc
collect2: error: ld returned 1 exit status
** Plc program link errors for arm_linux node plc_rasptest_0001_plc
Last Edit: 11 years 8 months ago by siamect.
The administrator has disabled public write access.

Re: compile for Raspberry Pi 11 years 8 months ago #4100

  • claes
  • claes's Avatar
  • OFFLINE
  • Platinum Boarder
  • Posts: 3178
  • Thank you received: 502
  • Karma: 133
Hi Martin,

You try just to remove -lrpcsvc in wb_gcg.sh on the exe directory for hw_arm (or in the source tree on wb/exp/com/src/os_linux/hw_arm). Maybe these functions are included in your libc.

/Claes
The administrator has disabled public write access.
Time to create page: 8.762 seconds