IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

 C Discussion :

Alerte de prototype lors de la compilation


Sujet :

C

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    24
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Septembre 2009
    Messages : 24
    Par défaut Alerte de prototype lors de la compilation
    Bonjour,
    Je travaille sur un petit projet de C embarqué. Je souhaite communiquer avec une SDHC par l'intermédiaire d'un pic18. Je travaille avec MPLAB avec le compilateur c18. Un autre point est que je débute en C.
    Pour l'instant j'essaie simplement de communiquer avec une SD, microchip me proposant des librairies de démonstration pour cela. Je pensais qu'elles fonctionneraient directement une fois les modifications matériel apportées mais ce n'est pas le cas. J'ai directement deux erreurs liées, les voici :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    Clean: Deleting intermediary and output files.
    Clean: Done.
    Executing: "C:\MCC18\bin\mcc18.exe" -p=18F67J50 /i"C:\MCC18\h" -I"..\Microchip\Include\PIC18 salloc" -I"..\Include\PIC18 salloc" -I"." -I".\PIC18F" -I"..\Include" -I"..\Include\MDD File System" -I"..\Microchip\Include" -I"..\..\Microchip\Include" -I"..\Microchip\Include\MDD File System" -I"..\..\Microchip\Include\MDD File System" -I"..\..\MDD File System-SD Card" -I"..\..\MDD File System-SD Card\PIC18F" "FSIO.c" -fo=".\Object - MDD File System-SD-PIC18\FSIO.o" -D__DEBUG -mL -Ls -Ou- -Ot- -Ob- -Op- -Or- -Od- -Opa-
    C:\Microchip Solutions\Microchip\MDD File System\FSIO.c:798:Warning [2058] call of function without prototype
    C:\Microchip Solutions\Microchip\MDD File System\FSIO.c:798:Error [1131] type mismatch in assignment
    Halting build on first failure as requested.
    voici ce qui est écrit sur la ligne : mediaInformation = MDD_MediaInitialize();

    Je vous donne la fonction (c'est peut être inutile de tout vous donner mais mieux vaut trop que pas assez)

    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
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    /*****************************************************************************
      Function:
        MEDIA_INFORMATION *  MDD_SDSPI_MediaInitialize (void)
      Summary:
        Initializes the SD card.
      Conditions:
        The MDD_MediaInitialize function pointer must be pointing to this function.
      Input:
        None.
      Return Values:
        The function returns a pointer to the MEDIA_INFORMATION structure.  The
        errorCode member may contain the following values:
            * MEDIA_NO_ERROR - The media initialized successfully
            * MEDIA_CANNOT_INITIALIZE - Cannot initialize the media.  
      Side Effects:
        None.
      Description:
        This function will send initialization commands to and SD card.
      Remarks:
        None.
      ***************************************************************************************/
     
    MEDIA_INFORMATION *  MDD_SDSPI_MediaInitialize(void)
    {
        WORD timeout;
        MMC_RESPONSE    response; 
     
    #if defined __C30__ || defined __C32__
        WORD spiconvalue = 0x0003;
    #endif
        mediaInformation.errorCode = MEDIA_NO_ERROR;
        mediaInformation.validityFlags.value = 0;
     
        SD_CS = 1;               //Initialize Chip Select line
     
        //Media powers up in the open-drain mode and cannot handle a clock faster
        //than 400kHz. Initialize SPI port to slower than 400kHz
    #if defined __C30__ || defined __C32__
    #ifdef __PIC32MX__
    	OpenSPI(SPI_START_CFG_1, SPI_START_CFG_2);
        SPIBRG = SPICalutateBRG(GetPeripheralClock(), 400000);
    #else
        // Calculate the prescaler needed for the clock
        timeout = GetSystemClock() / 400000;
        // if timeout is less than 400k and greater than 100k use a 1:1 prescaler
        if (timeout == 0)
        {
            OpenSPIM (MASTER_ENABLE_ON | PRI_PRESCAL_1_1 | SEC_PRESCAL_1_1);
        }
        else
        {
            while (timeout != 0)
            {
                if (timeout > 8)
                {
                    spiconvalue--;
                    // round up
                    if ((timeout % 4) != 0)
                        timeout += 4;
                    timeout /= 4;
                }
                else
                {
                    break;
                }
            }
     
            timeout--;
     
            OpenSPIM (MASTER_ENABLE_ON | spiconvalue | ((~(timeout << 2)) & 0x1C));
        }
    #endif    
     
     
        // let the card power on and initialize
        Delayms(1);
     
        //Media requires 80 clock cycles to startup [8 clocks/BYTE * 10 us]
        for(timeout=0; timeout<10; timeout++)
            mSend8ClkCycles();
     
        SD_CS = 0;
     
        Delayms(1);
     
        // Send CMD0 to reset the media
        response = SendMMCCmd(GO_IDLE_STATE,0x0);
     
        if((response.r1._byte == MMC_BAD_RESPONSE) || ((response.r1._byte & 0xF7) != 0x01))
        {
            SD_CS = 1;                               // deselect the devices
            mediaInformation.errorCode = MEDIA_CANNOT_INITIALIZE;
            return &mediaInformation;
        }
     
           response = SendMMCCmd(SEND_IF_COND, 0x1AA);
        if (((response.r7.bytewise._returnVal & 0xFFF) == 0x1AA) && (!response.r7.bitwise.bits.ILLEGAL_CMD))
    	{
            timeout = 0xFFF;
            do
            {
                   response = SendMMCCmd(SEND_OP_COND, 0x40000000);
                timeout--;
            }while(response.r1._byte != 0x00 && timeout != 0);
    		response = SendMMCCmd(READ_OCR, 0x0);
            if (((response.r7.bytewise._returnVal & 0xC0000000) == 0x80000000) && (response.r7.bytewise._byte == 0))
    		{
    			gSDMode = SD_MODE_NORMAL;
    		}
            if (((response.r7.bytewise._returnVal & 0xC0000000) == 0xC0000000) && (response.r7.bytewise._byte == 0))
    		{
            gSDMode = SD_MODE_;
    		}
    	}
        else
    	{
            gSDMode = SD_MODE_NORMAL;
     
        // According to spec cmd1 must be repeated until the card is fully initialized
        timeout = 0xFFF;
     
        do
        {
                response = SendMMCCmd(SEND_OP_COND,0x0);
            timeout--;
        }while(response.r1._byte != 0x00 && timeout != 0);
    	}
     
        // see if it failed
        if(timeout == 0)
        {
            mediaInformation.errorCode = MEDIA_CANNOT_INITIALIZE;
            SD_CS = 1;                               // deselect the devices
        }
        else      
        {
     
    #else
     
        // let the card power on and initialize
        Delayms(1);
     
        #if (GetSystemClock() < 25600000)
     
            #if (GetSystemClock() < 1600000)
                OpenSPIM (SYNC_MODE_FAST);
            #elif (GetSystemClock() < 6400000)
                OpenSPIM (SYNC_MODE_MED);
            #else
                OpenSPIM (SYNC_MODE_SLOW);
            #endif
     
            // let the card power on and initialize
            Delayms(1);
     
            //Media requires 80 clock cycles to startup [8 clocks/BYTE * 10 us]
            for(timeout=0; timeout<10; timeout++)
                mSend8ClkCycles();
     
            SD_CS = 0;
     
            Delayms(1);
     
            // Send CMD0 to reset the media
            response = SendMMCCmd(GO_IDLE_STATE,0x0);
     
            if((response.r1._byte == MMC_BAD_RESPONSE) || ((response.r1._byte & 0xF7) != 0x01))
            {
                mediaInformation.errorCode = MEDIA_CANNOT_INITIALIZE;
                SD_CS = 1;                               // deselect the devices
                return &mediaInformation;
            }
     
            response = SendMMCCmd(SEND_IF_COND, 0x1AA);
            if (((response.r7.bytewise._returnVal & 0xFFF) == 0x1AA) && (!response.r7.bitwise.bits.ILLEGAL_CMD))
    		{
    	        timeout = 0xFFF;
    	        do
    	        {
                    response = SendMMCCmd(SEND_OP_COND, 0x40000000);
    	            timeout--;
    	        }while(response.r1._byte != 0x00 && timeout != 0);
    			response = SendMMCCmd(READ_OCR, 0x0);
    	        if (((response.r7.bytewise._returnVal & 0xC0000000) == 0x80000000) && (response.r7.bytewise._byte == 0))
    			{
    				gSDMode = SD_MODE_NORMAL;
    			}
    	        if (((response.r7.bytewise._returnVal & 0xC0000000) == 0xC0000000) && (response.r7.bytewise._byte == 0))
    			{
                gSDMode = SD_MODE_HC;
    			}
    		}
            else
    		{
                gSDMode = SD_MODE_NORMAL;
     
            // According to spec cmd1 must be repeated until the card is fully initialized
            timeout = 0xFFF;
     
            do
            {
                    response = SendMMCCmd(SEND_OP_COND,0x0);
                timeout--;
            }while(response.r1._byte != 0x00 && timeout != 0);
    		}
     
        #else
     
            // Make sure the SPI module doesn't control the bus
            SPICON1 = 0x00;
     
            //Media requires 80 clock cycles to startup [8 clocks/BYTE * 10 us]
            for(timeout=0; timeout<10; timeout++)
                WriteSPIManual(0xFF);
     
            SD_CS = 0;
     
            Delayms(1);
     
            // Send CMD0 to reset the media
            response = SendMMCCmdManual (GO_IDLE_STATE, 0x0);
     
            if ((response.r1._byte == MMC_BAD_RESPONSE) || ((response.r1._byte & 0xF7) != 0x01))
            {
                SD_CS = 1;                              // deselect the devices
                mediaInformation.errorCode = MEDIA_CANNOT_INITIALIZE;
                return &mediaInformation;
            }
     
            response = SendMMCCmdManual(SEND_IF_COND, 0x1AA);
            if (((response.r7.bytewise._returnVal & 0xFFF) == 0x1AA) && (!response.r7.bitwise.bits.ILLEGAL_CMD))
    		{
    	        timeout = 0xFFF;
    	        do
    	        {
                    response = SendMMCCmdManual(SEND_OP_COND, 0x40000000);
    	            timeout--;
    	        }while(response.r1._byte != 0x00 && timeout != 0);
    			response = SendMMCCmdManual(READ_OCR, 0x0);
    	        if (((response.r7.bytewise._returnVal & 0xC0000000) == 0x80000000) && (response.r7.bytewise._byte == 0))
    			{
    				gSDMode = SD_MODE_NORMAL;
    			}
    	        if (((response.r7.bytewise._returnVal & 0xC0000000) == 0xC0000000) && (response.r7.bytewise._byte == 0))
    			{
                gSDMode = SD_MODE_HC;
    			}
    		}
            else
    		{
                gSDMode = SD_MODE_NORMAL;
            // According to the spec cmd1 must be repeated until the card is fully initialized
            timeout = 0xFFF;
     
            do
            {
                response = SendMMCCmdManual (SEND_OP_COND, 0x0);
                timeout--;
            }while(response.r1._byte != 0x00 && timeout != 0);
    		}
        #endif    
     
        // see if it failed
        if (timeout == 0)
        {
            mediaInformation.errorCode = MEDIA_CANNOT_INITIALIZE;
            SD_CS = 1;                              // deselect the devices
        }
        else
        {
    #endif
     
            Delayms (2);
     
            #ifdef __PIC32MX__
                #if (GetSystemClock() <= 20000000)
                    SPIBRG = SPICalutateBRG(GetPeripheralClock(), 10000);
                #else
                    SPIBRG = SPICalutateBRG(GetPeripheralClock(), SPI_FREQUENCY);
                #endif
            #else
                OpenSPIM(SYNC_MODE_FAST);
            #endif
     
            // Turn off CRC7 if we can, might be an invalid cmd on some cards (CMD59)
            response = SendMMCCmd(CRC_ON_OFF,0x0);
     
            // Now set the block length to media sector size. It should be already
            response = SendMMCCmd(SET_BLOCKLEN,MEDIA_SECTOR_SIZE);
     
            for(timeout = 0xFF; timeout > 0 && MDD_SDSPI_SectorRead(0x0,NULL) != TRUE; timeout--)
            {;}
     
            // see if we had an issue
            if(timeout == 0)
            {
                mediaInformation.errorCode = MEDIA_CANNOT_INITIALIZE;
                SD_CS = 1;                               // deselect the devices
            }
        }
     
        return &mediaInformation;
    }
    }//end MediaInitialize
    mediaInformation est déclarée de cette manière
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    static MEDIA_INFORMATION mediaInformation;
    J'espère que vous aller pouvoir m'aider pour ces erreurs. Et est-ce normal d'avoir directement des erreurs sur des librairies microchip ??

    Merci

    Guillaume

  2. #2
    Expert confirmé
    Avatar de diogene
    Homme Profil pro
    Enseignant Chercheur
    Inscrit en
    Juin 2005
    Messages
    5 761
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Essonne (Île de France)

    Informations professionnelles :
    Activité : Enseignant Chercheur
    Secteur : Enseignement

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 761
    Par défaut
    Pour le premier warning,
    call of function without prototype
    tu utilises une fonction sans que le compilateur ne connaisse son prototype, c'est à dire son en-tête. Par exemple, ceci est un prototype de la fonction MDD_SDSPI_MediaInitialize ()
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    MEDIA_INFORMATION *  MDD_SDSPI_MediaInitialize(void) ;
    Souvent, ceci se produit pour une fonction de bibliothèque lorsqu'on a oublié d'inclure le .h associé (c'est là où sont placés tous les prototypes des fonctions de la bibliothèque)
    Dans ces circonstances, la fonction est supposée par le compilateur (à tort ou à raison) renvoyer un int . Ceci peut être la cause de l'erreur qui suit :
    type mismatch in assignment

  3. #3
    Membre averti
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    24
    Détails du profil
    Informations personnelles :
    Localisation : Canada

    Informations forums :
    Inscription : Septembre 2009
    Messages : 24
    Par défaut
    Merci, c'était le problème.
    Je n'y avait pas prêté attention, je pensais ne pas à avoir à modifier quoi que ce soit, pour que cela marche?
    Bon maintenant, j'ai d'autres problèmes que je vais essayer de résoudre.
    Merci
    guillaume

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Alerte de prototype lors de la compilation
    Par damien14 dans le forum C
    Réponses: 2
    Dernier message: 18/04/2007, 11h37
  2. Réponses: 7
    Dernier message: 27/09/2005, 21h40
  3. [Debutant] probleme lors de la compilation
    Par boobi dans le forum Débuter
    Réponses: 5
    Dernier message: 26/08/2005, 15h57
  4. [MYSQL] Probleme lors de la compilation
    Par Nasky dans le forum Autres éditeurs
    Réponses: 10
    Dernier message: 24/02/2004, 17h04
  5. Warnings lors de la compilation
    Par polo54 dans le forum C
    Réponses: 5
    Dernier message: 07/02/2003, 09h12

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo