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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
1,047件の閲覧回数
osamutanaka
Contributor II

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

ラベル(1)
1 解決策
884件の閲覧回数
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

元の投稿で解決策を見る

7 返答(返信)
884件の閲覧回数
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 件の賞賛
884件の閲覧回数
osamutanaka
Contributor II

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

I also use Processor Expert tool.

Thank you.

0 件の賞賛
885件の閲覧回数
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

884件の閲覧回数
osamutanaka
Contributor II

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

Thank you so much.

0 件の賞賛
884件の閲覧回数
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

884件の閲覧回数
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 件の賞賛
884件の閲覧回数
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 件の賞賛