FreeRTOS port using Green hills compiler (Cortex R5F)

armaank wrote on Thursday, August 09, 2018:

I have a working FreeRTOS project in Code Composer Studio on a TI RM57 processor. I am attempting to port that into the Green hills compiler and am running into an issue with the software interrupts.

[elxr] (error #412) unresolved symbols: 5
vPortDisableInterrupts from os_event_groups.o
vPortEnterCritical from os_event_groups.o
vPortExitCritical from os_event_groups.o
prvRaisePrivilege from os_mpu_wrappers.o
vPortYield from os_tasks.o

[elxr] (error) errors during processing
Error: build failed
Build failed (Thu Aug 09 11:37:06 2018)

These symbols are all defined in os_portmacro.h under the #pragma SWI_ALIAS which I believe is where the problem lies. For example,

#ifdef cplusplus
#pragma SWI_ALIAS(5)
#else
#pragma SWI_ALIAS(vPortDisableInterrupts, 5)
#endif
extern void vPortDisableInterrupts( void );

Is there another way to handle these software interrupts without using SWI_ALIAS, since I do not think Greenhills has this functionality?

armaank wrote on Thursday, August 09, 2018:

I found a page in the Green hills manual that may be useful:

SWI Exception Functions

You can place the __swi(value) keyword in the declaration of a function to indicate that it should be called by an exception rather than a branch, using the SWI instruction. This syntax may be used in either ARM mode (with a range of 24 bits) or Thumb mode (with a range of 8 bits).

A function declared with the __swi keyword is not itself a top level interrupt handler; it is a function that is expected to be called by a separate SWI interrupt handler when the matching value field is detected. A top level SWI interrupt handler intended to dispatch different exception values can be declared with #pragma intvect or it may already be initialized outside the program. A function declared with the __swi keyword might have parameters or a non-void return value. The SWI interrupt handler must be written in assembly to properly pass the values through.

I tried implementing it with this syntax but it made no difference.

rtel wrote on Friday, August 10, 2018:

I’m afraid I’m not familiar with the Greenhills compiler. Is it
possible (just guessing) that the compiler sees the functions are never
called so removes the symbols? In GCC you would get around that using
the attribute((“keep”)) (forget actual syntax) function decoration.