Bonjour, je suis étudiant en alternance et dans l'entreprise qui me forme je dois pour le moment tenter de comprendre un code avec de très nombreux fichiers sources/headers. (j'utilise Eclipse comme IDE)
Je ne partagerez que ce que je pense nécessaire à la compréhension de mon problème.
Alors voilà je voulais savoir la différence entre le dossier qui se créer lorsque je compile en mode Debug et le fichier source et header qu'un programmeur de la boite à coder.
Explication :
Lorsque j'effectue une compilation que ce soit en Debug ou en Release on est bien d'accord que cela me créer un fichier dans mon projet ? (je ne suis pas sur mais quand je vois sa c'est ce que je me dis :
Le projet (sans la partie principale inutile à montrer ici) :
On voit donc le dossier respectif Debug et Release, j'imagine qu'il on était créer lors du premier lancement en Debug et en Realease respectivement si quelqu'un pourrait me confirmer sa s'il vous plait.
Ma question :
Lorsque j'ouvre le dossier spécifique au projet je retrouve un fichier source/header de debug
J'aimerais savoir quel est l'interet de ce debug présent ici puisque on peut voir qu'il a un dossier spécifique, j'aimerai également savoir si il existe une quelquonque différence entre les deux.
Voici le code correspondant au debug.c :
#include "debug.h"
#ifdef DEBUG_UDPPORT
/*******************/
/***** globals *****/
/*******************/
/** @brief The socket used to send debug messages */
struct udp_pcb *debugSocket = 0;
/*********************************/
/****** Function definition ******/
/*********************************/
/**
* @brief Initialize the USB debug interface
*/
void debugInit(void)
{
debugSocket = udp_new();
if (debugSocket)
udp_connect(debugSocket, (ip_addr_t*)&ip_addr_broadcast, DEBUG_UDPPORT);
}
/**
* @brief Send a line on debug interface
*
* @param[in] strToSend The string to send
*
* This function send the string and a CR+LF character
*/
void debugSendLine(char * strToSend)
{
debugSend(strToSend);
debugSendNewLine();
}
/**
* @brief Send a CR+LF character
*/
void debugSendNewLine(void)
{
debugSend("\r\n");
}
/**
* @brief Send a string on debug interface
*
* @param[in] strToSend The string to send
*/
void debugSend(char * strToSend)
{
debugSendRawBuffer(strToSend, strlen(strToSend));
}
/**
* @brief Send a raw buffer on debug interface
*
* @param[in] buffer The buffer to send
* @param[in] bufferLength The length of the buffer
*/
void debugSendRawBuffer(char *buffer, unsigned short bufferLength)
{
struct pbuf *p;
// send only if possible
if (debugSocket)
{
// allocate buffer
p = pbuf_alloc(PBUF_TRANSPORT, bufferLength, PBUF_REF);
p->payload = buffer;
// send it
udp_send(debugSocket, p);
// free buffer
pbuf_free(p);
}
}
/**
* @brief Send an hexadecimal byte on debug interface
*
* @param[in] value The hexadecimal byte to send
*/
void debugSendHexByte(unsigned char value)
{
char str[4];
str[0] = 'x';
hexaToAscii(value, 2, (unsigned char *)&str[1]);
str[3] = 0x00;
debugSend(str);
}
/**
* @brief Send an hexadecimal short on debug interface
*
* @param[in] value The hexadecimal short to send
*/
void debugSendHexShort(unsigned short value)
{
debugSendHexByte((0xFF00&value)/0x100);
debugSend("|");
debugSendHexByte((0x00FF&value)%0x100);
}
/**
* @brief Send an hexadecimal long on debug interface
*
* @param[in] value The hexadecimal long to send
*/
void debugSendHexLong(unsigned long value)
{
debugSendHexShort(value/0x10000);
debugSend("|");
debugSendHexShort(value%0x10000);
}
/**
* @brief Send an hexadecimal array on debug interface
*
* @param[in] array The array of bytes to send
* @param[in] length The number of bytes in the array
*/
void debugSendHexArray(unsigned char *array, unsigned short length)
{
unsigned short counter;
for (counter=0; counter<length; ++counter)
{
debugSendHexByte(array[counter]);
debugSend("|");
}
}
#endif
Voici le code correspondant au debug.h :
/**
* @file debug.h
* @brief USB debug interface
* @author Eric Jouffrey
* @author Jean-Yves BERNE
* @date 07/09/2011
*
* (c) MICHAT ELECTRONIQUE 2011
*/
#ifndef DEBUG_H_
#define DEBUG_H_
/**********************/
/****** includes ******/
/**********************/
#include <string.h>
#include "lwip/udp.h"
#include "../Common/genPurpose.h"
/********************************/
/***** constants and macros *****/
/********************************/
/** @brief Define the USART to use for debug */
//#define DEBUG_UDPPORT 40000
#ifdef DEBUG_UDPPORT
/***********************************/
/****** Function declarations ******/
/***********************************/
/**
* @brief Initialize the USB debug interface
*/
void debugInit(void);
/**
* @brief Send a line on debug interface
*
* @param[in] strToSend The string to send
*
* This function send the string and a CR+LF character
*/
void debugSendLine(char * strToSend);
/**
* @brief Send a CR+LF character
*/
void debugSendNewLine(void);
/**
* @brief Send a string on debug interface
*
* @param[in] strToSend The string to send
*/
void debugSend(char * strToSend);
/**
* @brief Send a raw buffer on debug interface
*
* @param[in] buffer The buffer to send
* @param[in] bufferLength The length of the buffer
*/
void debugSendRawBuffer(char *buffer, unsigned short bufferLength);
/**
* @brief Send an hexadecimal byte on debug interface
*
* @param[in] value The hexadecimal byte to send
*/
void debugSendHexByte(unsigned char value);
/**
* @brief Send an hexadecimal short on debug interface
*
* @param[in] value The hexadecimal short to send
*/
void debugSendHexShort(unsigned short value);
/**
* @brief Send an hexadecimal long on debug interface
*
* @param[in] value The hexadecimal long to send
*/
void debugSendHexLong(unsigned long value);
/**
* @brief Send an hexadecimal array on debug interface
*
* @param[in] array The array of bytes to send
* @param[in] length The number of bytes in the array
*/
void debugSendHexArray(unsigned char *array, unsigned short length);
#endif
#endif /* DEBUG_H_ */
Merci à vous pour votre aide. (P.S : désoler pour les fautes)
- Edité par Arrgon 19 septembre 2017 à 14:02:41
Pour réussir dans la vie, il y a deux choses essentielles : 1- Ne jamais révéler tout ce que l'on sait
J'aimerais savoir quel est l'interet de ce debug présent ici puisque on peut voir qu'il a un dossier spécifique, j'aimerai également savoir si il existe une quelquonque différence entre les deux.
Bonjour
Je pense qu'il n'y a aucun rapport. Les répertoires Debug et Release sont créés par l'IDE pour écrire dedans les fichiers résultants de la construction du projet (construction en mode debug ou release). Les fichiers debug.c et debug.h implémentent une fonctionnalité de debug propre au logiciel développé.
Merci de ta réponse, je te souhaite une excellente fin de journée !
Je ferme le sujet ici car résolu, simplement !
Pour réussir dans la vie, il y a deux choses essentielles : 1- Ne jamais révéler tout ce que l'on sait
Petite incompréhension Debug
× Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
× Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.