Want to compile native Android binary I can run in terminal on the phone

Just use the android-ndk. And build a Android.mk like so. include $(BUILD_EXECUTABLE) is what tells it build a executable instead of a JNI .lib Android.mk ifneq ($(TARGET_SIMULATOR),true) LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_CFLAGS += -Wall LOCAL_LDLIBS := -L$(LOCAL_PATH)/lib -llog -g LOCAL_C_INCLUDES := bionic LOCAL_C_INCLUDES += $(LOCAL_PATH)/include LOCAL_SRC_FILES:= main.cpp LOCAL_MODULE := mycmd include $(BUILD_EXECUTABLE) endif # … Read more

Why use LDR over MOV (or vice versa) in ARM assembly?

It is a trick/shortcut. say for example ldr r0,=main what would happen is the assembler would allocate a data word, near the instruction but outside the instruction path ldr r0,main_addr … b somewhere main_addr: .data main Now expand that trick to constants/immediates, esp those that cannot fit into a move immediate instruction: top: add r1,r2,r3 … Read more

What are “nosys”, “nano”, “rdimon” terms when using ARM GCC?

Gcc uses specs-strings, which control which subprocesses to run and what parameters it shall pass to them. The behavior defined by the spec-strings can be overridden using spec-files, whose purpose and syntax is documented here: https://gcc.gnu.org/onlinedocs/gcc/Spec-Files.html Looking at these spec files in the lib folder of the gcc tool chain (e.g. /usr/lib/arm-none-eabi/lib) we can see … Read more

What does ‘bank’ing a register mean?

Register banking refers to providing multiple copies of a register at the same address. Taken from section 1.4.6 of the arm docs The term is referring to a solution for the problem that not all registers can be seen at once. There is a different register bank for each processor mode. The banked registers give … Read more

How to run a C program with no OS on the Raspberry Pi?

Fully automated minimal bare metal blinker example Tested on Ubuntu 16.04 host, Raspberry Pi 2. https://github.com/dwelch67/raspberrypi is the most comprehensive example set I’ve seen to date (previously mentioned on this now deleted answer), but this is a minimal easy to setup hello world to get you started quickly. Usage: Insert SD card on host Make … Read more

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