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.

TMDSIDK437X: AM437x

Part Number: TMDSIDK437X
Other Parts Discussed in Thread: AM4379, SYSBIOS

I have put together a very simple experimental application for AM4379 processor using idkAM437x development platform. The application is using Ti-RTOS and it comprises of a config file and a main(). The goal of the application is to start an I2C driver and turn LEDs on and off. The importance of this development for me is to become more comfortable with using drivers in Ti-RTOS. Unfortunately, there are not many examples to show this for idkAM437x development platform. 

I have a compilation problem and I think I know what the problem is, but I don't know how to solve it. Ti documentation for RTOS  (SPRUHD4M—June 2016) says that before instantiating a the I2C driver handle, "The board.c file also declare the I2C_config structure. This structure must be provided to the I2C driver. It must be initialized before the I2C_init() function is called and cannot be changed afterwards." This does not seem to be correct and the document does not seem to be applicable to AM437x evms. 

As you can see from the compilation output, I am having problems with the referencing of I2C_config in my code. Here is the output:


**** Build of configuration Release for project Her_Project ****

"C:\\ti\\ccs1011\\ccs\\utils\\bin\\gmake" -k -j 8 all -O

making ../src/sysbios/sysbios.aa9fg ...
gmake[1]: Nothing to be done for 'all'.
Building file: "../main.c"
Invoking: GNU Compiler
"C:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc-7.3.1.exe" -c -mcpu=cortex-a9 -march=armv7-a -mtune=cortex-a9 -marm -mfloat-abi=hard -Dam4379 -I"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/include/am43xx" -I"C:/ti/pdk_am437x_1_0_17/packages/ti/starterware/include" -I"C:/Users/FaroukEshragi/workspace_v10/Her_Project" -I"C:/ti/bios_6_76_03_01/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/include/newlib-nano" -I"C:/ti/bios_6_76_03_01/packages/ti/posix/gcc" -I"C:/ti/gcc-arm-none-eabi-7-2018-q2-update/arm-none-eabi/include" -Os -Wall -MMD -MP -MF"main.d" -MT"main.o" -std=c99 @"configPkg/compiler.opt" -o"main.o" "../main.c"
../main.c: In function 'taskFxn':
../main.c:43:21: warning: unused variable 'i2cTransaction' [-Wunused-variable]
I2C_Transaction i2cTransaction;
^~~~~~~~~~~~~~
../main.c:42:21: warning: unused variable 'params' [-Wunused-variable]
I2C_Params params;
^~~~~~
../main.c:41:21: warning: unused variable 'handle' [-Wunused-variable]
I2C_Handle handle;
^~~~~~
../main.c:38:16: warning: unused variable 'i2c_Config' [-Wunused-variable]
I2C_Config i2c_Config[2];
^~~~~~~~~~
Finished building: "../main.c"

