Hi All,
I have 3 source files: file1.c, file2.c and file3.c and 1 header file config.h.
When I built entire uvision project, 3 object files got generated. file1.obj, file2.obj, file3.obj.
Now I re-build the project & generate hex by changing variables in the config.h header file.
My queries:
1. Can I use these object files and config.h file somehow to generate hex files? I mean without using the source files in building.
This is because, I don't want to give the source files to my client except the object files and config.h file, so that client can load them in uvsion project & generate different hex files by changing the config.h file.
Regards, Raj S.
Do you actually have "variables" defined in the include file, or #defines?
If the latter you're going to have problems because the source compilation is dependent on them.
Going to suggest you review the chapter of externalizing variables and abstraction, so you put the data you want the customer to see in one file you can provide them. Then review the chapter on object and library files, where you place all the compiled stuff you don't want the customer to see the source for into. You can then build a clean project by dropping in the objects/libraries you've previously created and adding the variable abstraction to it.
Think of it like a the C library code, where you don't get source.
Yes, I have #defines. If I can change it to variables in a separate C file, then I can use it as extern in my source files. But how to link and generate hex in uvision project. Please suggest me the process.
Regards, Rajesh
If the project contains object files or libraries (containers of one or more object files), they will be linked into the final binary.
If the project contains source files, they will be assembled or compiled to produce object files that will be then linked into the final project.
So have you experimented with using object files in the project? Or with creating a library?
"You can then build a clean project by dropping in the objects/libraries you've previously created and adding the variable abstraction to it."
I have 3 object files now and I want to link them with config.c file(this file has variable which can be changed by my client) to generate different hex file. Also, I used extern keyword for this variable while using it in my 3 source files. Now I would like to know how in uvision project I can add these 3 object files and one config.c file to link/build and generate hex.
Thanks
Right click on the group within the file view for your project and "Add Existing Files to Group", change "Files of type" in the file dialog to objects or libraries.