On Fri, May 11, 2012 at 7:22 PM, Xiaofan Chen <[email protected]> wrote:
> On Fri, May 11, 2012 at 6:48 PM, Andreas Fritiofson
> <[email protected]> wrote:
>> On Fri, May 11, 2012 at 12:30 PM, Xiaofan Chen <[email protected]> wrote:
>>
>>> It may have something to do with the C compiler. The other alternative
>>> under Mac OS X (XCode) is using Clang. It still segfaults but go slightly
>>> further, it segfaults after the first "reset init" command.
>>>
>>> mymacmini:lm3s1968 xiaofanc$ clang -v
>>> Apple clang version 3.1 (tags/Apple/clang-318.0.58) (based on LLVM 3.1svn)
>>> Target: x86_64-apple-darwin11.3.0
>>> Thread model: posix
>>>
>>> mymacmini:build_mpsse_clang xiaofanc$ cat myconfig_git.sh
>>> CC="clang" LDFLAGS="-L/usr/local/lib -lusb-1.0" ../configure
>>> --enable-maintainer-mode --prefix=/Users/xiaofanc/bin --enable-jlink
>>> --enable-ftdi --enable-ft2232_libftdi --enable-stlink --disable-werror
>>
>> You're building with --disable-werror. Is that because you get
>> warnings that could hint that I'm doing something unsafe that could
>> blow up under certain optimizations etc? Clang is usually good at
>> finding those problems, at least compared to the old gcc you had as an
>> alternative.
>
> I used disable-werror because some codes will generate warnings
> (maybe not your codes, but other codes). I will report later.

mymacmini:build_clang xiaofanc$ cat myconfig_git.sh
CC="clang" LDFLAGS="-L/usr/local/lib -lusb-1.0" ../configure
--enable-maintainer-mode --prefix=/Users/xiaofanc/bin --enable-ftdi
--enable-ft2232_libftdi

mymacmini:build_clang xiaofanc$ make -i
make  all-recursive
Making all in jimtcl
make[2]: Nothing to be done for `all'.
Making all in src
make  all-recursive
Making all in jtag
make  all-recursive
Making all in drivers
/bin/sh ../../../libtool --tag=CC   --mode=compile clang
-DHAVE_CONFIG_H -I. -I../../../../src/jtag/drivers -I../../..
-I../../../../src -I../../../src -I../../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../../jimtcl
-I../../../jimtcl   -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT ft2232.lo -MD -MP -MF .deps/ft2232.Tpo
-c -o ft2232.lo ../../../../src/jtag/drivers/ft2232.c
libtool: compile:  clang -DHAVE_CONFIG_H -I.
-I../../../../src/jtag/drivers -I../../.. -I../../../../src
-I../../../src -I../../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../../jimtcl
-I../../../jimtcl -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT ft2232.lo -MD -MP -MF .deps/ft2232.Tpo
-c ../../../../src/jtag/drivers/ft2232.c -o ft2232.o
../../../../src/jtag/drivers/ft2232.c:1490:7: error: explicitly assigning a
      variable of type 'int' to itself [-Werror,-Wself-assign]
        trst = trst;
        ~~~~ ^ ~~~~
1 error generated.
make[6]: [ft2232.lo] Error 1 (ignored)
mv -f .deps/ft2232.Tpo .deps/ft2232.Plo
/bin/sh ../../../libtool --tag=CC   --mode=link clang  -g -O2
-I/Users/xiaofanc/bin/include -Wall -Wstrict-prototypes
-Wformat-security -Wshadow -Wextra -Wno-unused-parameter
-Wbad-function-cast -Wcast-align -Wredundant-decls -Werror
-L/usr/local/lib -lusb-1.0 -L/Users/xiaofanc/bin/lib -o
libocdjtagdrivers.la  driver.lo  libusb1_common.lo     ft2232.lo
ftdi.lo mpsse.lo                  -lftdi -lusb
libtool: link: `ft2232.lo' is not a valid libtool object
make[6]: [libocdjtagdrivers.la] Error 1 (ignored)
make[6]: *** No rule to make target
`../../src/jtag/drivers/libocdjtagdrivers.la', needed by `libjtag.la'.
 Stop.
