Other Parts Discussed in Thread: C2000WARE
Hi,
I have some trouble to add the "FlashAPI_F28002x_FPU32.lib" to the universal motor control project from the MotorControl SDK.
As a start, I used the settings from "C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\driverlib\f28002x\examples\flash" to include the library,
which contains the following steps:
Add linked resources for the flash API
Add the FlashAPI_INCLUDE directory:
Add the file search path for the library:
Add the FlashAPI_F28002x_FPU32.lib in the linker script:
Add the FlashAPI_F28002x_FPU32.lib to the project by copying it in the project location:
I can now build the project as it is, but I get the following warning in the linker script for the FlashAPI_F28002x_FPU32.lib:
Here is my linker script:
/*
// FILE: f28002x_flash_lib_is_eabi.cmd
//
// TITLE: Linker Command File For F280025 examples that run out of Flash
//
//
// Keep in mind that L4, L5,L6 and L7 are protected by the code
// security module.
//
// What this means is in most cases you will want to move to
// another memory map file which has more memory defined.
//
*/
MEMORY
{
BEGIN : origin = 0x00080000, length = 0x00000002
BOOT_RSVD : origin = 0x00000002, length = 0x00000126
/* RAMLS5 : origin = 0x0000A800, length = 0x00000800 */
/* RAMLS6 : origin = 0x0000B000, length = 0x00000800 */
/* RAMLS7 : origin = 0x0000B800, length = 0x00000800 */
RAMLS567 : origin = 0x0000A600, length = 0x00001A00
/* Flash sectors */
/* BANK 0 */
/* FLASHBANK0_SECT0 : origin = 0x00080002, length = 0x00000FFE */
FLASHBANK0_BOOT : origin = 0x00080002, length = 0x00000FFE /* remote update */
/* FLASHBANK0_SECT1 : origin = 0x00081000, length = 0x00001000 */
/* FLASHBANK0_SECT2 : origin = 0x00082000, length = 0x00001000 */
/* FLASHBANK0_SECT3 : origin = 0x00083000, length = 0x00001000 */
/* FLASHBANK0_SECT4 : origin = 0x00084000, length = 0x00001000 */
/* FLASHBANK0_SECT5 : origin = 0x00085000, length = 0x00001000 */
/* FLASHBANK0_SECT6 : origin = 0x00086000, length = 0x00001000 */
/* FLASHBANK0_SECT7 : origin = 0x00087000, length = 0x00001000 */
/* FLASHBANK0_SECT8 : origin = 0x00088000, length = 0x00001000 */
/* FLASHBANK0_SECT9 : origin = 0x00089000, length = 0x00001000 */
/* FLASHBANK0_SECT10 : origin = 0x0008A000, length = 0x00001000 */
/* FLASHBANK0_SECT11 : origin = 0x0008B000, length = 0x00001000 */
/* FLASHBANK0_SECT12 : origin = 0x0008C000, length = 0x00001000 */
/* FLASHBANK0_SECT13 : origin = 0x0008D000, length = 0x00001000 */
FLASHBANK0_CODE : origin = 0x00085000, length = 0x00008000 /* control code */
/* FLASHBANK0_SECT14 : origin = 0x0008E000, length = 0x00001000 */
FLASHBANK0_DATA : origin = 0x0008D000, length = 0x00001000 /* constant data */
FLASHBANK0_SECT15 : origin = 0x0008F000, length = 0x000FF0
FLASHBANK0_SEC15_RSVD : origin = 0x08FFF0, length = 0x000010 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
BOOTROM : origin = 0x003F0000, length = 0x00008000
BOOTROM_EXT : origin = 0x003F8000, length = 0x00007FC0
RESET : origin = 0x003FFFC0, length = 0x00000002
RAMM0S : origin = 0x00000128, length = 0x00000118 /* stack, on-chip RAM block M0 part */
RAMM1D : origin = 0x00000240, length = 0x000005B8 /* on-chip RAM block M0 part & M1 */
RAMM1_RSVD : origin = 0x000007F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
RAMGS0 : origin = 0x0000C000, length = 0x000007F8
RAMGS0_RSVD : origin = 0x0000C7F8, length = 0x00000008 /* Reserve and do not use for code as per the errata advisory "Memory: Prefetching Beyond Valid Memory" */
RAMLS4 : origin = 0x0000A000, length = 0x00000600
}
SECTIONS
{
.reset : > RESET, TYPE = DSECT
codestart : > BEGIN, ALIGN(8)
.text : > FLASHBANK0_CODE, ALIGN(8)
.cinit : > FLASHBANK0_CODE, ALIGN(8)
.switch : > FLASHBANK0_CODE, ALIGN(8)
.cio : > FLASHBANK0_CODE
.pinit : > FLASHBANK0_CODE, ALIGN(8)
.const : > FLASHBANK0_CODE, ALIGN(8)
.init_array : > FLASHBANK0_CODE, ALIGN(8)
GROUP
{
#if defined(SFRA_ENABLE)
.TI.ramfunc
{
-l sfra_f32_tmu_eabi.lib<sfra_f32_tmu_collect.obj> (.text)
-l sfra_f32_tmu_eabi.lib<sfra_f32_tmu_inject.obj> (.text)
}
#else
.TI.ramfunc
{ -l FlashAPI_F28002x_FPU32.lib}
#endif
ramfuncs
/* Digital Controller Library functions */
dclfuncs
dcl32funcs
} LOAD = FLASHBANK0_CODE
RUN = RAMLS567,
LOAD_START(RamfuncsLoadStart),
LOAD_SIZE(RamfuncsLoadSize),
LOAD_END(RamfuncsLoadEnd),
RUN_START(RamfuncsRunStart),
RUN_SIZE(RamfuncsRunSize),
RUN_END(RamfuncsRunEnd),
ALIGN(2)
ctrlfuncs : {
}
LOAD = FLASHBANK0_CODE
RUN = RAMLS567,
LOAD_START(ctrlfuncsLoadStart),
LOAD_SIZE(ctrlfuncsLoadSize),
LOAD_END(ctrlfuncsLoadEnd),
RUN_START(ctrlfuncsRunStart),
RUN_SIZE(ctrlfuncsRunSize),
RUN_END(ctrlfuncsRunEnd),
ALIGN(2)
.stack : > RAMM0S
.bss : > RAMM1D
.bss:output : > RAMM1D
.bss:cio : > RAMM1D
.data : > RAMM1D
.sysmem : > RAMM1D
est_data : > RAMLS4
}
SECTIONS
{
prms_data : > FLASHBANK0_DATA
GROUP
{
user_data
foc_data
}
LOAD = RAMM1D
LOAD_START(ctrlVarsLoadStart),
LOAD_SIZE(ctrlVarsLoadSize),
LOAD_END(ctrlVarsLoadEnd)
GROUP
{
sys_data
ctrl_data
motor_data
}
LOAD = RAMGS0
LOAD_START(motorVarsLoadStart),
LOAD_SIZE(motorVarsLoadSize),
LOAD_END(motorVarsLoadEnd)
GROUP
{
vibc_data
dmaBuf_data
datalog_data
graph_data
sfra_data
SFRA_F32_Data
}
LOAD = RAMGS0
LOAD_START(extVarsLoadStart),
LOAD_SIZE(extVarsLoadSize),
LOAD_END(extVarsLoadEnd)
}
/*
//===========================================================================
// End of file.
//===========================================================================
*/
So, it seems I'm missing one or two steps, since when I add #include "F021_F28002x_C28x.h", I cannot compile it anymore, because it seems not to find the datatypes (uint16_t etc.):
>> Compilation failure
MCL_APP/subdir_rules.mk:23: recipe for target 'MCL_APP/MCL_FLASH.obj' failed
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\Registers.h", line 53: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\Init.h", line 49: error #20: identifier "uint8" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\Init.h", line 50: error #20: identifier "uint8" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\Init.h", line 51: error #20: identifier "uint8" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\Init.h", line 52: error #20: identifier "uint16" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 57: error #20: identifier "Fapi_FlashStatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 59: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 61: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 61: error #20: identifier "Fapi_FlashBankType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 63: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 68: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 68: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 70: error #20: identifier "boolean" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 70: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 73: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 74: error #20: identifier "Fapi_FlashStateCommandsType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 75: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 78: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 78: error #20: identifier "Fapi_FlashStateCommandsType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 81: error #20: identifier "Fapi_LibraryInfoType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 85: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 87: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 91: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 92: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 93: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 94: error #20: identifier "Fapi_FlashStatusWordType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 97: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 98: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 99: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 100: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 101: error #20: identifier "Fapi_FlashStatusWordType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 104: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 105: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 106: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 107: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 108: error #20: identifier "Fapi_FlashReadMarginModeType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 111: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 112: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 113: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 114: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 115: error #20: identifier "Fapi_FlashStatusWordType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 120: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 121: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 122: error #20: identifier "uint16" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 123: error #20: identifier "uint16" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 124: error #20: identifier "uint16" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 125: error #20: identifier "uint16" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 126: error #20: identifier "Fapi_FlashProgrammingCommandsType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 129: error #20: identifier "Fapi_StatusType" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 130: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 131: error #20: identifier "uint16" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 132: error #20: identifier "uint16" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 137: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 138: error #20: identifier "uint16" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 139: error #20: identifier "uint16" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 142: error #20: identifier "uint8" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 143: error #20: identifier "uint32" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 144: error #20: identifier "uint64" is undefined
"C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\F021.h", line 148: error #20: identifier "Fapi_StatusType" is undefined
Any ideas, what I'm missing here?
Edit: When I remove everything from the universal motor control library I can reproduce just including the types.h, which is used many times in the universal motor control library:
#include "libraries/utilities/types/include/types.h" //Produces the error #include "flash_programming_f28002x.h" // Flash API example header file #include "F021_F28002x_C28x.h"
So it seems, there will be two definitions of types.h and that throws then the error. What could I do about that?
EDIT2: It seems to have a problem with the include order. The following works without problems:
#include "libraries/math/include/math.h" #include "C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI/types.h"
That one gives the problems:
#include "C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI/types.h" #include "libraries/math/include/math.h"
So it seems, that in math.h, the __TMS320C28XX_CLA__ is already defined from the flash library and so <math.h> is not included. I'm still unsure, how I can properly add the library with the includes to the project.
Here is also a test project, where you can see what happens, when the two includes are online: https://www.mediafire.com/file/rj3hubflo3hns7z/gpio_ex2_toggle.zip/file
(Uncomment //#include "C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\libraries\math\include/math.h" for error)
Edit3 (Solution): The problems seems to be, that TYPE_H is already defined and so it is skyped. When I rename the following, it works:
#ifndef TYPES_H
#define TYPES_H
#endif
--> So it would be great, if you can rename the C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\c2000ware\libraries\flash_api\f28002x\include\FlashAPI\Types.h, since this is already defined in C:\ti\c2000\C2000Ware_MotorControl_SDK_4_00_00_00\libraries\utilities\types\include\types.h and leads to the above errors.