This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TIDM-02010: Error and warnings after enabling SFRA

Part Number: TIDM-02010
Other Parts Discussed in Thread: SFRA, C2000WARE

Hi,

I'm using the `C2000Ware_MotorControl_SDK_5_00_00_00 TIDM-02010 DMPFC 0013x` solution, and is currently trying out the SFRA module of the project, after enabling SFRA from compile definition, some errors and warnings have occurred.

I fixed the errors, but I can't solve the warnings, which makes me worry that the SFRA module isn't properly enabled and maybe broken.

What I've done to enable the SFRA module:

Compile Definition (Predefined Symbols) Changes:

```

DAC128S_ENABLE -> DAC128S_ENABLE_N

SFRA_ENABLE_N -> SFRA_ENABLE

```

I disabled DAC128S since it shares GPIO pins with SFRA

Code Changes to fix compile error:

These two errors occur after changing the compile definitions:

```

#20 identifier "GPIO_28_SCIRXDA" is undefined

#20 identifier "GPIO_29_SCITXDA" is undefined

```

To fix them, in file `sfra_settings.h`, I made these changes

```

diff --git a/src_control/drivers/include/sfra_settings.h b/src_control/drivers/include/sfra_settings.h
index 18d410c..c3d5d06 100644
--- a/src_control/drivers/include/sfra_settings.h
+++ b/src_control/drivers/include/sfra_settings.h
@@ -119,8 +119,8 @@ extern void configureSFRA(uint16_t plotOption, float32_t sfraISRFreq);
#define SFRA_GUI_SCIRX_GPIO 28
#define SFRA_GUI_SCITX_GPIO 29

-#define SFRA_GUI_SCIRX_GPIO_PIN_CONFIG GPIO_28_SCIRXDA
-#define SFRA_GUI_SCITX_GPIO_PIN_CONFIG GPIO_29_SCITXDA
+#define SFRA_GUI_SCIRX_GPIO_PIN_CONFIG GPIO_28_SCIA_RX
+#define SFRA_GUI_SCITX_GPIO_PIN_CONFIG GPIO_29_SCIA_TX

```

Warnings

With these changes, the project can compile without error.

However, three warnings still persist

```
#10247-D creating output section "SFRA_F32_Data" without a SECTIONS specification tidm_02010_dmpfc_0013x C/C++ Problem
#827-D specified symbol '_SFRA_F32_collect' undefined sfra_settings.h /tidm_02010_dmpfc_0013x/src_control/drivers/include line 60 C/C++ Problem
#827-D specified symbol '_SFRA_F32_inject' undefined sfra_settings.h /tidm_02010_dmpfc_0013x/src_control/drivers/include line 59 C/C++ Problem

```

Linker File Issues

While trying to solve these warnings, I found some weird problems with the linker file `src_device/f280013x_flash_lib.cmd`.

In its `.TI.ramfunc` section, the first library to link is `est_trajState_coff.lib` which isn't part of the project, but doesn't cause any error.

Then `sfra_f32_tmu_coff.lib` is also linked, but it also isn't part of the project, and also doesn't cause any error.

After removing the surrounding `#if defined(SFRA_ENABLE)` condition, the linker now finally complains it can't find the file during link.

But shouldn't the linker already be linking the file even with `#if defined(SFRA_ENABLE)`?

The file `sfra_f32_tmu_eabi.lib` is actually part of the project, so I changed the linked file from `x_coff.lib` to `x_eabi.lib`.

Now the project again compiles without error, but the warning still persist.

Disassemble

At this point I decided to try to actually run it with debugger.

With the debugger's help, I was able to break at the call site of `__SFRA_F32_collect` then disassemble and step into the function.

The function `__SFRA_F32_collect()` is actually located at address 0x0000A000` which according to the TSM320F2800137 datasheet should be the start of LS1 RAM.

Does that mean everything is all right? And SFRA should work correctly?

But then what doesn't those warnings actually mean?

I also noticed the warning mentioned `_SFRA_F32_xxx` instead of `__SFRA_F32_xxx` which has two leading underscore.

I'm at a complete loss at this point. Please help clarify on these questions:

1) Was my way of enabling SFRA correct?

2) Was my way of fixing the compile errors correct?

3) Why doesn't the linker files .lib file name match the .lib file included in the project? And does the linker file actually matter since it would compile even when the file names were incorrect.

4) How to fix these warnings?

Help would be greatly appreciated, thanks in advance.

  • Quick addition:

    I compiled with the original unmodified linker file and the disassembled `__SFRA_F32_collect` function is now located at 0x008cb35 which is flash.

    Hope this gives more insight.

  • Hello Ethan,

    After removing the surrounding `#if defined(SFRA_ENABLE)` condition, the linker now finally complains it can't find the file during link.

    But shouldn't the linker already be linking the file even with `#if defined(SFRA_ENABLE)`?

    This is a pre-processor instruction, so it relies on constant values to determine what to compile the code to. For that reason, unless the condition is true then nothing inside is built into memory (although there are still syntax checks I believe). I will let an expert on the SFRA help support the rest of your questions.

    Best regards,

    Omer Amir

  • Hi Omer,

    I realized there's a separate pre-defined preprocessor macro for linker that is not affected by the compiler pre-defined symbol. And within there is indeed a separate `SFRA_ENABLE_N` definition.

    But after I changed it to `SFRA_ENABLE`, the link process behaved just like when I removed the condition and the project failed to compile with error `cannot find file "sfra_f32_tmu_coff.lib"`.

  • Hi Ethan,

    Can you correct me if I am wrong. So, your goal is to use SFRA library for TIDM-2010 imported from C2000_MCSDK_5_00 and when you are building you found errors related to SFRA. Can you share the snippet of those errors, because I have repeated the same process and unable to see any errors/warnings.

    Thanks & Regards,

    Shashank

  • Ethan,

    I understood the problem. Yes, your way of resolving is correct.

    1. Changing predefined symbol SFRA_ENABLE_N -> SFRA_F32_ENABLE

    2. GPIO_28_SCIA_RX and GPIO_28_SCIA_TX change in sfra_settings.h

    3. tmu_eabi.lib change in flash_lib.cmd

    Now you are mentioning warnings are present. Can you add one more change in sfra_settings.h

    #pragma CODE_SECTION(__SFRA_F32_inject, ".TI.ramfunc");
    #pragma CODE_SECTION(__SFRA_F32_collect, ".TI.ramfunc");

    instead of 


    #pragma CODE_SECTION(_SFRA_F32_inject, ".TI.ramfunc");
    #pragma CODE_SECTION(_SFRA_F32_collect, ".TI.ramfunc");

    Thanks & Regards,

    Shashank

  • Ethan,

    For SFRA_F32_Data warning to be removed, you need to add following line in xxx_flash_lib.cmd at sections part after codestart line

           SFRA_F32_Data : > RAMLS0D, ALIGN = 64

    I think these will solve errors and warnings. Let me know if you face any issues.

    Thanks & Regards,

    Shashank

  • Is it also required to change the linker pre-define preprocessor macro `SFRA_ENABLE_N` to `SFRA_ENABLE`?

    Without it, the actual code seems to be executing from flash instead of ram

    Also, does the position of the line `SFRA_F32_Data : > RAMLS0D, ALIGN = 64` matter?

  • Ethan,

    It is required to change pre-defined symbol to "SFRA Enable" for enabling SFRA.

    You can add line after ".codestart" as in snippet of project_folder/src_device/f280013x_flash_lib.cmd.

    Regards,

    Shashank