I am trying to read a GPIO using the example,
gpio_read.rs, from the rust userland library (libtock-rs). The read always returns low, even when the GPIO bit is set. Is there a way I can read the GPIO bit from the capsule or the the
main.rs? I have verified the bit is set via gdb but, the application always returns 'Low'.
Configuration:
Tock: Release 1.6 RC1
The platform is based on the Imix board. I have limited my platform struct to include only the console, gpio, and kernel drivers. I copied chips/sam4l/
gpio.rs into my platform chips folder. I modified the BASE_ADDRESS in chips/myboard/
gpio.rs to align with the base address of the GPIOs on my platform. There are no other changes to
gpio.rs. The
main.rs was modified to configure Port A bit 0 as a GPIO.
unsafe fn set_pin_primary_functions() {
//use enclave::gpio::PeripheralFunction::{A, B, C, E};
use myboard::gpio::PA;
// Right column: Imix pin name
// Left column: SAM4L peripheral function
PA[00].configure(None); // GPIO pin
}
The gpio was created in the reset_handler().
let gpio = GpioComponent::new(
board_kernel,
components::gpio_component_helper!(
myboard::gpio::GPIOPin,
0 => &myboard::gpio::PA[0],
),
)
.finalize(components::gpio_component_buf!(myboard::gpio::GPIOPin));
I enabled the trace_syscalls in kernel/src/
config.rs and I can see the gpio driver call is successfully making the kernel call. I have verified the GPIO bit is set by dumping the memory location in gdb. What am I missing? Any help or pointers is appreciated.
Regards,
James.