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.

Tiva and CFG file

Other Parts Discussed in Thread: TM4C129XNCZAD

Hi.

I'm going to manage exception with my own routine, so I added

HwiM3.excHandlerFunc = "&BoardExceptionHandler";

HwiM3.busFaultFunc = "&Board_FAULT_BUS";

//HwiM3.hardFaultFunc =  "&Board_FAULT_HARD";

//HwiM3.memFaultFunc =  "&Board_FAULT_MPU";

//HwiM3.nullIsrFunc =   "&BoardFAULTDefault";

//HwiM3.debugMonFunc =  "&Board_FAULT_DEBUG";

//HwiM3.nmiFunc =  "&Board_Fault_NMI";

HwiM3.svCallFunc = "&Board_FAULT_SVCALL";

into my cfg file.

But when I compile I get the following error:

"c:\\ti\\ccsv6\\utils\\bin\\gmake" -k all

'Building file: ../cpu_board.cfg'

'Invoking: XDCtools'

"c:/ti/xdctools_3_25_04_88/xs" --xdcpath="c:/ti/tirtos_1_21_00_09/packages;c:/ti/tirtos_1_21_00_09/products/bios_6_37_00_20/packages;c:/ti/tirtos_1_21_00_09/products/ipc_3_10_01_11/packages;c:/ti/tirtos_1_21_00_09/products/ndk_2_23_01_01/packages;c:/ti/tirtos_1_21_00_09/products/uia_1_04_00_06/packages;c:/ti/ccsv6/ccs_base;" xdc.tools.configuro -o configPkg -t ti.targets.arm.elf.M4F -p ti.platforms.tiva:TM4C129XNCZAD -r debug -c "c:/ti/ccsv6/tools/compiler/arm_5.1.6" --compileOptions "-g --optimize_with_debug" "../cpu_board.cfg"

making package.mak (because of package.bld) ...

generating interfaces for package configPkg (because package/package.xdc.inc is older than package.xdc) ...

configuring cpu_board.xem4f from package/cfg/cpu_board_pem4f.cfg ...

clem4f package/cfg/cpu_board_pem4f.c ...

"package/cfg/cpu_board_pem4f.c", line 2100: error: identifier "Board_FAULT_BUS" is undefined

"package/cfg/cpu_board_pem4f.c", line 2106: error: identifier "Board_FAULT_SVCALL" is undefined

2 errors detected in the compilation of "package/cfg/cpu_board_pem4f.c".

I see that the extern declaration is not present in cpu_board_perm4f.c as per  BoardExceptionHandler, any suggestion?

Thanks in advance,

Marco C

  • Sadly, this is a known issue that will be fixed in the 6.42.01 release due out in a few weeks.
    For the moment, you should be able to initialize those vector table entries dynamically in main().
    The memFault, busFault, usageFault, exceptions are all routed to the hardFaultException handler by the cortexM core.
    By default, that vector is located at 0x20000008.
    If you initialize that location with the address of your exception handler then all subsequent memFault, busFault, usageFault, and hardFault exceptions will vector to your handler.

    Alan
  • Thank for your reply.

    Could you provide a small example?

    Regards,
    MC
  • Something like this should work:

    void myExceptionHandler()
    {
    }


    in main():

    *(UInt32 *)(0x20000008) = (UInt32)myExceptionHandler;



    Alan
  • Just another simple request.

    I'm looking for a full example on how to write my exception handler.

     

    In my test I've write down this simple piece of code but it seems that it doesn't work:

    myExceptionHanlder( void )

    {

    // save same global variable of my state mmachine  

           __asm("    bx      lr");

    }

    What I'm expecting is that my TIVA  exit from execption and continue running my application code, but really the program (compiled with debug  option) stuck and all is stopped.

    Could you help me ?

     

    Regards,

    MarcoC 

  • In general, I do not think you can simply 'return' from an exception back to the instruction where the exception occurred.
    The conditions that caused the exception are still present in some cases and won't allow execution to continue.
    Here is an article that provides a good deal of info about handling exceptions in cortex M devices:

    www.keil.com/.../apnt209.pdf

    Alan