Other Parts Discussed in Thread: SYSBIOS
Tool/software: TI-RTOS
Hi,base on rtos and am5728,I want to use ipu1 to access dmtimer for printing periodically.After compile the project successfully, I ran the project, unfortunate,it was a exeption occur,which the reason seem like when calling the interface Timer_create ,what should i do to solve the exception,and the code snippest is below:
/* * Copyright (c) 2013-2014, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* * ======== main_Ipu1.c ======== * */ /* xdctools header files */ #include <xdc/std.h> #include <xdc/runtime/Diags.h> #include <xdc/runtime/Error.h> #include <xdc/runtime/Log.h> #include <xdc/runtime/System.h> /* package header files */ #include <ti/ipc/Ipc.h> #include <ti/ipc/MultiProc.h> #include <ti/sysbios/BIOS.h> #include <ti/sysbios/knl/Task.h> #include <ti/ipc/remoteproc/Resource.h> #include <ti/sysbios/timers/dmtimer/Timer.h> /* local header files */ #include "Server.h" #include "rsc_table_ipu1.h" Void myIsr(UArg arg) { System_printf("myIsr arg = %d\n", (Int)arg); System_exit(0); } /* private functions */ static Void smain(UArg arg0, UArg arg1); /* * ======== main ======== */ Int main(Int argc, Char* argv[]) { Timer_Params timerParams; Timer_Handle myTimer; Error_Block eb; Error_init(&eb); Timer_Params_init(&timerParams); //timerParams.period = 10; timerParams.periodType = Timer_PeriodType_MICROSECS; //timerParams.extFreq.lo = 27000000; /* 27 MHz */ //timerParams.extFreq.hi = 0; //timerParams.arg = 1; myTimer = Timer_create(Timer_ANY, myIsr, &timerParams, &eb); if (myTimer == NULL) { Log_print0(Diags_INFO,"Timer create failed"); System_abort("Timer create failed"); } else { Log_print0(Diags_INFO,"Timer create success"); Timer_delete(myTimer); } /* start scheduler, this never returns */ BIOS_start(); /* should never get here */ Log_print0(Diags_EXIT, "<-- main:"); return (0); } /* * ======== smain ======== */ Void smain(UArg arg0, UArg arg1) { Int status = 0; Error_Block eb; Bool running = TRUE; Log_print0(Diags_ENTRY | Diags_INFO, "--> smain:"); Error_init(&eb); /* initialize modules */ Server_init(); /* turn on Diags_INFO trace */ Diags_setMask("Server+F"); /* loop forever */ while (running) { /* Attach to other slave */ do { status = Ipc_attach(MultiProc_getId("DSP1")); Task_sleep(1); } while (status == Ipc_E_NOTREADY); if (status < 0) { Log_print0(Diags_INFO,"smain: attach failed"); status = -1; goto leave; } /* BEGIN server phase */ /* server setup phase */ status = Server_create(); if (status < 0) { goto leave; } /* server execute phase */ status = Server_exec(); if (status < 0) { goto leave; } /* server shutdown phase */ status = Server_delete(); if (status < 0) { goto leave; } /* END server phase */ /* Detach from other slave */ do { status = Ipc_detach(MultiProc_getId("DSP1")); } while (status == Ipc_E_NOTREADY); if (status < 0) { Log_print0(Diags_INFO,"smain: detach failed"); goto leave; } } /* while (running) */ /* finalize modules */ Server_exit(); leave: Log_print1(Diags_EXIT, "<-- smain: %d", (IArg)status); return; }
after running my project,I check the status on ipu1 by the shell command:cat /sys/kernel/debug/remoteproc/remoteproc0/trace0,and the resulte is:
root@AM57xx-Tronlong:~# cat /sys/kernel/debug/remoteproc/remoteproc0/trace0
[0][ 0.000] 19 Resource entries at 0x3000
[0][ 0.000] [t=0x000ef279] ti.sysbios.family.arm.m3.Hwi: ERROR: line 1121: E_hardFault: FORCED
[0][ 0.000] ti.sysbios.family.arm.m3.Hwi: line 1121: E_hardFault: FORCED
[0][ 0.000] [t=0x001183ed] ti.sysbios.family.arm.m3.Hwi: ERROR: line 1198: E_busFault: PRECISERR: Immediate Bus Fault, exact addr known, address: 68034048
[0][ 0.000] ti.sysbios.family.arm.m3.Hwi: line 1198: E_busFault: PRECISERR: Immediate Bus Fault, exact addr known, address: 68034048
[0][ 0.000] Exception occurred in background thread at PC = 0x0001bad2.
[0][ 0.000] Core 0: Exception occurred in ThreadType_Main.
[0][ 0.000] Main name: main(), handle: 0x0.
[0][ 0.000] Main stack base: 0x8006e624.
[0][ 0.000] Main stack size: 0x1000.
[0][ 0.000] R0 = 0x68034000 R8 = 0x00000020
[0][ 0.000] R1 = 0x00000000 R9 = 0x00027984
[0][ 0.000] R2 = 0x00000002 R10 = 0x00000000
[0][ 0.000] R3 = 0x00000001 R11 = 0x8006f5a4
[0][ 0.000] R4 = 0x00000002 R12 = 0x8006f4d4
[0][ 0.000] R5 = 0x00000048 SP(R13) = 0x8006f470
[0][ 0.000] R6 = 0x8006f5ec LR(R14) = 0x00017f5d
[0][ 0.000] R7 = 0x00000000 PC(R15) = 0x0001bad2
[0][ 0.000] PSR = 0x61000200
[0][ 0.000] ICSR = 0x00400803
[0][ 0.000] MMFSR = 0x00
[0][ 0.000] BFSR = 0x82
[0][ 0.000] UFSR = 0x0000
[0][ 0.000] HFSR = 0x40000000
[0][ 0.000] DFSR = 0x00000000
[0][ 0.000] MMAR = 0x68034048
[0][ 0.000] BFAR = 0x68034048
[0][ 0.000] AFSR = 0x00000000
[0][ 0.000] Terminating execution...