STM32CubeMX Processing Before and After Code Generation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-09-06 3:04 PM
STM32CubeMX release 6.9.0 contained support for processing before and after code generation. The documentation does not appear to be updated to describe how this works.
What kind of file and scripting is expected for this feature?
- Labels:
-
STM32CubeMX
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-04 2:18 PM
Any luck with this? I also couldn't find any documentation from STM about this feature, despite them advertising it on the home page of STM32CubeMx.
I tried making both a powershell script and a shell script that would just echo a string into a file. When I set the After Code Generation path to either of these scripts, it caused CubeMX to freeze up and I had to kill it from the task manager.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-09 8:05 AM
I also really need this functionality but I find the current implementation pretty useless:
- There seems to be no way to specify a relative path to this script (relative to the sourcecode directory). Of course I this script inside my sourcede tree and check it into my version control system together with the sourcecode.
- Also the working directory of the script seems to be the installation directory of STM32CubeMX. And there is no environment variable or any other way to find the sourcecode directory(!) What good is this script supposed to do if it can't find or access the generated sourcecode?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-09 8:08 AM
@oskar what language is your script in?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-09 9:34 AM
I wrote it in bash. It's on a linux laptop.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2024-01-27 11:25 AM - edited ‎2024-01-28 7:19 AM
If the script is within the project, begin the script with the lines below, these will set the current directory to where the script is:
Windows
set SCRIPT_DIR=%~dp0%
cd %SCRIPT_DIR%
Linux
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd ${SCRIPT_DIR}
The *BAD* news is that the script path must be absolute on Windows (eg C:\Users...) even though is is within the project directory.
Using the Windows utility procmon.exe, I can see that when using relative path, the script is noticed but it is not executed
