This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

LD Scripts is the best approach for BitBanding with GCC?

I have searched information on Bit-Banding in Cortex-M3 and M4 with the GNU GCC ARM EABI NONE, I have seen basic examples on the internet but none works with GNU GCC also seems that no intention to have such feature implemented.

Can someone tell me if the LD via memory remapping really work? the best approach?

What is the best way?

Parents
  • This is a guess only, but I think carlosdelfino is teaching the students that if you need to set or clear a single bit, you can use a single write-cycle instead of read+modify+write cycle (3 or 4 clock cycles).

    On AVR, it's necessary to read, then use either AND or OR and then write back the modified value.

    That has a terrible disadvantage on the AVR. If you write to a port from an interrupt and you want to change a single bit from task-time, you risk that the interrupt will run in the middle of your read-modify-write cycle, which means that the values your interrupt writes will be available on the port for only a short time, then it's quickly changed back to what it was by your task-time.

    To fix that, you can disable interrupts and re-enable them after updating the port at task-time (now 5 clock cycles were used instead of only 1 on ARM).

    So one topic is the atomic access, the other topic is saving CPU-time on accessing the same port from both interrupt code and task-time code.

Reply
  • This is a guess only, but I think carlosdelfino is teaching the students that if you need to set or clear a single bit, you can use a single write-cycle instead of read+modify+write cycle (3 or 4 clock cycles).

    On AVR, it's necessary to read, then use either AND or OR and then write back the modified value.

    That has a terrible disadvantage on the AVR. If you write to a port from an interrupt and you want to change a single bit from task-time, you risk that the interrupt will run in the middle of your read-modify-write cycle, which means that the values your interrupt writes will be available on the port for only a short time, then it's quickly changed back to what it was by your task-time.

    To fix that, you can disable interrupts and re-enable them after updating the port at task-time (now 5 clock cycles were used instead of only 1 on ARM).

    So one topic is the atomic access, the other topic is saving CPU-time on accessing the same port from both interrupt code and task-time code.

Children