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.

TM4C1294NCPDT: What is this SVCall exception?

Part Number: TM4C1294NCPDT

Hi all,

While I was debugging my codes under CCS, I fell into SVCall exception, but I have no clue what I did to trigger it

What is the common cause of SVCall exception?

Thanks!

  • Hi David,
    Normally, a SVC is an exception that is triggered by the SVC instruction. the applications can use SVC instructions to access OS kernel functions and device drivers. Are you saying this is only happening in debug mode, not in run mode? You are not running any OS, right?
  • I was debugging my codes, which doesn't have any OS. I didn't verify if it would happen in run mode
  • Can you try in run mode? Can you add a small SVC handler to trap the SVC exception?

    Can you repeat the SVC exception in debug mode and if the CCS console says anything?
  • Run mode, what exactly do you mean? (compile the code and let it run freely?)
    What do you want me to add to the handler? (I verified it was SVCall exception)
    CCS console lost communication after that, but I forgot what it said

    Does TiVaware has SVC instruction embedded if I compile it in debug mode?
  • Yes, I meant to run freely and the SVC handler can be just while(1) loop. Once you are in SVC handler you may be able to trace back using the LR register. As you stated you see the problem in debug mode. Do you know which line of code that leads you to SVC exception? You may need to single step and narrow down the area of code that take you to the SVC exception. The default startup_ccs.c does not have a separate SVC handler. A SVC exception will point to the IntDefaultHandler. Do you already have a separate SVC handler defined in your startup_ccs.c file? If not, how do you know it was a SVCall exception if the code only ends up in the IntDefaultHandler()?

    I don't see any reason for the TivaWare to call SVC.
  • Yes, I assigned a handler just for SVC to trap it
  • swupdate.h calls SVC. SoftwareUpdateBegin() calls address 0x2C if ROM_UpdateEMAC is undefined. If you look at g_pfnVectors in a statup_ccs.c, you'll see the 11th thing (0x2C/4 == 11) is called an SVCall handler.

    I can't find a reverence to SVC in the Tiva ROM User Guide. Could you elaborate on what this call is?

    Edit: I can see in the same file, this is just a while(1) loop. I'm still a little hazy on what SVC means

  • There is a similar example in usbdfu-rt.c:

        //
        // Return control to the boot loader.  This is a call to the SVC
        // handler in the boot loader.
        //
        (*((void (*)(void))(*(uint32_t *)0x2c)))();

  • From David's description it doesn't seem like he is running a bootloader. If yes, he would have created a service for it if he is using the TivaWare bootloader example as a starting point. I will suggest he use the LR register to trace back the caller.
  • You got me, I forgot I had that call hidden in one place of my codes, thanks!
  • Happy to help. I found what Charles means by a bootloader handler. The bootloader's statup_ccs.s is an assembly file, but you can get the gist:

    Vectors:
        .ref    __STACK_TOP
        .word   __STACK_TOP                     ;; Offset 00: Initial stack pointer
        .word   ResetISR - 0x20000000           ;; Offset 04: Reset handler
        .word   NmiSR - 0x20000000              ;; Offset 08: NMI handler
        .word   FaultISR - 0x20000000           ;; Offset 0C: Hard fault handler
        .word   IntDefaultHandler               ;; Offset 10: MPU fault handler
        .word   IntDefaultHandler               ;; Offset 14: Bus fault handler
        .word   IntDefaultHandler               ;; Offset 18: Usage fault handler
        .word   0                               ;; Offset 1C: Reserved
        .word   0                               ;; Offset 20: Reserved
        .word   0                               ;; Offset 24: Reserved
        .word   0                               ;; Offset 28: Reserved
        .word   UpdateHandler - 0x20000000      ;; Offset 2C: SVCall handler

    SVC seems synonymous with SWI based on some googling. I assume TI used the term to specifically mean a boot loader interrupt vector.