Klipper_mcu segfaults on start

Hi Community !

I am trying to run a second MCU on the host using an RPI 3B and I have followed all documentation I could find or been pointed at but no joy so far.

I have installed OctoPI got Klipper working and connecting to my printer but tryin to launch out/klipper.elf aka /usr/local/bin/klipper_mcu is segfaulting regardles of being launched via the /etc/init.d/klipper_mcu or manually result is segfault with exit code 139.

Enabling core dump does not generate any core dump so I tried to run in valgrind and got:

valgrind ./out/klipper.elf
valgrind: mmap(0x0, 40960) failed in UME with error 22 (Invalid argument).
valgrind: this can be caused by executables with very large text, data or bss segments.

I did enable GPIO SPI in raspi-config, added the executable bit on the binary added pi user to tty group, used make MCU=2 and all i could find as part of the github issues in vain.

Could you please help ?

Thanks in advance,
Rafik

This is highly unusual.
My config:

  • RPi 3B
  • Ubuntu 20.04.2 LTS
  • Klipper git v0.9.1-442-gdfccc872
  • Simple make menuconfig → Linux → makemake flash

What OS do you use?

Console Output:
ubuntu@ubuntu ~/klipper $ make menuconfig
Using default symbol values (no '/home/ubuntu/klipper/.config')
Configuration saved to '/home/ubuntu/klipper/.config'
  Creating symbolic link out/board
Loaded configuration '/home/ubuntu/klipper/.config'
Configuration saved to '/home/ubuntu/klipper/.config'
ubuntu@ubuntu ~/klipper $ make
  Creating symbolic link out/board
  Building out/autoconf.h
  Compiling out/src/sched.o
  Compiling out/src/command.o
  Compiling out/src/basecmd.o
  Compiling out/src/debugcmds.o
  Compiling out/src/initial_pins.o
  Compiling out/src/gpiocmds.o
  Compiling out/src/stepper.o
  Compiling out/src/endstop.o
  Compiling out/src/adccmds.o
  Compiling out/src/spicmds.o
  Compiling out/src/thermocouple.o
  Compiling out/src/i2ccmds.o
  Compiling out/src/pwmcmds.o
  Compiling out/src/lcd_st7920.o
  Compiling out/src/lcd_hd44780.o
  Compiling out/src/buttons.o
  Compiling out/src/tmcuart.o
  Compiling out/src/spi_software.o
  Compiling out/src/neopixel.o
  Compiling out/src/sensor_adxl345.o
  Compiling out/src/pulse_counter.o
  Compiling out/src/linux/main.o
  Compiling out/src/linux/timer.o
  Compiling out/src/linux/console.o
  Compiling out/src/linux/watchdog.o
  Compiling out/src/linux/pca9685.o
  Compiling out/src/linux/spidev.o
  Compiling out/src/linux/analog.o
  Compiling out/src/linux/hard_pwm.o
src/linux/hard_pwm.c: In function ‘gpio_pwm_setup’:
src/linux/hard_pwm.c:69:5: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
   69 |     write(fd, scratch, strlen(scratch));
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/linux/hard_pwm.c: In function ‘gpio_pwm_write’:
src/linux/hard_pwm.c:105:9: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
  105 |         write(g.enable_fd, "0", 2);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~
src/linux/hard_pwm.c:111:5: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
  111 |     write(g.duty_fd, scratch, len + 1);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/linux/hard_pwm.c:112:5: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
  112 |     write(g.enable_fd, "1", 2);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~
  Compiling out/src/linux/i2c.o
  Compiling out/src/linux/gpio.o
  Compiling out/src/generic/crc16_ccitt.o
  Compiling out/src/generic/alloc.o
  Compiling out/src/linux/sensor_ds18b20.o
  Building out/compile_time_request.o
Version: v0.9.1-442-gdfccc872
  Linking out/klipper.elf
ubuntu@ubuntu ~/klipper $ make flash
  Flashing
Installing mirco-controller code to /usr/local/bin/
Attempting host MCU restart...