cancel
Showing results for 
Search instead for 
Did you mean: 

Anyone had success doing headless STM32 builds in a Docker container?

AVoel.1
Associate III

I need a strategy for doing CI/CD for our STM32 projects. Having done a little research, the logical path seems to be using a Docker container, as this approach seems to be widely supported.

This could either be using a Docker image with all of STM32CubeIDE installed and doing a command line build, or figuring a way to export the project to a runnable make or cmake solution. The path of least resistance seems to be the STM32CubeIDE route, even though the container will be large.

Has anyone out there got this working, and if so, how did you get there? I've tried pulling down a couple images with STM32CubeIDE, but am getting various errors trying actually run a headless build in Docker Desktop (on MacOS).

It seems this would be a very useful thing for anyone doing serious work with the STM32CubeIDE!!

1 ACCEPTED SOLUTION

Accepted Solutions
AVoel.1
Associate III

I'm not sure why we are even talking about Windows. The Docker containers widely supported for cloud builds are all Linux AFAIK. So of course we are talking about the the Linux version of stm32cubeide. And I basically did show an example. I pointed to the Docker Image I used, and showed the command line I used for the headless build. The only detail that ended up being Host platform specific was bind mounting the source code. But that would work differently on a cloud platform anyway (Bitbucket in my case, which I'll be attempting to hook up next).

But I still don't know how to tag this thread as answered ...

View solution in original post

8 REPLIES 8
AVoel.1
Associate III

UPDATE: I was able to get a headless build working using the following Docker Image:

https://hub.docker.com/r/wsbu/stm32cubeide/tags

I had to figure out how to mount the source code, the command lines for mounting I found weren't working, so I used a dialog box in Docker Desktop and it does whatever the right thing is. There is a headless build script in the folder with the executable, but I ended up doing the command line manually:

./stm32cubeide -nosplash -application org.eclipse.cdt.managedbuilder.core.headlessbuild -import {your-project-folder} -build all

Cartu38 OpenDev
Lead II

Headless build is common Eclipse CDT feature which is STM32CubeIDE supported too. See: Scriptable builds from the command line (gnu-mcu-eclipse.github.io)

Obviously if STM32CubeIDE rely on stm32cubeidec(.exe if Windows OS) instead eclipse application

AVoel.1
Associate III

OK, but I'm not sure how to do that (mark this thread as answered).

The OS required to run this container is Linux so stm32cubeidec.exe and everything Windows specific is not relevant.

Would like too to see a complete example of building in a docker container, either for Bitbucket or github...

-- pa

stm32cubeidec.exe if Windows install. stm32cubeidec if Linux or Mac OSes. Headless build is supported whatever OSes.

AVoel.1
Associate III

I'm not sure why we are even talking about Windows. The Docker containers widely supported for cloud builds are all Linux AFAIK. So of course we are talking about the the Linux version of stm32cubeide. And I basically did show an example. I pointed to the Docker Image I used, and showed the command line I used for the headless build. The only detail that ended up being Host platform specific was bind mounting the source code. But that would work differently on a cloud platform anyway (Bitbucket in my case, which I'll be attempting to hook up next).

But I still don't know how to tag this thread as answered ...

SGasp.1
Senior

I have the same need of the author of the question.

I would like to use this docker image

https://hub.docker.com/r/wsbu/stm32cubeide/tags

for building from a bitbucket pipeline automation .

But I really have no idea how to configure correctly the yaml file..

Can you please help me ?

# You can specify a custom docker image from Docker Hub as your build environment.
image: 
  name: wsbu/stm32cubeide
  username: simogaspa84
  password: ******
  email: simogaspa84@gmail.com
 
pipelines:
  default:
    - parallel:
      - step:
          name: 'Build and Test'
          script:
            - make -j12 
      - step:
          name: 'Lint'
          script:
            - echo "Your linting"
      - step:
          name: 'Security scan'
          script:
            - echo "Your security scan goes here..."
 
    # The following deployment steps will be executed for each pipeline run. To configure your steps and conditionally deploy see https://support.atlassian.com/bitbucket-cloud/docs/configure-bitbucket-pipelinesyml/
    - step:
        name: 'Deployment to Staging'
        deployment: staging
        script:
          - echo "Your deployment to staging script goes here..."
    - step:
        name: 'Deployment to Production'
        deployment: production
        trigger: 'manual'
        script:
          - echo "Your deployment to production script goes here..."

FPere.5.73
Associate

Necrobump here. Just came across this problem and wsbu/stm32cubeide has some disadvantages:

1) It is now outdated. Last version of the image is 1.5.0, but cube is already in 1.9.0

2) It is possibly not compliant with the software license, so it is not that safe to rely on this image. The nicest approach for that would be some sort of "official image" provided either by st or with its permission