Including a binary file

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

Including a binary file

2,342件の閲覧回数
cessna
Contributor I
I'd like to include an html file in a project written in 'C' for an HC05, its a small (600byte) status page.
I've tried setting my .htm file to "Ignored By Make" in the Standard Settings (Alt-F5) - "File-Mappings" but the included .htm file is still read and rejected, any ideas?
ラベル(1)
タグ(1)
0 件の賞賛
返信
2 返答(返信)

1,408件の閲覧回数
CompilerGuru
NXP Employee
NXP Employee
With changed File-Mappings you can only control how the ide treats the file, it wont download the content of the file to the target tough.
I think the simplest approach, and probably the best one too, is to store the content of the file as string literal as part of the application. So it wont be a separate file anymore, but everything is straight forward, no custom build steps.
If you really want to put the content of a file into the application, then the only way I see is to create an srecord out of the html page and then include the srecord in the prm.
The linker supports to include srecords, and the conversion from a binary file to an srecord can be done with the burner in a batch burner file.
I'm not going into too many details, as I think the simple code it as string literal approach is still the best one :smileyhappy:.


Daniel

BTW: I think processor expert has a bean for such purpose, but processor expert is not an option with the HC05. I'm sure there are many tools on the web too to encode a file into a C source file.

1,408件の閲覧回数
bigmac
Specialist III
Hello,
 
Using a similar aproach to Daniel's suggestion, and assuming your compiler/linker also supports the inclusion of .ASM assembly fiiles, a further alternative might be to incorporate the data as assembly directives.  For CW, this would be a series of lines of the following format -
 
   dc.b  "Line data",$0D,$0A  ; or whatever line termination is needed
 
Regards,
Mac