making ../src/sysbios/sysbios.aa9fg ...
gmake[2]: Nothing to be done for 'all'.
Building target: "Her_Project.out"
Invoking: GNU Linker
"C:/ti/gcc-arm-none-eabi-7-2018-q2-update/bin/arm-none-eabi-gcc-7.3.1.exe" -mtune=cortex-a9 -marm -Dam4379 -Os -Wall -mfloat-abi=hard -Wl,-Map,"Her_Project.map" -nostartfiles -static -Wl,--gc-sections -L"C:/ti/bios_6_76_03_01/packages/gnu/targets/arm/libs/install-native/arm-none-eabi/lib/hard" -Wl,--defsym,STACKSIZE=0x18000 -Wl,--defsym,HEAPSIZE=0x400 --specs=nano.specs -o"Her_Project.out" "./main.o" -Wl,-T"configPkg/linker.cmd" -Wl,--start-group -lgcc -lm -lnosys -lc -Wl,--end-group
makefile:145: recipe for target 'Her_Project.out' failed
C:\ti\pdk_am437x_1_0_17\packages\ti\drv\i2c\lib\a9\release\ti.drv.i2c.aa9fg(I2C_drv.oa9fg): In function `I2C_init':
C:\ti\pdk_am437x_1_0_17\packages\ti\drv\i2c/src/I2C_drv.c:117: undefined reference to `I2C_config'
C:\ti\pdk_am437x_1_0_17\packages\ti\drv\i2c/src/I2C_drv.c:117: undefined reference to `I2C_config'
collect2.exe: error: ld returned 1 exit status
gmake[1]: *** [Her_Project.out] Error 1
gmake: *** [all] Error 2
makefile:141: recipe for target 'all' failed

**** Build Finished ****

And here is my main file:

/*
* ======== main.c ========
*/

#include <xdc/std.h>

#include <xdc/runtime/Error.h>
#include <xdc/runtime/System.h>

#include <ti/sysbios/BIOS.h>

#include <ti/sysbios/knl/Task.h>
#include <ti/drv/i2c/I2C.h>
#include <ti/drv/i2c/soc/I2C_soc.h>
#include <ti/drv/i2c/soc/I2C_v1.h>
#include "chipdb_defs.h"

#include <ti/board/board.h>

extern int32_t PINMUXModuleConfig(chipdbModuleID_t moduleId, uint32_t instNum,
void *pParam1);
/*
void I2CCallbackFunction();

void I2CCallbackFunction(){
System_printf("making progress");
}
*/
/*
* ======== taskFxn ========
*/
Void taskFxn(UArg a0, UArg a1)
{
System_printf("enter taskFxn()\n");


PINMUXModuleConfig(CHIPDB_MOD_ID_I2C, 2U, NULL);
I2C_Config_list I2C_config[2];
I2C_init();

I2C_Handle handle;
I2C_Params params;
I2C_Transaction i2cTransaction;
/* I2C_init();
I2C_Params_init(&params);
params.transferMode = I2C_MODE_CALLBACK;
params.transferCallbackFxn = I2CCallbackFunction;
handle = I2C_open(((int32_t) 2), &params);
if (!handle) {
System_printf("I2C did not open");
*/
Task_sleep(10);

System_printf("exit taskFxn()\n");

System_flush(); /* force SysMin output to console */
}

/*
* ======== main ========
*/
Int main()
{
Task_Handle task;
Error_Block eb;

System_printf("enter main()\n");

Error_init(&eb);
task = Task_create(taskFxn, NULL, &eb);
if (task == NULL) {
System_printf("Task_create() failed!\n");
BIOS_exit(0);

You may see odd things in my main() file. That is because I have been experimenting with possibilities to understand what it is that I must do.

And here is the config file:

var Defaults = xdc.useModule('xdc.runtime.Defaults');
var Diags = xdc.useModule('xdc.runtime.Diags');
var Error = xdc.useModule('xdc.runtime.Error');
var Log = xdc.useModule('xdc.runtime.Log');
var LoggerBuf = xdc.useModule('xdc.runtime.LoggerBuf');
var Main = xdc.useModule('xdc.runtime.Main');
var Memory = xdc.useModule('xdc.runtime.Memory')
var SysMin = xdc.useModule('xdc.runtime.SysMin');
var System = xdc.useModule('xdc.runtime.System');
var Text = xdc.useModule('xdc.runtime.Text');

var BIOS = xdc.useModule('ti.sysbios.BIOS');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var Swi = xdc.useModule('ti.sysbios.knl.Swi');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var Hwi = xdc.useModule('ti.sysbios.hal.Hwi');

var I2c = xdc.loadPackage('ti.drv.i2c');

var deviceType = "am437x";
var Csl = xdc.loadPackage('ti.csl');
Csl.Settings.deviceType = deviceType;

var Board = xdc.loadPackage('ti.board');
Board.Settings.boardName = "idkAM437x";

/*
* Uncomment this line to globally disable Asserts.
* All modules inherit the default from the 'Defaults' module. You
* can override these defaults on a per-module basis using Module.common$.
* Disabling Asserts will save code space and improve runtime performance.
Defaults.common$.diags_ASSERT = Diags.ALWAYS_OFF;
*/

/*
* Uncomment this line to keep module names from being loaded on the target.
* The module name strings are placed in the .const section. Setting this
* parameter to false will save space in the .const section. Error and
* Assert messages will contain an "unknown module" prefix instead
* of the actual module name.
Defaults.common$.namedModule = false;
*/

/*
* Minimize exit handler array in System. The System module includes
* an array of functions that are registered with System_atexit() to be
* called by System_exit().
*/
System.maxAtexitHandlers = 4;

/*
* Uncomment this line to disable the Error print function.
* We lose error information when this is disabled since the errors are
* not printed. Disabling the raiseHook will save some code space if
* your app is not using System_printf() since the Error_print() function
* calls System_printf().
Error.raiseHook = null;
*/

/*
* Uncomment this line to keep Error, Assert, and Log strings from being
* loaded on the target. These strings are placed in the .const section.
* Setting this parameter to false will save space in the .const section.
* Error, Assert and Log message will print raw ids and args instead of
* a formatted message.
Text.isLoaded = false;
*/

/*
* Uncomment this line to disable the output of characters by SysMin
* when the program exits. SysMin writes characters to a circular buffer.
* This buffer can be viewed using the SysMin Output view in ROV.
SysMin.flushAtExit = false;
*/

/*
* The BIOS module will create the default heap for the system.
* Specify the size of this default heap.
*/
BIOS.heapSize = 0x1000;

/*
* Build a custom SYS/BIOS library from sources.
*/
BIOS.libType = BIOS.LibType_Custom;

/* System stack size (used by ISRs and Swis) */
Program.stack = 0x2000;

/* Circular buffer size for System_printf() */
SysMin.bufSize = 0x200;

/*
* Create and install logger for the whole system
*/
var loggerBufParams = new LoggerBuf.Params();
loggerBufParams.numEntries = 16;
var logger0 = LoggerBuf.create(loggerBufParams);
Defaults.common$.logger = logger0;
Main.common$.diags_INFO = Diags.ALWAYS_ON;

System.SupportProxy = SysMin;

I would appreciate it you would have a look and let me know what piece of code must be added so that the compiler/linker will resolved the issue of undefined reference to `I2C_config' .

