flop.c fail after cache enable

zhuchunxia wrote on Monday, July 18, 2016:

Hi:

when I enable data cache, flop.c fails in float data calculate. but it is correct when I disable cache.
I found vCompetingMathTask3 and vCompetingMathTask4 malloc a memory space to save result. and those result changes in malloced memory sometimes… but vCompetingMathTask1 and vCompetingMathTask2 never fails in both cache enable or disable… anyone can help ?

Vincent

davedoors wrote on Monday, July 18, 2016:

Which port? Sometimes you must call portTASK_USES_FLOATING_POINT() in a task before it uses floating point instructions.

zhuchunxia wrote on Monday, July 18, 2016:

my cpu is a special cpu which is not in demo project… I don’t see flop.c call portTASK_USES_FLOATING_POINT() the API ? how to port the API ? is there a example ?

zhuchunxia wrote on Monday, July 18, 2016:

anyway, I am alwaysing use soft float point… there is no FPU inside

rtel wrote on Monday, July 18, 2016:

If you are using soft floating point, then the floating point routines
are just C function, so there should be no difference in behaviour when
you call a C function that is not using floating point instructions to
one that is using floating point instructions.

Maybe the floating point emulation functions are using a lot of stack -
do you have stack overflow checking switched on? As this is your own
port, are you absolutely sure the tack overflow checking is working? Is
your port saving and restoring all the processor’s special purpose
registers correctly? Are the floating point emulation functions thread
safe?

zhuchunxia wrote on Monday, July 18, 2016:

before cache off, all demo common example run smoothly and work well … but after cache on, I only found flop.c fail so far… I enable #define configCHECK_FOR_STACK_OVERFLOW 1 in config file…

Are the floating point emulation functions thread safe?
what does it mean ? I only call vStartMathTasks to create 8 task to run floadting point function and check it with another task … I also dump all tasks stack status and do not find any overflow in stack.

rtel wrote on Monday, July 18, 2016:

Are the floating point emulation functions thread safe?

what does it mean ?

If you do not have a floating point unit then the compiler will generate
a function call for each floating point operation. Are the functions
inserted by the compiler safe to call from more than one thread of
execution at a time? If they use global variables or shared buffers
then they won’t be.