Jump to content

File2c usage


91321146

Recommended Posts

Have you checked out the usage text printed by the file2c binary?

$ file2c.exe -h
Usage:

file2c -?
file2c [-dbcs] [-n name] [-f file] [inputfile] [outputfile]
        -?      This help
        -h      This help
        -d      Add a directory entry for the ROM file system
        -b      Break the arrays for compilers that won't handle large arrays
        -c      Declare as const (useful to ensure they end up in Flash)
        -s      Declare as static
        -n name Use "name" as the name of the array
        -f file Use "file" as the filename in the ROM directory entry

The common usage of the tool looks like this:

file2c.exe -dcs myimage.png myimage.h

The -d flags is only useful if you want to use the file with the ROMFS file system. If that flag is specified the file2c tool will generate the required directory listing entries at the very bottom of the generated file.
The -c and -s files just control whether the generated array(s) are marked as const and static. This way you can ensure that they end up in ROM instead of RAM.

 

15 minutes ago, 91321146 said:

how can I import my image to this and generate hex file?

It is important that you understand that the file2c tool doesn't generate a hex file. All it does is taking the binary data and wrapping it into one or more C arrays of type uint8_t, that's all. It doesn't generate a hex file, it doesn't change the binary data, it doesn't do any encoding or decoding.

Link to comment
Share on other sites

So where should I type thease commands ? where should I include to my keil project?how keil know this file2c?please help Joel.

Really i can't understand ,now I have a jpg image on my desktop in my computer , and file2c is in "tools" directory!how I use file2c with my image and my keil project?

In demo/image box example it has an array named ugfx logged banner,how it comes with file2c?

Link to comment
Share on other sites

I merged all your posts into one - please don't spam the forum. We are not going to reply faster if you make more posts.

The file2c tool is a dedicated stand-alone application that you run on your desktop computer. It's a console application: Open a terminal, and launch the binary like you would with any other console application.
Using the file2c tool has nothing to do with Keil µVision - neither do you run it on your microcontroller.

Do you have any specific questions?

 

Link to comment
Share on other sites

What do you mean by terminal?

You know I saw text printed in above ,but I don't know where I use them.

Dear Joel unfortunately I couldn't understand how to work with file2c and how import image with ugfx.

But thanks

 

Edited by 91321146
Link to comment
Share on other sites

First, change the directory to the location where your file2c.exe binary and your image is located:

cd E:\Document\GUI\ugfx\ugfx2.6\tools\file2c\binaries\windows

Then, execute file2c.exe:

file2c.exe -dcs a.png a.h

You have to provide valid paths to your input and output files. Right now you are using the absolute path of the file2c.exe binary but your input file is not located in the current working directory.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...