2 ms·
Generally ST Micro did some fairly abhorrent stuff around mapping their registers into bit field packed structures for the Cortex M line. One of the reasons I d
by ChuckMcM 9y ago
Generally ST Micro did some fairly abhorrent stuff around mapping their registers into bit field packed structures for the Cortex M line. One of the reasons I don't use their library for coding them.
The authors use of looking at lines of assembly language code as a metric of goodness for the choices was also problematic. If they coded that stuff for a VAX they would be treated to variable length bit field addressing (see [1] below, page 8-6). Easy to implement very complex bit manipulation in just a few assembly language statements :-).
A better measure is CPU clocks + Memory Accesses (typically measured in kilocoreseconds [another VMS joke])
[1] http://www.ece.lsu.edu/ee4720/doc/vax.pdf http://www.ece.lsu.edu/ee4720/doc/vax.pdf
- barbegal 9y agoMapping registers into bit field packed structures is actually okay because most ARM Cortex M processors have bit banding enabled on all the peripherals. Unfortunately not all peripheral libraries use that functionality and GCC doesn't support it well.
- evancox100 9y agoYa,but the newest Cortex-M chips (M7, M22, and M33) do not even support bit-banding, so I wouldn't rely on that being around forever. Not quite sure why ARM removed it. Maybe there were performance costs to all instructions due to the extra hw/decode, while bit-banding only helped a small number of instructions. If anyone has more info, would love to hear!