Best practices for CI/CD

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Best practices for CI/CD

Jump to solution
2,630 Views
durga_choudhury
Contributor V

There has been a few similar posts on this topic before, but the answers are a bit dated and my question is also slightly different, so it is perhaps worth asking again. I have two questions:

 

1. Every once in a while, while doing a build from S32DS (v 3.6.2, The OS is Windows 11) , the build fails because it cannot find certain standard header files. Simply re-opening the project's .mex file, doing an 'update code' (although it should not actually update anything) and rebuilding fixes the issue. My question is: why does this happen? It seems to happen randomly, so I cannot provide any 'steps to reproduce', but it happens often enough that I'd be surprised if you are not at least aware of it. I have seen some other people also mentioning this issue on the forum. 

 

2. We are working towards putting the entire code base that will be programmed to the flash (as opposed to our application code only) into git and use a CI/CD pipeline, outside of the IDE in a headless environment, to build the image. We are using gitlab running on RHEL.

Are there any 'best practices' recommendation for this? In particular, since the RTD, the C standard library etc are outside the project and the IDE sets up a lot of the connections, how should this be handled in a CI/CD environment and how does one install a stand-alone toolchain?

0 Kudos
Reply
1 Solution
2,456 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

you can download standalone gcc from NXP pages for example this one https://www.nxp.com/webapp/sps/download/preDownload.jsp?render=true

 

Or any other version https://www.nxp.com/search?keyword=gcc%2520&start=0 

View solution in original post

0 Kudos
Reply
6 Replies
2,582 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

1. Every once in a while, while doing a build from S32DS (v 3.6.2, The OS is Windows 11) , the build fails because it cannot find certain standard header files. Simply re-opening the project's .mex file, doing an 'update code' (although it should not actually update anything) and rebuilding fixes the issue. My question is: why does this happen? It seems to happen randomly, so I cannot provide any 'steps to reproduce', but it happens often enough that I'd be surprised if you are not at least aware of it. I have seen some other people also mentioning this issue on the forum.

This issue is relatively common in Eclipse-based IDEs like S32DS. Here are the most likely causes:

  • Indexing/Path Resolution Glitch
    S32DS relies on Eclipse’s CDT indexer and project metadata to resolve include paths. Occasionally, the indexer or the internal build configuration gets out of sync—especially after changes to .mex or environment variables. Reopening the .mex file and regenerating code forces the IDE to refresh paths and rebuild the index.

  • Temporary Workspace Corruption
    The IDE stores a lot of state in the workspace. If the workspace cache becomes inconsistent (e.g., after an interrupted build or IDE crash), include paths may not be recognized until a refresh.

  • Windows File System Timing
    On Windows, antivirus or file-locking can delay access to header files during parallel build steps, causing intermittent failures.

2. We are working towards putting the entire code base that will be programmed to the flash (as opposed to our application code only) into git and use a CI/CD pipeline, outside of the IDE in a headless environment, to build the image. We are using gitlab running on RHEL.

Are there any 'best practices' recommendation for this? In particular, since the RTD, the C standard library etc are outside the project and the IDE sets up a lot of the connections, how should this be handled in a CI/CD environment and how does one install a stand-alone toolchain?

 

Handle RTD and External SDKs

Version Control or Artifact Repository:

Store RTD and SDK packages in Git (if allowed) or in an artifact repository like Nexus/Artifactory.

Environment Variables:

Define variables like RTD_PATH and SDK_PATH in your CI/CD pipeline.
Use these variables in your Makefile or build scripts instead of hardcoded paths.

Export Project for Headless Build

In S32DS, export the project as a Makefile project (Project → Generate Makefiles).
This gives you a Makefile that can be used outside the IDE.
Alternatively, use s32ds.exe --build for Windows-based headless builds, but for Linux CI/CD, Makefile is preferred.

Avoid IDE Dependencies

Do not rely on .mex regeneration in CI/CD.
Ensure all include paths and compiler flags are captured in the Makefile or CMake configuration.

I am not sure if there is anything else then general recommendations.

Best regards,

Peter

 

 

0 Kudos
Reply
1,086 Views
durga_choudhury
Contributor V

Hello @petervlna @jiri_kral 

 

Sorry for the delayed response on a closed ticket, but I finally had a chance to work on this issue.

 

What Peter is suggesting makes perfect sense to me; however, I cannot find the 'Project → Generate Makefiles' option in the S32 IDE (v3.6.6). I could try copying the generated makefiles, but there are a couple of not-so-good things about it:

1. It is not a stand-alone makefile, it depends on other .mk files which are also generated.

2. The makefile is generated per-build-target (unlike the .cproject file), which makes it a bit unwieldy. Ideally what I'd like is one Makefile where the build target is an argument to 'make'.

 

I am a bit surprised other people have not asked this question before or you don't have a 'how-to' document on this; given that the processor is very popular and is safety critical, I'd have thought doing builds in CI/CD Linux environment would be common.

0 Kudos
Reply
2,572 Views
durga_choudhury
Contributor V

Thank you, @petervlna for the tips. There is one question regarding the CI/CD pipeline that I still have:

 

How do I install the build tool chain independent of the IDE in a Linux environment?

0 Kudos
Reply
2,457 Views
jiri_kral
NXP Employee
NXP Employee

Hi, 

you can download standalone gcc from NXP pages for example this one https://www.nxp.com/webapp/sps/download/preDownload.jsp?render=true

 

Or any other version https://www.nxp.com/search?keyword=gcc%2520&start=0 

0 Kudos
Reply
2,546 Views
petervlna
NXP TechSupport
NXP TechSupport

Hello,

How do I install the build tool chain independent of the IDE in a Linux environment?

Unfortunately I do not have any knowledge on Linux environment, so I can help with only general answer:

Summary of Official Steps:

 

  1. Download the NXP GCC toolchain for ARM (Linux version) from the S32DS download page.
  2. Extract the archive to a directory like /opt/armgcc.
  3. Add the toolchain bin directory to your PATH.
  4. Install build tools (make, cmake) on your Linux system.
  5. Use exported Makefiles from S32DS for headless builds.

I suggest for linux questions to rise a separate thread.

Best regards,

Peter

 

0 Kudos
Reply
2,529 Views
durga_choudhury
Contributor V

Hello @petervlna 

 

Thank you for the suggestion. I need a bit more information on this. On the S32 Design studio page, I see a download option for the IDE as a whole, and it seems that the toolchain is installed as part of the IDE installation. I don't see the toolchain being offered as a separate download.

 

I do see that on Windows11 (which is what I am currently using), the tool chains are installed at

C:\NXP\S32DS.3.6.2\S32DS\build_tools

 

Is what you are suggesting is that:

1. Install the Linux version of the IDE on a Linux desktop

2. Copy the installed toolchain from this machine to the headless CI/CD server

3. Follow the steps you have outlined above

 

Please provide some clarification.

0 Kudos
Reply