Hi, there, I want to use uv2 to debug a system consisting of a set of C codes and one hex file. The C codes will read the data from this hex file. In uv2, I have created a project for this set of C codes, I can debug/trace the their execution. The question is how to include the Hex file into this project? Plausible solution 1, I added the Hex file into the project along with the C codes, and specify the Hex file's type as "Text file". The C codes could *not* read the data from the Hex file correctly. Plausible solution 2, in the "Options for Task" popup utility, there is a Linker panel. However, I didn't figure out where to put the Hex file. Any suggestion? For details of my task, please refer to the following discussion thread. http://www.keil.com/forum/docs/thread3564.asp Kan
Of course, I can wrap the Hex file into a C code which contains an array of bytes. But is there more decent solution? Kan
I added the Hex file into the project along with the C codes, and specify the Hex file's type as 'Text file'." When you specify a file as a 'Text File' that tells uVision that the only thing it has to do with that file is to display it in the editor - it does not form part of the build. "in the 'Options for Task' popup utility, there is a Linker panel." The linker deals with Object files - not hex files. The Linker's output is converted to hex (if required) after the Linker has finished - the linker knows nothing about hex files. If you want to merge a hex file with the hex file generated by the uVision build, you will have to do that via the 'Run User Program' options on the 'Output' tab. "Any suggestion?" Presumably, your hex file contains absolutely-located data? Why not just define a 'C' pointer to that location? Or maybe use the _at_ keyword extension to place a suitable 'C' symbol there?
Andy, I converted the Hex file into a C code, which only contained a byte(int) array. Then I added this byte array C code into the uv2 project, rebuilt this C code with all the others. It worked. The reason I asked the question is that when I want to change the content of the Hex file. I have to re-generate the C code, and then rebuilt the projects. Therefore, the problem is that how to access the content of a Hex file which is dynamically loaded. And furthermore, it is not necessary to be a Hex file, all I want is a data file, which is ultimately stored in ROM. Anyway, this is not a big issue, only for the convenience of debugging. thanks, Kan
"a byte(int) array." BEWARE: In C51, an int is two bytes! "when I want to change the content of the Hex file. I have to re-generate the C code, and then rebuilt the projects." If you can automate the C-code generation, you can include this in the Project by using a Custom Translation - see the uVision Manual
Maybe the answer http://www.keil.com/support/docs/2666.htm from the Knowledgebase helps.
Thanks. I will try the approach. For "a byte(int) array", thanks for the reminder. In my specific case, the Java VM will cast the byte into int, hence, it is not an issue for me. However, I agree with you, for general purpose, it is a very important issue to pay attention to. Many thanks again, Kan