Docker on Mac M1 gives: “The requested image’s platform (linux/amd64) does not match the detected host platform”

If you’re planning to run the image in your laptop, you need to build it for the cpu architecture of that particular machine. You can provide the –platform option to docker build (or even to docker-compose) to define the target platform you want to build the image for. For example: docker build –platform linux/arm64 .

What is the difference between the ARM, Thumb and Thumb 2 instruction encodings?

Oh, ARM and their silly naming… It’s a common misconception, but officially there’s no such thing as a “Thumb-2 instruction set”. Ignoring ARMv8 (where everything is renamed and AArch64 complicates things), from ARMv4T to ARMv7-A there are two instruction sets: ARM and Thumb. They are both “32-bit” in the sense that they operate on up-to-32-bit-wide … Read more

exit.c:(.text+0x18): undefined reference to `_exit’ when using arm-none-eabi-gcc

This happens when compiling a file with arm-none-eabi-gcc in one machine/architecture to load it in an ARM target machine. Most probably you are not making use of semihosting, you want to retarget. ARMĀ® Compiler toolchain Version 4.1 indicates: Semihosting is a mechanism that enables code running on an ARM target to communicate and use the … Read more

Is the `if` statement redundant before modulo and before assign operations?

If you want to understand what the compiler is doing, you’ll need to just pull up some assembly. I recommend this site (I already entered code from the question)): https://godbolt.org/g/FwZZOb. The first example is more interesting. int div(unsigned int num, unsigned int num2) { if( num >= num2 ) return num % num2; return num; … Read more

What are the purposes of the ARM ABI and EABI?

An ABI (Application Binary Interface) is a standard that defines a mapping between low-level concepts in high-level languages and the abilities of a specific hardware/OS platform’s machine code. That includes things like: how C/C++/Fortran/… data types are laid out in memory (data sizes / alignments) how nested function calls work (where and how the information … Read more

Looking for an efficient integer square root algorithm for ARM Thumb2

Integer Square Roots by Jack W. Crenshaw could be useful as another reference. The C Snippets Archive also has an integer square root implementation. This one goes beyond just the integer result, and calculates extra fractional (fixed-point) bits of the answer. (Update: unfortunately, the C snippets archive is now defunct. The link points to the … Read more

Android architecture usage?

First off, if you’re worring about binary size, you don’t really need arm64-v8a, all those devices can run the armeabi-v7a binaries just fine. Only if you really need to cram the last extra performance out of it, it might be worthwhile. As for armeabi and ARMv6; Android itself doesn’t officially support it any longer, since … Read more

How to access physical addresses from user space in Linux?

busybox devmem busybox devmem is a tiny CLI utility that mmaps /dev/mem. You can get it in Ubuntu with: sudo apt-get install busybox Usage: read 4 bytes from the physical address 0x12345678: sudo busybox devmem 0x12345678 Write 0x9abcdef0 to that address: sudo busybox devmem 0x12345678 w 0x9abcdef0 Source: https://github.com/mirror/busybox/blob/1_27_2/miscutils/devmem.c#L85 mmap MAP_SHARED When mmapping /dev/mem, you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)