Assembly Language Programming using Arduino IDE for Intel Edison Board

Hi,

I have a project to implement Elliptic Curve Cryptography(ECC) in the Intel Edison Board. Now, I need to make it light weight and to do this I need to do Assembly Language Programming. In general I use Arduino IDE for programming in the Edison Board.

Now I have gone through the lectures available in youtube for Assembly Language Programming in Arduino( https://www.youtube.com/watch?v=h8T3PWauYF4). Here it is told to modify the Sketch.java and Compiler.java file in the Arduino-master folder downloaded from github so that it can accept .s file (used for assembly coding). But the files have been modified recently and the code has significantly changed. Even the compiler.java file does not exist any more. So could you guide me in this regard?

Urbi: I have a project to implement Elliptic Curve Cryptography(ECC)

This one?

https://en.wikipedia.org/wiki/Elliptic_curve_cryptography#Backdoors

Just kidding.

Now I have gone through the lectures available in youtube for Assembly Language Programming in Arduino( https://www.youtube.com/watch?v=h8T3PWauYF4). Here it is told to modify the Sketch.java and Compiler.java file in the Arduino-master folder downloaded from github so that it can accept .s file (used for assembly coding).

Building is now driven by rules stored in a text file. The file is always named platform.txt. This is the file for the AVR processor...

https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/platform.txt

I believe these are the lines for building assembly source files... https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/platform.txt#L28 https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/platform.txt#L46 https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/platform.txt#L61

I suspect modifying the platform.txt file for the Intel Edison will get you what you need.

However, hand assembly is rarely better than what a good compiler produces.

Hi,

if you just want to call some assembly functions, you can use the IDE without modifications. Works at least in 1.6.7.

create your assembly file (new tab) with extension '.S' (capital letter S, lower .s will not work).

write the assembly code with the function you want do call defined as global.

myasmfunc.S

.global myasmfunc

myasmfunc:
  ret

create a header file and use the EXTERN directive to declare global data and procedures

myasmfunc.h

extern "C" {
  void myasmfunc(void);
}

Include the header file in your main sketch an call the function.

somesketch.ino

#include "myasmfunc.h"

void setup() {
  // put your setup code here, to run once:
myasmfunc();
}

void loop() {
  // put your main code here, to run repeatedly:

}

If you wand to pass arguments just follow the register layout and calling convention.

Only if you want to have your sketch directly in plain assembly you need to modify the IDE. Unfortunate I did not try this, cause as for now I'm happy with just including some assemlby functions.

I need to make it light weight and to do this I need to do Assembly Language Programming.

That's a pretty questionable statement. The x86 compiler is much more of a "key" gcc product (than AVR), and I'd expect that t will produce very good code indeed from C or C++. Unless there's specific coprocessing hardware assist that isn't supported by compilation.