Interrupt issues in SAMD20 app launched from bootloader

Go To Last Post
2 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I have a custom board with SAMD20. I have a working bootloader that successfully launches the main app. In the main app MCU, GPIOs, ADC, 2xI2C, 2xUSARTS, Timer and SPI setup is successful. After that as soon as I call usart_async_register_callback(...) the board hangs. I don't receive timer interrupts either. Could this be due to some interrupt vector table corruption when transitioning from bootloader to main app?

 

The bootloader is built on Linux whereas the main app is AS 7 start project.Both generate a bin file that I manually program into flash. This is my app startup code in the bootloader.

static void start_application()
{
        uint32_t app_start_address;

        /* Rebase the Stack Pointer */
        __set_MSP(*(uint32_t *) APP_START_ADDRESS); /* 0x1000 */

        /* Rebase the vector table base address */
        SCB->VTOR = ((uint32_t) APP_START_ADDRESS & SCB_VTOR_TBLOFF_Msk); /* 0xFFFFFFUL << 8 */

        /* Jump to application Reset Handler in the application */
        app_start_address = *(uint32_t *)(APP_START_ADDRESS + 4);
        asm("bx %0"::"r"(app_start_address));
}

 

Any clues on what could be going wrong or any pointers on where I should look?

TIA

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

My bootloader does not use interrupts and AFAIK does not generate an interrupt vector table.  My application does use interrupts and generates a intr. vector table. I have specified the start address of the application to be 0x1000 using

 

-Wl,--section-start=.text=0x1000

 

Will the intr. vector table be automatically placed at 0x1000 in my .bin file? If it does not, how do I make that happen? I'm using AS 7 with start project.

 

thanks for your help