Hello All,
With yocto project, I have developed an application for 64 bit x86_64 architecture and the application is using uint64_t data type inside code. The application was compiling successfully for x86_64 architecture.
The same application when i try tp port to Arm Cortex-A15 / Arm Cortex-M4 architecture , the application was not compiling and below error observed during compilation process. Please share if anyone knows solution for this issue.
| {standard input}: Assembler messages:| {standard input}:2478: Error: bad instruction `lock'| {standard input}:2479: Error: bad instruction `xadd r3,[r4,#8]'| {standard input}: Assembler messages:| {standard input}:1794: Error: bad instruction `lock'
const uint64_t MAX_TRANSFER_BYTES = omniORB::giopMaxMsgSize();
Processor TI AM5716, TI AM5726, TI AM5728, TI AM5748, TI AM5749 Architecture Arm Cortex-A15 / Arm Cortex-M4
Regards,
Punnrao
Dear PunnaraoD,
If you've written your application in a high-level programming language such as C/C++ without specific x86_64 inline assembly, and you do not rely on libraries tailored to that ISA, you shouldn't have any particular problem.
The error you see is that you're using specific assembly instruction for x86_64. "lock" and "xadd" are specific x86_64 instructions related to atomic arithmetic (https://en.wikipedia.org/wiki/Fetch-and-add).
Some literature on synchronization primitives : https://developer.arm.com/documentation/dht0008/a/arm-synchronization-primitives/software-synchronization
You can find an implementation of atomic arithmetic for arm 32 bits here : https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm/include/asm/atomic.h
The error is unrelated to the use of uint64_t data type.
Best Regards,Willy