Maximum line length for CSV data in PROGMEM

You can include as much binary data in PROGMEM as the FLASH can hold.
With the UNO that could be some 31 KBytes, may it be audio or video data.
If it comes as comma-separated 3-digit numbers it takes 31000*4=124000 characters,
and you can have it in a single line.
The problem arises when you have any functions declared below setup and loop.
They will not be visible for the compiler, and you will get error: 'foo' was not declared in this scope.
The same also happens when you move that data to an included h-file.
Of course, there are work-arounds:

  • moving the functions to the top
  • insert a forward reference at the top
  • divide the long line of data in two or more. The maximum line length that does not lead to that error seems to be 65536 characters.
    So, it is not a real problem, but it is not documented anywhere. I think it should be.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.