Merge branch 'master' of ssh://git.admin.sysmocom.de/christina/simtrace
diff --git a/sam3s_example/Makefile b/sam3s_example/Makefile
index 042c871..ba686cd 100644
--- a/sam3s_example/Makefile
+++ b/sam3s_example/Makefile
@@ -97,21 +97,24 @@
 INCLUDES += $(INCLUDES_USB)
 #INCLUDES += -I$(LIBRARIES)
 
-CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wimplicit-int #-Wformat=2 
+CFLAGS += -Wall -Wchar-subscripts -Wcomment -Wimplicit-int -Wformat=2 
 CFLAGS += -Werror-implicit-function-declaration -Wmain -Wparentheses
 CFLAGS += -Wsequence-point -Wreturn-type -Wswitch -Wtrigraphs #-Wunused
 CFLAGS += -Wuninitialized -Wunknown-pragmas -Wfloat-equal -Wundef
 CFLAGS += -Wshadow -Wpointer-arith -Wbad-function-cast -Wwrite-strings
 CFLAGS += -Wsign-compare -Waggregate-return
-#CFLAGS += -Wformat 
+CFLAGS += -Wformat 
 CFLAGS += -Wmissing-format-attribute -Wno-deprecated-declarations
-#CFLAGS += -Wpacked 
+CFLAGS += #-Wpacked 
 CFLAGS += -Wredundant-decls -Wnested-externs -Winline #-Wlong-long
 CFLAGS += -Wunreachable-code
 CFLAGS += -Wcast-align
 CFLAGS += -std=c11
-#CFLAGS += -Wmissing-noreturn
+CFLAGS += -Wmissing-noreturn
 #CFLAGS += -Wconversion
+# Disable unused variable warnings
+CFLAGS += -Wno-unused-but-set-variable -Wno-unused-variable
+CFLAGS += -Wno-suggest-attribute=noreturn
 
 # To reduce application size use only integer printf function.
 #CFLAGS += -Dprintf=iprintf
@@ -166,7 +169,7 @@
 
 $$(C_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.c Makefile $(OBJ) $(BIN)
 	@echo [COMPILING $$@]
-	@$(CC) $(CFLAGS) -D$(1) -Wa,-ahlms=$(BIN)/$$*.lst -c -o $$@ $$<  
+	$(CC) $(CFLAGS) -D$(1) -Wa,-ahlms=$(BIN)/$$*.lst -c -o $$@ $$<  
 
 $$(ASM_OBJECTS_$(1)): $(OBJ)/$(1)_%.o: %.S Makefile $(OBJ) $(BIN)
 	@echo [ASSEMBLING $$@]
diff --git a/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/source/iso7816_4.c b/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/source/iso7816_4.c
index bbb831c..5ee78c2 100644
--- a/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/source/iso7816_4.c
+++ b/sam3s_example/atmel_softpack_libraries/libboard_sam3s-ek/source/iso7816_4.c
@@ -108,9 +108,9 @@
                                       (1<<10)));

 

     if (status != 0 ) {

-        TRACE_DEBUG("R:0x%X\n\r", status); 

-        TRACE_DEBUG("R:0x%X\n\r", BOARD_ISO7816_BASE_USART->US_CSR);

-        TRACE_DEBUG("Nb:0x%X\n\r", BOARD_ISO7816_BASE_USART->US_NER );

+        TRACE_DEBUG("R:0x%" PRIX32 "\n\r", status); 

+        TRACE_DEBUG("R:0x%" PRIX32 "\n\r", BOARD_ISO7816_BASE_USART->US_CSR);

+        TRACE_DEBUG("Nb:0x%" PRIX32 "\n\r", BOARD_ISO7816_BASE_USART->US_NER );

         BOARD_ISO7816_BASE_USART->US_CR = US_CR_RSTSTA;

     }

 

