I am writing USB device firmware... i have the following struct typedef
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint16_t wTotalLength;
uint8_t bNumInterfaces;
uint8_t bConfigurationValue;
uint8_t iConfiguration;
uint8_t bmAttributes;
uint8_t bMaxPower;
} usbtmc_config_descriptor;
By my count, this is 9 bytes, however when I do this
sprintf(temp, "size of config is %02x, %d", sizeof(usbtmc_config_descriptor), sizeof(usbtmc_config_descriptor));
prints(temp);
terminal spits out the following
size of config is 0a, 10
I am absolutely flumuxxed... If you are wondering the prints() method is just a method I wrote to print out a string through the UART to hyperterminal followed by \r\n for ease of use...
here is the whole method for those who think it is important
void prints(const char* message){
MSS_UART_polled_tx_string(&g_mss_uart0, ((uint8_t *)message));
unsigned char newline[2] = {0x0A, 0x0D};
MSS_UART_polled_tx_string(&g_mss_uart0, newline);
}
some background info which may pertain to the situation, this is firmware code for a Cortex M3, Smartfusion Soc, using SoftConsole with GCC 4.4.1 CodeSourcery tools for compilation...
how is it possible that I am not getting a total of 9 for sizeof???? What am I missing???