Thank you.

  • Hi,

    You'll need to define I2C_config by your self. There are I2C examples from the PDK. Please follow instructions at https://software-dl.ti.com/processor-sdk-rtos/esd/docs/latest/rtos/index_overview.html#pdk-example-and-test-project-creation to create and build the example projects. You'll find I2C_Test_idkAM437x_armTestProject in the created projects and you'll see how I2C_config is defined.

    Hope this is helpful.

    Regards,

    Jianzhong

  • Thanks Jianzhong,

    I tried this before but no projects are created.

    This is the command I use with pdkProjectCreate.bat:

     .\pdkProjectCreate.bat AM437x C:\pdk_am437x_1_0_17\packages\ti\board\lib\idkAM437x little i2c all arm C:\ti\pdk_am437x_1_0_17\packages

    And here is what I get:

    =========================================================================
    Configuration:
    SOC : AM437x
    BOARD : C:\pdk_am437x_1_0_17\packages\ti\board\lib\idkAM437x
    ENDIAN : little
    MODULE : i2c
    PROJECT_TYPE : all
    PROCESSOR : arm
    PDK_SHORT_NAME : C:\ti\pdk_am437x_1_0_17\packages
    =========================================================================
    Checking Configuration...
    Complete
    =========================================================================
    PDK_PARTNO : AM437
    PDK_ECLIPSE_ID : com.ti.pdk.am437x
    RTSC_PLATFORM_NAME : ti.platforms.evmAM437X
    RTSC_TARGET : gnu.targets.arm.A9F
    CCS_DEVICE : "Cortex A.AM4379.IDK_AM437X"
    *****************************************************************************
    Detecting all projects in PDK and importing them in the workspace C:\ti\pdk_am437x_1_0_17\packages\MyExampleProjects
    The filename, directory name, or volume label syntax is incorrect.
    No projects detected
    Project generation complete
    *****************************************************************************

    I also checked out the pdk installation to see what projects are there for AM437x. Here is the directory I looked into:

    C:\ti\pdk_am437x_1_0_17\packages\ti\board\examples and the only project there is the ddr_thermal_test_app. 

    Am I overlooking something?

    Regards

  • The right command should be ".\pdkProjectCreate.bat AM437x idkAM437x little i2c all arm C:\ti\pdk_am437x_1_0_17\packages". Please note that the "board" argument should be one of the folder names under C:\pdk_am437x_1_0_17\packages\ti\board\lib, not the path of the folder.

  • Hi Jianzhongxu

    I tried exactly with the command you gave me and still no projects. Here is what I get:

    C:\ti\pdk_am437x_1_0_17\packages>.\pdkProjectCreate.bat AM437x idkAM437x little i2c all arm C:\ti\pdk_am437x_1_0_17\packages
    =========================================================================
    Configuration:
    SOC : AM437x
    BOARD : idkAM437x
    ENDIAN : little
    MODULE : i2c
    PROJECT_TYPE : all
    PROCESSOR : arm
    PDK_SHORT_NAME : C:\ti\pdk_am437x_1_0_17\packages
    =========================================================================
    Checking Configuration...
    Complete
    =========================================================================
    PDK_PARTNO : AM437
    PDK_ECLIPSE_ID : com.ti.pdk.am437x
    RTSC_PLATFORM_NAME : ti.platforms.evmAM437X
    RTSC_TARGET : gnu.targets.arm.A9F
    CCS_DEVICE : "Cortex A.AM4379.IDK_AM437X"
    *****************************************************************************
    Detecting all projects in PDK and importing them in the workspace C:\ti\pdk_am437x_1_0_17\packages\MyExampleProjects
    Detected Test Project: I2C_Example_idkAM437x_armExampleProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
    0 file(s) copied.
    Detected Test Project: I2C_FwExampleIcss0_idkAM437x_armExampleProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
    0 file(s) copied.
    Detected Test Project: I2C_FwExample_idkAM437x_armExampleProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
    0 file(s) copied.
    Detected Test Project: I2C_Test_idkAM437x_armTestProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
    0 file(s) copied.
    Detected Test Project: I2C_FwTestIcss0_idkAM437x_armTestProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
    0 file(s) copied.
    Detected Test Project: I2C_FwTest_idkAM437x_armTestProject
    The system cannot find the path specified.
    Copying macro.ini
    The system cannot find the path specified.
    0 file(s) copied.
    Project generation complete
    *****************************************************************************

    C:\ti\pdk_am437x_1_0_17\packages>

    -------------------------------

    Can you please tell me where the example files are supposed to be in the folder structure? If they are supposed to be in ti/board/examples, then here is the content:

    Directory of C:\ti\pdk_am437x_1_0_17\packages\ti\board\examples

    12/22/2020 12:21 AM <DIR> .
    12/22/2020 12:21 AM <DIR> ..
    12/22/2020 12:24 AM <DIR> ddr_thermal_test_app
    0 File(s) 0 bytes
    3 Dir(s) 96,959,426,560 bytes free

    As you can see, there is only one folder there and that is the about the temperature of DDR devices. 

  • This error was likely caused by mismatching CCS version. The pdkProjectCreate.bat has the following:

        set CCS_INSTALL_PATH=C:/ti/ccs930/ccs
    

    If you have a different version of CCS, please modify this line of code accordingly. Please also make sure all components of the Processor-SDk are registered in CCS.