make[5]: [all-recursive] Error 1 (ignored)
Making all in helper
make  all-am
make[5]: Nothing to be done for `all-am'.
Making all in target
make  all-am
/bin/sh ../../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H
-I. -I../../../src/target -I../..  -I../../../src -I../../src
-I../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../jimtcl
-I../../jimtcl   -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT arm_disassembler.lo -MD -MP -MF
.deps/arm_disassembler.Tpo -c -o arm_disassembler.lo
../../../src/target/arm_disassembler.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../../../src/target
-I../.. -I../../../src -I../../src -I../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../jimtcl
-I../../jimtcl -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT arm_disassembler.lo -MD -MP -MF
.deps/arm_disassembler.Tpo -c ../../../src/target/arm_disassembler.c
-o arm_disassembler.o
../../../src/target/arm_disassembler.c:2893:20: error: signed shift result
      (0x7FFF80000) requires 36 bits to represent, but 'int' only has 32 bits
      [-Werror,-Wshift-overflow]
                offset |= 0xffff << 19;
                          ~~~~~~ ^  ~~
1 error generated.
make[5]: [arm_disassembler.lo] Error 1 (ignored)
mv -f .deps/arm_disassembler.Tpo .deps/arm_disassembler.Plo
/bin/sh ../../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H
-I. -I../../../src/target -I../..  -I../../../src -I../../src
-I../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../jimtcl
-I../../jimtcl   -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT arm_simulator.lo -MD -MP -MF
.deps/arm_simulator.Tpo -c -o arm_simulator.lo
../../../src/target/arm_simulator.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../../../src/target
-I../.. -I../../../src -I../../src -I../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../jimtcl
-I../../jimtcl -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT arm_simulator.lo -MD -MP -MF
.deps/arm_simulator.Tpo -c ../../../src/target/arm_simulator.c -o
arm_simulator.o
../../../src/target/arm_simulator.c:527:8: error: explicitly assigning a
      variable of type 'uint32_t' (aka 'unsigned int') to itself
      [-Werror,-Wself-assign]
                                Rn = Rn;
                                ~~ ^ ~~
../../../src/target/arm_simulator.c:607:9: error: explicitly assigning a
      variable of type 'uint32_t' (aka 'unsigned int') to itself
      [-Werror,-Wself-assign]
                                        Rn = Rn;
                                        ~~ ^ ~~
2 errors generated.
make[5]: [arm_simulator.lo] Error 1 (ignored)
mv -f .deps/arm_simulator.Tpo .deps/arm_simulator.Plo
/bin/sh ../../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H
-I. -I../../../src/target -I../..  -I../../../src -I../../src
-I../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../jimtcl
-I../../jimtcl   -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT armv7a.lo -MD -MP -MF .deps/armv7a.Tpo
-c -o armv7a.lo ../../../src/target/armv7a.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../../../src/target
-I../.. -I../../../src -I../../src -I../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../jimtcl
-I../../jimtcl -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT armv7a.lo -MD -MP -MF .deps/armv7a.Tpo
-c ../../../src/target/armv7a.c -o armv7a.o
../../../src/target/armv7a.c:390:21: error: equality comparison with extraneous
      parentheses [-Werror,-Wparentheses-equality]
                        if ((curr->state == TARGET_HALTED)) {
                             ~~~~~~~~~~~~^~~~~~~~~~~~~~~~
../../../src/target/armv7a.c:390:21: note: remove extraneous parentheses around
      the comparison to silence this warning
                        if ((curr->state == TARGET_HALTED)) {
                            ~            ^               ~
../../../src/target/armv7a.c:390:21: note: use '=' to turn this equality
      comparison into an assignment
                        if ((curr->state == TARGET_HALTED)) {
                                         ^~
                                         =
1 error generated.
make[5]: [armv7a.lo] Error 1 (ignored)
mv -f .deps/armv7a.Tpo .deps/armv7a.Plo
/bin/sh ../../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H
-I. -I../../../src/target -I../..  -I../../../src -I../../src
-I../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../jimtcl
-I../../jimtcl   -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT stm32_stlink.lo -MD -MP -MF
.deps/stm32_stlink.Tpo -c -o stm32_stlink.lo
../../../src/target/stm32_stlink.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../../../src/target
-I../.. -I../../../src -I../../src -I../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../jimtcl
-I../../jimtcl -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT stm32_stlink.lo -MD -MP -MF
.deps/stm32_stlink.Tpo -c ../../../src/target/stm32_stlink.c -o
stm32_stlink.o
../../../src/target/stm32_stlink.c:654:18: error: cast from 'uint8_t *'
      (aka 'unsigned char *') to 'uint32_t *' (aka 'unsigned int *') increases
      required alignment from 1 to 4 [-Werror,-Wcast-align]
                                        address, c, (uint32_t *)dst);
                                                    ^~~~~~~~~~~~~~~
../../../src/target/stm32_stlink.c:703:18: error: cast from 'const uint8_t *'
      (aka 'const unsigned char *') to 'uint32_t *' (aka 'unsigned int *')
      increases required alignment from 1 to 4 [-Werror,-Wcast-align]
                                        address, c, (uint32_t *)dst);
                                                    ^~~~~~~~~~~~~~~
2 errors generated.
make[5]: [stm32_stlink.lo] Error 1 (ignored)
mv -f .deps/stm32_stlink.Tpo .deps/stm32_stlink.Plo
/bin/sh ../../libtool --tag=CC   --mode=link clang  -g -O2
-I/Users/xiaofanc/bin/include -Wall -Wstrict-prototypes
-Wformat-security -Wshadow -Wextra -Wno-unused-parameter
-Wbad-function-cast -Wcast-align -Wredundant-decls -Werror
-L/usr/local/lib -lusb-1.0 -L/Users/xiaofanc/bin/lib -o libtarget.la
algorithm.lo register.lo image.lo breakpoints.lo target.lo
target_request.lo testee.lo smp.lo arm_dpm.lo arm_jtag.lo
arm_disassembler.lo arm_simulator.lo arm_semihosting.lo arm_adi_v5.lo
adi_v5_jtag.lo adi_v5_swd.lo embeddedice.lo trace.lo etb.lo etm.lo
etm_dummy.lo armv4_5.lo armv4_5_mmu.lo armv4_5_cache.lo
arm7_9_common.lo arm7tdmi.lo arm720t.lo arm9tdmi.lo arm920t.lo
arm966e.lo arm946e.lo arm926ejs.lo feroceon.lo arm11.lo
arm11_dbgtap.lo armv7m.lo cortex_m.lo armv7a.lo cortex_a.lo fa526.lo
xscale.lo avr32_ap7k.lo avr32_jtag.lo avr32_mem.lo avr32_regs.lo
mips32.lo mips_m4k.lo mips32_pracc.lo mips32_dmaacc.lo mips_ejtag.lo
avrt.lo dsp563xx.lo dsp563xx_once.lo dsp5680xx.lo stm32_stlink.lo
-lftdi -lusb
libtool: link: `arm_disassembler.lo' is not a valid libtool object
make[5]: [libtarget.la] Error 1 (ignored)
Making all in transport
make[4]: Nothing to be done for `all'.
Making all in flash
Making all in nor
/bin/sh ../../../libtool --tag=CC   --mode=compile clang
-DHAVE_CONFIG_H -I. -I../../../../src/flash/nor -I../../..
-I../../../../src -I../../../src -I../../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../../jimtcl
-I../../../jimtcl   -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT cfi.lo -MD -MP -MF .deps/cfi.Tpo -c -o
cfi.lo ../../../../src/flash/nor/cfi.c
libtool: compile:  clang -DHAVE_CONFIG_H -I.
-I../../../../src/flash/nor -I../../.. -I../../../../src
-I../../../src -I../../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../../jimtcl
-I../../../jimtcl -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT cfi.lo -MD -MP -MF .deps/cfi.Tpo -c
../../../../src/flash/nor/cfi.c -o cfi.o
../../../../src/flash/nor/cfi.c:1818:28: error: implicit conversion from
      enumeration type 'enum armv7m_mode' to different enumeration type
      'enum arm_mode' [-Werror,-Wconversion]
                armv4_5_info.core_mode = ARMV7M_MODE_HANDLER;
                                       ~ ^~~~~~~~~~~~~~~~~~~
1 error generated.
make[5]: [cfi.lo] Error 1 (ignored)
mv -f .deps/cfi.Tpo .deps/cfi.Plo
/bin/sh ../../../libtool --tag=CC   --mode=link clang  -g -O2
-I/Users/xiaofanc/bin/include -Wall -Wstrict-prototypes
-Wformat-security -Wshadow -Wextra -Wno-unused-parameter
-Wbad-function-cast -Wcast-align -Wredundant-decls -Werror
-L/usr/local/lib -lusb-1.0 -L/Users/xiaofanc/bin/lib -o
libocdflashnor.la  core.lo tcl.lo aduc702x.lo at91sam3.lo at91sam7.lo
avrf.lo cfi.lo ecos.lo em357.lo faux.lo lpc2000.lo lpc288x.lo
lpc2900.lo non_cfi.lo ocl.lo pic32mx.lo stmsmi.lo stellaris.lo
stm32f1x.lo stm32f2x.lo stm32lx.lo str7x.lo str9x.lo str9xpec.lo
tms470.lo virtual.lo fm3.lo dsp5680xx_flash.lo kinetis.lo drivers.lo
-lftdi -lusb
libtool: link: `cfi.lo' is not a valid libtool object
make[5]: [libocdflashnor.la] Error 1 (ignored)
Making all in nand
make[5]: Nothing to be done for `all'.
/bin/sh ../../libtool --tag=CC   --mode=compile clang -DHAVE_CONFIG_H
-I. -I../../../src/flash -I../..  -I../../../src -I../../src
-I../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../jimtcl
-I../../jimtcl   -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT mflash.lo -MD -MP -MF .deps/mflash.Tpo
-c -o mflash.lo ../../../src/flash/mflash.c
libtool: compile:  clang -DHAVE_CONFIG_H -I. -I../../../src/flash
-I../.. -I../../../src -I../../src -I../../../src/helper
-DPKGDATADIR=\"/Users/xiaofanc/bin/share/openocd\"
-DPKGLIBDIR=\"/Users/xiaofanc/bin/lib/openocd\" -I../../../jimtcl
-I../../jimtcl -g -O2 -I/Users/xiaofanc/bin/include -Wall
-Wstrict-prototypes -Wformat-security -Wshadow -Wextra
-Wno-unused-parameter -Wbad-function-cast -Wcast-align
-Wredundant-decls -Werror -MT mflash.lo -MD -MP -MF .deps/mflash.Tpo
-c ../../../src/flash/mflash.c -o mflash.o
../../../src/flash/mflash.c:1177:45: error: implicit conversion from enumeration
      type 'enum _mg_vcmd' to different enumeration type 'mg_io_type_cmd' (aka
      'enum _mg_io_type_cmd') [-Werror,-Wconversion]
        ret = mg_mflash_do_write_sects(buff, 0, 1, mg_vcmd_update_stgdrvinfo);
              ~~~~~~~~~~~~~~~~~~~~~~~~             ^~~~~~~~~~~~~~~~~~~~~~~~~
../../../src/flash/mflash.c:1205:45: error: implicit conversion from enumeration
      type 'enum _mg_vcmd' to different enumeration type 'mg_io_type_cmd' (aka
      'enum _mg_io_type_cmd') [-Werror,-Wconversion]
        ret = mg_mflash_do_write_sects(buff, 0, 1, mg_vcmd_update_xipinfo);
              ~~~~~~~~~~~~~~~~~~~~~~~~             ^~~~~~~~~~~~~~~~~~~~~~
../../../src/flash/mflash.c:1233:45: error: implicit conversion from enumeration
      type 'enum _mg_vcmd' to different enumeration type 'mg_io_type_cmd' (aka
      'enum _mg_io_type_cmd') [-Werror,-Wconversion]
        ret = mg_mflash_do_write_sects(buff, 0, 1, mg_vcmd_wr_pll);
              ~~~~~~~~~~~~~~~~~~~~~~~~             ^~~~~~~~~~~~~~
../../../src/flash/mflash.c:1253:45: error: implicit conversion from enumeration
      type 'enum _mg_vcmd' to different enumeration type 'mg_io_type_cmd' (aka
      'enum _mg_io_type_cmd') [-Werror,-Wconversion]
        ret = mg_mflash_do_write_sects(NULL, 0, 0, mg_vcmd_purge_nand);
              ~~~~~~~~~~~~~~~~~~~~~~~~             ^~~~~~~~~~~~~~~~~~
4 errors generated.
make[5]: [mflash.lo] Error 1 (ignored)
mv -f .deps/mflash.Tpo .deps/mflash.Plo
make[5]: *** No rule to make target
`../../src/flash/nor/libocdflashnor.la', needed by `libflash.la'.
Stop.
make[4]: [all-recursive] Error 1 (ignored)
Making all in svf
make[4]: Nothing to be done for `all'.
Making all in xsvf
make[4]: Nothing to be done for `all'.
Making all in pld
make[4]: Nothing to be done for `all'.
Making all in server
make[4]: Nothing to be done for `all'.
Making all in rtos
make[4]: Nothing to be done for `all'.
make[4]: *** No rule to make target `../src/jtag/libjtag.la', needed
by `libopenocd.la'.  Stop.
make[3]: [all-recursive] Error 1 (ignored)
Making all in doc
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all-am'.


-- 
Xiaofan

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to