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.