Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
I'm trying to blink a led with timer interrupt in the DSP processor environment . but when I lunch the program i get this message :
"
[C66xx] ti.sysbios.family.c64p.Hwi: line 194: E_alreadyDefined: Hwi already defined: intr# 4
"
And there is no interrupts at all.
here is my code and the .cfg file:
/*
* ======== main.c ========
*/
#include <xdc/std.h>
#include <xdc/runtime/System.h>
#include <ti/sysbios/BIOS.h>
#include <ti/sysbios/knl/Task.h>
#include <ti/csl/soc.h>
#include <ti/csl/csl_types.h>
#include <ti/drv/gpio/GPIO.h>
#include <ti/drv/gpio/soc/GPIO_soc.h>
/* XDCtools Header files */
#include <xdc/std.h>
#include <xdc/cfg/global.h>
#include <xdc/runtime/System.h>
#include <xdc/runtime/Error.h>
#include <ti/board/board.h>
#define GPIO_PORT_NUM 1
#define GPIO_PIN_NUM 11
/* GPIO Driver board specific pin configuration structure */
GPIO_PinConfig gpioPinConfigs[] =
{
/* Output pin */
GPIO_DEVICE_CONFIG(GPIO_PORT_NUM, GPIO_PIN_NUM) |
GPIO_CFG_OUTPUT
};
/* GPIO Driver call back functions */
GPIO_CallbackFxn gpioCallbackFunctions[] =
{
NULL
};
/* GPIO Driver configuration structure */
GPIO_v0_Config GPIO_v0_config =
{
gpioPinConfigs,
gpioCallbackFunctions,
sizeof(gpioPinConfigs) / sizeof(GPIO_PinConfig),
sizeof(gpioCallbackFunctions) / sizeof(GPIO_CallbackFxn),
0,
};
Void gpio_test(UArg a0, UArg a1)
{
GPIO_toggle(0);
}
/*
* ======== main ========
*/
Int main()
{
Board_initCfg boardCfg;
boardCfg = BOARD_INIT_PINMUX_CONFIG |
BOARD_INIT_MODULE_CLOCK |
BOARD_INIT_UART_STDIO;
GPIO_init();
Board_init(boardCfg);
GPIO_write(0,1);
System_printf("enter main()\n");
// Clock_start(my_clock);
BIOS_start(); /* does not return */
return(0);
}
cfg:
/*
* Copyright 2015 by Texas Instruments Incorporated.
*
* All rights reserved. Property of Texas Instruments Incorporated.
* Restricted rights to use, duplicate or disclose this code are
* granted through contract.
*
*/
/* THIS FILE WAS GENERATED BY ti.sysbios.genx */
/*
* ======== gpio_test.cfg ========
*
*/
/* Load all required BIOS/XDC runtime packages */
var Memory = xdc.useModule('xdc.runtime.Memory');
var BIOS = xdc.useModule('ti.sysbios.BIOS');
var HeapMem = xdc.useModule('ti.sysbios.heaps.HeapMem');
var HeapBuf = xdc.useModule('ti.sysbios.heaps.HeapBuf');
var Log = xdc.useModule('xdc.runtime.Log');
var Task = xdc.useModule('ti.sysbios.knl.Task');
var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
var CpIntc = xdc.useModule('ti.sysbios.family.c66.tci66xx.CpIntc');
var Hwi = xdc.useModule('ti.sysbios.family.c64p.Hwi');
var ECM = xdc.useModule('ti.sysbios.family.c64p.EventCombiner');
var core = xdc.useModule('ti.sysbios.hal.Core');
var Clock = xdc.useModule('ti.sysbios.knl.Clock');
var devType = "k2g"
/* Load the OSAL package */
var osType = "tirtos"
var Osal = xdc.useModule('ti.osal.Settings');
Osal.osType = osType;
Osal.socType = devType;
/*use CSL package*/
var Csl = xdc.loadPackage('ti.csl');
Csl.Settings.deviceType = devType;
/* Load the Board package and set the board name */
var Board = xdc.loadPackage('ti.board');
Board.Settings.boardName = "evmK2G";
/* Load Profiling package */
var Utils = xdc.loadPackage('ti.utils.profiling');
/* Load the gpio package */
var Gpio = xdc.loadPackage('ti.drv.gpio');
Gpio.Settings.enableProfiling = true;
Gpio.Settings.socType = devType;
/* Load the uart package */
var Uart = xdc.useModule('ti.drv.uart.Settings');
Uart.socType = devType;
var System = xdc.useModule('xdc.runtime.System');
SysStd = xdc.useModule('xdc.runtime.SysStd');
System.SupportProxy = SysStd;
/* Load and use the CSL packages */
var Csl = xdc.useModule('ti.csl.Settings');
Csl.deviceType = devType;
/* Create a default system heap using ti.bios.HeapMem. */
var heapMemParams1 = new HeapMem.Params;
heapMemParams1.size = 8192 * 25;
heapMemParams1.sectionName = "systemHeap";
Program.global.heap0 = HeapMem.create(heapMemParams1);
/* No runtime stack checking is performed */
Task.checkStackFlag = false;
/* Reduce the number of task priorities */
Task.numPriorities = 4;
/* ================ Task configuration ================ */
/*
var task0Params = new Task.Params();
task0Params.instance.name = "echo";
task0Params.stackSize = 0x1000;
Program.global.echo = Task.create("&gpio_test", task0Params);
*/
/* This is the default memory heap. */
Memory.defaultHeapInstance = Program.global.heap0;
Program.sectMap["systemHeap"] = Program.platform.stackMemory;
Program.sectMap[".fardata:benchmarking"] = "DDR3";
/****** IPC - Shared Memory Settings ********/
/* IPC packages */
var memmap = Program.cpu.memoryMap;
/*Startup = xdc.useModule('xdc.runtime.Startup');
Startup.firstFxns.$add('&myStartupFxn');*/
/* Enable BIOS Task Scheduler */
BIOS.taskEnabled = true;
/*
* Enable Event Groups here and registering of ISR for specific GEM INTC is done
* using EventCombiner_dispatchPlug() and Hwi_eventMap() APIs
*/
var exception = xdc.useModule('ti.sysbios.family.c64p.Exception');
exception.enablePrint = true;
/*
* @(#) ti.sysbios.genx; 2, 0, 0, 0,275; 4-29-2009 15:45:06; /db/vtree/library/trees/avala/avala-k25x/src/
*/
/* Define and add one Task Hook Set */
Task.addHookSet({
registerFxn: '&TaskRegisterId',
switchFxn: '&mySwitch',
});
/* Create myTimer as source of Hwi */
var Timer = xdc.useModule('ti.sysbios.hal.Timer');
var timer0Params = new Timer.Params();
timer0Params.instance.name = "timer0";
timer0Params.period = 10000;
Program.global.timer0 = Timer.create(-1, "&gpio_test", timer0Params);
Thank you,
Offer.