Tool/software: Code Composer Studio
I am trying to update a project I did 6 years ago under CCSv5 to CCSv8. However, I did something too-clever-by-half back then to get the output file name to include my firmware version number. Although I never had a problem under CCSv5, it's not working under CCSv8. I'll try to explain what I did, and then maybe someone can explain a better way.
In makefile.init, I added defines for my firmware version and configuration options and used them to define an output file name, OUTPUT_NAME.
VMAJOR = 1 VMINOR = 2 VBUG = 3 CPU = 5527 OPTION = 1 ifeq ($(OPTION),1) OPTEXT = O else OPTEXT = X endif OUTPUT_NAME = $(CONFIG_NAME)-V$(VMAJOR).$(VMINOR).$(VBUG)-$(OPTEXT)
Then in makefile.defs I added a rule to build a source file containing a datecode that gets updated anytime the project is built.
# This file inserts the datacode object as a dependency between source objects and # output file. So if any change to source occurs, the datecode object gets rebuilt # and then that triggers rebuilding of the output file. PERL_TOOL = "C:\Perl64\bin\perl.exe" # ActivePerl 5.18.2 MY_OBJS := $(OBJS) # create a copy of the source object list OBJS := datecode.obj # make output file dependent only on date code object ORDERED_OBJS += datecode.obj # add datecode object to list of objects to be linked into output datecode.obj: $(MY_OBJS) $(GEN_CMDS) $(CMD_SRCS) # data code object is dependent on source objects # ------- # generate data code source file # ------- @echo 'Generating datacode.c' $(PERL_TOOL) ../datecode.pl ../datecode.c @echo ' ' # ------- # compile the file # ------- @echo 'Building file: datecode.c' @echo 'Invoking: MSP430 Compiler' "$(CG_TOOL_ROOT)/bin/cl430" -vmspx --abi=eabi -O3 --opt_for_speed=0 -g \ --use_hw_mpy=F5 --define=__MSP430F$(CPU)__ --silicon_errata=CPU40 \ --data_model=restricted --large_memory_model --preproc_with_compile "../datecode.c" @echo 'Finished building: datecode.c' @echo ' ' # ------- # delete the source # ------- @echo 'Removing datacode.c' $(RM) "$(subst /,\,$(CWD)/../datecode.c)" @echo ' '
Finally, I went into Project Properties>Build>MSP430 Linker>Basic Options and set map file name to "$(OUTPUT_NAME).map" and output file name to $(OUTPUT_NAME).out. (Note quotes are only on map file. Not sure why I did that or if it's important)
After importing this to CCSv8, I'm having two issues:
- After cleaning, source files don't get built. This has something to do with my trick to insert the datecode rule--if I remove that the build works normally. Otherwise I have to select the source files and click "build selected file(s)" from the context menu. After that building the output works.
- Once the output is built, clicking the debug button results in error message: "Encountered a problem loading file: C:\<long path name>\Test\Test\$(OUTPUT_NAME)." I looked in the debug configuration and the program name is ${build_artifact:Test}. Apparently, CCSv8 is taking this literally and using the name specified in the linker options where CCSv5 used the result of the output name from gmake.
Attached is a zip file with a stripped down version of my project demonstrating the problems. It was built using CCSv8.3
For now, I've copied my source code into a new CCSv8 project and am building the output with the default name, which works. To get the datecode, I added a prebuild step that always builds the datecode object before every build whether the project needs building or not. It's not elegant, but it's working.
If you know how to fix this or a better way to incorporate a datecode and filename version, I'm eager to hear.