Skip to main content
Visitor II
February 6, 2004
Question

Cosmic re-entrant functions

  • February 6, 2004
  • 3 replies
  • 807 views
Posted on February 06, 2004 at 04:19

Cosmic re-entrant functions

    This topic has been closed for replies.

    3 replies

    parveenAuthor
    Visitor II
    February 5, 2004
    Posted on February 05, 2004 at 08:33

    Hello All,

    Could anybody help me to resolve the re-entrant funcion issue in cosmic.

    I am using +modc memory model and I am putting @interrupt @stack before each interrupt handler but still the problem persists.

    I am getting error Reentrant function exists

    Many thanks in advance

    PraveenG
    Visitor II
    February 5, 2004
    Posted on February 05, 2004 at 18:04

    To make a function reentrant all you have to do is use the @stack ,eg.

    @stack void MyFunc(void)

    also make sure it is declared the same in the header file.

    Remember interrupt functions are always stack based by default in cosmic regardless of memory model used, so the @stack for an interrupt function is not necessary.

    By the sounds of your problem you are calling a normal function from within your interrupt routine, this function will need to be declared with the @stack option not the einterrupt.

    Regards

    sjo
    Visitor II
    February 6, 2004
    Posted on February 06, 2004 at 04:19

    as SJO says, the message you get means the linker has found a function that is called both from main and interrupt. This function must be made reentrant (which is not the case by default, because you're using +modc) using @stack or your application may crash at run time.

    Regards,

    Luca