init of large arrays

Hi all,

what would be the best way to init a huge array, which will never change his values? Will the array affect the stack if I use const aray[][] or should I use static const array[][]?

What would be the best way if the array is not const during the whole program?

best regards
Hans

Parents
  • Will the array affect the stack if I use const aray[][] or should I use static const array[][]?

    It is possible that the array ends up on the stack if static is not used.

    As long as the array does not need to be in RAM (e.g. to increase speed or power consumption), such an array could be "initialized" at FW load time (i.e. it's simply put in the EEPROM somewhere and accessed there).

    What would be the best way if the array is not const during the whole program?

    That very much depends on your definition of "best", and to some degree on the contents of the array.

Reply
  • Will the array affect the stack if I use const aray[][] or should I use static const array[][]?

    It is possible that the array ends up on the stack if static is not used.

    As long as the array does not need to be in RAM (e.g. to increase speed or power consumption), such an array could be "initialized" at FW load time (i.e. it's simply put in the EEPROM somewhere and accessed there).

    What would be the best way if the array is not const during the whole program?

    That very much depends on your definition of "best", and to some degree on the contents of the array.

Children
More questions in this forum