やっと、Zynq上でコンパイルができた。
root@zedboard-aquaxis:~# gcc --version
gcc (GCC) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
テストソースは下記のような感じで、axi_gpioでLEDを0xAAで光らせてみた。
横着してごめんなさい。
"/dev/mem"でmmapして、BASE_ADRSでaxi_gpioのアドレスへ明示的にずらしてます。
void main(){
int fd;
unsigned int *buf;
fd = open("/dev/mem", O_RDWR),
if (fd == -1) {
printf("open\n"),
return;
}
buf = mmap(NULL, SIZE, PROT_READ|PROT_WRITE, MAP_SHARED, fd, BASE_ADRS),
if (buf == MAP_FAILED) {
printf("mmap\n"),
return;
}
buf[REG_TRI] = 0x00;
buf[REG_DATA] = 0xAA;
munmap(buf, SIZE),
close(fd),
}
#ドライバは週末に作ろう
#DTBとuio_platform_genirqを使うつもりだけど・・・