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++

overriding HAL functions

Altera_Forum
Honored Contributor II
1,459 Views

Hello, 

 

 

I have a question about overriding HAL functions in my code. I am attempting to make character output with printf() non-blocking. But with the combination of options that I need to use to build my BSP, I discovered that the ALT_WRITE() function in HAL\src\alt_write.c is always passing a hard-coded 0 for the "flags" byte in its call to ALT_DRIVER_WRITE(). So character output is always blocking. I noticed this comment in alt_write.c: 

To provide your own implementation of a HAL function, include the file in your Nios II IDE application project. When building the executable, the Nios II IDE finds your function first, and uses it in place of the HAL version. 

So I wrote my own version of ALT_WRITE() which is non-blocking and put it in my application project. It worked perfectly for a while. Now for some reason when I build the project, it is back to using the HAL version of ALT_WRITE() and ignoring the one in my application. Any idea why? How does the linker decide which function to use? 

 

 

Thanks. 

 

 

 

 

0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
731 Views

Sounds silly but did you clean the syslib and rebuild? I think the IDE caches things and sometimes it causes problems. I know I have to occasionally rebuild my syslib and project. 

 

Bill
0 Kudos
Altera_Forum
Honored Contributor II
731 Views

Bill, 

 

I have tried doing a clean build of both the BSP and the app, and that doesn't fix it. I did verify that my version of alt_write.c is being compiled as part of the app. 

 

I wish I knew what happened between the time it worked and the time it stopped working. I was making changes to other (unrelated) code in the app... 

 

Thanks, 

John
0 Kudos
Reply