Giter Site home page Giter Site logo

filip62 / armv8a-call-java-method-from-assembly Goto Github PK

View Code? Open in Web Editor NEW

This project forked from miouyouyou/armv8a-call-java-method-from-assembly

0.0 0.0 0.0 107 KB

This demonstrates how to write a native library with a procedure calling a Java method, defined in an Android app that previously invoked that native procedure. The library is written in ARMv8-A assembly.

License: MIT License

Makefile 15.80% Java 9.64% Assembly 72.58% Batchfile 0.93% Shell 1.05%

armv8a-call-java-method-from-assembly's Introduction

If you appreciate this project, you can support me on Patreon ! Patreon !

Pledgie ! Tip with Altcoins

About

This example demonstrates how to :

  • assemble a library written with the ARMv8-A 64 bits GNU ASsembly syntax
  • call a native procedure, included in this library, from an Android app using the JNI.

The called procedure will then call back a Java method, defined in the Android Application, using the JNI helpers.

Building

Building using GNU Make

Requirements

  • GNU AS (aarch64)
  • Gold linker (aarch64)
  • An ARMv8-A 64 bits Android phone/emulator on which you have installation privileges

Build

Run make from this folder

Manually

Run the following commands :

# cross compiler prefix. Remove if you're assembling from an ARM machine
export PREFIX="aarch64-linux-gnu"
export APP_DIR="./apk"
export LIBNAME="libarcane.so"
${PREFIX}-as -o decypherArcane.o decypherArcane.s
${PREFIX}-ld.gold -shared --dynamic-linker=/system/bin/linker -shared --hash-style=sysv -o $LIBNAME decypherArcane.o
mkdir -p $APP_DIR/app/src/main/jniLibs/arm64-v8a
cp $LIBNAME $APP_DIR/app/src/main/jniLibs/arm64-v8a

Building using Android ndk-build

Requirements

  • The Android NDK path in your system's PATH directory

Build

  • On Windows, run 'mkbuild.bat'
  • On Linux, run 'mkbuild.sh'

Installing the prepared APK

  • Connect your ARMv8-A 64 bits Android phone/emulator
  • open a shell or a "command window"
  • cd to the apk folder

Then :

  • On Windows run gradlew installDebug.
  • On Linux run ./gradlew installDebug

armv8a-call-java-method-from-assembly's People

Contributors

miouyouyou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.