FPGA, SoC, And CPLD Boards And Kits
FPGA Evaluation and Development Kits
Announcements
Intel Support hours are Monday-Fridays, 8am-5pm PST, except Holidays. Thanks to our community members who provide support during our down time or before we get to your questions. We appreciate you!

Need Forum Guidance? Click here
Search our FPGA Knowledge Articles here.
5145 Discussions

How to access FPGA peripherals from ARM

XChoo
Beginner
383 Views

I would like to know how to access FPGA from ARM?

IS there any example ?

 

Thank you

0 Kudos
1 Solution
Fawaz_J_Intel
Employee
217 Views

Hello,

You can access the FPGA peripherals through the bridges based on your connection in Platform Designer.

lets say you have a peripheral connected to h2f bridge. You can use ARM to access this IP through the h2f bridge offset + the IP offset in qsys.

 

Lets say you have a qsys IP, defined in a c code:

#define SYSID_BASE 0x10000

 

The h2f bridge can be accessed through this address:

#define ALT_AXI_FPGASLVS_OFST 0xC0000000

 

 

Then, you need to open your mem device in your linux system:

 

if( ( fd = open( "/dev/mem", ( O_RDWR | O_SYNC ) ) ) == -1 ) {

printf( "ERROR: could not open \"/dev/mem\"...\n" );

return( 1 );

}

 

Next, create the virtual memory:

virtual_base = mmap( NULL, HW_REGS_SPAN, ( PROT_READ | PROT_WRITE ), MAP_SHARED, fd, ALT_AXI_FPGASLVS_OFST );

 

 

After that, you can cast the pointer of system_ID to your virtual memory:

qsys_id_addr =virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + SYSID_BASE ) & ( unsigned long)( HW_REGS_MASK ) );

 

Finally, you should be able to use qsys_id_addr pointer to access your system ID IP in qsys:

printf("system ID = %x",*(uint32_t *)qsys_id_addr);

 

Hope this might help.

 

Thank you

 

 

 

View solution in original post

2 Replies
Fawaz_J_Intel
Employee
218 Views

Hello,

You can access the FPGA peripherals through the bridges based on your connection in Platform Designer.

lets say you have a peripheral connected to h2f bridge. You can use ARM to access this IP through the h2f bridge offset + the IP offset in qsys.

 

Lets say you have a qsys IP, defined in a c code:

#define SYSID_BASE 0x10000

 

The h2f bridge can be accessed through this address:

#define ALT_AXI_FPGASLVS_OFST 0xC0000000

 

 

Then, you need to open your mem device in your linux system:

 

if( ( fd = open( "/dev/mem", ( O_RDWR | O_SYNC ) ) ) == -1 ) {

printf( "ERROR: could not open \"/dev/mem\"...\n" );

return( 1 );

}

 

Next, create the virtual memory:

virtual_base = mmap( NULL, HW_REGS_SPAN, ( PROT_READ | PROT_WRITE ), MAP_SHARED, fd, ALT_AXI_FPGASLVS_OFST );

 

 

After that, you can cast the pointer of system_ID to your virtual memory:

qsys_id_addr =virtual_base + ( ( unsigned long )( ALT_LWFPGASLVS_OFST + SYSID_BASE ) & ( unsigned long)( HW_REGS_MASK ) );

 

Finally, you should be able to use qsys_id_addr pointer to access your system ID IP in qsys:

printf("system ID = %x",*(uint32_t *)qsys_id_addr);

 

Hope this might help.

 

Thank you

 

 

 

XChoo
Beginner
217 Views

Thank you very much Fjumaah. With your help, I can run my first application,

 

Reply