Bootloader: C:0x0000 - C:0x7FFF Manages CAN-Communication and in-field update. Application C:0x8000 - C:0xEFFF Applications is controlled with bootloader over CAN 2.0. Compiled both seperatly and merge the Hex-file. Interrupts and function calls work. At level of 8 successive funtions calls the acces to an struct in Applications XDATA mem is incorrect. The expected pointer is not given. Any adwise?
Same problem on lower level. The struct i want to access is global for this modul. i do something like this:
tXSEvent_ChannelPtr XSDevice_GetEventChanByID( tXSDevice_DeviceEntry* deviceEntryPtr, tXS_Group groupID, tXS_Channel chanID) { xdata tXSEvent_SourcePtr eventSrcEntry; xdata tXSEvent_ChannelPtr retVal; char temp[0x06]; retVal = (tXSEvent_ChannelPtr)0x0000; InitUart(); SendUart(0x05," dEP:"); sprintf(temp,"%p", deviceEntryPtr); SendUart(0x06,temp); if(0x00 != deviceEntryPtr) { /* check if group id is supported */ if( groupID < deviceEntryPtr->numEvents ) { eventSrcEntry = &(deviceEntryPtr->eventListPtr[groupID]); SendUart(0x04," eSE"); sprintf(temp,"%p",&(deviceEntryPtr->eventListPtr[groupID])); SendUart(0x06,temp); /* zero pointer check. */ if((0x00 != eventSrcEntry)) { /* check if channel is supported for the group */ if(chanID < eventSrcEntry->numChannels) { retVal = &(eventSrcEntry->channelListPtr[chanID]); SendUart(0x03,"-1-"); } } } } SendUart(0x03," rV"); sprintf(temp,"%p",retVal); SendUart(0x06,temp); return retVal; }
<dEP Pointer is correct. At eSE is the error. Ah. So the pointer does get passed correctly, and becomes corrupted later on. That is a different can of worms entirely, and would point more towards a problem with the call tree, i.e. the pointer gets stored in a memory location and is later overwritten. pre>tXSDevice_DeviceEntry* deviceEntryPtr If this is always a pointer to a location in xdata memory, it is a waste to use a generic pointer.
tXSDevice_DeviceEntry xdata * deviceEntryPtr
(Ok, I hope I got the formatting correct this time) dEP Pointer is correct. At eSE is the error. Ah. So the pointer does get passed correctly, and becomes corrupted later on. That is a different can of worms entirely, and would point more towards a problem with the call tree, i.e. the pointer gets stored in a memory location and is later overwritten.
tXSDevice_DeviceEntry* deviceEntryPtr
typedef struct _XSIMDEVICE { tXS_UINT8 numEvents; /**< Event entry count for the device.*/ tXS_UINT8 groupCount; /**< Group entry count for the device.*/ tXSEvent_SourcePtr eventListPtr; /**< Event group pointer. */ struct _XSIMDEVICEGROUPINFO groupList[0x10u]; /**< Pointer to list of group entries. */ } tXSDevice_DeviceEntry;
typedef xdata struct _XSIMDEVICE { tXS_UINT8 numEvents; /**< Event entry count for the device.*/ tXS_UINT8 groupCount; /**< Group entry count for the device.*/ tXSEvent_SourcePtr eventListPtr; /**< Event group pointer. */ struct _XSIMDEVICEGROUPINFO groupList[0x10u]; /**< Pointer to list of group entries. */ } tXSDevice_DeviceEntry;
A lot of Linker Errors with different Datatypes and Unresolved Externals. I guess you will have to hunt down all declarations of the function and change them accordingly. However, this was just something I noted on the side. The cause for your problem is most likely related to the call tree. Read the application note and the chapter in the linker's documentation.
I disabled NOOVERLAY to get a call tree in my map-file. But the calling tree of the application is empty. Perhaps it's a problem with my startup-code and linker-script inside application-project.