I'm attempting to learn Assembly for the Arduino Uno, currently, I'm using the Arduino IDE and a .S file in which I overwrite the setup and loop functions. I want to make the Arduino receive a serial character and do something depending on what character it received. However, I can't seem to find how to call standard Arduino functions from the .S file. Specifically, I want to call the Serial.begin, Serial.read and Serial.available functions. If someone could point me in the right direction I would much appreciate it.
Edit:
I was able to call C functions from assembly (the delay function in this case) and pass it parameters. Now i've tried to do the same for "Serial.begin(9600)" with the folowing code:
.extern Serial.begin
setup:
ldi r22, 0b10000000 ; set 9600 as a long for the first parameter
ldi r23, 0b00100101
clr r24
clr r25
call Serial.begin ; call serial begin
...
the idea is to move 9600 in the registers r22:r25 as I understand that is where it will expect the first parameter. I am positive there is a better way to do this but thats the way I came up with. Compiling this yields the error: "undefined reference to `Serial.begin'"
if anyone could help me I would appreciate it.