How do I convert an STM32F1xx project to an STM32F0xx project? - Page 1
Forum section: electronics / general

author: panoss
author_rank: Frequent Contributor
timestamp: November 30, 2019, 03:12:17 pm
content: I have downloadedthisproject and opened it with Atollic TrueSTUDIO.I want to convert it to a project for STM32F030F4P6.This is the projects 's folder structure:I replaced the 'target': Project->Properties->C/C++ Build->Settings->Tab 'Target Settings', I changed to 'STM32F030F4P6' and clicked 'Ok'.I answered 'Yes' to the next questions and when it finished I rebuilt it.But at the Project Explorer, the project 's name is marked with a red 'X', indicating that there is some error(s).Also the folder 'STM32F1xx_HAL_Driver' remained the same. I thought it would be replaced by 'STM32F0xx_HAL_Driver'.Isn't this the correct way of converting a project from one mcu to another?

author: panoss
author_rank: Frequent Contributor
timestamp: November 30, 2019, 04:41:08 pm
content: Approach #2:1. I reversed any changes I had made in the downloaded example. So it's at it 's original state.2. I created a new project with STM32CubeMX based on my MCU. And opened it with Atollic.3. I compaired the folder structures of the 2 projects. I found that the downloaded example had 6 files extra:Inc/gpio.hInc/spi.hInc/SX1278.hSrc/gpio.cSrc/spi.cSrc/SX1278.cI suppose gpio and spi files have to be made for my MCU.So my question is: how can I install these files in my project?Through STM32CubeMX?Should I download them from somewhere and manually copy them in my project?

author: JohnnyBerg
author_rank: Frequent Contributor
timestamp: November 30, 2019, 04:45:46 pm
content: I would start from scratch, and let CubeMX generate the code. The F030 is a 20 pin TSSOP, so that should not be that hard. When evering is set right and the project compiles, a would start porting code over from the original project. I guest that will be the hardest part.

author: panoss
author_rank: Frequent Contributor
timestamp: November 30, 2019, 04:49:55 pm
content: Files gpio and spi are supposed to be made by STM32CubeMX?

author: JohnnyBerg
author_rank: Frequent Contributor
timestamp: November 30, 2019, 04:59:56 pm
content: Quote from: panoss on November 30, 2019, 04:49:55 pmJow .. as well as the startup_xx.s and the linker script.In gpio and spi you can add in some code in the user section, that would come out of the other project.edit: there is a option in CubeMX to generate the files outside of main.

author: panoss
author_rank: Frequent Contributor
timestamp: November 30, 2019, 05:22:58 pm
content: Ok, at 'Pinout & Configuration' tab->System Core->GPIO, I setted one of the pins as Output.At 'Connectivity' I checked 'SPI1'.Generated code but I see no gpio and spi files.But in main.c I found SPI related code, like 'MX_SPI1_Init'.And GPIO related code, like 'MX_GPIO_Init'.So I suppose gpio and spi code are included in main.c?While at the downloaded they have been put in respective files? (gpio.h, gpio.c, spi.h, spi.c)Quote from: JohnnyBerg on November 30, 2019, 04:59:56 pmI haven't found such an option.

author: JohnnyBerg
author_rank: Frequent Contributor
timestamp: November 30, 2019, 05:40:51 pm
content: Quote from: panoss on November 30, 2019, 05:22:58 pm

author: panoss
author_rank: Frequent Contributor
timestamp: November 30, 2019, 05:49:17 pm
content: Yes!! This did the job!So now I only have to copy the SX1278.h & SX1278.c in my project 's 'Inc' & 'Src' folders.EDIT: I copied the files and built it without errors!