EEVblog Electronics Community Forum

Products => Computers => Embedded Computing => Topic started by: emece67 on August 27, 2021, 01:59:51 pm

Title: This is an armclang bug, isn't it? [It wasn't]
Post by: emece67 on August 27, 2021, 01:59:51 pm
.
Title: Re: This is an armclang bug, isn't it?
Post by: ataradov on August 27, 2021, 04:39:38 pm
I'd say this is a bug. I see nothing wrong with this code.

Does it do the same if instead of a literal parameter you create a structure on the stack and pass that?
Title: Re: This is an armclang bug, isn't it?
Post by: emece67 on August 27, 2021, 07:13:19 pm
.
Title: Re: This is an armclang bug, isn't it?
Post by: ataradov on August 27, 2021, 08:19:14 pm
What MCU/core you are targeting?

According to this https://www.keil.com/support/man/docs/armclang_ref/armclang_ref_sam1444138667173.htm: (https://www.keil.com/support/man/docs/armclang_ref/armclang_ref_sam1444138667173.htm:)
Quote
-munaligned-access is the default for architectures that support unaligned accesses to data. This default applies to all architectures supported by Arm Compiler 6, except Armv6‑M, and Armv8‑M without the Main Extension.

So if you are targeting Cortex-M4/M7, then it will default to unaligned access, so it has to be enabled in the core. Or pass -mno-unaligned-access flag.
Title: Re: This is an armclang bug, isn't it?
Post by: emece67 on August 27, 2021, 10:32:45 pm
.