does the oe or android images support gpio access atm?
Did you find a way to use the GPIO from android ?
nope, just sysfs for now. AOSP as is does not have an API for controlling gpio. Maybe @jstultz can throw some light if i am missing something.
I tried it with gcc inline assembly this works without android on the board. But with android it gives a segmentation fault.
Android doesn’t like to access any hardware directly. What you will need to do is create a hal for the hardware you are trying to control, and have the hal access the gpio.
As an alternative to a hal, you could also create a console service that you can connect to using a Unix domain socket and relay data through the socket.
For the most out of your mind level, you can set the sysfs gpio permissions (not forgetting about selinux!) to something very dangerous, and deal with sysfs directly. Highly NOT recommended.
Hi question i try to talk to the gpio using gcc inline assembly and the NDK. I can excute code because printf is working. But when i try to write to the memery mapped IO i get a seg fault. Do i have to set some permissions somewhere? The assembly code is working tested it before by modifying BL1 without AOSP.
@doitright’s post above describes a number of good ways to talk to GPIO, for very good reasons he did not mention doing memory mapped I/O in assembler.
At the bottom level there is already code to wiggle the pins (it is the code that implements the sysfs interface). Either you should build a HAL on top of that, implement a hack on top of that (the later two suggestions) or, if speed matters, write a new kernel driver and build a HAL on top of that.
None of this needs to involve assembly code.
In the end i used /dev/mem and mmap to talk to the GPIO.