How can I embed a small binary file like bitmap to my executable?  Also, how do I access to it from my program?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How can I embed a small binary file like bitmap to my executable?  Also, how do I access to it from my program?

Jump to solution
1,038 Views
osamutanaka
Contributor II

An item resources in project property does not works as this purpose.

Labels (1)
1 Solution
875 Views
Jiun_Yong
Contributor III

Hi

This is only a suggestion, but if you look through the Processor Expert, there is a component called "ExternalFile"

pastedImage_0.png

You will need to add your source file to the list of files included in your project.

pastedImage_1.png

Then specify this file in the ExternalFile component in Processor Expert

pastedImage_2.png

The rebuild your project. Processor Expert creates a new source file which has all your binary data in code format, defined as an array of bytes.

pastedImage_6.png

Your ExternalFile bean has 3 methods, which return the size of the array, a pointer to its start and an indexed value.

pastedImage_4.png

Sadly, I could not find any better documentation in the help file, but I am sure someone can point us to it.

Hope this helps

Steve

View solution in original post

7 Replies
875 Views
bobpaddock
Senior Contributor III

The answer is dependent on  which tool chain you are using for compiler and linker.
Which one are you using?

0 Kudos
875 Views
osamutanaka
Contributor II

I am working on Kinetis Design Studio with the Cross ARM GCC.

I also use Processor Expert tool.

Thank you.

0 Kudos
876 Views
Jiun_Yong
Contributor III

Hi

This is only a suggestion, but if you look through the Processor Expert, there is a component called "ExternalFile"

pastedImage_0.png

You will need to add your source file to the list of files included in your project.

pastedImage_1.png

Then specify this file in the ExternalFile component in Processor Expert

pastedImage_2.png

The rebuild your project. Processor Expert creates a new source file which has all your binary data in code format, defined as an array of bytes.

pastedImage_6.png

Your ExternalFile bean has 3 methods, which return the size of the array, a pointer to its start and an indexed value.

pastedImage_4.png

Sadly, I could not find any better documentation in the help file, but I am sure someone can point us to it.

Hope this helps

Steve

875 Views
osamutanaka
Contributor II

I tried as you suggested, and I could get a binary file's reference.

Thank you so much.

0 Kudos
875 Views
mjbcswitzerland
Specialist V

Hi

See chapter 3.5 of http://www.utasker.com/docs/uTasker/uTaskerLCD.PDF

The utilities are at http://www.utasker.com/forum/index.php?topic=1445.0

This works with any compiler/tool chain.

Regards

Mark

875 Views
osamutanaka
Contributor II

Do you mean the only way to embed a small binary resource to my executable is insert it as program code?

Thank you for your introducing an useful tool.

0 Kudos
875 Views
mjbcswitzerland
Specialist V

Hi

There are probaby many different ways to insert binary but inserting it as code means that it is compiler independent and so portable.

Other methods will tend to be rather tool-chain specific and so more difficult to maintain and require re-inventing the solution each time it is to be repeated in a different environment.

Regards

Mark

0 Kudos