Using a const char array to access a binary image
Technical Note 71111
Arkitekturer:
ARM
Komponent:
linker
Uppdaterad:
2018-11-22 17:16
Introduction
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.
Discussion
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]);
}
Conclusion
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.