CC1352P7: How to use TI's example code as a git submodule?

Part Number: CC1352P7
Other Parts Discussed in Thread: SYSCONFIG

Tool/software:

Hi,

I am using the ns_coap_node (Wi-SUN) code from Resource Explorer as an example to a project. I have modified it and the intention is to use it as a base to several other projects.

What I need is to be able to use this modified code as a submodule in the main project. Basically a full project would be structured like this:

my_project/                         <- git project
├── ns_coap_node_modified/          <- git submodule
├── my_specific_application/
│   ├── my-application.c
│   ├── my-application.h
│   ├── libs/
│   └── ...

What is the recommended approach to do this?

Thank you.

  • Hi Eduardo,

    By default, when you import an example project from the SDK, all source files and their modifications are still located in the original location and linked to your CCS workspace. You might have seen this already, if you open the project's folder it will be mostly empty. 
    So if you now import a second copy of the example project, it will pull the modified files from the SDK. So you could managed the entire SDK with git (you might want to ignore docs/).

    You could also have a full copy of the example project, for that, you need to open the .projectspec file (for instance, SDK_PATH\examples\rtos\LP_CC1352P7_1\ti_wisunfan\ns_coap_node\tirtos7\ticlang\ns_coap_node_LP_CC1352P7_1_tirtos7_ticlang.projectspec), replace action="link" to  action="copy"  for the files you want to copy into you workspace. Now, when you import the example project from within CCS, you will get a copy of the files instead of a link. You could now manage your project with git.

    Best regards,

    Daniel

  • Hi Daniel,

    Thank you for the suggestion, I'll probably import the modified files from the examples as copies so I do not modify the original files, so if I need to get back to any file I have the original version.

    Regarding the project architecture, when I import an example to my CCS workspace, the example comes as a project. But to be able to use this example in the architecture I mentioned earlier, I would need to the example imported and modified to be just a path with files, and the "my_project" folder should be the one recognized by CCS as the real project. What are the necessary modifications I need to perform to reach this organization?

    Regards,
    Eduardo.

  • Hi Eduardo,

    I think I'm not following completely on what you want to do. 

    So ns_coap_node_modified is a modified version of the example and you will make it a git submodule, it is a full CCS project, with the linker file and sysconfig, etc.

    You then create some other files outside the project (my-application.c) and these are used by application.c of the ns_coap_node_modified project?

    my_project/                         <- git project
    ├── ns_coap_node_modified/          <- git submodule
    |   ├── application/
    |   |   ├── application.c
    |   |   ├── main.c
    │   ├── mbed/
    │   ├── rcp/
    |   ├── software_stack/
    │   ├── cc13x2.cmd
    │   ├── coap_node.sysconfig
    |   └── ...
    ├── my_specific_application/
    │   ├── my-application.c
    │   ├── my-application.h
    │   ├── libs/
    │   └── ...

    Best regards,

    Daniel

  • Hi Daniel,

    Yes, that is exactly what I want to do.

    it is a full CCS project

    And I think this is the main point here. In this case, the ns_coap_node_modified should not be anymore a full CCS project and should be part of the new full CCS project that would be my_project, correct?

    Regards,
    Eduardo.

  • Hi Eduardo,

    Would my_project be a project on itself? Would it work if you create a project dependency as explained here?
    6.1. Creating and Managing Projects — Code Composer Studio 20.3.0 Documentation

    Best regards,

    Daniel

  • Hi Daniel,

    I think it does should work. I am trying to test it doing the following:

    1. I import an empty project from Resource Explorer (empty_LP_CC1352P7_1_tirtos7_ticlang), so it is the project we have been calling by my_project;

    2. Added the ns_coap_node_modified project as dependency (empty project properties -> Dependencies -> Project dependencies);

    3. Right click on empty_LP_CC1352P7_1_tirtos7_ticlang, "Add files/folders" and then: Select folders to link -> WORKSPACE_LOC and selected the path to ns_coap_node_modified.

    This is how the project organization looks like after that:

    After step (3) I did not modify anything in the code, I just tried compiling the project and I see some errors being generated that do not happen when I compile just ns_coap_node_modified. Do I need to configure anything else?

    Regards,
    Eduardo.

  • Hi Eduardo,

    Ok, I can see the same. The issue seems to be the ti_drivers_config.h, using the definitions for the coap node, instead of empty. So one of the two SysConfig has to be disabled, and merge all required changes into a single SysConfig.

    I disabled the generation of these files in the empty project, and renamed CONFIG_GPIO_LED_0 to CONFIG_GPIO_RLED in empty.c, using the definition of the coap_node. However this will still lead to some error due to redefinitions. So I'm not sure there is a straight forward way to do this, I'll do some more research and come back to you.

    Best regards,

    Daniel

  • Hi Daniel,

    In addition to these definitions from SysConfig you mentioned, I also see some other errors due to "include" options. The ns_coap_node_modified project has some other files that include some libs that are already used in application.c but when I compile it says that could not find the files. I do not know exactly why, because when I compile ns_coap_node_modified these errors do not happen. Do you think I need to add anything to Arm Compiler and/or Arm Linker flags?

    Regards,
    Eduardo.

  • Hi Daniel,

    Another question came to my mind. Following the architecture we have defined earlier:

    my_project/                         <- git project
    ├── ns_coap_node_modified/          <- git submodule
    |   ├── application/
    |   |   ├── application.c
    |   |   ├── main.c
    │   ├── mbed/
    │   ├── rcp/
    |   ├── software_stack/
    │   ├── cc13x2.cmd
    │   ├── coap_node.sysconfig
    |   └── ...
    ├── my_specific_application/
    │   ├── my-application.c
    │   ├── my-application.h
    │   ├── libs/
    │   └── ...

    If my_project is created using as reference the empty project and I add ns_coap_node_modified as a Project Dependency, the main() function that will be called would be from the empty project, correct? I need that the main() function to be called is the one from ns_coap_node_modified project.

    Regards,
    Eduardo.