This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

HWI_enable cannot be called from the program’s main() function

Hi,

I see following in BIOS document "HWI_enable cannot be called from the program’s main() function". What is the effect of calling this from main()? In our target code interrupt enable in main (c64x and c64x+ DSPs). Is this a serious issue?

If only individual interrupts are enabled in main() but not the GIE bit, does it have any difference in behavior? If both are  individual interrupts and GIE bit are enabled in main(), is there any difference in behavior?

Is there a history (reasoning) behind why interrupts should not be enabled inside main()?

I'm investigating some product issue and noticed this in our legacy code.

Regards,

Justin

  • Justin --

    It is OK to enable specific bits in IER register in main(), but it is not OK to enable the GIE bit.

    In BIOS 5.x, when main() returns, we finish the system initialization and carefully enable the TSK scheduler, SWI scheduler and enable interrupts.   If you enable HWI in main(), then interrupts might call SEM_post(), etc. which will cause problems if the TSK and SWI schedulers have not been enabled.

    In BIOS 6.x, similar initialization is handled with BIOS_start() which is typically the last function call in main().

    Thanks,
    -Karl-