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

fix compilation issue 'array subscript 0 is outside array bounds' for arm-none-eabi-gcc version 13 #321

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

SaidAlvarado
Copy link
Contributor

Hello! :D
I got the following error when building with arm-none-eabi-gcc version 13.2.0, in Linux 5.15.146-1-MANJARO:

lib/sdk11/components/libraries/bootloader_dfu/bootloader_settings.c: In function 'bootloader_mbr_addrs_populate':
lib/sdk11/components/libraries/bootloader_dfu/bootloader_settings.c:45:7: error: array subscript 0 is outside array bounds of 'const uint32_t[0]' {aka 'const long unsigned int[]'} [-Werror=array-bounds=]
   45 |   if (*(const uint32_t *)MBR_BOOTLOADER_ADDR == 0xFFFFFFFF)
compilation terminated due to -Wfatal-errors.
cc1: all warnings being treated as errors
make: *** [Makefile:417: _build/build-sparkfun_nrf52840_micromod/bootloader_settings.o] Error 1

It seems like this is an issue with newer GCC versions. Based on the discussion in #273: This was already fixed for GCC version 12, but the problem reappeared for GCC version 13.

I tested the same fix proposed in #273 (add the compile flag --param=min-pagesize=0). It solved the issue, and I could successfully compile the bootloader firmware.

This PR is just an extension of the #273 fix. The conditional in the MakeFile now checks for both gcc versions 12 and 13 and applies the relevant compile flag. I tested the code against arm-none-eabi-gcc versions:

  • 13.2.0
  • 12.2.Rel1

It worked with both.

Thank you for your time!

Copy link
Member

@hathach hathach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

look good, thank you for the fix

@hathach hathach merged commit e745002 into adafruit:master Feb 5, 2024
45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants