public inbox for ecos-patches@sourceware.org
 help / color / mirror / Atom feed
* redboot/.../flash.c compiler warnings
@ 2009-02-17 16:11 Rene Nielsen
  2009-03-02 16:16 ` Rene Nielsen
  0 siblings, 1 reply; 2+ messages in thread
From: Rene Nielsen @ 2009-02-17 16:11 UTC (permalink / raw)
  To: ecos-patches

[-- Attachment #1: Type: text/plain, Size: 2494 bytes --]

Hi,

The attached patch fixes the following compiler warnings seen when
CYGOPT_REDBOOT_REDUNDANT_FIS is enabled:

.../packages/redboot/current/src/flash.c: In function
`fis_start_update_directory':
.../packages/redboot/current/src/flash.c:289: warning: initialization
makes integer from pointer without a cast
.../packages/redboot/current/src/flash.c:290: warning: initialization
makes integer from pointer without a cast
.../packages/redboot/current/src/flash.c:295: warning: assignment makes
integer from pointer without a cast
.../packages/redboot/current/src/flash.c:296: warning: assignment makes
pointer from integer without a cast
.../packages/redboot/current/src/flash.c:313: warning: format argument
is not a pointer (arg 2)
.../packages/redboot/current/src/flash.c:320: warning: format argument
is not a pointer (arg 2)
.../packages/redboot/current/src/flash.c: In function
`fis_update_directory':
.../packages/redboot/current/src/flash.c:363: warning: initialization
makes pointer from integer without a cast
.../packages/redboot/current/src/flash.c:364: warning: assignment makes
integer from pointer without a cast
.../packages/redboot/current/src/flash.c:375: warning: passing arg 1 of
`cyg_flash_program' makes integer from pointer without a cast
.../packages/redboot/current/src/flash.c:377: warning: format argument
is not a pointer (arg 2)
.../packages/redboot/current/src/flash.c: In function
`fis_erase_redundant_directory':
.../packages/redboot/current/src/flash.c:475: warning: passing arg 1 of
`cyg_flash_erase' makes integer from pointer without a cast
.../packages/redboot/current/src/flash.c:475: warning: passing arg 3 of
`cyg_flash_erase' from incompatible pointer type
.../packages/redboot/current/src/flash.c: In function `fis_init':
.../packages/redboot/current/src/flash.c:673: warning: format argument
is not a pointer (arg 2)
.../packages/redboot/current/src/flash.c:683: warning: format argument
is not a pointer (arg 2)
.../packages/redboot/current/src/flash.c: In function `do_flash_init':
.../packages/redboot/current/src/flash.c:1938: warning: passing arg 1 of
`cyg_flash_read' makes integer from pointer without a cast
.../packages/redboot/current/src/flash.c:1959: warning: assignment makes
pointer from integer without a cast
.../packages/redboot/current/src/flash.c:1960: warning: assignment makes
integer from pointer without a cast

Regards,
Rene Schipp von Branitz Nielsen 
Vitesse Semiconductors

[-- Attachment #2: redboot_flash_2009_02_17.patch --]
[-- Type: application/octet-stream, Size: 5891 bytes --]

Index: ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/ChangeLog,v
retrieving revision 1.263
diff -u -r1.263 ChangeLog
--- ChangeLog	6 Feb 2009 15:39:29 -0000	1.263
+++ ChangeLog	17 Feb 2009 16:07:22 -0000
@@ -1,3 +1,8 @@
+2009-02-17  Rene Schipp von Branitz Nielsen <rbn@vitesse.com>
+
+	* src/flash.c: Fix compilation warnings when redundant FIS
+	is selected.
+
 2009-02-06  John Dallaway  <john@dallaway.org.uk>
 
 	* cdl/redboot.cdl: Fix documentation reference.
Index: src/flash.c
===================================================================
RCS file: /cvs/ecos/ecos/packages/redboot/current/src/flash.c,v
retrieving revision 1.86
diff -u -r1.86 flash.c
--- src/flash.c	29 Jan 2009 17:50:04 -0000	1.86
+++ src/flash.c	17 Feb 2009 16:07:23 -0000
@@ -169,7 +169,7 @@
 void *fis_work_block;
 cyg_flashaddr_t fis_addr;
 #ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
-void *redundant_fis_addr;
+cyg_flashaddr_t redundant_fis_addr;
 #endif
 int fisdir_size;  // Size of FIS directory.
 #endif
@@ -286,8 +286,8 @@
 #endif
 
    struct fis_image_desc* img=NULL;
-   cyg_flashaddr_t err_addr=NULL;
-   cyg_flashaddr_t tmp_fis_addr=NULL;
+   cyg_flashaddr_t err_addr;
+   cyg_flashaddr_t tmp_fis_addr;
    int stat;
 
    /*exchange old and new valid fis tables*/
@@ -310,14 +310,15 @@
 #endif
 
    if ((stat = cyg_flash_erase(fis_addr, fisdir_size, &err_addr)) != 0) {
-       diag_printf("Error erasing FIS directory at %p: %s\n", err_addr, cyg_flash_errmsg(stat));
+       diag_printf("Error erasing FIS directory at %p: %s\n",
+                   (void*)err_addr, cyg_flash_errmsg(stat));
        return 1;
    }
    //now magic is 0xffffffff
    fis_endian_fixup(fis_work_block);
    if ((stat = cyg_flash_program(fis_addr, fis_work_block, flash_block_size, &err_addr)) != 0) {
        diag_printf("Error writing FIS directory at %p: %s\n",
-                   err_addr, cyg_flash_errmsg(stat));
+                   (void*)err_addr, cyg_flash_errmsg(stat));
        return 1;
    }
    fis_endian_fixup(fis_work_block);
