AnsweredAssumed Answered

Migrating code from one STM32F0 micro to another

Question asked by fries.larry on Dec 17, 2015
Latest reply on Jan 12, 2016 by fries.larry

I am developing code on an STM32F072B-DISCOVERY board that I wish to use on an STM32F031F4P6 micro.  I downloaded STM32CubeF0, found an I2C example that I can use on the Discovery board, built it, modified it, and got some I2C and GPIO functionality the way I want it.  Now I want to change the project so that it compiles for the STM32F031F4P6 micro. 

I found under “Options for Target” where to change the device.  I see that when I do that, the startup file changes to startup_stm32f031.s.  I also see that many other files in the project are labeled as stm32f0xx, which I reasonably assume means that they will work for any stm32f0 micro. 

I then found that a folder named Device had automagically appeared under MDK-ARM/RTE (on the hard drive, not in the Project window of the uVision IDE).  There are two folders in Device, STM32F031F4 and STM32F078RB.  The former has two files, system_stm32f0xx.c and startup_stm32f031.s.  The latter contains system_stm32f0xx.c file and startup_stm32f072.s. 

Question #1:  I see that the two system_stm32f0xx.c files that recently appeared are identical to each other but are older than the one that appears in the Project window.  What am I to do with these files?

Question #2:  startup_stm32f072.s is what appears in the Project window.  I don’t see how to change it to startup_stm32f031.s.

Question #3:  In the Project window, I see a file under the Drivers/BSP/STM32F072B-Discovery folders called stm32f072b_discovery.c.  I am not finding any files in STM32CubeF0 to replace this with.  

Also, is there anything else that I might be missing or making trouble for myself that I haven’t yet encountered?

Outcomes