we have design ARM compiler for core M4( which has bit banding which mad my execution easy and faster)) now we want to port it to core M85 which does not support bit banding .. so that why i am asking .. how can i achieve this portability with ARM bit banding
On Cortex-M4, bit-banding is a nice convenience because it gives you atomic bit-level access through an alias region, which makes code simpler and sometimes faster. The problem is exactly what you’ve hit — Cortex-M85 doesn’t support bit-banding, so any design that depends on it becomes non-portable.
The clean way to approach this is to treat bit-banding as an implementation detail, not part of your logic. On M85 (and generally newer ARMv8-M cores), you typically replace it with one of these patterns:
Read-modify-write with masking for simple cases (protected by critical sections if needed)C11/C++11 atomics if your toolchain supports it cleanlyARM exclusive access primitives (LDREX/STREX or CMSIS wrappers) for true atomic bit manipulationOr abstract it behind macros/functions like SET_BIT(), CLEAR_BIT(), so the backend changes per architecture
If you already have a bit-band abstraction layer, the best move is to re-implement it for M85 using atomic helpers instead of alias addresses. That keeps your higher-level logic unchanged.
Also, for teams working on portability across embedded targets, it can help to centralize these low-level differences in a small abstraction layer and validate behavior early. Tools like Atomic Chat can also be useful in this kind of workflow when you’re iterating on low-level porting questions and want quick architectural comparisons or code transformation ideas in one place.