@@ -147,12 +147,12 @@
                                       (1<<10)));

 

     if (status != 0 ) {

-        TRACE_DEBUG("******* status: 0x%X (Overrun: %d, NACK: %d, Timeout: %d, underrun: %d)\n\r", 

+        TRACE_DEBUG("******* status: 0x%" PRIX32 " (Overrun: %" PRIX32 ", NACK: %" PRIX32 ", Timeout: %" PRIX32 ", underrun: %" PRIX32 ")\n\r", 

                     status, ((status & US_CSR_OVRE)>> 5), ((status & US_CSR_NACK) >> 13), 

                     ((status & US_CSR_TIMEOUT) >> 8), ((status & (1 << 10)) >> 10));

         

-        TRACE_DEBUG("E (USART CSR reg):0x%X\n\r", BOARD_ISO7816_BASE_USART->US_CSR);

-        TRACE_DEBUG("Nb (Number of errors):0x%X\n\r", BOARD_ISO7816_BASE_USART->US_NER );

+        TRACE_DEBUG("E (USART CSR reg):0x%" PRIX32 "\n\r", BOARD_ISO7816_BASE_USART->US_CSR);

+        TRACE_DEBUG("Nb (Number of errors):0x%" PRIX32 "\n\r", BOARD_ISO7816_BASE_USART->US_NER );

         BOARD_ISO7816_BASE_USART->US_CR = US_CR_RSTSTA;

     }

 

diff --git a/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/USBD_HAL.c b/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/USBD_HAL.c
index 6930a5e..d5ec38e 100644
--- a/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/USBD_HAL.c
+++ b/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/USBD_HAL.c
@@ -508,7 +508,7 @@
     size = pEndpoint->size;

     if (size > pBi->remaining) size = pBi->remaining;

 

-    TRACE_DEBUG_WP("w%d.%d ", pTransfer->outCurr, size);

+    TRACE_DEBUG_WP("w%d.%" PRId32 " ", pTransfer->outCurr, size);

 

     /* Record last accessed buffer */

     pTransfer->outLast = pTransfer->outCurr;

@@ -659,7 +659,7 @@
     USBGenericRequest request;

 

     TRACE_DEBUG_WP("E%d ", bEndpoint);

-    TRACE_DEBUG_WP("st:0x%X ", status);

+    TRACE_DEBUG_WP("st:0x%" PRIX32 " ", status);

 

     // Handle interrupts

     // IN packet sent

@@ -908,7 +908,7 @@
 

         return USBD_STATUS_LOCKED;

     }

-    TRACE_DEBUG_WP("Write%d(%d) ", bEndpoint, dLength);

+    TRACE_DEBUG_WP("Write%d(%" PRIu32 ") ", bEndpoint, dLength);

 

 /*    int i;

     for (i = 0; i < dLength; i++) {

@@ -983,7 +983,7 @@
         }

     }

 

-    TRACE_DEBUG_WP("AddW%d(%d) ", bEndpoint, dLength);

+    TRACE_DEBUG_WP("AddW%d(%" PRIu32 ") ", bEndpoint, dLength);

 

     /* Add buffer to buffer list and update index */

     pTx = &(pMbl->pMbl[pMbl->inCurr]);

@@ -1047,7 +1047,7 @@
 

     /* Endpoint enters Receiving state */

     pEndpoint->state = UDP_ENDPOINT_RECEIVING;

-    TRACE_DEBUG_WP("Read%d(%d) ", bEndpoint, dLength);

