91321146 Posted December 1, 2016 Report Posted December 1, 2016 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
Joel Bodenmann Posted December 1, 2016 Report Posted December 1, 2016 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.
91321146 Posted December 1, 2016 Author Report Posted December 1, 2016 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?
Joel Bodenmann Posted December 1, 2016 Report Posted December 1, 2016 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?
91321146 Posted December 1, 2016 Author Report Posted December 1, 2016 (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 December 1, 2016 by 91321146
inmarket Posted December 1, 2016 Report Posted December 1, 2016 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.
91321146 Posted December 1, 2016 Author Report Posted December 1, 2016 Hi This is the thing I did: 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.
Joel Bodenmann Posted December 1, 2016 Report Posted December 1, 2016 The -dcs a.png a.h part are the parameters for the application. You have to type them in the same line as the file2c.exe binary execution command: E:\Document\...\file2c.exe -dcs a.png a.h
91321146 Posted December 1, 2016 Author Report Posted December 1, 2016 Joel I did that but it say"the file name, directory name,or volume liable syntax Iso incorrect " do you ever yourself use file2c?
Joel Bodenmann Posted December 1, 2016 Report Posted December 1, 2016 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.
91321146 Posted December 1, 2016 Author Report Posted December 1, 2016 Joel I have searched in Google and I know how use command line,but it doesn't work even when I use your advices . again when I press enter nothing happens .
91321146 Posted December 1, 2016 Author Report Posted December 1, 2016 Is there any way to use other images hex converter and one in my project?
inmarket Posted December 2, 2016 Report Posted December 2, 2016 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?
Joel Bodenmann Posted December 2, 2016 Report Posted December 2, 2016 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.
91321146 Posted December 2, 2016 Author Report Posted December 2, 2016 Thanks Joel ! thanks . You are the best . I love you my friend ,i could do that . Thanks because of time you spend for me . Really thanks man .
Joel Bodenmann Posted December 2, 2016 Report Posted December 2, 2016 We are happy to hear that you managed to get it working!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now