This problem is associated with enabling separate data and instruction spaces in Dynamic C 8.61 for RCM3200.
When I compile the program to flash and run it, no issues in program execution. If I execute the program after selecting “Enable separate instruction and data spaces”(found in Dynamic C IDE Options>Project Options>Compiler Tab), code gets compiled smoothly but leads to abnormal execution i.e, at a particular point of function call in the code, an argument(passed by value) does not retain the value in its scope, causing all the fuss. Suspecting stack overflow, I monitored stack pointer in the concerned function. It remained same in all cases.
In Dynamic C user manual 19.4.2 (http://www.rabbit.com/documentation/docs/manuals/DC/DCUserManual/index.htm), options available for increasing root data space are mentioned.
1. Enabling separate instruction and data space.
2. Decrease DATAORG macro(defined in RABBITBIOS.C) value to increase root data space.
Accordingly, I tested for 3 cases.
Case I: Disable separate instruction and data space(Program runs properly).
Case II: Enable separate instruction and data space(Program goes awry).
Case III: Change DATAORG macro value from 0x3000 to 0x2000(I doubt if this affects the stack size).
By changing DATAORG macro, XMEM code locations change. Rest all remain the same.
Stack location and Stack pointer at critical point of the code have been same in all cases and values were…
Stack Pointer: DE37
Differences created by enabling and disabling separate data and instruction spaces are:.
Root Code: <0000> <30EC> <30ED>
XMEM code: <0D000> <30AEE> <23AEE>
Watch code: <01FF>
Root data: <7369> <5C97>
Total code size: 158684 bytes
Total data size: 23703 bytes
Root Code: <0000> <47BE> <47BF>
XMEM code: <06000> <26A48> <20A48>
Watch code: <01FF>
Root data: <7177> <5A89>
Total code size: 152072 bytes
Total data size: 23177 bytes
I haven’t been able to figure out the cause for this problem. I seek help from any forum members in this regard.