Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Overriding HAL functions

Hi,

I'm using the NIOS II SDT 9.1 and I find I need to change the implementation of a HAL function. Can anyone point me at the correct way of doing this?

- if I make modify the function directly in the generated BSP everything works but my modified files are overwritten if I regenerate the BSP

- if I use the same modified files into my application they build OK don't appear to work correctly

I'm not sure if it's important but the files I'm trying to modify are altera_avalog_jtag_uart_write.c and altera_avalon_jtag_uart_read.c - they don't use the ALT_PEND_FLAGS() macro to avoid wasting time while waiting for a character unless __ucosii__ is defined - which is annoying if you're using an RTOS other than uCosII!

Thanks,

Darren.

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    You could also copy Altera's files, make a new version of the software driver and put it somewhere that the tools can find it like "c:\altera\ip\user_components". Then when you create your BSP, select your driver for the uart rather than Altera's version.

    Jake
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    You could just modify the original copy of the files located in the Altera install directory. C:\altera\91\ip\altera\sopc_builder_ip\altera_avalon_jtag_uart\HAL\src

    Jake

    --- Quote End ---

    Thanks for the suggestion Jake. I should be able to use this but I'll need to be careful to do the same changes to the other development systems used in the project.

    Do you think there is any solution that keeps the changes in the project directories? It's not a big problem but it would be nice to keep everything together if possible to simplify source code management (i.e. CVS).

    Thanks,

    Darren.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    If you choose option 2 that I gave before (copying the existing driver and modifying it), you can place it wherever you like so long as the tools can find it. So, in your case, place it under the folder where your SoPC system is located. Then it will follow the project.

    Just make sure you give it a unique version number to distinguish it from Altera's driver.

    Jake