mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-07 04:23:41 +00:00
avr: add interrupt support
Interrupts are supported using a special //go:interrupt pragma.
For example:
//go:interrupt INT0_vect
func handleINT0() {
// do something here
}
This commit is contained in:
@@ -1135,6 +1135,9 @@ func (c *Compiler) parseFunc(frame *Frame) error {
|
||||
if !frame.fn.IsExported() {
|
||||
frame.fn.LLVMFn.SetLinkage(llvm.InternalLinkage)
|
||||
}
|
||||
if frame.fn.IsInterrupt() && strings.HasPrefix(c.Triple, "avr") {
|
||||
frame.fn.LLVMFn.SetFunctionCallConv(85) // CallingConv::AVR_SIGNAL
|
||||
}
|
||||
|
||||
if c.Debug {
|
||||
pos := c.ir.Program.Fset.Position(frame.fn.Pos())
|
||||
|
||||
Reference in New Issue
Block a user