signal SIGSEGV, Segmentation fault

54 views
Skip to first unread message

Omid Fathi

unread,
Sep 22, 2021, 2:14:52 AM9/22/21
to bcm2835
Hi 

I install bcm2835-1.68 by steps that wrote in https://www.airspayce.com/mikem/bcm2835/
on my RPI4 B with Linux raspberrypi 5.10.63-v7l+  armv7l GNU/Linux


Now when i compile my code with gcc "version 8.3" with adding " -l bcm2835 ", when i try to run the program i get "Segmentation fault", so compile my code with -g and put it in gdb and then run it, so i get this error:
###
Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/arm/armv6/strlen.S:26
26 ../sysdeps/arm/armv6/strlen.S: No such file or directory.
###
when i run bt after that i get these messages:
###
#0  strlen () at ../sysdeps/arm/armv6/strlen.S:26
#1  0xb6e8852c in __GI__IO_puts (
    str=0x17041406 <error: Cannot access memory at address 0x17041406>)
    at ioputs.c:35
#2  0x00010a64 in main () at EtherBerry_Test.cpp:85
####
run with sudo, without sudo and there is no different


I really need your help, Thanks

Mike McCauley

unread,
Sep 22, 2021, 2:46:54 AM9/22/21
to bcm...@googlegroups.com
Hello,

looks like there is a bug in your program. Seems you are passing a bad pointer
to ioputs()

I cant say any more without seeing your code.
But I dont think its anything to do with bcm2835.

Cheers.
--
Mike McCauley VK4AMM mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com 5R3MRFM2+X6
Phone +61 7 5598-7474



Omid Fathi

unread,
Sep 22, 2021, 3:43:18 AM9/22/21
to bcm2835
Here is the code 
EtherBerry_Test.cpp

Mike McCauley

unread,
Sep 22, 2021, 4:02:53 AM9/22/21
to bcm...@googlegroups.com
Hello,

Hard to say, but perhaps the read from the clock failed and this line is
crashing because buf[3] is 0 or less?

printf("%s\n", str[(unsigned char)buf[3]-1]);
Reply all
Reply to author
Forward
0 new messages