Part Number: TMS320F28386S
Tool/software:
Hello all,
Problem statement:
I am currently working on an application that, among others, features the following code structure:
// File interface.h #pragma FUNC_ALWAYS_INLINE(some_function) void some_function(uint16_t some_argument);
//File interface_implementation.c
#include "interface.h"
void some_function(uint16_t some_argument)
{
// Some code that interacts with HW registers via pointers to volatiles
// have also tried with code that does not access HW registers at all and also does not work
}
// File user_file.c
#include "interface.h"
#pragma INTERRUPT(user_isr)
static void user_isr(void)
{
uint16_t argument = 10U;
some_function(argument);
// ISR flag handling etc..
}
My goal is to inline the some_function function call in the user_isr interrupt without having to use static inline on some_function . This way it is not needed to expose all internals of the some_function implementation. Given that the file user_file.c only sees the declaration of some_function but not its implementation I rely on the linker inlining the some_function function call. According to the document SPRU514Z Chapter 2.11 the linker should be capable of inlining functions. Please correct me if I am wrong on that and there are other ways to go around this.
By taking a look at the dissassembled output file it can be seen that an LCR instruction is used to call some_function thereby confirming that it did not get inlined.
Things that were tested (but did not solve the problem):
I've taken a look at the SPRU514Z document on how this can be done and I've come up with the following try (which in my case does not work):
- CGT version: ti-cgt-c2000_20.2.1.LTS
- #pragma FUNC_ALWAYS_INLINE(some_function) right before the function declaration.
- Compiler flags: --opt_level=4 --opt_for_speed=5
- Linker flags: --opt_level=4 --opt_for_speed=5 (although I think it does not apply for the linker)
Additionally I've seen that in section 2.11.2 of SPRU514Z it is mentioned that inlining will not be done in a situation where it is "difficult" for the compiler to do so. Unless I missed something, I am not doing any of those. The "is not declared inline bulletpoint ..." is making me doubt although I tried explicitly using the inline keywork and it did not help.
I am for sure missing something but I do not see what it is. Could you please help me with this issue? In case you need further information I'll happily try to provide it.
Thanks a lot in advance for your help,
Best regards,
Francesc