@@ -360,13 +361,13 @@
    //but IN_PROGRESS is also good enough I think
    if (error!=0)
    {
-      void* swap_fis_addr=fis_addr;
+      cyg_flashaddr_t swap_fis_addr=fis_addr;
       fis_addr=redundant_fis_addr;
       redundant_fis_addr=swap_fis_addr;
    }
    else //success
    {
-      void* tmp_fis_addr=(void *)((CYG_ADDRESS)fis_addr+CYG_REDBOOT_RFIS_VALID_MAGIC_LENGTH);
+      cyg_flashaddr_t tmp_fis_addr=((CYG_ADDRESS)fis_addr+CYG_REDBOOT_RFIS_VALID_MAGIC_LENGTH);
 
       img->u.valid_info.valid_flag[0]=CYG_REDBOOT_RFIS_VALID;
       img->u.valid_info.valid_flag[1]=CYG_REDBOOT_RFIS_VALID;
@@ -374,7 +375,7 @@
       if ((stat = cyg_flash_program(tmp_fis_addr, img->u.valid_info.valid_flag,
                                     sizeof(img->u.valid_info.valid_flag), &err_addr)) != 0) {
           diag_printf("Error writing FIS directory at %p: %s\n", 
-                      err_addr, cyg_flash_errmsg(stat));
+                      (void*)err_addr, cyg_flash_errmsg(stat));
       }
    }
 #ifdef CYGHWR_IO_FLASH_BLOCK_LOCKING
@@ -463,7 +464,7 @@
 fis_erase_redundant_directory(void)
 {
     int stat;
-    void *err_addr;
+    cyg_flashaddr_t err_addr;
 
 #ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL
     // Ensure [quietly] that the directory is unlocked before trying
@@ -474,7 +475,7 @@
     if ((stat = cyg_flash_erase(redundant_fis_addr, fisdir_size,
                                 &err_addr)) != 0) {
          diag_printf("Error erasing FIS directory at %p: %s\n",
-                     err_addr, cyg_flash_errmsg(stat));
+                     (void*)err_addr, cyg_flash_errmsg(stat));
     }
 #ifdef CYGSEM_REDBOOT_FLASH_LOCK_SPECIAL
     // Ensure [quietly] that the directory is locked after the update
@@ -670,7 +671,7 @@
         }
         if ((stat = cyg_flash_erase(erase_start, erase_size,&err_addr)) != 0) {
           diag_printf("   initialization failed %p: %s\n",
-                 err_addr, cyg_flash_errmsg(stat));
+                      (void*)err_addr, cyg_flash_errmsg(stat));
         }
         erase_start += (erase_size + flash_block_size);
         if (fis_addr > cfg_base) {
@@ -680,7 +681,7 @@
         }
         if ((stat = cyg_flash_erase(erase_start, erase_size,&err_addr)) != 0) {
           diag_printf("   initialization failed %p: %s\n",
-                 err_addr, cyg_flash_errmsg(stat));
+                      (void*)err_addr, cyg_flash_errmsg(stat));
         }
         erase_start += (erase_size + flash_block_size);
 #else  // !CYGSEM_REDBOOT_FLASH_CONFIG        
