# Problme with CORTEX\_R4\_RM48\_TMS570\_CCS5 on TI Hercules RM48L950 HDK 

**URL:** <https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756>\
**Category:** Kernel\
**Created:** [June 5, 2014, 6:12am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756 "2014-06-05T06:12:14Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 5, 2014, 6:12am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/1 "2014-06-05T06:12:14Z")

</div>

**[zealhero](https://sourceforge.net/u/zealhero/)** wrote on [Thursday, June 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#6ceb):

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

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [June 5, 2014, 6:26am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/2 "2014-06-05T06:26:43Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, June 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#5edb):

Do you know which line the error:

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

is referring to?

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 5, 2014, 7:06am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/3 "2014-06-05T07:06:41Z")

</div>

**[zealhero](https://sourceforge.net/u/zealhero/)** wrote on [Thursday, June 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#801a):

Error occured at line 169, 183, 189, 199, 209, 219, 236, when it refered ‘portRESTORE\_CONTEXT’ or ‘portSAVE\_CONTEXT’.

Thanks

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [June 5, 2014, 7:35am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/4 "2014-06-05T07:35:59Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, June 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#6320):

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.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 5, 2014, 7:54am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/5 "2014-06-05T07:54:06Z")

</div>

**[zealhero](https://sourceforge.net/u/zealhero/)** wrote on [Thursday, June 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#b01c):

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.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [June 5, 2014, 8:17am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/6 "2014-06-05T08:17:27Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, June 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#6e9c):

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.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 5, 2014, 8:28am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/7 "2014-06-05T08:28:13Z")

</div>

**[zealhero](https://sourceforge.net/u/zealhero/)** wrote on [Thursday, June 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#ce7e):

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.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [June 5, 2014, 8:39am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/8 "2014-06-05T08:39:07Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, June 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#1c90):

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.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 5, 2014, 8:52am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/9 "2014-06-05T08:52:35Z")

</div>

**[zealhero](https://sourceforge.net/u/zealhero/)** wrote on [Thursday, June 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#3d8d):

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.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [June 5, 2014, 9:03am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/10 "2014-06-05T09:03:26Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, June 05, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#cc28):

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.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 8, 2014, 11:17pm UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/11 "2014-06-08T23:17:37Z")

</div>

**[zealhero](https://sourceforge.net/u/zealhero/)** wrote on [Sunday, June 08, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#9c5d):

Hi.

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

Thank you!

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [June 12, 2014, 11:02pm UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/12 "2014-06-12T23:02:05Z")

</div>

**[zealhero](https://sourceforge.net/u/zealhero/)** wrote on [Thursday, June 12, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#21f3):

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.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [June 13, 2014, 8:05am UTC](https://forums.freertos.org/t/problme-with-cortex-r4-rm48-tms570-ccs5-on-ti-hercules-rm48l950-hdk/2756/13 "2014-06-13T08:05:06Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Friday, June 13, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#1072):

> 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](https://sourceforge.net/p/freertos/discussion/382005/thread/7ba7f0d8/#cc28): 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.
