]> git.sur5r.net Git - openocd/commitdiff
warnings: fix alignment warnings
authorØyvind Harboe <oyvind.harboe@zylin.com>
Fri, 3 Sep 2010 20:49:37 +0000 (22:49 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Mon, 20 Sep 2010 11:12:35 +0000 (13:12 +0200)
These warnings are for architectures that do not
support non-aligned word access.

Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
13 files changed:
src/flash/mflash.c
src/flash/nand/lpc3180.c
src/flash/nor/at91sam3.c
src/helper/types.h
src/pld/virtex2.c
src/target/arm11.c
src/target/arm_adi_v5.c
src/target/arm_jtag.h
src/target/avr32_ap7k.c
src/target/avr32_mem.c
src/target/etb.c
src/target/mips_m4k.c
src/target/xscale.c

index 43721280e943d0cf7bac8d78a8b984445c39d0dc..26b85b1fb3105357a732109b8c7d690d480dc677 100644 (file)
@@ -1121,7 +1121,7 @@ static int mg_storage_config(void)
                        != ERROR_OK)
                return ret;
 
-       mg_gen_ataid((mg_io_type_drv_info *)buff);
+       mg_gen_ataid((mg_io_type_drv_info *)(void *)buff);
 
        if ((ret = mg_mflash_do_write_sects(buff, 0, 1, mg_vcmd_update_stgdrvinfo))
                        != ERROR_OK)
@@ -1149,7 +1149,7 @@ static int mg_boot_config(void)
        buff[0] = mg_op_mode_snd;               /* operation mode */
        buff[1] = MG_UNLOCK_OTP_AREA;
        buff[2] = 4;                            /* boot size */
-       *((uint32_t *)(buff + 4)) = 0;          /* XIP size */
+       *((uint32_t *)(void *)(buff + 4)) = 0;          /* XIP size */
 
        if ((ret = mg_mflash_do_write_sects(buff, 0, 1, mg_vcmd_update_xipinfo))
                        != ERROR_OK)
index 93d00d5c8415db91e0287c2cb079f56499a4e9d7..d81443d1e0d5edef5b55def8cfb9e8cffbdccb00 100644 (file)
@@ -1119,9 +1119,9 @@ static int lpc3180_read_page(struct nand_device *nand, uint32_t page, uint8_t *d
                     target_read_memory(target, target_mem_base+SPARE_OFFS, 4, 16, ecc_flash_buffer);
                     target_read_memory(target, target_mem_base+ECC_OFFS, 4, 8, ecc_hw_buffer);
                     for(i=0;i<idx;i++){
-                        if( (0x00ffffff&*(uint32_t *)(ecc_hw_buffer+i*8)) != (0x00ffffff&*(uint32_t *)(ecc_flash_buffer+8+i*16)) )
+                        if( (0x00ffffff&*(uint32_t *)(void *)(ecc_hw_buffer+i*8)) != (0x00ffffff&*(uint32_t *)(void *)(ecc_flash_buffer+8+i*16)) )
                             LOG_WARNING("ECC mismatch at 256 bytes size block= %d at page= 0x%" PRIx32,i*2+1,page);
-                        if( (0x00ffffff&*(uint32_t *)(ecc_hw_buffer+4+i*8)) != (0x00ffffff&*(uint32_t *)(ecc_flash_buffer+12+i*16)) )
+                        if( (0x00ffffff&*(uint32_t *)(void *)(ecc_hw_buffer+4+i*8)) != (0x00ffffff&*(uint32_t *)(void *)(ecc_flash_buffer+12+i*16)) )
                             LOG_WARNING("ECC mismatch at 256 bytes size block= %d at page= 0x%" PRIx32,i*2+2,page);
                     }                
                 }
index 221832ce600823c522e1548549145609d744a85d..8005fe0a076496fed4994f5dbfdac0081d806c6d 100644 (file)
@@ -1702,7 +1702,7 @@ sam3_get_reg_ptr(struct sam3_cfg *pCfg, const struct sam3_reg_list *pList)
        // By using prototypes - we can detect what would
        // be casting errors.
 
-       return ((uint32_t *)(((char *)(pCfg)) + pList->struct_offset));
+       return ((uint32_t *)(void *)(((char *)(pCfg)) + pList->struct_offset));
 }
 
 
@@ -1756,7 +1756,7 @@ sam3_GetReg(struct sam3_chip *pChip, uint32_t *goes_here)
                // calculate where this one go..
                // it is "possibly" this register.
 
-               pPossible = ((uint32_t *)(((char *)(&(pChip->cfg))) + pReg->struct_offset));
+               pPossible = ((uint32_t *)(void *)(((char *)(&(pChip->cfg))) + pReg->struct_offset));
 
                // well? Is it this register
                if (pPossible == goes_here) {
index 1010dcd967b6365f198ce9738ac431b6fcc11b8d..04b005945939fb8925633b5762b25bc2f1442ae0 100644 (file)
@@ -80,7 +80,7 @@ typedef bool _Bool;
  */
 #define container_of(ptr, type, member) ({                     \
        const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
-       (type *)( (char *)__mptr - offsetof(type,member) );})
+       (type *)( (void *) ( (char *)__mptr - offsetof(type,member) ) );})
 
 
 /**
index 19637366adb44c70f08f49279d3143e7b15a625f..f4657bcf48670636f74cf25b5233436592b86d52 100644 (file)
@@ -78,7 +78,7 @@ static int virtex2_send_32(struct pld_device *pld_device,
 static __inline__ void virtexflip32(jtag_callback_data_t arg)
 {
   uint8_t *in = (uint8_t *)arg;
-       *((uint32_t *)in) = flip_u32(le_to_h_u32(in), 32);
+       *((uint32_t *)arg) = flip_u32(le_to_h_u32(in), 32);
 }
 
 static int virtex2_receive_32(struct pld_device *pld_device,
index 85d45b009185a20b20c99df7b0f6911b463d1a85..9955143adb872c9352c703edc98edbb5556622c3 100644 (file)
@@ -901,7 +901,7 @@ static int arm11_read_memory_inner(struct target *target,
                {
                uint32_t instr = !arm11_config_memrw_no_increment ? 0xecb05e01 : 0xed905e00;
                /** \todo TODO: buffer cast to uint32_t* causes alignment warnings */
-               uint32_t *words = (uint32_t *)buffer;
+               uint32_t *words = (uint32_t *)(void *)buffer;
 
                /* LDC p14,c5,[R0],#4 */
                /* LDC p14,c5,[R0] */
