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.

CCS/TMS320F28379D: How to combine the CPU1 and CPU2 firmware together

Part Number: TMS320F28379D

Tool/software: Code Composer Studio

Hi, there

I am trying to use the TMS320F28379D MCU. I can see from the examples that each CPU will have their own project build and loaded separately. However, it will be a lot more convenient to combine the two project to one so that I only have to manage one firmware.

So, a couple questions related to this:

1st. I can see the examples that have

#ifdef CPU1

.......

#endif 

I can use the same thing to define this piece of code will only be used on CPU1 or CPU2. However, I can't find anywhere defined CPU1, could you explain how these works?

2nd. Are there a register that stores the info of whether it is CPU1 or CPU2 that I can read at the beginning of the code and determine how the rest of the code should execute, if so, where can I find the info?

3rd. If I can combine CPU1 and CPU2 project together with a cmd file combine the memory definition together, I should be able to program the CPU1 and CPU2 together if both checkbox is selected when I am loading the project, right?

Thanks

  • Hainan,

    The F28379D is a dual-core device, where each core has its own dedicated resources and also shared resources (e.g. memory). Therefore each core has its own memory map and its own linker command file, as well as its own project. As a result, you need to separate projects and program the device with separate .out files. The predefined symbols (CPU1 and CPU2) that you are referring to are configured in the CCS project properties under “C2000 Compiler” and then select “Predefined Symbols”. The CPU1 and CPU2 names are used in the project to conditionally include the peripheral register header files code specific to each CPU.

    For an example of a dual-core project please see lab 11 in the C2000 Multi-Day Workshop at:

    processors.wiki.ti.com/.../C2000_Multi-Day_Workshop

    To answer your question, yes you can define common code that can be conditionally used with a specific CPU. In the source file 'PieVect.c' you will notice that #ifdef is being used for this purpose. Also, the F2837xD has "Device Identification Registers" which contains various information about the device. Please see the data sheet (SPRS880I) on page 185 and the Technical Reference Manual (SPRUHM8G) section 2.2.1 on page 86 for more details.

    In case you are interested, you can find another dual-core project in the C2000 One-Day Workshop, too (please see lab 1):

    processors.wiki.ti.com/.../C2000_One-Day_Workshop

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken
  • Thanks for the reply

    Ok, I see where the #ifdef CPU1 coming from. Yes I have to have separate project if I want to use that. However, as you described:
    1st. I could read the CPU ID out at the beginning of my code and use that to determine how the rest of my code should do.
    2nd. I should be able to do one common cmd file to define the memory map for both CPUs.
    If I do 1&2 and create just one .out file, I should be able to use that to program both CPUs, right?

    It is very inconvenient to have two .out files for large scale production, because sometime wrong program could be loaded to CPUs that could cause system failure sometime. If I could not do this, I will have to stick to F28379S. But that will be a little bit slow to my project.
    Please suggest
    Thanks
  • Hainan,

    The #ifdef is a preprocessor directive. It determines what code is included or excluded during build-time, not run-time. That is, only the "true" conditional code for CPU1 or CPU2 is included during the build. After the code is compiled, it is the .out file that runs on the device. So, there are two separate .out files - one for CPU1 and another for CPU2. The #ifdef allows a common source file (e.g. the 'PieVect.c' in lab 11) to be conditionally used. You would still need to have a separate .out file for each CPU.

    That being said, it would be difficult and complex to try and have the same .out be used for each CPU. When the device starts, CPU1 controls various resources before making them available for CPU2 (e.g. clocks, shared memory, GPIO, etc.). Even if you try and read each CPU ID, you would still need both sets of code in each core, making it very inefficient for memory usage, and it will most likely have conflict with the shared memory.

    I hope this helps. If this answers your question, please click the green "Verified Answer" button. Thanks.

    - Ken