2024-09-24 06:27 AM
Hi everyone,
I recently started programming STM Microcontrollers. I'm using STM32CubeIDE 1.13.2 to setup my project.
I want to build a modular software, where some necessary peripherals are initialized from beginning and others are initialized dependend on my build variables.
I was using STM32CubeIDE to setup the project and initialize the peripherals in the .ioc file. That worked well!
The reason I want to build a modular SW is because I also have a modular HW. Sometimes I want to use the same pins for different purposes dependent on my build variables. That is why I want to reset every pin I do not necessarily need from the begining. My problem is occuring when generating the code. The code generation does not only add or delete some code as I configure. It does also delete the HAL drivers if a module is not used. For example if I deactivate ADC it deletes the HAL drivers for adc even if I define them as enabled in the user code space of "stm32l4xx_hal_conf.h". How can I prevent the code generation process from deleting those drivers? I do not want to copy the folder manually or via script every time from my repository.
Is there any solution to keep the driver files?
Thank you very much!
Best regards!
Solved! Go to Solution.
2024-09-24 10:10 AM
@DN19 wrote:I don't want to copy the driver files every time I generate the code.
You could automate it as a User Action?
2024-09-25 12:38 AM
The adc.c and adc.h in Project/Core/Src and Project/Core/Include persist, but the HAL drivers are deleted. That was what I meant. Please excuse my unclear description.
2024-09-25 12:40 AM
Maybe, I don't know. I never used this box before, because its disabled. Nevertheless I would love to try it.
2024-09-25 12:53 AM
Thanks a lot for this suggestion. I recently had a look at that post, but this will not fit for my solution. I sometimes also change some common settings in the ioc file (clock or some common GPIOs). And if I adopt this solution, I would have to edit every existing ioc file if I understand it right.
2024-09-25 12:58 AM
Yeah, the whole CubeMX/IOC file thing really doesn't support that.
I think you're just going to have to do it manually.
You can always use CubeMX to get you started, but then manage changes manually in the generated code - rather than trying to re-generate.
2024-09-25 01:01 AM
Thanks for your answer. So I think my solution to go is just to use the ioc file to set up some new hardware components and afterwards just refreshing the drivers folder manually.
2024-09-25 03:57 AM
@DN19 wrote:I never used this box before, because its disabled. Nevertheless I would love to try it.
Apparently it's only disabled within CubeIDE - it should be available if you use the standalone CubeMX:
2024-09-25 04:28 AM
It is disabled when creating code for STM32CubeIDE even in the standalone STM32CubeMX.
2024-09-25 04:37 AM
Oh well - I guess that must've changed since 2021, then?
Why is it still there if it's never enabled?!