Physical and DRAM base addresses of the S905X ARM SOC

The design of Pi4J is inherently non-portable as it uses native APIs. Also it does some things that are big no-no’s in terms of proper design.

  1. It should never have direct access to memory. This is a huge NO and a massive security vulnerability.
  2. It should use proper kernel GPIO and other APIs. The kernel has the gpio character devices /dev/gpiochipX that are to be controlled through libgpiod. Any proper Java native implementation should go through libgpiod.
  3. For GPIO mapping, you can use the lgpio tool pre-installed on the images to get the chip and line number to use with libgpiod.
  4. For other pinmux functions, we have the ldto tool. However, hardware should not just be toggled on and off because there are implications for the kernel’s internal state machine as well as the device hardware states. Functions should only be enabled or disabled at boot time.

There are many libraries and hacks out there for Raspberry Pi and most are very poorly done. We do not recommend using or porting them. There are guides on this hub about how to enable and use each interface correctly. Stick to them when possible.

1 Like