20
Chapter 4
Software Description
User’s Manual U17316EE1V0UM00
4.2 Display of PNG Files
In order to display png files (Portable Network Graphics), we have ported the free PNG Reference
Library libpng (www.libpng.org) to the V850. This library requires the zlib compression library
(www.gzip.org), which has also been ported. These two libraries are documented on their respective
websites. Calls to zlib functions are transparent and the libpng user need not bother too much about
that zlib library. It should be noted, however, that a certain amount of heap space is required for both lib-
png and zlib. Also the stack size should not be too small, as these functions seem to use it extensively.
They have clearly been written with personal computers in mind and are not optimized for the limited
memory resources of embedded applications. Nevertheless there is a limited number of tuning possibil-
ities by defining certain variables that control compilation of the libraries. See the respective documen-
tation for details.
4.3 Bin2C: Converting Binary Files to C-Source Code
A binary file cannot be directly copied to an embedded system. At least it must be converted to a down-
loadable ASCII file of Intel-Hex or Motorola S-Record format. A slightly more complicated conversion
seems to offer the best possible flexibility: converting the binary file to C-Source code. That is exactly
what the bin2c utility was made for. The generated C-Source code can be embedded into any project
and be located to any required address. bin2c was written for the conversion of .png files, but it does not
perform any structural analysis and so it may be used with any file, not just with binary png-files.
bin2c inserts a pragma for the Green Hills compiler to emit the subsequent data into the segment
.images. That allows for relocation of that data to any target address. bin2c defines an array of unsigned
char and names the array with the file name of the input file. A few characters are converted if they are
incompatible with the C naming conventions. The best idea is probably to avoid file names, which do
not comply with C variable names.
bin2c can convert multiple files at once. For each input file it creates its own array with a name as
described before. When the “Generate table of contents” checkbox is enabled, then an array of pointers
to unsigned char is allocated and that array is initialized with pointers to the individual arrays. The name
of this table is toc and the variable toc_size is initialized with the number of arrays (=number of files).
Animated sequences are usually created with index numbers in their file names. When the “Sort Input
Files” checkbox is enabled, then the files are automatically sorted in ascending file name order.
bin2c was compiled with the free OpenWatcom tool chain, which is downloadable from
http://www.openwatcom.org/. The sources of bin2c are provided on the CD and may be modified as
required.
Summary of Contents for startWARE-GHS-Ravin-E
Page 6: ...6 User s Manual U17316EE1V0UM00 ...
Page 8: ...8 User s Manual U17316EE1V0UM00 ...
Page 10: ...10 User s Manual U17316EE1V0UM00 ...
Page 12: ...12 User s Manual U17316EE1V0UM00 ...
Page 14: ...14 User s Manual U17316EE1V0UM00 MEMO ...
Page 38: ...38 User s Manual U17316EE1V0UM00 MEMO ...
Page 40: ......