Cortex-M4 setup vector table for external interrupts

I don't want to setup the vector table for all my external interrupts. For instance I only need the timer4 IRQhandler at IRQn 30. How can I make an offset in the table? Is this necessary?

Parents
  • Hi jvanmont,

    I checked the STM32F42xx Reference Manual (http://www.st.com/st-web-ui/static/active/jp/resource/technical/document/reference_manual/DM00031020.pdf) and confirmed the timer4 interrupt is assigned to IRQ30. Do you want to know how to write the original startup.s? If it is so, please refer to the post "Writing your own startup code for Cortex-M" (Writing your own startup code for Cortex-M). I extracted the essential part from the post and added the new vector entry of the timer4 handler.

    ----[snip]-----

    .align  2

    .long  _stack/* 0x00000000 The initial stack pointer (defined by the linker-script) */

    .long  Reset_Handler   /* 0x00000004 */

    .long  NMI_Handler   /* 0x00000008 */

    .long  HardFault_Handler/* 0x0000000c */

    .long  MemManage_Handler/* 0x00000010 */

    .long  BusFault_Handler /* 0x00000014 */

    .long  UsageFault_Handler/* 0x00000018 */

    .long  0     /* 0x0000001c */

    .long  0     /* 0x00000020 */

    .long  0     /* 0x00000024 */

    .long  0     /* 0x00000028 */

    .long  SVC_Handler   /* 0x0000002c */

    .long  DebugMon_Handler /* 0x00000030 */

    .long  0     /* 0x00000034 */

    .long  PendSV_Handler   /* 0x00000038 */

    .long  SysTick_Handler  /* 0x0000003c */

    /*  .long      ..._IRQHandler */

    /* 0x00000040 and forward. IRQ vectors specific to your microcontroller follows here... */

    .align 7 /* 0x00000080 */

    .space 0x38 /* 0x000000B8 */

    .long tim4_IRQHandler

      .text  /* Put everything in the text-section from now on... */

      .align  /* Make sure address is aligned for code output */

    ----[snip]-----

    Best regards,

    Yasuhiko Koumoto.

Reply
  • Hi jvanmont,

    I checked the STM32F42xx Reference Manual (http://www.st.com/st-web-ui/static/active/jp/resource/technical/document/reference_manual/DM00031020.pdf) and confirmed the timer4 interrupt is assigned to IRQ30. Do you want to know how to write the original startup.s? If it is so, please refer to the post "Writing your own startup code for Cortex-M" (Writing your own startup code for Cortex-M). I extracted the essential part from the post and added the new vector entry of the timer4 handler.

    ----[snip]-----

    .align  2

    .long  _stack/* 0x00000000 The initial stack pointer (defined by the linker-script) */

    .long  Reset_Handler   /* 0x00000004 */

    .long  NMI_Handler   /* 0x00000008 */

    .long  HardFault_Handler/* 0x0000000c */

    .long  MemManage_Handler/* 0x00000010 */

    .long  BusFault_Handler /* 0x00000014 */

    .long  UsageFault_Handler/* 0x00000018 */

    .long  0     /* 0x0000001c */

    .long  0     /* 0x00000020 */

    .long  0     /* 0x00000024 */

    .long  0     /* 0x00000028 */

    .long  SVC_Handler   /* 0x0000002c */

    .long  DebugMon_Handler /* 0x00000030 */

    .long  0     /* 0x00000034 */

    .long  PendSV_Handler   /* 0x00000038 */

    .long  SysTick_Handler  /* 0x0000003c */

    /*  .long      ..._IRQHandler */

    /* 0x00000040 and forward. IRQ vectors specific to your microcontroller follows here... */

    .align 7 /* 0x00000080 */

    .space 0x38 /* 0x000000B8 */

    .long tim4_IRQHandler

      .text  /* Put everything in the text-section from now on... */

      .align  /* Make sure address is aligned for code output */

    ----[snip]-----

    Best regards,

    Yasuhiko Koumoto.

Children