Problme with CORTEX_R4_RM48_TMS570_CCS5 on TI Hercules RM48L950 HDK

zealhero wrote on Thursday, June 05, 2014:

Hi.
I have tried using FreeRTOS 2 ways.
First way. using ‘CORTEX_R4_RM48_TMS570_CCS5’ in FreeRTOS8.0 on HDK(RM48L950, TI).
Second way. I make a new project with HALCoGen(RM48L950ZWT_FREERTOS) and change OS files, because those files already exist are version 7.4. So I make a project and change to 8.0 files.

But there are some errors in those ways…

Situation 1.
CCS(Code Composer Studio) 5.5
compiler version: TI v5.1.1
Runtime support library: rtsv7R4_T_le_v3D16_eabi.lib(Thumb mode)

There are 7 same errors when I build that project.
“[E0004} Operand must be a” in ‘portasm.asm’

Situation 2.
CCS(Code Composer Studio) 5.5
compiler version: TI v4.9.7
Runtime support library: rtsv7R4_A_le_v3D16_eabi.lib(Arm mode)

There are 6 errors as follows when I build it…

unresolved symbol vPortSWI, first referenced in sys_intvecs.obj
unresolved symbol vApplicationTickHook, first referenced in os_tasks.obj
unresolved symbol vApplicationStackOverflowHook, first referenced in os_tasks.obj
unresolved symbol vApplicatioinmallocFailedHook, first referenced in os_heap.obj
unresolved symbol vApplicationIdleHook, first referenced in os_tasks.obj
unresolved symbol __clz, first referenced in os_tasks.obj

How can I resolve this problem…
Those problems are exist both 2 ways. A difference of those situation is compiler and Runtime Library.

If you need more information. Please tell me…

Regards.

I want use

rtel wrote on Thursday, June 05, 2014:

Do you know which line the error:

“”[E0004} Operand must be a" in ‘portasm.asm’"

is referring to?

Regards.

zealhero wrote on Thursday, June 05, 2014:

Error occured at line 169, 183, 189, 199, 209, 219, 236, when it refered ‘portRESTORE_CONTEXT’ or ‘portSAVE_CONTEXT’.

Thanks

rtel wrote on Thursday, June 05, 2014:

Those lines are macros, which themselves contain multiple lines of assembler code. I suspect the problem is related to a compiler version difference, and we need to determine which lines within those macros are causing the problem. Unfortunately I have just switched computers and don’t have CCS installed yet to look.

You will see the portRESTORE_CONTEXT definition within the same portASM.asm assembler file. Can you replace one of the calls to the portRESTORE_CONTEXT macros with the code from the macros definition (so comment out the call to portRESTORE_CONTEXT in one place and paste in the code from and including lines 67 to 116 - line numbers taken from an unmodified V8.0.1 version of the file). Once you have done that try compiling again and this time the line numbers will tell us the offending instructions.

Regards.

zealhero wrote on Thursday, June 05, 2014:

You maybe confused portRESTORE_CONTEXT and portRESOTRE_SAVE.
67 to 116 line is portRESOTRE_SAVE.
So I replaced portRESTORE_SAVE to 67 ~ 116 line and portRESTORE_CONTEXT to 125~160.
That result is…
Error occurred at line 104(context), 140(save).
Those lines are same, BEQ PC+3

Regards.

rtel wrote on Thursday, June 05, 2014:

Ok - so this does look like this is a problem introduced by a compiler update. If it was GCC it would be easy to fix with a relative label, but I’m not sure if CCS has that capability, so lets try removing the branch altogether and instead use condition codes on the instructions. Please try the following:

In portSAVE_CONTEXT replace the lines:

BEQ PC+3
FSTMDBD LR!, {D0-D15}
FMRX R1, FPSCR
STMFD LR!, {R1}

with

FSTMDBDNE LR!, {D0-D15}
FMRXNE R1, FPSCR
STMFDNE LR!, {R1}

Likewise in port RESTORE_CONTEXT replace the lines (note I have removed the comment):

BEQ PC+3
LDMFD LR!, {R0}
FLDMIAD LR!, {D0-D15}
FMXR FPSCR, R0

with

LDMFDNE LR!, {R0}
FLDMIADNE LR!, {D0-D15}
FMXRNE FPSCR, R0

Please ensure to report back your findings even if this fixes your problem.

Regards,
Richard Barry.

zealhero wrote on Thursday, June 05, 2014:

Wow. It’s a really cool. Errors are disappeared.
But there are some new warnings… [W0005] A conditional VMRS.
is it OK?

Thank you so much!

Regards.

rtel wrote on Thursday, June 05, 2014:

I’m not sure about the warning. Is it on the lines we just changed?

The VMRS instruction is not used directly in the assembly code, but it is possible that FSTMD (which is used) is a pseudo instruction for VMRS. However, it is valid to put a condition code on a VMRS instruction too - so I’m not sure why it is generating a warning.

Does the code actually run without error?

I will have to look at it in more detail as to why it thinks it merits a warning.

Regards,
Richard Barry.

zealhero wrote on Thursday, June 05, 2014:

Yes. it is on the lines we changed. But only 3 which is portSAVE_CONTEXT.
So I replaced it by previous method. warning occure at ‘FMRXNE R1, FPSCR’

They are just warning. So it maybe operate. But another error occured when it was resolved.
I will try resolve it. And I’ll comeback to this forum if i cannot solve it…
Really thanks!

Regards.

rtel wrote on Thursday, June 05, 2014:

A little more digging reveals the instruction is valid. The compiler is warning that some ARM cores have a bug that makes the instruction unreliable. I have no idea if TI chips are effected or not, but best to avoid the instruction I think.

Think again…

Try this. Please revert the changes you made, so you are back with the original code (sorry to mess you around!) and this time replace the

BEQ PC+3

with

BEQ $+16

Does that compile and run ok?

Regards,
Richard Barry.

zealhero wrote on Sunday, June 08, 2014:

Hi.

I tried it what you suggest. VMRS error is disappeared.

Thank you!

Regards.

zealhero wrote on Thursday, June 12, 2014:

I have some questions related with this issue.

  1. What is the reason of this error?
    I downloaded this DEMO on FreeRTOS website, and just build it. not fixed.
    Demo has wrong code or my system environment(CCS, compiler, etc.) has problem?

  2. How can you resolve it?
    Unfortunately, I don’t know assembly codes… so I cannot understand what you did for this error.

Please explain it
Thanks

Regards.

rtel wrote on Friday, June 13, 2014:

  1. What is the reason of this error?

A change in the way the compiler handles assembly language since the demo was created.

I downloaded this DEMO on FreeRTOS website, and just build it. not fixed.

That is because discussing it in the forum and finding a solution does not retrospectively fix code that has already been released.

  1. How can you resolve it?

At the risk of repeating exactly what is said in this post above: Find the file FreeRTOS/Source/portable/CCS/ARM_Cortex-R4/portasm.s, find the two occurrences of the line “BEQ PC+3” and replace with the line “BEQ $+16”.

Regards.