@@ -1023,7 +1023,7 @@ static int arm11_write_memory_inner(struct target *target,
                uint32_t instr = !no_increment ? 0xeca05e01 : 0xed805e00;
 
                /** \todo TODO: buffer cast to uint32_t* causes alignment warnings */
-               uint32_t *words = (uint32_t*)buffer;
+               uint32_t *words = (uint32_t*)(void *)buffer;
 
                /* "burst" here just means trusting each instruction executes
                 * fully before we run the next one:  per-word roundtrips, to
index b26175b30fd664acc129df553b2c99bc3cb58489..34147967a7feda7fa526e670ba7b5c05a59f395e 100644 (file)
@@ -316,7 +316,7 @@ int mem_ap_write_buf_u32(struct adiv5_dap *dap, uint8_t *buffer, int count, uint
                for (writecount = 0; writecount < blocksize; writecount++)
                {
                        retval = dap_queue_ap_write(dap, AP_REG_DRW,
-                               *(uint32_t *) (buffer + 4 * writecount));
+                               *(uint32_t *) ((void *) (buffer + 4 * writecount)));
                        if (retval != ERROR_OK)
                                break;
                }
index f581278180d75335aaec2d19cc51e0888a960250..e90abfe04353a240e3779c9693c4518b9f153743 100644 (file)
@@ -77,13 +77,13 @@ int arm_jtag_setup_connection(struct arm_jtag *jtag_info);
 static __inline__ void arm7flip32(jtag_callback_data_t arg)
 {
   uint8_t *in = (uint8_t *)arg;
-  *((uint32_t *)in) = flip_u32(le_to_h_u32(in), 32);
+  *((uint32_t *)arg) = flip_u32(le_to_h_u32(in), 32);
 }
 
 static __inline__ void arm_le_to_h_u32(jtag_callback_data_t arg)
 {
   uint8_t *in = (uint8_t *)arg;
-  *((uint32_t *)in) = le_to_h_u32(in);
+  *((uint32_t *)arg) = le_to_h_u32(in);
 }
 
 
index a5cdbe47bf5d6b174bb743c69dddf6909d783a30..ed10847abcf2bd4cd6ec6b4e9bd80faf21c9a31b 100644 (file)
@@ -499,10 +499,10 @@ static int avr32_ap7k_read_memory(struct target *target, uint32_t address,
        switch (size)
        {
        case 4:
-               return avr32_jtag_read_memory32(&ap7k->jtag, address, count, (uint32_t*)buffer);
+               return avr32_jtag_read_memory32(&ap7k->jtag, address, count, (uint32_t*)(void *)buffer);
                break;
        case 2:
-               return avr32_jtag_read_memory16(&ap7k->jtag, address, count, (uint16_t*)buffer);
+               return avr32_jtag_read_memory16(&ap7k->jtag, address, count, (uint16_t*)(void *)buffer);
                break;
        case 1:
                return avr32_jtag_read_memory8(&ap7k->jtag, address, count, buffer);
@@ -537,10 +537,10 @@ static int avr32_ap7k_write_memory(struct target *target, uint32_t address,
        switch (size)
        {
        case 4:
-               return avr32_jtag_write_memory32(&ap7k->jtag, address, count, (uint32_t*)buffer);
+               return avr32_jtag_write_memory32(&ap7k->jtag, address, count, (uint32_t*)(void *)buffer);
                break;
        case 2:
-               return avr32_jtag_write_memory16(&ap7k->jtag, address, count, (uint16_t*)buffer);
+               return avr32_jtag_write_memory16(&ap7k->jtag, address, count, (uint16_t*)(void *)buffer);
                break;
        case 1:
                return avr32_jtag_write_memory8(&ap7k->jtag, address, count, buffer);
index 0767c55c7adf288a3cf521d3f267bfac4729ced3..fe6b8f0f10508992a192b1e573d1ff92d90798f4 100644 (file)
@@ -112,7 +112,7 @@ int avr32_jtag_read_memory8(struct avr32_jtag *jtag_info,
        if (addr & 3)
        {
                retval = avr32_jtag_mwa_read(jtag_info, SLAVE_HSB_UNCACHED,
-                               addr + i, (uint32_t*)data);
+                               addr + i, (uint32_t*)(void *)data);
 
                if (retval != ERROR_OK)
                        return retval;
@@ -126,7 +126,7 @@ int avr32_jtag_read_memory8(struct avr32_jtag *jtag_info,
        for (; i < (count & ~3); i+=4)
        {
                retval = avr32_jtag_mwa_read(jtag_info, SLAVE_HSB_UNCACHED,
-                               addr + i, (uint32_t*)data);
+                               addr + i, (uint32_t*)(void *)data);
 
                if (retval != ERROR_OK)
                        return retval;
@@ -139,7 +139,7 @@ int avr32_jtag_read_memory8(struct avr32_jtag *jtag_info,
        if (i < count)
        {
                retval = avr32_jtag_mwa_read(jtag_info, SLAVE_HSB_UNCACHED,
-                               addr + i, (uint32_t*)data);
+                               addr + i, (uint32_t*)(void *)data);
 
                if (retval != ERROR_OK)
                        return retval;
index ba47c39ae141f17ba38642ce5a92f6f57a02c46e..489b9ed5634132b93c94701326c17cad05d44336 100644 (file)
@@ -166,7 +166,7 @@ static void etb_getbuf(jtag_callback_data_t arg)
 {
        uint8_t *in = (uint8_t *)arg;
 
-       *((uint32_t *)in) = buf_get_u32(in, 0, 32);
+       *((uint32_t *)arg) = buf_get_u32(in, 0, 32);
 }
 
 
index 62c484a98af2467d9db4107c067bb1911df3382d..c0adc066e81d7c9ad7f6093ebbeaf2978fde5659 100644 (file)
@@ -1000,7 +1000,7 @@ static int mips_m4k_bulk_write_memory(struct target *target, uint32_t address,
        }
 
        retval = mips32_pracc_fastdata_xfer(ejtag_info, source, write_t, address,
-                       count, (uint32_t*) buffer);
+                       count, (uint32_t*) (void *)buffer);
        if (retval != ERROR_OK)
        {
                /* FASTDATA access failed, try normal memory write */
index 37a243857c7f3baa6d1078b64101435a86778070..e0ce400b46101a5b480467693deccf0757a64db4 100644 (file)
@@ -244,7 +244,7 @@ static int xscale_read_dcsr(struct target *target)
 static void xscale_getbuf(jtag_callback_data_t arg)
 {
        uint8_t *in = (uint8_t *)arg;
-       *((uint32_t *)in) = buf_get_u32(in, 0, 32);
+       *((uint32_t *)arg) = buf_get_u32(in, 0, 32);
 }
 
 static int xscale_receive(struct target *target, uint32_t *buffer, int num_words)