Assembly Programming in Pine64
#3
Well, it depends on what you mean.

Bear in mind, the normal way pine64 is run is you are running an operating system (written in C with some assembly thrown in, perhaps in C++) kernel that runs programs on demand. Could you replace the operating system with something you wrote from scratch? You could, but it might take person-years if not person-decades to get all of the interfaces correct. I suspect by the time you finish, this version of the pine64 will have been replaced by the next generations. If you have not programmed in assembly before, it may be too complex to do anything but simple toy programs.

If you really want to do this, perhaps using a different ARM board that is setup to download code from a host, and has debug support via JTAG or other means built-in would be simpler than using a system setup to run a normal OS. Note, even in this arena it is extremely rare that the whole system is written in assembly. Normally only bits and pieces are written in assembly, and everything else is written in higher level languages like C/C++ (and yeah, I know C is not particularly high level compared to other languages, but it still is a lot higher than assembly language).

Ok, maybe writing a complete OS isn't your cup of tea, could you write a Linux/Android program completely in assembly language? Sure. Not only would you have to learn the ARM assembly language, you would have to replicate the whole interface between the operating system, and the programs that is normally handled by the standard libraries. This is doable, but it is perhaps a bit of work tracking down all of the interface details. This might be 1-2 person-weeks worth of effort if you are already familiar with ARM assembly and just need to figure out the details on the pine64 system, or it might be several person-months of effort if you have not have programmed in assembly before (as it appears from your question).

Now, if you just wanted to learn ARM assembly, and are willing to use the standard libraries, then it is possible, and in fact is probably the simplest method to learn assembly. First write a program in C, and compile it with gcc -O2 -S foo.c, and it will provide a foo.s file. Hack on this to your hearts content, using gcc -o foo.exe foo.s to build it, and then run foo.ex (or whatever name you call it). You can use the debugger (gdb) to place breakpoints at locations, you can single step at the instruction level, and look at registers. You will need to figure out the application binary interface (ABI) to learn what the conventions for the stack layout, what registers are used for passing/return parameters, what registers are preserved across calls, etc.

You can also write assembly code that is a function called from C/C++, rather than the whole program.

You can also use GCC's inline assembly feature (https://gcc.gnu.org/onlinedocs/gcc-5.3.0...age-with-C).


Messages In This Thread
Assembly Programming in Pine64 - by mustaphos - 04-13-2016, 05:29 AM
RE: Assembly Programming in Pine64 - by rahlquist - 04-13-2016, 06:14 AM
RE: Assembly Programming in Pine64 - by frewind - 04-13-2016, 12:00 PM
RE: Assembly Programming in Pine64 - by MichaelMeissner - 04-13-2016, 06:54 AM
RE: Assembly Programming in Pine64 - by dmartin - 05-13-2016, 12:08 PM
RE: Assembly Programming in Pine64 - by tllim - 05-13-2016, 04:40 PM
RE: Assembly Programming in Pine64 - by johnsl - 12-06-2016, 07:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Programming languages support under PINE64 baryluk 6 9,831 09-23-2020, 11:46 PM
Last Post: Phillip Bell
  Manjaro arm on pine64+ roel 2 4,604 10-19-2019, 05:13 AM
Last Post: roel
  Volumio for PINE64 Released mikelangeloz 11 20,313 03-22-2019, 09:25 AM
Last Post: llungster
  I2S Audio patches for Pine64+ uploaded to GitHub ramstadt 1 3,258 01-19-2019, 11:31 AM
Last Post: ramstadt
  Pine64: Minimal SDL config Max11 3 4,683 01-04-2019, 03:47 PM
Last Post: Max11
  Fedora 27 on Pine64 gregjo 18 28,093 01-02-2019, 10:42 PM
Last Post: heatfanjohn
  Official build procedure of ayufan pine64 r.tanaka 0 2,617 08-21-2018, 10:54 PM
Last Post: r.tanaka
  DKMS on kernel 3.10.107-pine64 obrienmd 5 6,626 06-21-2018, 05:45 PM
Last Post: evilbunny
  Gentoo for pine64 - longsleep kernel incoherent 0 3,103 12-09-2017, 08:14 AM
Last Post: incoherent
  Fedora Running On Pine64! cztian 26 28,778 10-26-2017, 05:51 PM
Last Post: gregjo

Forum Jump:


Users browsing this thread: 1 Guest(s)