tp Initialization for new task (RH850/V850)

d0miller wrote on Thursday, January 11, 2018:

Can anyone explain to me why the tp/R05 register is initialized to 0x55555555 for newly created tasks, by pxPortInitialiseStack() in port.c in Source\portable\IAR\V850ES (9.0.0)?
Is there any reason tasks should use a different tp value than that initialized at system startup?

After considerable experimenting and tweaking, I got multitasking working with the original value initialized for new processes. I then added Bull’s Eye Coverage, which reads word values from memory based on tp. Since tp is odd, it generates a Misalignment exception and crashes multitasking.

I commented out the instruction that sets tp in portRESTORE_CONTEXT, so that tasks keep the same tp as system, to test. Multitasking is again functioning properly, but I’m concerned that there may have been a reason to use different tp for tasks.

rtel wrote on Thursday, January 11, 2018:

Sorry, but I’m not following completely. The only place I can find
0x55555555 used in the port is on line 115 of port.c here

That sets R05 to a known value at the time the task is created only,
which is only done assist development in that it enables the developer
to check the expected value ends up in the expected register. The
values is actually arbitrary and could be anything.

Does something need to be changed?