We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I have a overlay problem: I've got one function who is called from main and from my interrupt service routine. When the interrupt calls the function my local variables point to an indefinite adress. I have the problem however I deactivate overlaing. My programm:
void main (void) { ... eventChannelPtr = XSDevice_GetEventChanByID( &XSIM_DeviceGroups, groupID, chanID)} } void task_1ms(void) interrupt 1 using 1 { ... eventChannelPtr = XSDevice_GetEventChanByID( &XSIM_DeviceGroups, groupID, chanID); } tXSEvent_ChannelPtr XSDevice_GetEventChanByID( tXSDevice_DeviceEntry* deviceEntryPtr, tXS_Group groupID, tXS_Channel chanID) { tXSEvent_SourcePtr eventSrcEntry; tXSEvent_ChannelPtr retVal; ... eventSrcEntry = &deviceEntryPtr->eventListPtr[groupID]; }
I've got one function who is called from main and from my interrupt service routine. Is the function reentrant ? I do not see the reentrant keyword in the source code, and from the list of parameters I would guess that the function is not intrinsically reentrant.
the eventSrcEntry is at D:0x01. D:0x01 is register R1 in register Bank 1. Do you expect eventSrcEntry to keep its value after the function returns until the next call ?
I have the problem however I deactivate overlaing. Deactivating overlaying only stops different functions from using the same memory address for their local variables. It does nothing to prevent reentrant calls to the same function from using the same memory address for each reentrant call, that is what the reentrant keyword is for.
My function is called 3 times at main (interrupts are disabled). Then the main is in a while(1) and only my interrupt use the function. But with the keyword reentrant the problem is solved. Do you expect eventSrcEntry to keep its value after the function returns until the next call ? No I don't expect this. My function get mi an adress (of an global variable) as return value and I don't work with eventSrcEntry.
Right here:
void task_1ms(void) interrupt 1 using 1
Thanks a lot, using 1 was the problem
Maybe... Besure that the compiler is not pushing the whole register bank when the interupt is called. that is what the using R# prevents.
Thanks a lot, using 1 was the problem I doubt that very much. I think not using 1 properly was the problem. Erik