+    TRACE_DEBUG_WP("Read%d(%" PRIu32 ") ", bEndpoint, dLength);

 

 /*    int i;

     for (i = 0; i < dLength; i++) {

@@ -1094,7 +1094,7 @@
     status = UDP->UDP_ISR;

     status &= UDP->UDP_IMR;

     

-    TRACE_DEBUG("status; 0x%x", status);

+    TRACE_DEBUG("status; 0x%" PRIx32 , status);

 

     if (USBD_GetState() < USBD_STATE_POWERED) {

 

diff --git a/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/pio_it.c b/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/pio_it.c
index c5351e8..48403c0 100644
--- a/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/pio_it.c
+++ b/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/pio_it.c
@@ -104,7 +104,7 @@
     /* Check pending events */

     if ( status != 0 )

     {

-        TRACE_DEBUG( "PIO interrupt on PIO controller #%d\n\r", id ) ;

+        TRACE_DEBUG( "PIO interrupt on PIO controller #%" PRIu32 "\n\r", id ) ;

 

         /* Find triggering source */

         i = 0;

@@ -119,7 +119,7 @@
                 /* Source has PIOs whose statuses have changed */

                 if ( (status & _aIntSources[i].pPin->mask) != 0 )

                 {

-                    TRACE_DEBUG( "Interrupt source #%d triggered\n\r", i ) ;

+                    TRACE_DEBUG( "Interrupt source #%" PRIu32 " triggered\n\r", i ) ;

 

                     _aIntSources[i].handler(_aIntSources[i].pPin);

                     status &= ~(_aIntSources[i].pPin->mask);

@@ -231,7 +231,7 @@
     assert( _dwNumSources < MAX_INTERRUPT_SOURCES ) ;

 

     /* Define new source */

-    TRACE_DEBUG( "PIO_ConfigureIt: Defining new source #%d.\n\r",  _dwNumSources ) ;

+    TRACE_DEBUG( "PIO_ConfigureIt: Defining new source #%" PRIu32 ".\n\r",  _dwNumSources ) ;

 

     pSource = &(_aIntSources[_dwNumSources]) ;

     pSource->pPin = pPin ;

diff --git a/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/pmc.c b/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/pmc.c
index b71d748..fa4dde0 100644
--- a/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/pmc.c
+++ b/sam3s_example/atmel_softpack_libraries/libchip_sam3s/source/pmc.c
@@ -63,7 +63,7 @@
     {

         if ( (PMC->PMC_PCSR0 & ((uint32_t)1 << dwId)) == ((uint32_t)1 << dwId) )

         {

-            TRACE_DEBUG( "PMC_EnablePeripheral: clock of peripheral"  " %u is already enabled\n\r", dwId ) ;

+            TRACE_DEBUG( "PMC_EnablePeripheral: clock of peripheral"  " %" PRIu32 " is already enabled\n\r", dwId ) ;

         }

         else

         {

@@ -75,7 +75,7 @@
         dwId -= 32;

         if ((PMC->PMC_PCSR1 & ((uint32_t)1 << dwId)) == ((uint32_t)1 << dwId))

         {

-            TRACE_DEBUG( "PMC_EnablePeripheral: clock of peripheral"  " %u is already enabled\n\r", dwId + 32 ) ;

+            TRACE_DEBUG( "PMC_EnablePeripheral: clock of peripheral"  " %" PRIu32 " is already enabled\n\r", dwId + 32 ) ;

         }

         else

         {

@@ -100,7 +100,7 @@
     {

         if ( (PMC->PMC_PCSR0 & ((uint32_t)1 << dwId)) != ((uint32_t)1 << dwId) )

         {

-            TRACE_DEBUG("PMC_DisablePeripheral: clock of peripheral" " %u is not enabled\n\r", dwId ) ;

+            TRACE_DEBUG("PMC_DisablePeripheral: clock of peripheral" " %" PRIu32 " is not enabled\n\r", dwId ) ;

         }

         else

         {

@@ -112,7 +112,7 @@
         dwId -= 32 ;

         if ( (PMC->PMC_PCSR1 & ((uint32_t)1 << dwId)) != ((uint32_t)1 << dwId) )

         {

-            TRACE_DEBUG( "PMC_DisablePeripheral: clock of peripheral" " %u is not enabled\n\r", dwId + 32 ) ;

+            TRACE_DEBUG( "PMC_DisablePeripheral: clock of peripheral" " %" PRIu32 " is not enabled\n\r", dwId + 32 ) ;

         }

         else

         {

diff --git a/sam3s_example/atmel_softpack_libraries/usb/device/core/USBD.c b/sam3s_example/atmel_softpack_libraries/usb/device/core/USBD.c
index 3613007..3630c05 100644
--- a/sam3s_example/atmel_softpack_libraries/usb/device/core/USBD.c
+++ b/sam3s_example/atmel_softpack_libraries/usb/device/core/USBD.c
@@ -108,8 +108,7 @@
         deviceState = previousDeviceState;
         if (deviceState >= USBD_STATE_DEFAULT) {
             /* Invoke the Resume callback */
-            if (USBDCallbacks_Resumed)
-                USBDCallbacks_Resumed();
+            USBDCallbacks_Resumed();
         }
     }
 }