When I used armclang to compile the code of arm cm7, I found a surprising bug in armclang, which is manifested in the following assembly instructions generated under -O2/-Os/-Ofast/-O3/-Os/....:
__asm(
"ldr r5,=0x20010402"
);
"ldr r7,=0x55f4"
"strbt r7,[r5,#6]"
The CPU is in privileged mode all the time.when the CPU executes the STRBT instruction, it enters the memmanage_handler interrupt function.
Arm A-profile A32/T32 Instruction Set Architecture
solution: even in privileged mode, the MPU must be configured, as the machine instructions generated by the compiler may cause memmanage errors.
config all ram area: full access ,BUFFERABLE,CACHEABLE,SHAREABLE,LEVEL0
so I think it's a compiler bug.
armclang version:
.\armclang.exe -vProduct: MDK Professional 5.36Component: ARM Compiler 6.16Tool: armclang [5dfeb700]
Additional Notes:
CHIP:STM32H723ZGT6
KEIL:5.36
HostOS:win10
Hi David,I think this is completely expected: When using inline assembly with __asm, you are explicitly putting that instruction, as-is, into your binary at that location. No further verifying is done on insline assembly.It is your responsibility to ensure that the CPU and MPU are in the correct states for that instruction to be executed, or you need to use a different instruction (sadly I'm not familiar with this part of the architecture!)