Altera_Forum
Honored Contributor
16 years agooverriding HAL functions
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.