This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[FAQ] AM2634-Q1: How to use CCS studio to compile my MCAL projects?

Part Number: AM2634-Q1

Currently, the MCAL projects seems to be a makefile based environment and how to use CCS studio to create, compile and debug our MCAL based projects easily? We're seeing lot of errors regarding missing assembly and source files. How to solve this? 

  • Here are the steps I followed to do it and some of the important things to be taken care of

    1. Create an empty project in the CCS studio by importing from the MCU+SDK.
    2. CCS projects are makefile based and any source file you want it to be compiled should be specified in the makefile, however CCS studio is sophisticated enough to do this for you i.e., if a ".c" source file is added and when a Build project is done, the build dependencies will automaticlly be added into the makefiles as shown below 

               

     

    1. Now, the task of compiling the MCAL files in the CCS studio is more of a porting effort where we need to bring the dependecy files into the CCS project one after the other and make the required list of the files, in this case I have added all of them into a folder named "mcal_srcs" and when I trigger a build CCS will identify the sources and the appropriate changes to the makefiles will be done and auto-generated.
    2. As a part of doing this the, there will be lot of definitions done as part of the assembly files (mainly startup, vectors related code), however it is not so straight forward to compile the asm files in CCS which needs a change to the compiler flags as shown below. We need to add the "-x ti-asm" flag in order to compile asm files in the CCS. More info can be found in the TI-ARM-CLANG compiler user guide (compiler user guide) page 353, Section 3.5.3 TI-Syntax Arm Assembler 






    3. Once this is done and compile, you should see the object files of the asm files in the "Debug/" folder as shown below upon successful compilation 



    4. After the compilation, the linking steps comes and there's a high chance a problem can be seen here becuase the MCAL uses a completely different linker script and the CCS based projects use a different linkers. Many region overlapping errors can be seen because of the re-definition of the regions in both linkers. A closer look here and adjusting the memory region names solves the issue, as shown below (makesure to declare the regions in only one of the linker script)



     

    1. Once thes steps are done, you should have a smooth compilation and the .out files are generated which can be loaded into the CCS project and directly run on the EVM. Please make a note that there will be few warnings coming from the Linker script which I have not yet resolved. Along with the above points, please ensure that the below predefined symbols are added to the CCS project settings as they are needed by the MCAL Compiler.h files to verify the AUTOSAR versions and the Memmaps files to know the compiler type (CLANG or DIAB) if this is not provided you will be seeing lot of compiler legacy warnings regarding PRAGMA. (Add the below symbols in the CCS project settings)

    Hope this helps and much clear to create you rown CCS integrated MCAL projcts. Attached an example project which compiles the "Mcu_app.c" example from MCAL and replace it with whatever the example you need and compile it accordingly

    .mcal_ccs_integration_demo.zip

    Thanks