Hi, all.
My platform is am1705 (CCS5.1.1; SYS/BIOS 6_33_02_31; Win7*64bit)
I need a preemptive multitasking at SYS/BIOS.
I use example from spruex3k (3.5.6 Task Yielding).
New SYS/BIOS project + copy-paste the source code gives me three different results.
I decided the problem is a modification of stack during the switching of tasks.
I tried to guard the System_printf by the pair "Task_disable" + "Task_enable". Result is the same (damaged).
The only way is to protect the application from crash is to remark "Task_yield" call.
My question is: how to implement the preemptive multitasking?
It is possible to increment the "numTimes" in the "hiPriTask" to increase the probability of error.
1) Correct result like
Task 0: time is 0
Task 0: time is 1
Task 0: time is 2
Task 0: time is 3
Task 1: time is 4
Task 1: time is 5
Task 1: time is 6
Task 1: time is 7
hiPriTask here
...
2) Sometime I can see the result like this:
Task 2: time is 44
Task 2: time is 45
Task 2: time is 46
Task 2: time is 47
hiPriTask here
Task -1047245608: time is 48
Task -1047245608: time is 49
Task -1047245608: time is 50
Task -1047245608: time is 51
Task 1: time is 52
Task 1: time is 53
Task 1: time is 54
Task 1: time is 55
3) Sometime the result is:
Task 1: time is 52
Task 1: time is 53
Task 1: time is 54
Task 1: time is 55
Exception occurred in ThreadType_Task.
Task handle: 0xc00061a8.
Task stack base: 0xc00061f0.
Task stack size: 0x2000.
R0 = 0x00000000 R8 = 0xffffffff
R1 = 0x00000000 R9 = 0xffffffff
R2 = 0x016e3600 R10 = 0xffffffff
R3 = 0xc1944cd8 R11 = 0xffffffff
R4 = 0xffffffff R12 = 0x6000005f
R5 = 0xffffffff SP(R13) = 0xc00081c0
R6 = 0xffffffff LR(R14) = 0xc1944d50
R7 = 0xffffffff PC(R15) = 0xc194d274
PSR = 0x200000df
ti.sysbios.family.arm.exc.Exception: line 174: E_dataAbort: pc = 0xc194d274, lr = 0xc1944d50.
xdc.runtime.Error.raise: terminating execution