Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of bound error #2

Closed
nretro opened this issue Jun 7, 2020 · 5 comments
Closed

Out of bound error #2

nretro opened this issue Jun 7, 2020 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@nretro
Copy link

nretro commented Jun 7, 2020

In src/flash/mflash.h the line

mg_io_uint8 reserved7[186];

should be changed to

mg_io_uint8 reserved7[190];

This is obviously an error, since in mflash.c reserved7 is accessed using
memset(pSegIdDrvInfo->reserved7, 0x00, 190);

Current gcc compiler flags this with an out of bound warning. In combination with the "Werror" flag, the compilation will be aborted.

@tarek-bochkati tarek-bochkati self-assigned this Jun 16, 2020
@tarek-bochkati
Copy link
Contributor

Thanks @nretro

Could you please specify the GCC version you are using.
BTW, we are doing an alignment with official OpenOCD : github mirror
In the official repo the mflash driver is deleted : please check this link and the deletion commit
So I would like the have the compiler version you used, so I can check on the official OpenOCD.

Thanks again,
Tarek

@nretro
Copy link
Author

nretro commented Jun 16, 2020

Hi Tarek,

thanks for your answer. I'm using "gcc (Debian 9.3.0-13) 9.3.0" on debian unstable.
The official openocd compiles nicely and also supports both my chinese ST-LINK V2 clone and my STM32H7 Nucleo board. Maybe after more than three years, it would be time for another upstream release... the 0.10.0 release (which comes with debain) of 2017 does have problems with both boards.

Thanks,
Norbert.

@tarek-bochkati
Copy link
Contributor

Thanks again Norbert

Our next release of CubeIDE planned beginning of July will contain the latest official OpenOCD code plus STMicroelectronics additions (not merged in official openocd yet).
And this fork does not include the mflash driver.

the 0.10.0 release (which comes with debain) of 2017 does have problems with both boards.

indeed, I have started last year upstreaming ST code so it should be OK, you can check this link
and we are still reviewing the commits adding the latest ST devices : link
By the way, we are talking about a new release 0.11, hopefully it can be done before the end of this summer:
0.11.0-rc1 proposal : http://openocd.zylin.com/#/c/5707/

Please do not hesitate to share with us, if you detect any issue or if you feel that there is something missing.

Thanks,
Tarek

@tarek-bochkati tarek-bochkati added the bug Something isn't working label Jun 18, 2020
@stansotn
Copy link

Just tried to build on gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 arm64 raspberry pi 4 and ran into the same issue. After patching the following compilation goes further. Thanks @nretro

In src/flash/mflash.h the line

mg_io_uint8 reserved7[186];

should be changed to

mg_io_uint8 reserved7[190];

Then breaks here

/usr/include/aarch64-linux-gnu/sys/sysctl.h:21:2: error: #warning "The <sys/sysctl.h> header is deprecated and will be removed." [-Werror=cpp]
   21 | #warning "The <sys/sysctl.h> header is deprecated and will be removed."
      |  ^~~~~~~
cc1: all warnings being treated as errors

Build succeeded only if -Werror is removed from the makefile.

@tarek-bochkati
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants