you are viewing a single comment's thread
view the rest of the comments
[–] 39 points 1 year ago* (7 children)

The 8-bit Intel 8051 family provides a dedicated bit-addressable memory space (addresses 20h-2Fh in internal RAM), giving 128 directly addressable bits. Used them for years. I'd imagine many microcontrollers have bit-width variables.

bit myFlag = 0;

Or even return from a function:

bit isValidInput(unsigned char input) { // Returns true (1) if input is valid, false (0) otherwise return (input >= '0' && input <= '9'); }

  • source
  • hideshow 7 child comments
  • [–] 16 points 1 year ago (4 children)

    Nothing like that in ARM. Even microcontrollers have enough RAM that nobody cares, I guess.

  • source
  • parent
  • hideshow 4 child comments
  • [–] 10 points 1 year ago

    ARM has bit-banding specifically for this. I think it’s limited to M-profile CPUs (e.g. v7-M) but I’ve definitely used this before. It basically creates a 4-byte virtual address for every bit in a region. So the CPU itself can’t “address” a bit but it can access an address backed by only 1 bit of SRAM or registers (this is also useful to atomically access certain bits in registers without needing to use SW atomics).

  • source
  • parent
  • [–] 1 point 1 year ago (2 children)

    Tell this to the LPC1114 I'm working with. Did you ever run a multilingual GUI from 2kbytes RAM on a 256x32 pixel display?

  • source
  • parent
  • hideshow 2 child comments