I'm getting a compiler warning stopping the build on Ubuntu 17.04 with gcc version 6.3.0 20170406 (Ubuntu 6.3.0-12ubuntu2)

I'm fine working around it, but if it's a problem for anyone else, here's a patch.

-rick

--- compiler warning
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./src -I./src -I./src/helper -DPKGDATADIR=\"/usr/local/share/openocd\" -DBINDIR=\"/usr/local/bin\" -I./jimtcl -I./jimtcl -Wall -Wstrict-prototypes -Wformat-security -Wshadow -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror -g -O2 -MT src/flash/nor/at91sam3.lo -MD -MP -MF src/flash/nor/.deps/at91sam3.Tpo -c src/flash/nor/at91sam3.c -o src/flash/nor/at91sam3.o
src/flash/nor/stm32f2x.c: In function ‘stm32x_handle_unlock_command’:
src/flash/nor/stm32f2x.c:1324:67: error: left shift of negative value [-Werror=shift-negative-value] stm32x_info->option_bytes.optcr2_pcrop = OPTCR2_PCROP_RDP | (~1 << bank->num_sectors);

--- patch
diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c
index 0e4abb53..d23adbbe 100644
--- a/src/flash/nor/stm32f2x.c
+++ b/src/flash/nor/stm32f2x.c
@@ -1321,7 +1321,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
         * this will also force a device unlock if set */
        stm32x_info->option_bytes.RDP = 0xAA;
        if (stm32x_info->has_optcr2_pcrop) {
- stm32x_info->option_bytes.optcr2_pcrop = OPTCR2_PCROP_RDP | (~1 << bank->num_sectors); + stm32x_info->option_bytes.optcr2_pcrop = OPTCR2_PCROP_RDP | ((unsigned)~1 << bank->num_sectors);
        }

        if (stm32x_write_options(bank) != ERROR_OK) {


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to