Salut tout le monde
J'ai ecrit ce code en langage c embarqué,j'ai compilé et j'ai plein d'erreur qui peut m'aider?
Le code est:
avec "xparameter.h" est:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60 #include "xparameters.h" #include "xgpio_l.h" #include "xutil.h" #include <stdio.h> #include <fcntl.h> int main (void) { Xuint32 *MLogicPtr; Xuint32 data,data1, data2, result; int i; Print ("-- Entering main () --\r\n\n"); Do{ MLogicPtr = (Xuint32 *)XPAR_M_LOGIC_0_BASEADDR; //Entrer la premiére valeur Do { data =XGpio_mGetDataReg(XPAR_PUSH_BUTTONS_3BIT_BASEADDR, 1) ; data1 =XGpio_mGetDataReg(XPAR_DIP_SWITCHES_8BIT_BASEADDR, 1) ; } while (data == 0); xil_printf("Data read from Push_Buttons_3Bit: 0x%x\r\n", data); xil_printf("Data read from DIP_Switches_8Bit: 0x%x\r\n", data1); *(MLogicPtr) = data1 ; for(i=0; i <= 100; i++) { ; } //Temporistaion //Entrer la deuxiéme valeur Do { data =XGpio_mGetDataReg(XPAR_PUSH_BUTTONS_3BIT_BASEADDR, 1) ; data2 =XGpio_mGetDataReg(XPAR_DIP_SWITCHES_8BIT_BASEADDR, 1) ; } while (data == 0); xil_printf("Data read from Push_Buttons_3Bit: 0x%x\r\n", data); xil_printf("Data read from DIP_Switches_8Bit: 0x%x\r\n", data2); *(MLogicPtr + 0x21) = data2; for(i=0; i <= 100; i++) { ; } //Temporistaion //Recuperer le resultat result= *(MLogicPtr + 0x44); print ("Le resultat est \r\n"); xil_printf("%d + %d = %d \r\n", data1,data2,result); xil_printf("%x + %x = %x \r\n\n", data1,data2,result); for(i=0; i <= 100; i++) { ; } //Temporistaion } while(1); // Toujours tant qu'il y'a une entrée de la part de l'utilisateur print("-- Exiting main() --\r\n\n\n"); return 0; }
Les erreurs sont:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52 *******************************************************************/ #define STDIN_BASEADDRESS 0x40600000 #define STDOUT_BASEADDRESS 0x40600000 /******************************************************************/ #define XPAR_DLMB_CNTLR_BASEADDR 0x00000000 #define XPAR_DLMB_CNTLR_HIGHADDR 0x00003FFF #define XPAR_ILMB_CNTLR_BASEADDR 0x00000000 #define XPAR_ILMB_CNTLR_HIGHADDR 0x00003FFF /******************************************************************/ #define XPAR_XUARTLITE_NUM_INSTANCES 2 #define XPAR_DEBUG_MODULE_BASEADDR 0x41400000 #define XPAR_DEBUG_MODULE_HIGHADDR 0x4140FFFF #define XPAR_DEBUG_MODULE_DEVICE_ID 0 #define XPAR_DEBUG_MODULE_BAUDRATE 0 #define XPAR_DEBUG_MODULE_USE_PARITY 0 #define XPAR_DEBUG_MODULE_ODD_PARITY 0 #define XPAR_DEBUG_MODULE_DATA_BITS 0 #define XPAR_RS232_BASEADDR 0x40600000 #define XPAR_RS232_HIGHADDR 0x4060FFFF #define XPAR_RS232_DEVICE_ID 1 #define XPAR_RS232_BAUDRATE 9600 #define XPAR_RS232_USE_PARITY 0 #define XPAR_RS232_ODD_PARITY 0 #define XPAR_RS232_DATA_BITS 8 /******************************************************************/ #define XPAR_XGPIO_NUM_INSTANCES 2 #define XPAR_PUSH_BUTTONS_3BIT_BASEADDR 0x40000000 #define XPAR_PUSH_BUTTONS_3BIT_HIGHADDR 0x4000FFFF #define XPAR_PUSH_BUTTONS_3BIT_DEVICE_ID 0 #define XPAR_PUSH_BUTTONS_3BIT_INTERRUPT_PRESENT 0 #define XPAR_PUSH_BUTTONS_3BIT_IS_DUAL 0 #define XPAR_DIP_SWITCHES_8BIT_BASEADDR 0x40020000 #define XPAR_DIP_SWITCHES_8BIT_HIGHADDR 0x4002FFFF #define XPAR_DIP_SWITCHES_8BIT_DEVICE_ID 1 #define XPAR_DIP_SWITCHES_8BIT_INTERRUPT_PRESENT 0 #define XPAR_DIP_SWITCHES_8BIT_IS_DUAL 0 /******************************************************************/ #define XPAR_M_LOGIC_NUM_INSTANCES 1 #define XPAR_M_LOGIC_0_DEVICE_ID 0 #define XPAR_M_LOGIC_0_BASEADDR 0x73600000 #define XPAR_M_LOGIC_0_HIGHADDR 0x7360FFFF /******************************************************************/
TestApp_Memory/src/TestApp_Memory.c: In function `main'
TestApp_Memory/src/TestApp_Memory.c:14: error: `Do' undeclared (first use in
this function
TestApp_Memory/src/TestApp_Memory.c:14: error: (Each undeclared identifier is
reported only onc
TestApp_Memory/src/TestApp_Memory.c:14: error: for each function it appears in.
TestApp_Memory/src/TestApp_Memory.c:14: error: parse error before '{' toke
TestApp_Memory/src/TestApp_Memory.c: At top level
TestApp_Memory/src/TestApp_Memory.c:21: error: parse error before "while
TestApp_Memory/src/TestApp_Memory.c:22: error: parse error before string constan
TestApp_Memory/src/TestApp_Memory.c:22: error: conflicting types for 'xil_printf
/cygdrive/c/EDK/gnu/microblaze/nt/bin/../lib/gcc/microblaze/3.4.1/../../../../mi
croblaze/sys-include/stdio.h:135: error: previous declaration of 'xil_printf'
was her
TestApp_Memory/src/TestApp_Memory.c:22: error: conflicting types for 'xil_printf
/cygdrive/c/EDK/gnu/microblaze/nt/bin/../lib/gcc/microblaze/3.4.1/../../../../mi
croblaze/sys-include/stdio.h:135: error: previous declaration of 'xil_printf'
was her
TestApp_Memory/src/TestApp_Memory.c:22: warning: data definition has no type or
storage clas
TestApp_Memory/src/TestApp_Memory.c:23: error: parse error before string constan
TestApp_Memory/src/TestApp_Memory.c:23: warning: data definition has no type or
storage clas
TestApp_Memory/src/TestApp_Memory.c:25: error: `data1' undeclared here (not in a
function
TestApp_Memory/src/TestApp_Memory.c:25: warning: data definition has no type or
storage clas
TestApp_Memory/src/TestApp_Memory.c:27: error: parse error before "for
TestApp_Memory/src/TestApp_Memory.c:30: error: syntax error before '{' toke
TestApp_Memory/src/TestApp_Memory.c:32: error: initializer element is not
constan
TestApp_Memory/src/TestApp_Memory.c:32: warning: data definition has no type or
storage clas
TestApp_Memory/src/TestApp_Memory.c:34: error: parse error before '}' toke
TestApp_Memory/src/TestApp_Memory.c:35: error: parse error before string constan
TestApp_Memory/src/TestApp_Memory.c:35: warning: data definition has no type or
storage clas
TestApp_Memory/src/TestApp_Memory.c:36: error: parse error before string constan
TestApp_Memory/src/TestApp_Memory.c:36: warning: data definition has no type or
storage clas
TestApp_Memory/src/TestApp_Memory.c:38: error: parse error before '+' toke
TestApp_Memory/src/TestApp_Memory.c:43: error: initializer element is not
constan
TestApp_Memory/src/TestApp_Memory.c:43: warning: data definition has no type or
storage clas
TestApp_Memory/src/TestApp_Memory.c:45: error: parse error before string constan
TestApp_Memory/src/TestApp_Memory.c:45: error: conflicting types for 'print
/cygdrive/c/EDK/gnu/microblaze/nt/bin/../lib/gcc/microblaze/3.4.1/../../../../mi
croblaze/sys-include/stdio.h:137: error: previous declaration of 'print' was her
TestApp_Memory/src/TestApp_Memory.c:45: error: conflicting types for 'print
/cygdrive/c/EDK/gnu/microblaze/nt/bin/../lib/gcc/microblaze/3.4.1/../../../../mi
croblaze/sys-include/stdio.h:137: error: previous declaration of 'print' was her
TestApp_Memory/src/TestApp_Memory.c:45: warning: data definition has no type or
storage clas
TestApp_Memory/src/TestApp_Memory.c:46: error: parse error before string constan
TestApp_Memory/src/TestApp_Memory.c:46: warning: data definition has no type or
storage clas
TestApp_Memory/src/TestApp_Memory.c:47: error: parse error before string constan
TestApp_Memory/src/TestApp_Memory.c:47: warning: data definition has no type or
storage clas
TestApp_Memory/src/TestApp_Memory.c:53: error: parse error before string constan
TestApp_Memory/src/TestApp_Memory.c:53: warning: data definition has no type or
storage clas
Partager