Embed file - restrictions on file size
Posted: Mon May 18, 2026 9:36 pm
Just tried to use embed file - and hit a (serious) limitation....
I tried to include a 22k (binary) file - but this doesn't work. Looking at the source code (of the project and the component) - and it looks like the file is expanded to a 1000 character string. So at an average of two bytes per digit (+ ',') this looks to limit the file size to about 300 bytes
Oddly - the embed file also gives a length of 65535 bytes (the file is correct at 22k).
The component also seems to attempt to embed the file as a single line of text:
(With a small test file)
This is going to get very 'messy' for larger files and the text would ideally be split over multiple lines....
A better technique might be for embed_file to generate a new file and a #include instruction. The file should be generated once (when added) - and only refreshed if the user changes the file specified (or clicks 'refresh'?)
There also seems to be a limit on the LUT size of about 4600 bytes - and these are laid out in a more logical manner (multiple rows)
I worked around by generating the C source and adding to supplementary code - although a #include might be neater?
Martin
I tried to include a 22k (binary) file - but this doesn't work. Looking at the source code (of the project and the component) - and it looks like the file is expanded to a 1000 character string. So at an average of two bytes per digit (+ ',') this looks to limit the file size to about 300 bytes
Oddly - the embed file also gives a length of 65535 bytes (the file is correct at 22k).
The component also seems to attempt to embed the file as a single line of text:
ROMARRAY_(MX_UINT8) FCD_00fb2_lut1__INTFIXEDLIST_LUT ROMARRAY_E =
{
1,2,3,4,5,6,7,8,9,16
};
(With a small test file)
This is going to get very 'messy' for larger files and the text would ideally be split over multiple lines....
A better technique might be for embed_file to generate a new file and a #include instruction. The file should be generated once (when added) - and only refreshed if the user changes the file specified (or clicks 'refresh'?)
There also seems to be a limit on the LUT size of about 4600 bytes - and these are laid out in a more logical manner (multiple rows)
I worked around by generating the C source and adding to supplementary code - although a #include might be neater?
Martin