@@ -1923,11 +1924,11 @@
 #ifdef CYGOPT_REDBOOT_REDUNDANT_FIS
 
         if (CYGNUM_REDBOOT_FIS_REDUNDANT_DIRECTORY_BLOCK < 0) {
-            redundant_fis_addr = (void *)((CYG_ADDRESS)flash_end + 1 +
-                                          (CYGNUM_REDBOOT_FIS_REDUNDANT_DIRECTORY_BLOCK*flash_block_size));
+            redundant_fis_addr = ((CYG_ADDRESS)flash_end + 1 +
+                                  (CYGNUM_REDBOOT_FIS_REDUNDANT_DIRECTORY_BLOCK*flash_block_size));
         } else {
-            redundant_fis_addr = (void *)((CYG_ADDRESS)flash_start +
-                                (CYGNUM_REDBOOT_FIS_REDUNDANT_DIRECTORY_BLOCK*flash_block_size));
+            redundant_fis_addr = ((CYG_ADDRESS)flash_start +
+                                  (CYGNUM_REDBOOT_FIS_REDUNDANT_DIRECTORY_BLOCK*flash_block_size));
         }
 
         if (((CYG_ADDRESS)redundant_fis_addr + fisdir_size - 1) > (CYG_ADDRESS)flash_end) {
@@ -1955,7 +1956,7 @@
         if (fis_get_valid_buf(&img0, &img1, &fis_update_was_interrupted)==1)
         {
            // Valid, so swap primary and secondary
-           void * tmp;
+           cyg_flashaddr_t tmp;
            tmp = fis_addr;
            fis_addr = redundant_fis_addr;
            redundant_fis_addr = tmp;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: redboot/.../flash.c compiler warnings
  2009-02-17 16:11 redboot/.../flash.c compiler warnings Rene Nielsen
@ 2009-03-02 16:16 ` Rene Nielsen
  0 siblings, 0 replies; 2+ messages in thread
From: Rene Nielsen @ 2009-03-02 16:16 UTC (permalink / raw)
  To: ecos-patches

Hi again,

Sorry to bug you, but this patch is gating for additional patches I have
to the same file, so if I could get you to have a look at it, I'd be
happy.

Thanks,
Rene

-----Original Message-----
From: ecos-patches-owner@ecos.sourceware.org
[mailto:ecos-patches-owner@ecos.sourceware.org] On Behalf Of Rene
Nielsen
Sent: 17. februar 2009 17:12
To: ecos-patches@sourceware.org
Subject: redboot/.../flash.c compiler warnings

Hi,

The attached patch fixes the following compiler warnings seen when
CYGOPT_REDBOOT_REDUNDANT_FIS is enabled:

.../packages/redboot/current/src/flash.c: In function
`fis_start_update_directory':
.../packages/redboot/current/src/flash.c:289: warning: initialization
makes integer from pointer without a cast
.../packages/redboot/current/src/flash.c:290: warning: initialization
makes integer from pointer without a cast
.../packages/redboot/current/src/flash.c:295: warning: assignment makes
integer from pointer without a cast
.../packages/redboot/current/src/flash.c:296: warning: assignment makes
pointer from integer without a cast
.../packages/redboot/current/src/flash.c:313: warning: format argument
is not a pointer (arg 2)
.../packages/redboot/current/src/flash.c:320: warning: format argument
is not a pointer (arg 2)
.../packages/redboot/current/src/flash.c: In function
`fis_update_directory':
.../packages/redboot/current/src/flash.c:363: warning: initialization
makes pointer from integer without a cast
.../packages/redboot/current/src/flash.c:364: warning: assignment makes
integer from pointer without a cast
.../packages/redboot/current/src/flash.c:375: warning: passing arg 1 of
`cyg_flash_program' makes integer from pointer without a cast
.../packages/redboot/current/src/flash.c:377: warning: format argument
is not a pointer (arg 2)
.../packages/redboot/current/src/flash.c: In function
`fis_erase_redundant_directory':
.../packages/redboot/current/src/flash.c:475: warning: passing arg 1 of
`cyg_flash_erase' makes integer from pointer without a cast
.../packages/redboot/current/src/flash.c:475: warning: passing arg 3 of
`cyg_flash_erase' from incompatible pointer type
.../packages/redboot/current/src/flash.c: In function `fis_init':
.../packages/redboot/current/src/flash.c:673: warning: format argument
is not a pointer (arg 2)
.../packages/redboot/current/src/flash.c:683: warning: format argument
is not a pointer (arg 2)
.../packages/redboot/current/src/flash.c: In function `do_flash_init':
.../packages/redboot/current/src/flash.c:1938: warning: passing arg 1 of
`cyg_flash_read' makes integer from pointer without a cast
.../packages/redboot/current/src/flash.c:1959: warning: assignment makes
pointer from integer without a cast
.../packages/redboot/current/src/flash.c:1960: warning: assignment makes
integer from pointer without a cast

Regards,
Rene Schipp von Branitz Nielsen
Vitesse Semiconductors

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-02 16:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-17 16:11 redboot/.../flash.c compiler warnings Rene Nielsen
2009-03-02 16:16 ` Rene Nielsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).