Jump to content

Recommended Posts

Posted

HI friends 

Can you help me how to work with file2c?

Really think I studied redme and documentation but I couldn't work with this!

How should I use it?how can I import my image to this and generate hex file?

Please help 

Posted

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.

Posted

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?

Posted

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?

 

Posted (edited)

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
Posted

Terminal = command line.

This is not a gui application. It runs from the command line (or in unix speak -  from a shell). Google will provide more specific answers on what a comnand line/terminal/shell is.

Posted

Hi

This is the  thing I did:IMG_20161201_232136.jpg But when I type"-dcs a.png a.h " and press  Enter  it doesn't give me  hex in array. 

Please what should I do ? 

It's necessary for me.

Posted

Please navigate to the directory containing the file2c.exe executable binary and then type this:

file2c.exe -dcs a.png a.h

 

9 minutes ago, 91321146 said:

ever yourself use file2c?

Yes, we use the file2c tool every day and so do many other people. Please use a Google search to learn how to use your command line.

Posted

Joel 

I have searched in Google and I know how use command line,but it doesn't work even when I use your advices . IMG_20161202_010156.jpg again when I press enter nothing happens . 

Posted

You are still not following Joels instructions to put the command and its arguments all on the one command line.

I am not sure how we could possibly explain it more clearly. Perhaps someone else in the community would like to try explaining it?

Posted

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.

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...