You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are compilation issues when using the latest gcc version on raspbian (currently 10.2.1-1+rpi1).
To fix those errors, I was able to cherry-pick different commits but I had to fix the first one by hand because I got into a chain of emerging error due to dependency on older commits (see first error below).
I'd like to know if I should create a PR or not ? Maybe rebasing this repository on openocd-org/openocd would be better as the more time passes, the more it is likely that cherry-picking will be hard...
To explain what I changed, here is the list of errors I fixed without any special order :
‘status’ may be used uninitialized in this function
In file included from ./src/flash/common.h:21,
from src/flash/nor/core.h:25,
from src/flash/nor/imp.h:22,
from src/flash/nor/jtagspi.c:22:
src/flash/nor/jtagspi.c: In function ‘jtagspi_write_enable’:
./src/helper/log.h:133:2: error: ‘status’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
133 | log_printf_lf(LOG_LVL_ERROR, __FILE__, __LINE__, __func__, expr)
| ^~~~~~~~~~~~~
src/flash/nor/jtagspi.c:262:11: note: ‘status’ was declared here
262 | uint32_t status;
| ^~~~~~
src/flash/nor/jtagspi.c: In function ‘jtagspi_wait’:
src/flash/nor/jtagspi.c:249:15: error: ‘status’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
249 | if ((status & SPIFLASH_BSY_BIT) == 0) {
| ~~~~~~~~^~~~~~~~~~~~~~~~~~~
I fixed those by initializing status with (uint32_t)-1 like they did upstream : openocd-org@be57b0a
I did not cherry-pick the commit because it changes a lot more than needed and I do not have the time to fully review how it impacts the whole project.
src/target/arm920t.c: In function 'arm920t_read_cp15_interpreted.constprop':
src/target/arm920t.c:255:9: error: 'arm9tdmi_write_core_regs' accessing 64 bytes in a region of size 8 [-Werror=stringop-overflow=]
255 | arm9tdmi_write_core_regs(target, 0x2, regs);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/target/arm920t.c:255:9: note: referencing argument 3 of type 'uint32_t *' {aka 'unsigned int *'}
In file included from src/target/arm920t.h:22,
from src/target/arm920t.c:24:
src/target/arm9tdmi.h:40:6: note: in a call to function 'arm9tdmi_write_core_regs'
40 | void arm9tdmi_write_core_regs(struct target *target,
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/target/arm920t.c:273:9: error: 'arm9tdmi_read_core_regs' accessing 128 bytes in a region of size 8 [-Werror=stringop-overflow=]
273 | arm9tdmi_read_core_regs(target, 0x1, regs_p);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/target/arm920t.c:273:9: note: referencing argument 3 of type 'uint32_t **' {aka 'unsigned int **'}
In file included from src/target/arm920t.h:22,
from src/target/arm920t.c:24:
src/target/arm9tdmi.h:38:6: note: in a call to function 'arm9tdmi_read_core_regs'
38 | void arm9tdmi_read_core_regs(struct target *target,
| ^~~~~~~~~~~~~~~~~~~~~~~
src/target/arm920t.c: In function 'arm920t_write_cp15_interpreted':
src/target/arm920t.c:304:9: error: 'arm9tdmi_write_core_regs' accessing 64 bytes in a region of size 8 [-Werror=stringop-overflow=]
304 | arm9tdmi_write_core_regs(target, 0x3, regs);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/target/arm920t.c:304:9: note: referencing argument 3 of type 'uint32_t *' {aka 'unsigned int *'}
In file included from src/target/arm920t.h:22,
from src/target/arm920t.c:24:
src/target/arm9tdmi.h:40:6: note: in a call to function 'arm9tdmi_write_core_regs'
40 | void arm9tdmi_write_core_regs(struct target *target,
| ^~~~~~~~~~~~~~~~~~~~~~~~
src/jtag/drivers/presto.c: In function 'presto_open_libftdi':
src/jtag/drivers/presto.c:163:9: error: 'ftdi_usb_purge_buffers' is deprecated [-Werror=deprecated-declarations]
163 | if (ftdi_usb_purge_buffers(&presto->ftdic) < 0) {
| ^~
In file included from src/jtag/drivers/presto.c:37:
/usr/include/libftdi1/ftdi.h:566:20: note: declared here
566 | int DEPRECATED(ftdi_usb_purge_buffers(struct ftdi_context *ftdi));
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/libftdi1/ftdi.h:247:55: note: in definition of macro 'DEPRECATED'
247 | #define DEPRECATED(func) __attribute__ ((deprecated)) func
| ^~~~
src/jtag/drivers/presto.c:177:17: error: 'ftdi_usb_purge_buffers' is deprecated [-Werror=deprecated-declarations]
177 | if (ftdi_usb_purge_buffers(&presto->ftdic) < 0)
| ^~
In file included from src/jtag/drivers/presto.c:37:
/usr/include/libftdi1/ftdi.h:566:20: note: declared here
566 | int DEPRECATED(ftdi_usb_purge_buffers(struct ftdi_context *ftdi));
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/libftdi1/ftdi.h:247:55: note: in definition of macro 'DEPRECATED'
247 | #define DEPRECATED(func) __attribute__ ((deprecated)) func
| ^~~~
src/jtag/drivers/openjtag.c: In function 'openjtag_init_standard':
src/jtag/drivers/openjtag.c:441:9: error: 'ftdi_usb_purge_buffers' is deprecated [-Werror=deprecated-declarations]
441 | if (ftdi_usb_purge_buffers(&ftdic) < 0) {
| ^~
In file included from src/jtag/drivers/openjtag.c:85:
/usr/include/libftdi1/ftdi.h:566:20: note: declared here
566 | int DEPRECATED(ftdi_usb_purge_buffers(struct ftdi_context *ftdi));
| ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/libftdi1/ftdi.h:247:55: note: in definition of macro 'DEPRECATED'
247 | #define DEPRECATED(func) __attribute__ ((deprecated)) func
| ^~~~
In file included from ./src/jtag/jtag.h:25,
from src/target/riscv/riscv-011.c:18:
In function 'buf_set_u64',
inlined from 'buf_set_u64' at ./src/helper/binarybuffer.h:69:20,
inlined from 'dbus_scan' at src/target/riscv/riscv-011.c:434:2:
./src/helper/binarybuffer.h:93:47: error: 'out' may be used uninitialized [-Werror=maybe-uninitialized]
93 | buffer[i / 8] &= ~(1 << (i % 8));
| ^~
src/target/riscv/riscv-011.c: In function 'dbus_scan':
src/target/riscv/riscv-011.c:425:17: note: 'out' declared here
425 | uint8_t out[8];
| ^~~
Please open a pull request, I found this same problem and it took me a while to figure it out. For future reference, from the openocd-spi directory run:
git remote add zorvalt https://github.com/Zorvalt/openocd-spi/
git pull zorvalt fix-multiple-gcc-10-errors
make
There are compilation issues when using the latest gcc version on raspbian (currently 10.2.1-1+rpi1).
To fix those errors, I was able to cherry-pick different commits but I had to fix the first one by hand because I got into a chain of emerging error due to dependency on older commits (see first error below).
I pushed everything on a fork, here : https://github.com/Zorvalt/openocd-spi/tree/fix-multiple-gcc-10-errors
I'd like to know if I should create a PR or not ? Maybe rebasing this repository on openocd-org/openocd would be better as the more time passes, the more it is likely that cherry-picking will be hard...
To explain what I changed, here is the list of errors I fixed without any special order :
‘status’ may be used uninitialized in this function
I fixed those by initializing status with
(uint32_t)-1
like they did upstream : openocd-org@be57b0aI did not cherry-pick the commit because it changes a lot more than needed and I do not have the time to fully review how it impacts the whole project.
Commit fixing this error : openocd-org@be57b0a
Applying it breaks some types comparisons like
sector < bank->num_sectors
in openocd-org@be57b0a#diff-5e2e3ea9c2f7e815c40a02619a32e1f45d1dd8e3254bb380740f2f9097220f4aR283This can in turn be fixed with openocd-org@ef14384 which breaks other parts again and I stopped my investigations there in favor of a simple two line commit.
accessing
N
bytes in a region of size 8Fixed by cherry-picking openocd-org@6db49eb
'ftdi_usb_purge_buffers' is deprecated
Fixed by cherry-picking openocd-org@5bb0f6b
'out' may be used uninitialized
Fixed by cherry-picking openocd-org@a2e8228
The text was updated successfully, but these errors were encountered: