Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12612 Discussions

Which folder contains the source code for Nios II built in function

Chris039
Novice
1,677 Views

Hi, 

 

In the bsp generated using Nios II, there is one file <bsp folder>/HAL/inc/io.h. You may easily find this in the hello world design. 

 

In line below,

#define IORD(BASE, REGNUM) \
__builtin_ldwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)))

 

the IORD is defined as __builtin_ldwio function. I found the list of the built in function available in 

https://splichal.eu/gccsphinx-final/html/gcc/extensions-to-the-c-language-family/target-builtins/altera-nios-ii-built-in-functions.html

 

Can you point me to the file that define the function of __builtin_ldwio?

 

Thanks

0 Kudos
1 Solution
KellyJialin_Goh
Employee
1,505 Views

Hi Chris,

Sorry about the bad news. Unfortunately after consulting the engineering team, we are unable to provide the definition on how to use the built in function and the source code as it is private and confidential. However, do feel free to use the macros which is the IORD or IOWR that calls the built in function.


I will set your case to close-pending if I do not hear from you the next few days. Thank you.


Regards,

Kelly


View solution in original post

0 Kudos
15 Replies
Chris039
Novice
1,674 Views

I am not compiling my source code using Nios Eclipse. I am compiling using gcc. I guess there is missing .c or .h file that define the function which gives me error below

 

Chris039_0-1667998464017.png

 

0 Kudos
KellyJialin_Goh
Employee
1,655 Views

Greetings,

Is it possible for you to send your design files so that we can compile and have a look further on our side? Which version of NIOS are you using?


Thank you.

Regards,

Kelly


0 Kudos
Chris039
Novice
1,652 Views

Quartus Pro 22.2

you may find the design in Hello world example design

0 Kudos
KellyJialin_Goh
Employee
1,636 Views

Hi,

I will get back to you soon as it needs more time for investigation. May we know the version of GCC compiler that you are using?


Thank you,

Regards,

Kelly


0 Kudos
Chris039
Novice
1,623 Views

I think it doesn’t matter which gcc compiler version. It is the source file for nios built in function. 
Sure, do let me know when you found the code 

0 Kudos
KellyJialin_Goh
Employee
1,602 Views

Hi Chris,

Could you kindly check out this link:https://www.intel.com/content/www/us/en/support/programmable/support-resources/devices/ips-nios2-ide-tutorial.html and download the source files(any version works fine) and unzip them. Unzip once with command tar -xf on linux environement or unzip twice on Windows environment.


Regards,

Kelly


0 Kudos
Chris039
Novice
1,593 Views

Thank you for the link, Kelly

Could you point me to the files that contain the functions like __builtin_ldwio?

0 Kudos
KellyJialin_Goh
Employee
1,590 Views

Hi,

After you download the link and unzip the files, the directory to find _builtin_ldwio is : Downloads\acds-16.0.tar\acds-16.0\acds-16.0\gcc-5.2\gcc\testsuite\gcc.target\nios2 and locate to nios2-builtin-io.c .You should be able to see the source code in the file.


Thank you.

Regards,

Kelly


0 Kudos
KellyJialin_Goh
Employee
1,572 Views

Hi,

Any updates from your side?


Thank you.

Regards,

Kelly


0 Kudos
KellyJialin_Goh
Employee
1,572 Views

Hi,

Any updates from your side? Did you managed to find the file from your side?


Thank you.

Regards,

Kelly


0 Kudos
Chris039
Novice
1,541 Views

Hi Kelly,

This file use the built-in function but not defining the function. I am looking for the file that is defining the function.

 

 

0 Kudos
KellyJialin_Goh
Employee
1,531 Views

Hi,

You may check out this link https://www.intel.com/content/www/us/en/docs/programmable/683242/current/nios-ii-custom-instruction-overview.html and download the pdf, check out chapter 3.2 Built in Function and User defined Macros. I believe the file you refer to is the system.h for custom instructions.


Regards,

Kelly


0 Kudos
Chris039
Novice
1,529 Views

 The below define IORD as __builtin_ldwio but how do I know what is this function __builtin_ldwio doing? I would like to know the source code for the built in function

 

#define IORD(BASE, REGNUM) \
__builtin_ldwio (__IO_CALC_ADDRESS_NATIVE ((BASE), (REGNUM)))

 

The document that you have shared chapter 3.2.X lists out all the built in function available but there is no source code for each function.

0 Kudos
KellyJialin_Goh
Employee
1,506 Views

Hi Chris,

Sorry about the bad news. Unfortunately after consulting the engineering team, we are unable to provide the definition on how to use the built in function and the source code as it is private and confidential. However, do feel free to use the macros which is the IORD or IOWR that calls the built in function.


I will set your case to close-pending if I do not hear from you the next few days. Thank you.


Regards,

Kelly


0 Kudos
KellyJialin_Goh
Employee
1,487 Views

Hi,

I’m glad that your question has been addressed, I now transition this thread to community support. If you have a new question, Please login to ‘https://supporttickets.intel.com’, view details of the desire request, and post a feed/response within the next 15 days to allow me to continue to support you. After 15 days, this thread will be transitioned to community support. The community users will be able to help you on your follow-up questions.


p/s: If any answer from the community or Intel Support are helpful, please feel free to give best answer or rate 9/10 survey.


Thank you.

Regards,

Kelly Jialin, GOH


0 Kudos
Reply