Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8937257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:22:28+00:00 2026-06-15T10:22:28+00:00

I have an ARM stm32f107 chip. I’m porting a project from IAR to GCC

  • 0

I have an ARM stm32f107 chip. I’m porting a project from IAR to GCC

IAR provides the following functions to enable and disable interrupts:

#define __disable_interrupt() ...
#define __enable_interrupt() ...

How do I enable / disable interrupt for my chip using GCC?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T10:22:29+00:00Added an answer on June 15, 2026 at 10:22 am

    I can’t answer for ARM but the same function in Coldfire boils down to setting/clearing the Interrupt Priority Level masking register in the CPU. Setting it to the highest number disables/ignores all but non-maskable, setting it to 0 enables all (YMMV).

    Worth noting that it’s handy to read-back the value when “disabling” and restore when “enabling” to ensure that stacked interrupts don’t break each other:

    ipl = DisableInts(); // Remember what the IPL was
    <"Risky" code happens here>
    EnableInts(ipl); // Restore value
    

    This is useful when twiddling interrupt masks, which may cause spurious interrupts, or doing stuff that shouldn’t be interrupted.

    Functions come out as:

    uint8 DisableInts(void)
    {
        return(asm_set_ipl(7));
    }
    
    uint8 EnableInts(uint8 ipl)
    {
        return(asm_set_ipl(ipl));
    }
    

    Both of which map to this asm:

    asm_set_ipl:
    _asm_set_ipl:
    /* Modified for CW7.2! */
        link    A6,#-8
        movem.l D6-D7,(SP)
    
        move.l  D0,D6           /* save argument                 */
    
        move.w  SR,D7           /* current sr                    */
    
        move.l  D7,D0           /* prepare return value          */
        andi.l  #0x0700,D0      /* mask out IPL                  */
        lsr.l   #8,D0           /* IPL                           */
    
        andi.l  #0x07,D6        /* least significant three bits  */
        lsl.l   #8,D6           /* move over to make mask        */
    
        andi.l  #0x0000F8FF,D7  /* zero out current IPL          */
        or.l    D6,D7           /* place new IPL in sr           */
        move.w  D7,SR
    
        movem.l (SP),D6-D7
        //lea     8(SP),SP
        unlk    A6
        rts
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ARM project that I'm building with make. I'm creating the list
I have an embedded system (ARM 9263) running an RTOS, IAR tools. The system
I have an application which i build using gcc on linux host for ARM
I am using the CodeSorcery arm-eabi-gcc tool chain and I have a problem using
I am having trouble reading serial data from ARM LPC2378 microcontroller. Will I have
Say that I have an array like the following: Array ( [arm] => Array
On my AT91SAM9RL-EK ARM board, running a Linux 2.6.30 buildroot, I have the following.
I have arm-linux-androideabi-gcc installed in my computer, but when I try to compiler even
I have one shared library ,Which written in c build using arm-linux-androideabi-gcc compiler now
I have just joined a project which require working on ARM based micro-controllers.. i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.