Hi
I m using XTC 14.4.1 and I have a problem with the constrains checker which prevent me to deliver a new version...need help!
considering I have 2 tasks running on tile 0 and launched in main()
task A is using a par statement like this:
taskA() {
if (conditiona)
par { taskA_1(); taskA_2(); }
else
par { taskA_1(); taskA_2(); taskA_3(); }
}
so task A uses either 2 cores or potentially 3 depending on conditiona
task B is using a similar par statement like this:
taskB() {
if (conditionb)
par { taskB_1(); taskB_2(); taskB_3(); taskB_4(); taskB_5(); }
else
par { taskB_1(); taskB_2(); taskB_3(); taskB_4(); taskB_5(); taskB_6();}
}
so task B uses either 5 cores or potentially 6 depending on conditionb
the constrains checker say I m using 9 cores and print FAILED.
I have good reason to declare my tasks and sub tasks in this way, AND I am 100% sure that the combinaison of conditiona and conditions will never bring an overload to 9 cores.
what can I do to fool the constraint checker....?
I ve tried putting a asm volatile(".set taskB.maxcores,5"); somewhere but obviously the linker see an error of duplicate defined label...
need a way to solve this please ! is it possible de de-activate the checker ?
Thanks
PROBLEM with constrains check
-
- Respected Member
- Posts: 270
- Joined: Mon Jan 08, 2018 4:14 pm
-
- Respected Member
- Posts: 270
- Joined: Mon Jan 08, 2018 4:14 pm
okay I found a trick...
declare the symbol taskB.maxcores as weak in the file where it is declared, with this statement:
asm volatile(".weak taskB.maxcore");
then in another file, override the value with
asm volatile(".set taskB.maxcores,5");
compiler XC happy, linker happy, constrains now show the max 8 instead of 9
declare the symbol taskB.maxcores as weak in the file where it is declared, with this statement:
asm volatile(".weak taskB.maxcore");
then in another file, override the value with
asm volatile(".set taskB.maxcores,5");
compiler XC happy, linker happy, constrains now show the max 8 instead of 9
-
- Respected Member
- Posts: 270
- Joined: Mon Jan 08, 2018 4:14 pm
Hi
a much better and reliable solution is to create a trampoline function (in assembly) and defining the .maxcores and .maxtimers as wathever instead of the normal value...
and then call the "trampoline" instead of the original "function_par"
so simple but sometime not obvious!
a much better and reliable solution is to create a trampoline function (in assembly) and defining the .maxcores and .maxtimers as wathever instead of the normal value...
Code: Select all
trampoline:
bu function_par
.set trampoline.maxcores, 1
.set trampoline.maxtimers, 0
.set trampoline.maxchanends, function_par.maxchanends
.set trampoline.nstackwords, function_par.nstackwords
.global trampoline.maxcores
.global trampoline.maxtimers
.global trampoline.maxchanends
.global trampoline.nstackwords
so simple but sometime not obvious!