cancel
Showing results for 
Search instead for 
Did you mean: 

STM32cubeMX - Change processor type

Duggan.Robert
Associate II
Posted on September 02, 2015 at 18:03

Is it possible the change the selected processor in a given STM32cubeMX project?

I would like to maintain the user pin labels and config.

#stm32cubemx
4 REPLIES 4
Posted on September 03, 2015 at 19:02

Hi duggan.robert.001,

You can use a previously-saved configuration to create a new project with a new MCU of the same series. You create a new project with a new MCU and you import the previous project.

For more details, have a look at section 4.6 of

http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/DM00104712.pdf

.

-Shahrzad-

jwoerle
Associate III

Hi,

question is a little bit old, but it seems like, there has been a better solution since the last answer.

In STM32CubeMX in the main view you can click under "Pinout & Configuration" on "Pinout" -> "List Pinout Compatible MCUs (Alt-L)".

In the new open window you can now selected a different MCU and import it into your design. You can even change the MCU Series and/or packages. User Pin Labels and Configuration seems to be the same as before.

Best regards

Julian

0693W00000DmwJnQAJ.jpg

JSirk
Associate II

Now if only this worked directly in STM32CubeIDE as well, and also "Import" is a very loose term here since MX allows to change the CPU but then upon "save project" (not even save project AS) it blurts out a warning that it will delete everything already existing in that folder.

Also, you might want to check all the Code Generator settings - they revert back to defaults and not those you previously had, so you might for instance lose peripheral.c and .h files that had some user code in them as well. Not a terribly easy method of changing a CPU variant from, say, 64kB Flash to 128kB Flash.

I can only select the alternate parts in this dialog when using the embedded CubeMX editor in the IDE, but there is no option to set the selected part.

I got it to work by doing this (but I'm fairly certain that it will ONLY work if the desired part has all of the same peripherals, libraries, etc. and only the FLASH/RAM size is different between your current part and the desired part):

1. Close the IDE/CubeMX and backup your project.

2. In the file .cproject, replace all of the old processor instances with the new one.  For example STM32WB55REV6 -> STM32WB55RGV6

3. In the .ioc file used by the CubeMX editor, do the same.

4. Rename your linker command file so that you can copy your changes to the new linker file that will be created.

5. Open the IDE and turn on/off some benign setting in the CubeMX view to cause code to be regenerated.

6. Edit the newly created linker file using your old linker file you backed up in step #4 as a reference.

7. Build everything to make sure it worked.

If someone from ST sees this, can you confirm if this is a sound approach to doing this?  Or have I broken something that I may/may not notice (like with updates/downloads/etc.)?