Skip to content

Volatile structs compile but do not work as expected from interrupt handlers #151

Closed
@deadprogram

Description

@deadprogram

I am trying to create a struct that wraps around some volatile members. The code compiles, but the interrupt handlers do not seem to be able to access them as expected, aka nothing seems to happen.

I tried this initially:

//go:volatile
type volatileByte byte

type RingBuffer struct {
   rxbuffer [bufferSize]volatileByte
   head volatileByte
   tail volatileByte
}

and also this

//go:volatile
type volatileByte byte

//go:volatile
type RingBuffer struct {
   rxbuffer [bufferSize]volatileByte
   head volatileByte
   tail volatileByte
}

And also this

//go:volatile
type RingBuffer struct {
   rxbuffer [bufferSize]byte
   head byte
   tail byte
}

They increased the size of my BIN file considerably, but did not work as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions