This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ASM in langage C

Hello everybody,

Sorry for my english.

I start a new prog, and so I am at the beging.
This the first time that I include assembler code in a program write in C.

When I build all targets I have 2 warnings :

- Warning L1: Unresolved external symbol Symbol: ?C_START Module: STARTUP.obj (?C_STARTUP)

and

- Warning L2: Reference made to unresolved external Symbol: ?C_START Module: STARTUP.obj (?C_STARTUP) Address: 2687H

I read the help of Keil, but it does not do me much.

Note that I validated "Generate Assembler SRC File" in the option of main.c and in the option of "Source Group 1".

In the "source group 1" I have 2 files "main.c" and "STARTUP.A51"

Please find this two files :

main.c :


#include <REG51.H>

void ecriture_flash();


void main()
{
unsigned char unite;
unsigned char dizaine;
unsigned char centaine;

#pragma asm
ORG 0000h
JMP 2000h
ORG 2000h
#pragma endasm

SM0=0;                          //UART en mode 1
SM1=1;                          //UART en mode 1
SM2=0;                          //Gestion multiprocesseur inactive
REN=1;                          //Reception active

TMOD=0x20;                      //Config Timer 1 en mode 2 et mode temporisateur
TH1=255;                        //56000 Bauds
TR1=1;                          //Active le timer 1

TI=0;

centaine='3';
dizaine='2';
unite='1';

DPH=0xFF;
DPL=0xFF;
ACC=centaine;
ecriture_flash();

DPH=0xFF;
DPL=0xFE;
ACC=dizaine;
ecriture_flash();

DPH=0xFF;
DPL=0xFD;
ACC=unite;
ecriture_flash();

DPH=0xFF;
DPL=0xFC;
ACC=0xDD;
ecriture_flash();

while (1);

}


void ecriture_flash()
{
#pragma asm
MOV R1, #02h
MOV 0B1h, #0
CALL 1FF0h
MOV 0B1h, #1
#pragma endasm

}