This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

eorror of multiple call to segment

Hi,

The compile error is:

WARNING L15: MULTIPLE CALL TO SEGMENT
SEGMENT: ?PR?_STRTONUM?PARSE
CALLER1: ?PR?TC0?PERIPHERAL
CALLER2: ?C_C51STARTUP

The callers TC0 is an ISR using reg bank 2 and I don't know about the c51startup. The called function STRTONUM is using the directive of #pragma NOAREGS so can be called for any functions. The question is why I still got the multiple call error? Thanks for answering my question.

By the way, C51 is V6.21, BL51 is V4.21 and LIB51 is V4.20.

chao.

Parents
  • Jon,

    Can reentrant prevent the problem of "what happens if main is in the middle of displaying the data and the interrupt occurs to display the data?" Is this a displaying order problem? For instance, when main() is in the middle of displaying page 1, timer 0 interrupt fires and an user wants to see page 2. After the interrupt is done page 2 is on the screen already, execution goes back to main() and continue displaying page 1 (the old job, before the interrupt). This is the major problem of my project structure. I am wondering what if I can somehow make the execution not to run the old job after the interrupt. Is it possible to do that in c level? I need help on this "how". If not maybe I need to re-construct my entire program.

    chao.

Reply
  • Jon,

    Can reentrant prevent the problem of "what happens if main is in the middle of displaying the data and the interrupt occurs to display the data?" Is this a displaying order problem? For instance, when main() is in the middle of displaying page 1, timer 0 interrupt fires and an user wants to see page 2. After the interrupt is done page 2 is on the screen already, execution goes back to main() and continue displaying page 1 (the old job, before the interrupt). This is the major problem of my project structure. I am wondering what if I can somehow make the execution not to run the old job after the interrupt. Is it possible to do that in c level? I need help on this "how". If not maybe I need to re-construct my entire program.

    chao.

Children
  • "maybe I need to re-construct my entire program"

    That would seem to be your solution.

    Despite the fact that Jon sees it as a software cludge I'd still recommend setting a flag in your ISR and doing the 'real' work from main. If nothing else, you'll find this a lot easier to maintain when you look at your code again in a couple of years time.

    Stefan

  • Despite the fact that Jon sees it as a software cludge I'd still recommend setting a flag in your ISR and doing the 'real' work from main.

    Well, I see EVERYTHING as a software kludge!

    If the ISR is already implemented and working, I'd lean more towards setting the interrupt request flag in the main program and letting the ISR handle things. I think this is less code, does not require a flag or other variables, and has fewer design issues than checking a flag in the main loop. Note that doing real work in an ISR is not my first choice either.

    As far as making the display function reentrant...if it is invoked from the main program and, while displaying, is invoked by the ISR, the display may show strange stuff (the first part displayed by main, the whole info displayed by the ISR, and the last part displayed by main). Is this a problem?

    This is why I suggest disabling the ISR when making the call to the display routine from the main program.

    Jon