Codescape GNU Tools for MIPS.MIPS HAL.Interrupt handlers and the M5150 core

This topic contains 3 replies, has 2 voices, and was last updated by  Sean 2 months, 3 weeks ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #56324

    aleks78
    Member

    In my project, I work with the M5150 processor which has eight interrupt inputs in vector interrupt mode. In the Codescape GNU Tools for MIPS.MIPS HAL functions for interrupt servicing processing hw6-hw7 interrupts are not defined (MIPS_Toolchain_Codescape_GNU_Tools_for_MIPS_Programmers_Guide.docx Issue Date : 09 Jun 2016).
    An error occurred while compiling the following definitions:
    void __attribute__ ((interrupt(“vector=hw6”))) _mips_isr_hw6();
    void __attribute__ ((interrupt(“vector=hw7”))) _mips_isr_hw7();
    In the file ..\mips-mti-elf\2016.05-03\mips-mti-elf\include\mips\m32c0.h SR_HINT6 SR_HINT7 and other related bits fields not defined.

    #56330

    Sean
    Moderator

    aleks78,

    The compiler generated interrupt handler logic in the HAL currently does not offer support for the MCU ASE vectored interrupt extension, so it only supports up to HW5. The two highest priority MCU handlers can still be used, but the compiler generate code will not automatically disable the lower priority interrupts. Using the following attributes will allow you to use C generated interrupt handlers for HW6 and HW7:

    void __attribute__ ((interrupt(“vector”), keep_interrupts_masked)) _mips_isr_hw6();

    For HW6 it will not allow HW7 to nest during executions of the HW6 handler. To unmask HW7 during HW6 handling, the C code would need to preserve EPC and STATUS then update the STATUS register to clear HW6 to SW0 and enable the IE bit. Before returning it would also need to restore EPC and STATUS.

    It is also necessary to build a custom version of the mips_excpt_isr.S file. You can find a template in share/mips/hal/mips_excpt_isr.S. Copy this to your project and amend the end of the file to add the text in bold below otherwise the additional HW interrupt entry points will not be located correctly. Build this file with the same options as the rest of your project and ensure it is included in the link by specifying it directly on the command line as a .o file (rather than within an archive).

    mips_excpt_isr_aleks78
    (Source attached for convenience)

    Regards,

    Sean.

    • This reply was modified 2 months, 3 weeks ago by  Sean. Reason: Formatting text in code snippet
    • This reply was modified 2 months, 3 weeks ago by  Sean.
    Attachments:
    You must be logged in to view attached files.
    1 user thanked author for this post.
    #56345

    aleks78
    Member

    Probably there is a copy/paste error in your code. I did as described below.

    .org 7 * VEC_SPACE
    AENT(__isr_vec_hw5)
    .weak _mips_isr_hw5
    LA k1, _mips_isr_hw5
    beqz k1, 1f
    jr k1

    .org 8 * VEC_SPACE
    AENT(__isr_vec_hw6)
    .weak _mips_isr_hw6
    LA k1, _mips_isr_hw6
    beqz k1, 1f
    jr k1

    .org 9 * VEC_SPACE
    AENT(__isr_vec_hw7)
    .weak _mips_isr_hw7
    LA k1, _mips_isr_hw7
    beqz k1, 1f
    jr k1

    After correcting the code, Interrupt handlers appeared in the output file.
    Thank you.

    #56346

    Sean
    Moderator

    Sure, sorry about that copy and paste error.

    Thanks for re-posting.

    Regards,

    Sean.

Viewing 4 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic.