Porting to a different board
Thanks for making this terrific project. Wonderful way to get started.
In your blog post about it at https://www.hackster.io/yusefkarim/upload-code-to-stm32l4-using-linux-gnu-make-and-openocd-a3d4de you wrote
If you are using a different board, this tutorial can still provide all the steps needed to do the same on your board, you will just have to make some small changes to make sure you are targeting your board.
I am using STM32H743. I found (details later) all that I needed for that board, but the problem is the init.c
file. It includes a lot of board specific initializations that I found it impossible to port. Perhaps I am doing something wrong? The way that I am attempting it is by comparing the "original" CMSIS/inc/stm32l476xx.h
included in your project with the CMSIS/inc/stm32h743xx.h
I replaced it with. Really too much changes. A small excertp:
$ make
arm-none-eabi-gcc -g -Wall -T../CMSIS/STM32L476RG.ld -mlittle-endian -mthumb -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 --specs=nosys.specs -Iinc -I../CMSIS/inc -o blinky.elf src/init.c src/main.c ../CMS
IS/src/system_stm32h7xx.c ../CMSIS/src/startup_stm32h743xx.s
src/init.c: In function 'System_Clock_80MHz_Init':
src/init.c:25:21: error: 'RCC_PLLCFGR_PLL2RGE_HSI' undeclared (first use in this function); did you mean 'RCC_PLLCFGR_PLL2RGE_0'?
25 | RCC->PLLCFGR |= RCC_PLLCFGR_PLL2RGE_HSI;
| ^~~~~~~~~~~~~~~~~~~~~~~
| RCC_PLLCFGR_PLL2RGE_0
src/init.c:25:21: note: each undeclared identifier is reported only once for each function it appears in
src/init.c:30:22: error: 'RCC_PLLCFGR_PLLN' undeclared (first use in this function); did you mean 'RCC_PLLCFGR_PLL2RGE'?
30 | RCC->PLLCFGR &= ~RCC_PLLCFGR_PLLN;
| ^~~~~~~~~~~~~~~~
| RCC_PLLCFGR_PLL2RGE
src/init.c:31:21: error: 'RCC_PLLCFGR_PLLN_4' undeclared (first use in this function); did you mean 'RCC_PLLCFGR_PLL2RGE'?
31 | RCC->PLLCFGR |= RCC_PLLCFGR_PLLN_4 | RCC_PLLCFGR_PLLN_2;
| ^~~~~~~~~~~~~~~~~~
| RCC_PLLCFGR_PLL2RGE
Is there a better way to do this port?