Kann es sein, dass das hmlangw auf 64bit Bookworm nicht läuft?
make hat grundsätzlich funktioniert, aber bereits mit Warnungen, die ich nicht wirklich verstehe.
Code: Alles auswählen
root@RaspberryPi:/usr/src/hmlangw# make
g++ -c -O2 -pipe -Wall hmlangw.cpp
g++ -c -O2 -pipe -Wall hmframe.cpp
hmframe.cpp: In function ‘int sendEnterBootloader(int)’:
hmframe.cpp:79:26: warning: format ‘%s’ expects argument of type ‘char*’, but argument 3 has type ‘int’ [-Wformat=]
79 | fprintf( stderr, "%s sendEnterBootloader(%d)\n", fd, currentTimeStr());
| ~^ ~~
| | |
| char* int
| %d
hmframe.cpp:79:49: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘char*’ [-Wformat=]
79 | fprintf( stderr, "%s sendEnterBootloader(%d)\n", fd, currentTimeStr());
| ~^ ~~~~~~~~~~~~~~~~
| | |
| int char*
| %s
hmframe.cpp: In function ‘bool isBootloaderReply(const void*, int)’:
hmframe.cpp:125:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
125 | if( len >= sizeof(bootloaderReply) )
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
hmframe.cpp:131:13: warning: comparison of integer expressions of different signedness: ‘int’ and ‘long unsigned int’ [-Wsign-compare]
131 | if( len >= sizeof(bootloaderReply2) )
| ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
g++ -o hmlangw hmlangw.o hmframe.o -lgpiod -lpthread
/usr/bin/ld: hmlangw.o: in function `main':
hmlangw.cpp:(.text.startup+0x574): warning: the use of `tempnam' is dangerous, better use `mkstemp'
Egal mit welchen Parametern ich hmlangw ausführe, bekomme ich immer nur "Speicherzugriffsfehler" ohne irgendwelche weiteren Details.
Nur ohne -n funktioniert, aber dann funktioniert halt nichts, außer dass eine Meldung kommt, dass -n fehlt.
Code: Alles auswählen
Linux RaspberryPi 6.12.62+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.62-1+rpt1~bookworm (2026-01-19) aarch64 GNU/Linux
Code: Alles auswählen
root@RaspberryPi:/usr/src/hmlangw# ls -al /dev/ttyAMA*
crw-rw---- 1 root dialout 204, 64 1. Apr 17:32 /dev/ttyAMA0
crw-rw---- 1 root dialout 204, 67 1. Apr 17:32 /dev/ttyAMA3
Mit -g kompiliert kommt das raus:
Code: Alles auswählen
(gdb) run -n show
Starting program: /usr/src/hmlangw/hmlangw -n show
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".
Program received signal SIGSEGV, Segmentation fault.
0x0000007ff7f93360 in gpiod_chip_get_line () from /lib/aarch64-linux-gnu/libgpiod.so.2
Mit scheint, als ob sich da ein Fehler eingeschlichen hat, gpiod_chip_get_line will als ersten Parameter ein Objekt, müsste "chip" sein, nicht 0.
Code: Alles auswählen
static int openResetLine(int port) {
struct gpiod_chip *chip;
int ret;
chip = gpiod_chip_open_by_number(0); // z.B. 0 für /dev/gpiochip0
if (!chip) {
perror("Open gpiochip failed");
return -1;
}
g_resetLine = gpiod_chip_get_line(chip, port);
if (!g_resetLine) {
perror("Get gpio line failed");
gpiod_chip_close(chip);
return -1;
}
ret = gpiod_line_request_output(g_resetLine, "my-app", 0); // Direction: output, initial value: 0
if (ret < 0) {
perror("Request line as output failed");
gpiod_chip_close(chip);
return -1;
}
return 0;
}
Damit komme ich schon mal ein Stück weiter.
Code: Alles auswählen
./hmlangw -n show
2026-04-03 17:15:23.827 write() could not set reset line to 0
2026-04-03 17:15:23.837 write() could not set reset line to 1
sh: 1: /lib/ld-linux.so.3: not found
2026-04-03 17:15:23.839 can't get serial number!
2026-04-03 17:15:23.839 write() could not set reset line to 0
2026-04-03 17:15:23.849 write() could not set reset line to 1
Mit manueller Angabe der Seriennummer -n NEQ... und ohne Reset -r -1 startet der Daemon. Danach passiert nicht mehr viel.
Ich bin mir nicht sicher, für was ich das Funkmodul zuletzt genutzt habe, könnte sein, dass da eine neuere Firmware drauf ist. Ich richte bei Gelegenheit einen Pi3 mit 32bit OS ein und versuche dort, hmlangw zum laufen zu bekommen.