Guest
#1616126
hi, is there anybody out there who can explain, how i can call c-code
from asm-code?
for tests i wrote some little code for my atmega8:
asm_code in atmel-avr-assembler:
.include "m8def.inc"
.include "test_c.c"
.def temp = r16
ldi temp, LOW(RAMEND)
out SPL, temp
ldi temp, HIGH(RAMEND)
out SPH, temp
nop
nop
nop
RCALL test_c
nop
nop
c_code (external file named test_c.c):
#include <avr/io.h>
#include <stdio.h>
int main (void) {
DDRB = 0xff;
PORTB = 0x03;
PORTB = 0x07;
while(1) {
/* "empty*/
}
return 0;
}
if i try to build the asm-section, i get the following errors:
E:\elektronik\atmega8\c aus asm\test.c(1): error: Cannot find include
file: avr/io.h
E:\elektronik\atmega8\c aus asm\test.c(2): error: Cannot find include
file: stdio.h
E:\elektronik\atmega8\c aus asm\test.c(4): error: syntax error,
unexpected FUNCTION
what is wrong? do i have to compile the test.c first? but then i get
these files:
test_c.aps
test_c.aws
test_c.c
test_c.o
test_c.map
test_c.lss
test_c.eep
test_c.elf
test_c.hex
do i have to include one of them??
thanks for help!!!