Skip to content

Commit 36a504a

Browse files
authored
Updates to stm32cubeide github actions article (#555)
1 parent 5828347 commit 36a504a

File tree

1 file changed

+38
-39
lines changed

1 file changed

+38
-39
lines changed

_posts/2024-08-01-github-actions-for-stm32cubeide.md

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ environment.
2323
![Picture of GitHub Actions calling STM32CubeIDE in a Docker container](/img/stm32cubeide/arch.excalidraw.svg)
2424

2525
The STM32 series of microcontrollers from STMicroelectronics are very popular in
26-
the embedded industry. ST provides an in-house Eclipse-based IDE, [STM32CubeIDE](https://www.st.com/en/development-tools/stm32cubeide.html),
27-
for developing projects using these chips.
26+
the embedded industry. ST provides an in-house Eclipse-based IDE,
27+
[STM32CubeIDE](https://www.st.com/en/development-tools/stm32cubeide.html), for
28+
developing projects using these chips.
2829

2930
The STM32CubeIDE provides an all-in-one starting point for STM32-based projects,
3031
with example code, drivers, and middleware, and tools for configuring
@@ -84,34 +85,40 @@ With tools of this nature, I like to follow this process to create the image:
8485
8586
```bash
8687
# run a container from the base image, interactively
87-
$ docker run --tty --interactive ubuntu:22.04
88+
$ docker run --tty --interactive ubuntu:24.04
8889
```
8990
90-
I first tried following the
91-
[installation instructions provided by ST (PDF warning)](https://www.st.com/resource/en/user_manual/um2563-stm32cubeide-installation-guide-stmicroelectronics.pdf),
92-
which are pretty straightforward; in my case it was running this command after
93-
downloading the installer:
91+
As of STM32CubeIDE version `1.17.0`, the unattended install works on Ubuntu
92+
24.04 out of the box, no need for workarounds! Thanks to
93+
[Daan Timmer](https://github.com/daantimmer) for pointing this out, and
94+
providing a fixed up Dockerfile 🥳!
9495
95-
```bash
96-
sudo sh ./st-stm32cubeide_1.15.0_20695_20240315_1429_amd64.deb_bundle.sh
97-
```
98-
99-
Unfortunately, the embedded script in that self-extracting installer doesn't
100-
fully support an unattended mode (at least in the versions I tested, 1.15 +
101-
1.16).
102-
103-
After some experimentation, I found a way to work around this; instead of
104-
running the installer as-is, I extracted the installation files from the
105-
package, and run them independently with a minor tweak.
96+
> <details><summary>Prior to STM32CubeIDE 1.17.0:</summary>
97+
>
98+
> I first tried following the
99+
> <a href="https://www.st.com/resource/en/user_manual/um2563-stm32cubeide-installation-guide-stmicroelectronics.pdf">installation
100+
> instructions provided by ST (PDF warning)</a>, which are pretty
101+
> straightforward; in my case it was running this command after downloading the
102+
> installer:
103+
>
104+
> <pre>
105+
> sudo sh ./st-stm32cubeide_1.15.0_20695_20240315_1429_amd64.deb_bundle.sh
106+
> </pre>
107+
>
108+
> Unfortunately, the embedded script in that self-extracting installer doesn't
109+
> fully support an unattended mode (at least in the versions I tested, 1.15 +
110+
> 1.16).
111+
>
112+
> After some experimentation, I found a way to work around this; instead of
113+
> running the installer as-is, I extracted the installation files from the
114+
> package, and run them independently with a minor tweak.
115+
>
116+
> </details>
106117
107-
Below is the final Dockerfile I used to create the image, with some comments
108-
explaining the more exotic parts.
118+
Below is the final Dockerfile I used to create the image
109119
110120
```dockerfile
111-
# This is the newest Ubuntu version with simple support for STM32CubeIDE-
112-
# the Cube .deb has a dependency on the python2.7 package, which is no longer
113-
# available in the latest Ubuntu LTS 24.04
114-
FROM ubuntu:22.04
121+
FROM ubuntu:24.04
115122
116123
# Typical dockerfile stuff, try to suppress interactive prompts when installing
117124
# packages
@@ -130,7 +137,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
130137
# don't clear apt cache, the stm32cubeide installer needs it
131138
# && rm -rf /var/lib/apt/lists/*
132139
133-
ARG STM32CUBE_VERSION=1.16.0_21983_20240628_1741
140+
ARG STM32CUBE_VERSION=1.17.0_23558_20241125_2245
134141
# Copy the installer file into the image. It needs to be downloaded into the
135142
# directory where the Dockerfile is.
136143
COPY en.st-stm32cubeide_${STM32CUBE_VERSION}_amd64.deb_bundle.sh.zip /tmp/stm32cubeide.sh.zip
@@ -139,16 +146,7 @@ RUN mkdir -p /tmp/stm32cubeide && \
139146
cd /tmp/stm32cubeide && \
140147
unzip stm32cubeide.sh.zip && \
141148
chmod +x st-stm32cubeide_${STM32CUBE_VERSION}_amd64.deb_bundle.sh && \
142-
# run the self-unpacker script, but don't actually install anything
143-
./st-stm32cubeide_${STM32CUBE_VERSION}_amd64.deb_bundle.sh --target ./ --noexec && \
144-
# this is required to avoid an error during apt-get install
145-
chmod a+r /tmp/stm32cubeide/*.deb && \
146-
chmod 777 /tmp/stm32cubeide/*.deb && \
147-
# need to set this env var for unattended install. install everything
148-
# manually, to avoid issues with the installer script, which does not have
149-
# an unattended install mode.
150-
LICENSE_ALREADY_ACCEPTED=1 apt-get install -y \
151-
/tmp/stm32cubeide/st-st*.deb && \
149+
LICENSE_ALREADY_ACCEPTED=1 ./st-stm32cubeide_${STM32CUBE_VERSION}_amd64.deb_bundle.sh && \
152150
rm -rf /tmp/stm32cubeide
153151
```
154152
@@ -160,7 +158,7 @@ Once we've created the Dockerfile, we'll build the image as usual:
160158
# note that I'm tagging the image with the build date and putting it into a
161159
# GitHub container registry namespace for later uploading to the GitHub
162160
# container registry
163-
$ DOCKER_BUILDKIT=1 docker build -t ghcr.io/noahp/stm32wba55-example:2024-08-01 -f Dockerfile .
161+
$ DOCKER_BUILDKIT=1 docker build -t ghcr.io/noahp/stm32wba55-example:2025-02-24 -f Dockerfile .
164162
```
165163
166164
### Testing the Docker Image
@@ -284,7 +282,7 @@ jobs:
284282
build:
285283
runs-on: ubuntu-latest
286284
container:
287-
image: ghcr.io/noahp/stm32wba55-example:2024-08-01
285+
image: ghcr.io/noahp/stm32wba55-example:2025-02-24
288286
289287
steps:
290288
- name: Checkout code
@@ -295,12 +293,12 @@ jobs:
295293
296294
- name: Build project
297295
run: |
298-
/opt/st/stm32cubeide_1.16.0/stm32cubeide --launcher.suppressErrors -nosplash \
296+
/opt/st/stm32cubeide_1.17.0/stm32cubeide --launcher.suppressErrors -nosplash \
299297
-application org.eclipse.cdt.managedbuilder.core.headlessbuild \
300298
-data /tmp/stm-workspace \
301299
-import "STM32CubeIDE"
302300
303-
/opt/st/stm32cubeide_1.16.0/stm32cubeide --launcher.suppressErrors -nosplash \
301+
/opt/st/stm32cubeide_1.17.0/stm32cubeide --launcher.suppressErrors -nosplash \
304302
-application org.eclipse.cdt.managedbuilder.core.headlessbuild \
305303
-data /tmp/stm-workspace \
306304
-build BLE_p2pServer/Debug
@@ -353,6 +351,7 @@ Thanks for reading!
353351
## References
354352
355353
<!-- prettier-ignore-start -->
354+
356355
- [The example project in this article](https://github.com/noahp/stm32wba55-example)
357356
- [STM32CubeIDE website](https://www.st.com/en/development-tools/stm32cubeide.html)
358357
- [MCU on Eclipse article about command-line building Eclipse](https://mcuoneclipse.com/2014/09/12/building-projects-with-eclipse-from-the-command-line/)

0 commit comments

Comments
 (0)