Using a const char array to access a binary image

Technical Note 71111






11/22/2018 5:16 PM


A common method of accessing the contents of a binary file stored in flash is to dereference a char pointer. This technical note describes how to access the stored contents directly through a linker symbol.


Use the linker option --image_input to include a binary file and assign a linker symbol that is associated with the address in flash where the contents are stored.

In your source code, use the associated linker symbol directly to access the binary image, for example:


extern const char test_bin_symbol[];

for (int i=0; i < 10; i++)
printf("%c\n", test_bin_symbol[i]);


You can access the stored contents of a binary file through a linker symbol defined by the linker option --image_input.

The example contains a project and screenshots showing linker options.


All Product names are trademarks or registered trademarks of their respective owners.

We do no longer support Internet Explorer. To get the best experience of, we recommend upgrading to a modern browser such as Chrome or Edge.